|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.sape.carbon.core.config.node.AbstractNode
|
+--org.sape.carbon.core.config.node.AbstractConfigurationDocument
|
+--org.sape.carbon.services.config.jar.JarConfigurationDocument
Implementation of ConfigurationDocument using entries within jar files as the backing datastore.
This implementation does not maintain an open jar file. It will open the jar file only when it needs to read or write and close it when it is done.
Copyright 2002 Sapient
| Field Summary | |
private EnhancedJarFile |
currentOpenJar
Holds the enhanced jar being wrapped. |
private String |
jarEntryName
Name of the jar entry. |
private File |
jarFile
Holds the simple reference to the jar file. |
private boolean |
jarOpenForRead
flags if the jar is open for read. |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
private ReadWriteLock |
readWriteLock
Holds a read/write lock for this jar. |
| Fields inherited from class org.sape.carbon.core.config.node.AbstractConfigurationDocument |
configuration |
| Fields inherited from class org.sape.carbon.core.config.node.AbstractNode |
childNodes, nodeListeners |
| Fields inherited from interface org.sape.carbon.core.config.node.Node |
DELIMITER |
| Constructor Summary | |
JarConfigurationDocument(Node parent,
String name,
ConfigurationFormatService formatter,
ReadWriteLock readWriteLock,
File jarFile,
String jarEntryName)
Constructor for JarConfigurationDocument. |
|
| Method Summary | |
protected boolean |
backingDataExists()
Method called from the refresh method to see if the backing data still exists. |
protected void |
closeInputStream(InputStream in)
Closes the input stream. |
private void |
closeJar()
Closes the jar file if it is open, releasing the lock based upon how it was opened. |
protected void |
closeOutputStream(OutputStream out)
Closes the output stream. |
protected void |
destroyBackingData()
This method is called by remove to destroy the data
backing this node in the data source. |
protected InputStream |
openInputStream()
This method should be overridden by classes implementing ConfigurationDocuments for specific data stores. |
private EnhancedJarFile |
openJar(boolean forRead)
Opens the jar file. |
protected OutputStream |
openOutputStream()
This method should be overridden by classes implementing ConfigurationDocuments for specific data stores. |
| Methods inherited from class org.sape.carbon.core.config.node.AbstractConfigurationDocument |
addNestedConfigurationDocument, getAllChildNames, getFormatService, getNestedNodeFactory, issueNodeModifiedEvent, loadChild, notifyNestedDocuments, readConfiguration, refresh, remove, writeChildReferences, writeConfiguration |
| Methods inherited from class org.sape.carbon.core.config.node.AbstractNode |
addNodeListener, addNodeListener, addNodeListener, containsChild, fetchChild, fetchChildren, getAbsoluteName, getAddOrLoadChildLock, getAllowsChildren, getName, getParent, getReadOrAlterNodeLock, isRemoved, issueChildLoadedEvent, issueNodeRemovedEvent, removeRemovedChildren, setRemoved, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.sape.carbon.core.config.node.Node |
addNodeListener, addNodeListener, containsChild, fetchChild, fetchChildren, getAbsoluteName, getAllowsChildren, getName, getParent, isRemoved |
| Field Detail |
private org.apache.commons.logging.Log log
private File jarFile
private String jarEntryName
private EnhancedJarFile currentOpenJar
private boolean jarOpenForRead
private final ReadWriteLock readWriteLock
| Constructor Detail |
public JarConfigurationDocument(Node parent,
String name,
ConfigurationFormatService formatter,
ReadWriteLock readWriteLock,
File jarFile,
String jarEntryName)
parent - the parent node of the configuration documentname - name of the configuration documentformatter - formatter to use on the documentreadWriteLock - lock for the documentjarFile - jarfile the document is wrappingjarEntryName - entry inside the jarfile| Method Detail |
protected InputStream openInputStream()
throws IOException
AbstractConfigurationDocumentConfigurationDocuments for specific data stores.
The returned InputStream should be a stream of data
that can be read by the ConfigurationFormatService and
converted to a Configuration object.
This method is called by readConfiguration.
openInputStream in class AbstractConfigurationDocumentInputStream from which to read
the Configuration object within this
ConfigurationDocument
IOExceptionAbstractConfigurationDocument.openInputStream()
protected void closeInputStream(InputStream in)
throws IOException
AbstractConfigurationDocument
closeInputStream in class AbstractConfigurationDocumentin - the stream to open
IOExceptionAbstractConfigurationDocument.closeInputStream(InputStream)
protected OutputStream openOutputStream()
throws IOException
AbstractConfigurationDocumentConfigurationDocuments for specific data stores.
The returned OutputStream should be a stream of data
that can be written to by the ConfigurationFormatService.
This method is called by writeConfiguration.
openOutputStream in class AbstractConfigurationDocumentOutputStream to which to write
the Configuration object within this
ConfigurationDocument
IOExceptionAbstractConfigurationDocument.openOutputStream()
protected void closeOutputStream(OutputStream out)
throws IOException
AbstractConfigurationDocument
closeOutputStream in class AbstractConfigurationDocumentout - the stream to close
IOExceptionAbstractConfigurationDocument.closeOutputStream(OutputStream)
protected void destroyBackingData()
throws NodeRemovalException
AbstractNoderemove to destroy the data
backing this node in the data source. Implementations of this method
should remove all traces of the Node's existence
destroyBackingData in class AbstractNodeNodeRemovalException - indicates an error removing the nodeAbstractNode.destroyBackingData()protected boolean backingDataExists()
AbstractNode
backingDataExists in class AbstractNodeAbstractNode.backingDataExists()
private EnhancedJarFile openJar(boolean forRead)
throws IOException
forRead - if true a read lock will be acquired, if false,
a write lock will be acquired
IOException - indicates an error opening the jar
private void closeJar()
throws IOException
IOException - indicates an error closing the jar
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||