|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.muse.core.AbstractFilePersistence
public abstract class AbstractFilePersistence
AbstractFilePersistence is an abstract component that provides generic resource-state-to-file utilities without specifying the format of the XML that goes into the files. It can be used by resources or capabilities that wish to save state to disk and reload that state the next time the application is initialized.
Constructor Summary | |
---|---|
AbstractFilePersistence()
|
Method Summary | |
---|---|
protected void |
createResourceFile(EndpointReference epr,
Resource resource)
Creates the proper file name for the given resource instance and then delegates creation of the file's contents to the abstract method of the same name. |
protected abstract 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 void |
destroyResourceFile(EndpointReference epr)
Finds the file associated with the given resource EPR and removes it from the file system. |
protected String |
getContextPath(EndpointReference epr)
|
protected Integer |
getFileNumber(String fileName)
|
protected Map |
getFileNumberTables()
|
protected abstract String |
getFilePrefix()
|
String |
getInitializationParameter(String name)
|
Map |
getInitializationParameters()
|
protected String |
getNextFileName(int fileNumber)
|
protected int |
getNextFileNumber(String contextPath)
|
protected File |
getPersistenceDirectory()
|
String |
getPersistenceLocation()
|
ResourceManager |
getResourceManager()
|
protected File |
getResourceTypeDirectory(String contextPath)
|
void |
reload()
This implementation re-loads all saved instances of the resource types found in the ResourceManager. |
protected abstract 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. |
protected void |
reloadResources(String contextPath,
File resourceTypeDir)
This method finds all of the files in the resource type's persistence directory and reloads them one at a time. |
void |
setInitializationParameters(Map parameters)
Allows the resource's creator to provide it with arbitrary name-value pairs that may be used during initialization. |
void |
setPersistenceLocation(String location)
|
void |
setResourceManager(ResourceManager manager)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractFilePersistence()
Method Detail |
---|
protected void createResourceFile(EndpointReference epr, Resource resource) throws SoapFault
epr
- resource
-
SoapFault
getNextFileNumber(String)
,
createResourceFile(EndpointReference, Resource, File)
protected abstract void createResourceFile(EndpointReference epr, Resource resource, File resourceFile) throws SoapFault
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.
SoapFault
- protected void destroyResourceFile(EndpointReference epr) throws SoapFault
epr
- The EPR of the resource that has been permanently destroyed.
SoapFault
protected String getContextPath(EndpointReference epr)
epr
-
protected Integer getFileNumber(String fileName)
fileName
-
protected Map getFileNumberTables()
protected abstract String getFilePrefix()
getNextFileNumber(String)
public String getInitializationParameter(String name)
getInitializationParameter
in interface InitializationParameters
public Map getInitializationParameters()
getInitializationParameters
in interface InitializationParameters
protected String getNextFileName(int fileNumber)
fileNumber
-
protected int getNextFileNumber(String contextPath)
protected File getPersistenceDirectory()
public String getPersistenceLocation()
getPersistenceLocation
in interface Persistence
public ResourceManager getResourceManager()
getResourceManager
in interface Persistence
protected File getResourceTypeDirectory(String contextPath)
contextPath
-
getPersistenceDirectory()
,
File.mkdirs()
public void reload() throws SoapFault
reload
in interface Persistence
SoapFault
reloadResources(String, File)
protected abstract Resource reloadResource(String contextPath, Element resourceXML) throws SoapFault
contextPath
- The context path of the instance's resource type.resourceXML
- The persisted data that must be reloaded.
SoapFault
protected void reloadResources(String contextPath, File resourceTypeDir) throws SoapFault
contextPath
- resourceTypeDir
-
SoapFault
reloadResource(String, Element)
public void setInitializationParameters(Map parameters)
InitializationParameters
setInitializationParameters
in interface InitializationParameters
parameters
- A simple set of name-value pairs - Map[String, String] - that
contains initialization parameters for the resource.public void setPersistenceLocation(String location)
setPersistenceLocation
in interface Persistence
public void setResourceManager(ResourceManager manager)
setResourceManager
in interface Persistence
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |