|
|||||||||||
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.classloader.ClassloaderConfigurationDocument
Implementation of ConfigurationDocument using streams found from a classloader.
Copyright 2003 Sapient
Field Summary | |
private ConfigurationSource |
configSource
The source for configuration data. |
private boolean |
isInMemoryOnly
Keeps track of whether or not this node was created in memory only or it is actually on the backing data store. |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
private String |
resourcePath
The path of the resource that contains this configuration. |
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 | |
ClassloaderConfigurationDocument(Node parent,
String name,
ConfigurationFormatService formatter,
String resourcePath,
ConfigurationSource configSource)
Constructor for ClassloaderConfigurationDocument. |
Method Summary | |
protected boolean |
backingDataExists()
If this node exists, then it was either loaded from a classloader resource or it is in-memory-only. |
protected void |
closeOutputStream(OutputStream out)
This implementation cannot write configurations to a backing data store. |
protected void |
destroyBackingData()
This is only called in the case of in-memory-only configurations. |
protected InputStream |
openInputStream()
This implementation opens an input stream of the resource itentified by this.resourcePath by calling classloader.getResourceAsStream(this.resourcePath) |
protected OutputStream |
openOutputStream()
This implementation cannot write configurations to a backing data store. |
void |
refresh()
This implementation only refreshes the node if it is not in memory only |
int |
remove()
Only configurations that exist in-memory-only can be removed. |
void |
writeConfiguration(Configuration config)
This implementation does not write through to the backing datastore as Classloader resources are read-only. |
Methods inherited from class org.sape.carbon.core.config.node.AbstractConfigurationDocument |
addNestedConfigurationDocument, closeInputStream, getAllChildNames, getFormatService, getNestedNodeFactory, issueNodeModifiedEvent, loadChild, notifyNestedDocuments, readConfiguration, writeChildReferences |
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 final String resourcePath
private final ConfigurationSource configSource
private final boolean isInMemoryOnly
Constructor Detail |
public ClassloaderConfigurationDocument(Node parent, String name, ConfigurationFormatService formatter, String resourcePath, ConfigurationSource configSource)
parent
- name
- formatter
- resourcePath
- Method Detail |
public void writeConfiguration(Configuration config)
This method is synchronized internally to prevent multiple writes from
saving Configuration
s concurrently and to make sure that
no one is writing a new Configuration
while someone else
is reading.
writeConfiguration
in interface ConfigurationDocument
writeConfiguration
in class AbstractConfigurationDocument
config
- the new Configuration
protected InputStream openInputStream() throws IOException
openInputStream
in class AbstractConfigurationDocument
InputStream
from which to read
the Configuration
object within this
ConfigurationDocument
IOException
protected OutputStream openOutputStream() throws IOException
openOutputStream
in class AbstractConfigurationDocument
OutputStream
to which to write
the Configuration
object within this
ConfigurationDocument
UnsupportedOperationException
IOException
protected void closeOutputStream(OutputStream out) throws IOException
closeOutputStream
in class AbstractConfigurationDocument
out
- the stream to close
UnsupportedOperationException
IOException
protected void destroyBackingData() throws NodeRemovalException
destroyBackingData
in class AbstractNode
NodeRemovalException
- indicates an error removing the nodeprotected boolean backingDataExists()
backingDataExists
in class AbstractNode
public int remove() throws NodeRemovalException
remove
in interface Node
remove
in class AbstractConfigurationDocument
NodeRemovalException
- if this configuration was created from
a classloader resource.synchronized to ensure no one is fetching or adding children while
this method is removing them
public void refresh()
refresh
in interface Node
refresh
in class AbstractConfigurationDocument
Node.refresh()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |