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

java.lang.Object
  extended by org.apache.muse.core.AbstractFilePersistence
      extended by org.apache.muse.ws.notification.impl.NotificationProducerFilePersistence
All Implemented Interfaces:
InitializationParameters, Persistence, ResourceManagerListener, NotificationProducerPersistence

public class NotificationProducerFilePersistence
extends AbstractFilePersistence
implements NotificationProducerPersistence

NotificationProducerFilePersistence is an implementation of file-based persistence of subscription resource data. It stores data about current subscription resources on disk and then re-loads them after an application restarts. This allows the producer resource to continue functioning as it was before the restart without the application having to notify all subscribers and have them re-subscribe.

Author:
Dan Jemiolo (danj)

Constructor Summary
NotificationProducerFilePersistence()
           
 
Method Summary
protected  void createResourceFile(EndpointReference epr, Resource resource, File resourceFile)
          This method should be overridden by concrete file-based persistence classes to create the given file and fill it with the appropriate XML content.
protected  String getFilePrefix()
           
 NotificationProducer getNotificationProducer()
           
protected  Resource reloadResource(String contextPath, Element resourceXML)
          This method should be overridden by concrete file-based persistence classes to update a resource instance with the saved data from the XML fragment.
 void resourceAdded(EndpointReference epr, Resource resource)
           
 void resourceRemoved(EndpointReference epr)
           
 void setNotificationProducer(NotificationProducer producer)
           
 
Methods inherited from class org.apache.muse.core.AbstractFilePersistence
createResourceFile, destroyResourceFile, getContextPath, getFileNumber, getFileNumberTables, getInitializationParameter, getInitializationParameters, getNextFileName, getNextFileNumber, getPersistenceDirectory, getPersistenceLocation, getResourceManager, getResourceTypeDirectory, reload, reloadResources, setInitializationParameters, setPersistenceLocation, setResourceManager
 
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.core.Persistence
getPersistenceLocation, getResourceManager, reload, setPersistenceLocation, setResourceManager
 
Methods inherited from interface org.apache.muse.core.InitializationParameters
getInitializationParameter, getInitializationParameters, setInitializationParameters
 

Constructor Detail

NotificationProducerFilePersistence

public NotificationProducerFilePersistence()
Method Detail

createResourceFile

protected void createResourceFile(EndpointReference epr,
                                  Resource resource,
                                  File resourceFile)
                           throws SoapFault
Description copied from class: AbstractFilePersistence
This method should be overridden by concrete file-based persistence classes to create the given file and fill it with the appropriate XML content. Classes that are only interested in the serialization of a certain capability's data can use the Resource object to get access to said capability.

Specified by:
createResourceFile in class AbstractFilePersistence
Parameters:
epr - The EPR that maps to the given Resource in the ResourceManager.
resource - The resource instance whose state is being persisted.
resourceFile - The File object that represents the yet-to-be-created XML file that will contain the content generated by this method. The implementation of this method must be sure to create the File on disk somehow.
Throws:
SoapFault -
  • If there is an error generating the proper content for the persistence file.
  • If there is an I/O error while reading or writing to the file system.

getFilePrefix

protected String getFilePrefix()
Specified by:
getFilePrefix in class AbstractFilePersistence
Returns:
The common string that will start all files created by the persistence implementation. This string will have the next file number appended to it in order to create unique file names.
See Also:
AbstractFilePersistence.getNextFileNumber(String)

getNotificationProducer

public NotificationProducer getNotificationProducer()
Specified by:
getNotificationProducer in interface NotificationProducerPersistence

reloadResource

protected Resource reloadResource(String contextPath,
                                  Element resourceXML)
                           throws SoapFault
Description copied from class: AbstractFilePersistence
This method should be overridden by concrete file-based persistence classes to update a resource instance with the saved data from the XML fragment. The resource instance may be created by this method, or it may exist prior to invocation.

Specified by:
reloadResource in class AbstractFilePersistence
Parameters:
contextPath - The context path of the instance's resource type.
resourceXML - The persisted data that must be reloaded.
Returns:
The Resource instance whose state (or part of it) has been reloaded from XML. The Resource may have already existed prior to the method being called, and simply had one of its capabilities updated with saved data; it may also have been created by the method and initialized right before return.
Throws:
SoapFault

resourceAdded

public void resourceAdded(EndpointReference epr,
                          Resource resource)
                   throws SoapFault
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.
Throws:
SoapFault

resourceRemoved

public void resourceRemoved(EndpointReference epr)
                     throws SoapFault
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'.
Throws:
SoapFault

setNotificationProducer

public void setNotificationProducer(NotificationProducer producer)
Specified by:
setNotificationProducer in interface NotificationProducerPersistence


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