org.apache.muse.ws.notification.impl
Class SimpleSubscriptionManager

java.lang.Object
  extended by org.apache.muse.core.AbstractCapability
      extended by org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
          extended by org.apache.muse.ws.notification.impl.SimpleSubscriptionManager
All Implemented Interfaces:
Capability, Initialization, InitializationParameters, Shutdown, XmlSerializable, SubscriptionManager, WsResourceCapability

public class SimpleSubscriptionManager
extends AbstractWsResourceCapability
implements SubscriptionManager

SimpleSubscriptionManager is Muse's default implementation of the WS-Notification SubscriptionManager port type. It uses the NotificationConsumerClient class to send messages to its subscribers. It also provides an initialization flag, trace-notifications that allows users to turn on tracing for the outgoing notification messages (the default is 'false').

This implementation does not support subscription policies.

Author:
Dan Jemiolo (danj)

Field Summary
 
Fields inherited from interface org.apache.muse.ws.notification.SubscriptionManager
PROPERTIES
 
Constructor Summary
SimpleSubscriptionManager()
           
 
Method Summary
protected  NotificationConsumerClient createConsumerClient()
          Users can override this method to provide a different implementation of the WS-N client class without changing the implementation of subscription management.
 void deleteProperty(QName property)
           
protected  NotificationConsumerClient getConsumerClient()
           
 EndpointReference getConsumerReference()
           
 Date getCreationTime()
           
 Filter getFilter()
           
protected  int getNumberOfTries()
           
 EndpointReference getProducerReference()
           
 Element[] getProperty(QName property)
           
 QName[] getPropertyNames()
          Concrete capability classes that define properties MUST override this method and provide the names of the properties.
 Policy getSubscriptionPolicy()
          This implementation always returns null.
 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.
 void insertProperty(QName property, Element[] values)
           
protected  boolean isDestroyedOnFailure()
           
 boolean isPaused()
           
protected  boolean isUsingTrace()
           
 void pauseSubscription()
          Temporarily stops the producer resource from sending messages that are published to consumer.
 void publish(NotificationMessage message)
          Sends the given message to the subscription's consumer resource.
 void resumeSubscription()
          If the subscription is paused, it is unpaused, so that messages published to the topic will once again be sent to the consumer.
 void setConsumerReference(EndpointReference consumer)
           
 void setFilter(Filter filter)
           
 void setProducerReference(EndpointReference producer)
           
 void setSubscriptionPolicy(Policy policy)
          Logs a warning message that this feature is not supported.
 Element toXML()
          Converts this object into an XML representation, as defined by its related schema or specification.
 Element toXML(Document doc)
          Converts this object into an XML representation, as defined by its related schema or specification.
 void updateProperty(QName property, Element[] values)
           
 
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, initializeCompleted, prepareShutdown, 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
getWsResource
 
Methods inherited from interface org.apache.muse.core.Capability
getActions, getCapabilityURI, getEnvironment, getLog, getMessageHandler, getPersistence, getResource, initializeCompleted, prepareShutdown, 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

SimpleSubscriptionManager

public SimpleSubscriptionManager()
Method Detail

createConsumerClient

protected NotificationConsumerClient createConsumerClient()
Users can override this method to provide a different implementation of the WS-N client class without changing the implementation of subscription management.

Returns:
An instance of NotificationConsumerClient.

getConsumerClient

protected NotificationConsumerClient getConsumerClient()

getConsumerReference

public EndpointReference getConsumerReference()
Specified by:
getConsumerReference in interface SubscriptionManager
Returns:
The EPR of the resource that is receiving the notifications.

getCreationTime

public Date getCreationTime()
Specified by:
getCreationTime in interface SubscriptionManager
Returns:
The time that the subscription resource was created.

getFilter

public Filter getFilter()
Specified by:
getFilter in interface SubscriptionManager
Returns:
The filter that provided when the subscription was created.

getNumberOfTries

protected int getNumberOfTries()

getProducerReference

public EndpointReference getProducerReference()
Specified by:
getProducerReference in interface SubscriptionManager
Returns:
The EPR of the resource that created the subscription (when subscribe() was called).

getPropertyNames

public QName[] getPropertyNames()
Concrete capability classes that define properties MUST override this method and provide the names of the properties.

Overrides:
getPropertyNames in class AbstractWsResourceCapability
Returns:
The names of the resource properties defined by this capability.

getSubscriptionPolicy

public Policy getSubscriptionPolicy()
This implementation always returns null.

Specified by:
getSubscriptionPolicy in interface SubscriptionManager
Returns:
The policy that provided when the subscription was created.

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

isDestroyedOnFailure

protected boolean isDestroyedOnFailure()

isPaused

public boolean isPaused()
Specified by:
isPaused in interface SubscriptionManager
Returns:
True if the subscription is paused and not publishing messages to its consumer.

isUsingTrace

protected boolean isUsingTrace()

pauseSubscription

public void pauseSubscription()
Description copied from interface: SubscriptionManager
Temporarily stops the producer resource from sending messages that are published to consumer. This does not involved terminating the subscription with WS-RL - the subscription resource will remain intact through the pause. Messages will only be sent again if the resumeSubscription() operation is invoked on the subscription.

If the subscription is already paused, the result is a no-op (the operation is idempotent).

Specified by:
pauseSubscription in interface SubscriptionManager

publish

public void publish(NotificationMessage message)
Description copied from interface: SubscriptionManager
Sends the given message to the subscription's consumer resource.

Specified by:
publish in interface SubscriptionManager

resumeSubscription

public void resumeSubscription()
Description copied from interface: SubscriptionManager
If the subscription is paused, it is unpaused, so that messages published to the topic will once again be sent to the consumer. If the subscription was not paused, the result is a no-op (the operation is idempotent).

Specified by:
resumeSubscription in interface SubscriptionManager

setConsumerReference

public void setConsumerReference(EndpointReference consumer)
Specified by:
setConsumerReference in interface SubscriptionManager

setFilter

public void setFilter(Filter filter)
Specified by:
setFilter in interface SubscriptionManager

setProducerReference

public void setProducerReference(EndpointReference producer)
Specified by:
setProducerReference in interface SubscriptionManager

setSubscriptionPolicy

public void setSubscriptionPolicy(Policy policy)
Logs a warning message that this feature is not supported.

Specified by:
setSubscriptionPolicy in interface SubscriptionManager

toXML

public Element toXML()
Description copied from interface: XmlSerializable
Converts this object into an XML representation, as defined by its related schema or specification. The format of the XML is dependent on the concrete type.

Specified by:
toXML in interface XmlSerializable
Returns:
An XML representation of this object.

toXML

public Element toXML(Document doc)
Description copied from interface: XmlSerializable
Converts this object into an XML representation, as defined by its related schema or specification. The format of the XML is dependent on the concrete type.

Specified by:
toXML in interface XmlSerializable
Parameters:
doc - The DOM Document that will be used to create all of the nodes in the resulting XML fragment.
Returns:
An XML representation of this object.

deleteProperty

public void deleteProperty(QName property)
                    throws BaseFault
Throws:
BaseFault

getProperty

public Element[] getProperty(QName property)
                      throws BaseFault
Throws:
BaseFault

insertProperty

public void insertProperty(QName property,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault

updateProperty

public void updateProperty(QName property,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.