Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.ws.notification.impl
Class SimpleNotificationProducer

    java.lang.Object
      org.apache.muse.core.AbstractCapability
          org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
              org.apache.muse.ws.notification.impl.SimpleNotificationProducer

All Implemented Interfaces:
  Capability, Initialization, InitializationParameters, NotificationProducer, ResourceManagerListener, Shutdown, WsResourceCapability, org.apache.muse.ws.resource.WsResourceCapabilityProperties

public class SimpleNotificationProducer
extends AbstractWsResourceCapability
implements NotificationProducer, ResourceManagerListener

SimpleNotificationProducer is Muse's default implementation of the WS-Notification NotificationProducer port type.
Resources that implement this port type should be deployed with the SubscriptionManager type as well; the subscription resources cannot be managed without this endpoint.

Author:
  Dan Jemiolo (danj)

Field Summary

Fields inherited from interface org.apache.muse.ws.notification.NotificationProducer
`PROPERTIES`

Constructor Summary
`SimpleNotificationProducer()`

Method Summary
`void` | `addSubscription(WsResource sub)` This method is for internal (service-side) code that wishes to add a subscription that has already been created (perhaps from data residing in a persistent data store) and does not require a call to subscribe().
`Topic` | `addTopic(QName topicName)` Creates a topic in the resource's topic set and adds it to the appropriate topic namespace.
`TopicNamespace` | `addTopicNamespace(java.lang.String namespace)` Creates a topic namespace in the resource's topic set using the given URI.
`protected MessageHandler` | `createGetCurrentMessageHandler()`
`protected ChangeNotificationListenerFactory` | `createNotificationListenerFactory()` Users can override this method to provide an alternative implementation of ChangeNotificationListenerFactory that wraps WS-RP change notifications in a different set of XML content.
`protected NotificationMessage` | `createNotificationMessage()` Users can override this method to provide an alternative implementation of NotificationMessage.
`protected MessageHandler` | `createSubscribeHandler()`
`NotificationMessage` | `getCurrentMessage(QName topicPath)` Retrieves the last message published for a given topic.
`boolean` | `getFixedTopicSet()`
`protected ChangeNotificationListenerFactory` | `getNotificationListenerFactory()`
`QName[]` | `getPropertyNames()` Concrete capability classes that define properties MUST override this method and provide the names of the properties.
`protected java.lang.String` | `getSubscriptionContextPath()`
`protected java.util.Collection` | `getSubscriptions()`
`Topic` | `getTopic(QName topicName)`
`QName[]` | `getTopicExpression()`
`java.lang.String[]` | `getTopicExpressionDialect()`
`TopicNamespace` | `getTopicNamespace(java.lang.String namespace)`
`TopicSet` | `getTopicSet()`
`protected boolean` | `hasSubscription(EndpointReference subscriptionEPR)`
`boolean` | `hasTopic(QName topicName)`
`void` | `initialize()` AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it. AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties.
`void` | `initializeCompleted()` This method is called by the containing Resource after all other capabilities have been initialized via initialize().
`void` | `prepareShutdown()` This method is called prior to shutdown() and allows the capability to do any shutdown tasks that require the presence of certain other capabilities.
`void` | `publish(QName topicName, org.w3c.dom.Element content)` Creates a WS-N notification message with the given topic and message content and sends it to the appropriate subscribers.
`void` | `publish(QName topicName, org.w3c.dom.Element[] content)`
`void` | `publish(QName topicName, QName[] contentNames, java.lang.Object[] content)`
`void` | `publish(QName topicName, QName contentName, java.lang.Object content)` This is a convenience method that calls publish(QName, Element) after the given content object has been serialized to XML using the Muse serializer framework.
`void` | `publish(QName topicName, XmlSerializable content)` This is a convenience method that calls publish(QName, Element) after the XmlSerializable object has been serialized to XML.
`void` | `publish(QName topicName, XmlSerializable[] content)`
`void` | `removeSubscription(EndpointReference epr)` This method is for internal (service-side) code that wishes to remove a subscription so that messages are no longer published to its subscriber.
`void` | `resourceAdded(EndpointReference epr, Resource resource)`
`void` | `resourceRemoved(EndpointReference epr)`
`WsResource` | `subscribe(EndpointReference consumer, Filter filter, java.util.Date terminationTime, Policy policy)` Registers a consumer resource to receive events that are published to a certain topic (along with other filtering rules).

Methods inherited from class org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
`createGettersAndSetters, deleteProperty, getGetter, getProperty, getPropertyElements, getSetter, getWsResource, insertProperty, invokeMethod, setResource, updateProperty`

Methods inherited from class org.apache.muse.core.AbstractCapability
`getActions, getCapabilityURI, getEnvironment, getInitializationParameter, getInitializationParameters, getLog, getMessageHandler, getPersistence, getResource, hasBeenInitialized, hasBeenShutdown, setCapabilityURI, setEnvironment, setInitializationParameters, setLog, setMessageHandler, setMessageHandlers, setPersistence, shutdown`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.muse.ws.resource.WsResourceCapability
`deleteProperty, getProperty, getWsResource, insertProperty, updateProperty`

Methods inherited from interface org.apache.muse.core.Capability
`getActions, getCapabilityURI, getEnvironment, getLog, getMessageHandler, getPersistence, getResource, setCapabilityURI, setEnvironment, setLog, setMessageHandlers, setPersistence, setResource`

Methods inherited from interface org.apache.muse.core.Initialization
`hasBeenInitialized`

Methods inherited from interface org.apache.muse.core.InitializationParameters
`getInitializationParameter, getInitializationParameters, setInitializationParameters`

Methods inherited from interface org.apache.muse.core.Shutdown
`hasBeenShutdown, shutdown`

Constructor Detail

### SimpleNotificationProducer

    public SimpleNotificationProducer()

Method Detail

### addSubscription

    public void addSubscription(WsResource sub)

  Description copied from interface: `NotificationProducer`
  This method is for internal (service-side) code that wishes to add a subscription that has already been created (perhaps from data residing in a persistent data store) and does not require a call to subscribe(). It should not be exposed to remote clients - the subscribe() method is already available for the purpose of remote subscription.

  Specified by:
    `addSubscription` in interface `NotificationProducer`
  Parameters:
    `sub` -

### addTopic

    public Topic addTopic(QName topicName)
                   throws BaseFault

  Description copied from interface: `NotificationProducer`
  Creates a topic in the resource's topic set and adds it to the appropriate topic namespace. If the topic namespace does not exist, it is created.

  Specified by:
    `addTopic` in interface `NotificationProducer`
  Parameters:
    `topicName` - The name of the topic, where the namespace matches the topic namespace the topic belongs to and the local part is a path that defines the topic's hierarchy (the path may also be a simple name, no slashes).
  Returns:
    The Topic that was created and added to the resource's topic set.
  Throws:
    `BaseFault`

### addTopicNamespace

    public TopicNamespace addTopicNamespace(java.lang.String namespace)
                                     throws BaseFault

  Description copied from interface: `NotificationProducer`
  Creates a topic namespace in the resource's topic set using the given URI.

  Specified by:
    `addTopicNamespace` in interface `NotificationProducer`
  Returns:
    The TopicNamespace that was created and added to the resource's topic set.
  Throws:
    `BaseFault`

### createGetCurrentMessageHandler

    protected MessageHandler createGetCurrentMessageHandler()

### createNotificationListenerFactory

    protected ChangeNotificationListenerFactory createNotificationListenerFactory()

  Users can override this method to provide an alternative implementation of ChangeNotificationListenerFactory that wraps WS-RP change notifications in a different set of XML content.

  Returns:
    An instance of WsrpNotificationListenerFactory

### createNotificationMessage

    protected NotificationMessage createNotificationMessage()

  Users can override this method to provide an alternative implementation of NotificationMessage.

  Returns:
    An instance of SimpleNotificationMessage

### createSubscribeHandler

    protected MessageHandler createSubscribeHandler()

### getCurrentMessage

    public NotificationMessage getCurrentMessage(QName topicPath)
                                          throws NoCurrentMessageOnTopicFault,
                                                 TopicNotSupportedFault

  Description copied from interface: `NotificationProducer`
  Retrieves the last message published for a given topic.
  NOTE:The term 'current' is only helpful if you think of the published messages being stored in a stack, with the last one on top. This is the 'current message'. In reality, implementations are not likely to store an in-memory copy of every message that is published, but it is a useful mental model.

  Specified by:
    `getCurrentMessage` in interface `NotificationProducer`
  Parameters:
    `topicPath` - The name of the Topic whose last message you wish to retrieve.
  Returns:
    The last message that was published on the given topic.
  Throws:
    `NoCurrentMessageOnTopicFault`
    `TopicNotSupportedFault`

### getFixedTopicSet

    public boolean getFixedTopicSet()

  Specified by:
    `getFixedTopicSet` in interface `NotificationProducer`
  Returns:
    True if the resource's topic set cannot be modified after it has been initialized.

### getNotificationListenerFactory

    protected ChangeNotificationListenerFactory getNotificationListenerFactory()

### getPropertyNames

    public QName[] getPropertyNames()

  Description copied from interface: `org.apache.muse.ws.resource.WsResourceCapabilityProperties`
  Concrete capability classes that define properties MUST override this method and provide the names of the properties.

  Specified by:
    `getPropertyNames` in interface `org.apache.muse.ws.resource.WsResourceCapabilityProperties`
  Overrides:
    `getPropertyNames` in class `AbstractWsResourceCapability`

### getSubscriptionContextPath

    protected java.lang.String getSubscriptionContextPath()

### getSubscriptions

    protected java.util.Collection getSubscriptions()

### getTopic

    public Topic getTopic(QName topicName)

  Specified by:
    `getTopic` in interface `NotificationProducer`
  Parameters:
    `topicName` -
  Returns:
    The Topic with the given namespace and name, or null if no such Topic exists.

### getTopicExpression

    public QName[] getTopicExpression()

  Specified by:
    `getTopicExpression` in interface `NotificationProducer`
  Returns:
    The names of all of the topic that are supported by this resource.

### getTopicExpressionDialect

    public java.lang.String[] getTopicExpressionDialect()

  Specified by:
    `getTopicExpressionDialect` in interface `NotificationProducer`
  Returns:
    All of the topic expression dialects that are supported by this resource.

### getTopicNamespace

    public TopicNamespace getTopicNamespace(java.lang.String namespace)

  Specified by:
    `getTopicNamespace` in interface `NotificationProducer`
  Parameters:
    `namespace` -
  Returns:
    The TopicNamespace representing the given URI, or null if no such TopicNamespace exists.

### getTopicSet

    public TopicSet getTopicSet()

  Specified by:
    `getTopicSet` in interface `NotificationProducer`
  Returns:
    The resource's entire topic set, which contains topic namespaces and (within those) topics.

### hasSubscription

    protected boolean hasSubscription(EndpointReference subscriptionEPR)

### hasTopic

    public boolean hasTopic(QName topicName)

  Specified by:
    `hasTopic` in interface `NotificationProducer`
  Parameters:
    `topicName` -
  Returns:
    True if the resource supports the given topic.

### initialize

    public void initialize()
                    throws SoapFault

  Description copied from class: `AbstractWsResourceCapability`
  AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it.

  Specified by:
    `initialize` in interface `Initialization`
  Overrides:
    `initialize` in class `AbstractWsResourceCapability`
  Throws:
    `SoapFault`

### initializeCompleted

    public void initializeCompleted()
                             throws SoapFault

  Description copied from interface: `Capability`
  This method is called by the containing Resource after all other capabilities have been initialized via initialize(). It allows the Capability to do initialization work that requires the presence of certain other capabilities. This "post-initialization" state is necessary because capability definition and creation is non-deterministic, and users cannot make any assumptions about the order of those tasks.

  Specified by:
    `initializeCompleted` in interface `Capability`
  Overrides:
    `initializeCompleted` in class `AbstractCapability`
  Throws:
    `SoapFault`

### prepareShutdown

    public void prepareShutdown()
                         throws SoapFault

  Description copied from interface: `Capability`
  This method is called prior to shutdown() and allows the capability to do any shutdown tasks that require the presence of certain other capabilities. Once shutdown() is called, the capability cannot be certain that the other capabilities it depends on have not already been shutdown as well, so this "pre-shutdown" state gives it this opportunity.

  Specified by:
    `prepareShutdown` in interface `Capability`
  Overrides:
    `prepareShutdown` in class `AbstractCapability`
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        org.w3c.dom.Element content)
                 throws SoapFault

  Description copied from interface: `NotificationProducer`
  Creates a WS-N notification message with the given topic and message content and sends it to the appropriate subscribers. The implementation will do all of the work of figuring out which subscribers should get the message based on its topic and/or content.

  Specified by:
    `publish` in interface `NotificationProducer`
  Parameters:
    `topicName` - The WS-N topic associated with the message. This is optional (it can be null).
    `content` - The XML fragment that will be put under the wsnt:Message section of the notification message. This is also called the 'payload'.
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        org.w3c.dom.Element[] content)
                 throws SoapFault

  Specified by:
    `publish` in interface `NotificationProducer`
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        XmlSerializable content)
                 throws SoapFault

  Description copied from interface: `NotificationProducer`
  This is a convenience method that calls publish(QName, Element) after the XmlSerializable object has been serialized to XML.

  Specified by:
    `publish` in interface `NotificationProducer`
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        XmlSerializable[] content)
                 throws SoapFault

  Specified by:
    `publish` in interface `NotificationProducer`
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        QName contentName,
                        java.lang.Object content)
                 throws SoapFault

  Description copied from interface: `NotificationProducer`
  This is a convenience method that calls publish(QName, Element) after the given content object has been serialized to XML using the Muse serializer framework.

  Specified by:
    `publish` in interface `NotificationProducer`
  Parameters:
    `topicName` - The WS-N topic associated with the message. This is optional (it can be null).
    `contentName` - The name of the root element of the payload. This will be passed to Serializer.toXML() when converting the content value to XML.
    `content` - The value that will be converted to XML and then put under the wsnt:Message section of the notification message. This is also called the 'payload'.
  Throws:
    `SoapFault`

### publish

    public void publish(QName topicName,
                        QName[] contentNames,
                        java.lang.Object[] content)
                 throws SoapFault

  Specified by:
    `publish` in interface `NotificationProducer`
  Throws:
    `SoapFault`

### removeSubscription

    public void removeSubscription(EndpointReference epr)

  Description copied from interface: `NotificationProducer`
  This method is for internal (service-side) code that wishes to remove a subscription so that messages are no longer published to its subscriber. It should not be exposed to remote clients - the WS-RL capabilities can be added to the subscription resource type so that subscriptions can be removed remotely.

  Specified by:
    `removeSubscription` in interface `NotificationProducer`

### resourceAdded

    public void resourceAdded(EndpointReference epr,
                              Resource resource)

  Specified by:
    `resourceAdded` in interface `ResourceManagerListener`
  Parameters:
    `epr` - The unique EPR that is being associated with the new resource. This value should always be used over Resource.getEndpointReference() because some applications may choose to map multiple EPRs to the same resource instance, and thus getEndpointReference() will not provide an accurate value.
    `resource` - The resource instance being associated with the given EPR.

### resourceRemoved

    public void resourceRemoved(EndpointReference epr)

  Specified by:
    `resourceRemoved` in interface `ResourceManagerListener`
  Parameters:
    `epr` - The unique EPR of the resource that has been destroyed - the Resource object is not provided because it would most likely be in an inconsistent state. At this point, the resource has already been 'destroyed'.

### subscribe

    public WsResource subscribe(EndpointReference consumer,
                                Filter filter,
                                java.util.Date terminationTime,
                                Policy policy)
                         throws TopicNotSupportedFault,
                                UnacceptableInitialTerminationTimeFault,
                                SubscribeCreationFailedFault

  Description copied from interface: `NotificationProducer`
  Registers a consumer resource to receive events that are published to a certain topic (along with other filtering rules). Registration results in the creation of a subscription resource, which exposes the WS-N SubscriptionManager port type and can be managed as a regular WS-RF implied resource. Once subscription is complete, the event consumer will receive notifications on the topic until the subscription is terminated (via WS-RL) or the producer shuts down.

  Specified by:
    `subscribe` in interface `NotificationProducer`
  Parameters:
    `consumer` - The EPR of the resource that will receive the notifications from the producing resource. This does not have to be the same component that is making the subscribe() request. An orchestrating service may be subscribing for the consumer.
    `filter` - Optional filter that allows for messages to be published if they meet a certain criteria. Filter types include topic names, message patterns (XPath), and current state (WSRP doc).
    `policy` - Optional filter that allows for more complex analysis on the conditions needed to send a message. The implementation must provide one or more policy languages (dialects) that clients can use to express how and when a message that is published to a topic should be sent. If this parameter is null, no policy is applied.
    `terminationTime` - Because subscriptions are WS-resources, they may be terminated with scheduled termination (specifically, the WS-RL TerminationTime property). If this parameter is null, no termination time is set.
  Returns:
    The new subscription resource.
  Throws:
    `TopicNotSupportedFault`
    `UnacceptableInitialTerminationTimeFault`
    `SubscribeCreationFailedFault`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD