de.fzj.unicore.wsrflite.xmlbeans.wsn.impl
Class NotificationProducerSupport

java.lang.Object
  extended by de.fzj.unicore.wsrflite.xmlbeans.wsn.impl.NotificationProducerSupport
All Implemented Interfaces:
NotificationProducer, WSNConstants, Serializable

public class NotificationProducerSupport
extends Object
implements NotificationProducer, Serializable

implements the NotificationProducer, supports

This class can be used as delegate to add notification capabilities to services transparently. See NPSupportTest for an example.

Author:
schuller
See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
           
protected  ArrayList<String> subscriptionIds
           
protected  ArrayList<org.oasisOpen.docs.wsn.b2.TopicDocument> topics
           
 
Fields inherited from interface de.fzj.unicore.wsrflite.xmlbeans.wsn.NotificationProducer
GETCURRENTMESSAGE_ACTION, SUBSCRIBE_ACTION
 
Fields inherited from interface de.fzj.unicore.wsrflite.xmlbeans.wsn.WSNConstants
BW_BASENS, RPFixedTopicSet, RPTopicExpression, RPTopicExpressionDialect, RPTopicSet, SIMPLE_TOPIC, WSN_CHANNEL, XPATH_URI
 
Constructor Summary
NotificationProducerSupport()
           
 
Method Summary
protected  boolean acceptTopic(org.oasisOpen.docs.wsn.b2.FilterType f)
          do we accept the filter?
 void addSimpleTopic(QName q)
           
protected  org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createMessage(ISubscription subscription, Event e)
           
protected  org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createRPValueChangeMessage(ISubscription subscription, Event e)
          creates a message using the ResourcePropertyValueChanged document defined in the WS-ResourceProperties spec.
protected  org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createSimpleMessage(ISubscription subscription, Event e)
          make a simple message
 boolean deleteSubscription(String subscriptionID)
          deletes a subscription
 org.oasisOpen.docs.wsn.b2.GetCurrentMessageResponseDocument GetCurrentMessage(org.oasisOpen.docs.wsn.b2.GetCurrentMessageDocument req)
           
 org.oasisOpen.docs.wsn.b2.TopicExpressionDialectDocument getExpressionDialectDocument()
           
 org.oasisOpen.docs.wsn.b2.FixedTopicSetDocument getFixedTopicSetDocument()
           
 String getProducerURL()
           
 org.oasisOpen.docs.wsn.b2.TopicExpressionDocument[] getTopicExpressionDocuments()
           
 void notifyObservers()
          this method will check the subscriber list and notify them of any events
protected  boolean passesMessageContentFilter(String mcd, org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType[] messages)
           
 void postEvent(QName q, org.apache.xmlbeans.XmlObject[] newValue)
          post event so subscribers to this will be notified
 void sendNotifications(org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType[] messages, org.oasisOpen.docs.wsn.b2.ConsumerReferenceDocument consumer, String filter)
          send messages to a consumer
 void setProducerURL(String url)
           
 void setSubscriptionServiceName(String subscriptionServiceName)
           
 org.oasisOpen.docs.wsn.b2.SubscribeResponseDocument Subscribe(org.oasisOpen.docs.wsn.b2.SubscribeDocument req)
          subscribe
protected  void updateSubscriptionIds()
          check our messages and update subscription ids
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

topics

protected ArrayList<org.oasisOpen.docs.wsn.b2.TopicDocument> topics

subscriptionIds

protected ArrayList<String> subscriptionIds
Constructor Detail

NotificationProducerSupport

public NotificationProducerSupport()
Method Detail

GetCurrentMessage

public org.oasisOpen.docs.wsn.b2.GetCurrentMessageResponseDocument GetCurrentMessage(org.oasisOpen.docs.wsn.b2.GetCurrentMessageDocument req)
                                                                              throws BaseFault
Specified by:
GetCurrentMessage in interface NotificationProducer
Throws:
BaseFault

getProducerURL

public String getProducerURL()

setProducerURL

public void setProducerURL(String url)

Subscribe

public org.oasisOpen.docs.wsn.b2.SubscribeResponseDocument Subscribe(org.oasisOpen.docs.wsn.b2.SubscribeDocument req)
                                                              throws BaseFault
subscribe

Specified by:
Subscribe in interface NotificationProducer
Throws:
BaseFault

deleteSubscription

public boolean deleteSubscription(String subscriptionID)
deletes a subscription

Parameters:
subscriptionID -
Returns:
true - if subscription was deleted

acceptTopic

protected boolean acceptTopic(org.oasisOpen.docs.wsn.b2.FilterType f)
do we accept the filter?

Parameters:
f -
Returns:

postEvent

public void postEvent(QName q,
                      org.apache.xmlbeans.XmlObject[] newValue)
post event so subscribers to this will be notified

Parameters:
q -

getFixedTopicSetDocument

public org.oasisOpen.docs.wsn.b2.FixedTopicSetDocument getFixedTopicSetDocument()

getTopicExpressionDocuments

public org.oasisOpen.docs.wsn.b2.TopicExpressionDocument[] getTopicExpressionDocuments()

getExpressionDialectDocument

public org.oasisOpen.docs.wsn.b2.TopicExpressionDialectDocument getExpressionDialectDocument()

addSimpleTopic

public void addSimpleTopic(QName q)

createMessage

protected org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createMessage(ISubscription subscription,
                                                                                Event e)

sendNotifications

public void sendNotifications(org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType[] messages,
                              org.oasisOpen.docs.wsn.b2.ConsumerReferenceDocument consumer,
                              String filter)
                       throws MessagingException
send messages to a consumer

Throws:
MessagingException

passesMessageContentFilter

protected boolean passesMessageContentFilter(String mcd,
                                             org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType[] messages)

updateSubscriptionIds

protected void updateSubscriptionIds()
check our messages and update subscription ids


notifyObservers

public void notifyObservers()
this method will check the subscriber list and notify them of any events


createSimpleMessage

protected org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createSimpleMessage(ISubscription subscription,
                                                                                      Event e)
make a simple message

Parameters:
subscription -
q -
Returns:

createRPValueChangeMessage

protected org.oasisOpen.docs.wsn.b2.NotificationMessageHolderType createRPValueChangeMessage(ISubscription subscription,
                                                                                             Event e)
creates a message using the ResourcePropertyValueChanged document defined in the WS-ResourceProperties spec.

Parameters:
subscription - - the subscription
e - - the event
Returns:
NotificationMessageHolderType

setSubscriptionServiceName

public void setSubscriptionServiceName(String subscriptionServiceName)


Copyright © 2010. All Rights Reserved.