|
|||||||||||
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.jndi.JNDIConfigurationDocument
A node that represents a JNDI context that contains content.
Content is read and writen using a ConfigurationFormatService
.
This implementation implements NamespaceChangeListener and
ObjectChangeListener from the javax.naming.event package in order to listen
for changes in the backing datastore.
Copyright 2003 Sapient
Field Summary | |
private JNDILinkNodeConfiguration |
config
|
private String |
documentType
|
private DirContext |
initialContext
|
private org.apache.commons.logging.Log |
log
|
private Name |
nodeContextName
|
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 | |
JNDIConfigurationDocument(Node parent,
String name,
ConfigurationFormatService formatter,
DirContext initialContext,
Name nodeContextName,
JNDILinkNodeConfiguration config,
String documentType)
Constructs the JNDIConfigurationDocument and registers itself as a JNDI naming listener |
Method Summary | |
protected boolean |
backingDataExists()
Checks the backing directory to see if this nodes context exists and if it does, has the right attributes. |
protected void |
closeOutputStream(OutputStream out)
Gets the data from the output stream and writes it to the jndi directory |
protected void |
destroyBackingData()
Calls destroySubcontext with this context's name |
void |
namingExceptionThrown(NamingExceptionEvent evt)
Logs the fact that a NamingExceptionEvent occured |
void |
objectAdded(NamingEvent evt)
This implementation does not do anything if an object is added. |
void |
objectChanged(NamingEvent evt)
Causes a refresh of this node |
void |
objectRemoved(NamingEvent evt)
Causes a refresh of this node |
void |
objectRenamed(NamingEvent evt)
Causes a refresh of this node |
protected InputStream |
openInputStream()
Gets the content from the JNDI directory and converts it to a stream |
protected OutputStream |
openOutputStream()
Returns a new ByteArrayOutputStream that is read when it is closed |
protected void |
registerNamingListener()
Registers this node as a NamingListener with the backing context |
Methods inherited from class org.sape.carbon.core.config.node.AbstractConfigurationDocument |
addNestedConfigurationDocument, closeInputStream, 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 DirContext initialContext
private Name nodeContextName
private JNDILinkNodeConfiguration config
private String documentType
Constructor Detail |
public JNDIConfigurationDocument(Node parent, String name, ConfigurationFormatService formatter, DirContext initialContext, Name nodeContextName, JNDILinkNodeConfiguration config, String documentType)
parent
- the parent node of this nodename
- the name of this nodeformatter
- the format service this node should useinitialContext
- the jndi initial contextnodeContextName
- the name of this node's contextconfig
- configuration used to get the names of the attributes
that hold node name, node and document type, and document content as well
as valid attribute values for node and document type.Method Detail |
protected void destroyBackingData() throws NodeRemovalException
destroyBackingData
in class AbstractNode
NodeRemovalException
- if a NamingException is encounteredprotected InputStream openInputStream() throws NamingException
openInputStream
in class AbstractConfigurationDocument
InputStream
from which to read
the Configuration
object within this
ConfigurationDocument
NamingException
- if content cannot be read from the jndi directory
InvalidConfigurationException
- if there is no content in this
nodes contextprotected OutputStream openOutputStream()
openOutputStream
in class AbstractConfigurationDocument
OutputStream
to which to write
the Configuration
object within this
ConfigurationDocument
protected void closeOutputStream(OutputStream out) throws Exception
closeOutputStream
in class AbstractConfigurationDocument
out
- the stream to close
NamingException
- if there is a problem writing to the directory
Exception
- indicates an error closing the streamprotected boolean backingDataExists()
backingDataExists
in class AbstractNode
public void objectAdded(NamingEvent evt)
objectAdded
in interface NamespaceChangeListener
public void objectRemoved(NamingEvent evt)
objectRemoved
in interface NamespaceChangeListener
public void objectRenamed(NamingEvent evt)
objectRenamed
in interface NamespaceChangeListener
public void objectChanged(NamingEvent evt)
objectChanged
in interface ObjectChangeListener
public void namingExceptionThrown(NamingExceptionEvent evt)
namingExceptionThrown
in interface NamingListener
protected void registerNamingListener()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |