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.resource.sg.impl
Class ServiceGroupFilePersistence

    java.lang.Object
      org.apache.muse.core.AbstractFilePersistence
          org.apache.muse.ws.resource.sg.impl.ServiceGroupFilePersistence

All Implemented Interfaces:
  InitializationParameters, Persistence, ResourceManagerListener, ServiceGroupPersistence

public class ServiceGroupFilePersistence
extends AbstractFilePersistence
implements ServiceGroupPersistence

ServiceGroupFilePersistence is an implementation of file-based persistence of service group entry data. It stores data about current service group entries on disk and then re-loads them after an application restarts. This allows the service group to continue functioning as it was before the restart without the application having to somehow re-discover and re-add all of the members.

Author:
  Dan Jemiolo (danj)

Constructor Summary
`ServiceGroupFilePersistence()`

Method Summary
`protected void` | `createResourceFile(EndpointReference epr, Resource resource, java.io.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 java.lang.String` | `getFilePrefix()`
`WsResource` | `getServiceGroup()`
`protected Resource` | `reloadResource(java.lang.String contextPath, org.w3c.dom.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` | `setServiceGroup(WsResource serviceGroup)`

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

### ServiceGroupFilePersistence

    public ServiceGroupFilePersistence()

Method Detail

### createResourceFile

    protected void createResourceFile(EndpointReference epr,
                                      Resource resource,
                                      java.io.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 java.lang.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)`

### getServiceGroup

    public WsResource getServiceGroup()

  Specified by:
    `getServiceGroup` in interface `ServiceGroupPersistence`

### reloadResource

    protected Resource reloadResource(java.lang.String contextPath,
                                      org.w3c.dom.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`

### setServiceGroup

    public void setServiceGroup(WsResource serviceGroup)

  Specified by:
    `setServiceGroup` in interface `ServiceGroupPersistence`

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