Package org.dlese.dpc.schemedit.config
Class AbstractConfigReader
java.lang.Object
org.dlese.dpc.schemedit.config.AbstractConfigReader
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AccessManager,CollectionConfigReader,FrameworkConfigReader,SuggestionServiceManager
Abstract class for extracting information from, and writing to, XML config
files
- Author:
- ostwald
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractConfigReader(File source) Create a AbstractConfigReader.AbstractConfigReader(String xmlSource) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()This method is called at the conclusion of processing and may be used for tear-down.voidflush()Write config document to disk and then force reread of values.org.dom4j.DocumentGets delocalized Document for this reader.Gets the document attribute of the AbstractConfigReader objectorg.dom4j.DocumentGets the localized Document for this reader.org.dom4j.NodeGets a single Node satisfying give XPath.Get all Nodes satisfying the given xpath.getNodeText(String xpath) return the Text of a Node satisfying the given XPath.Gets the source attribute of the AbstractConfigReader objectGets the sourcePath attribute of the AbstractConfigReader objectprotected static voidPrint a line to standard out.voidrefresh()Write Document to disk and then set docMap to null, forcing a re-read upon next access.protected voidsetNodeText(String xpath, String value) Sets the nodeText for specified path, creating new node if necessary.protected voidset source file, used when creating new CollectionConfig's by first reading a default config file and then assigning a new source so it will be written to a new config file
-
Field Details
-
debug
protected static boolean debugDescription of the Field -
writeOnDestroy
protected static boolean writeOnDestroyDescription of the Field -
rootElementName
-
nameSpaceInfo
-
docMap
-
source
-
df
protected org.dom4j.DocumentFactory df
-
-
Constructor Details
-
Method Details
-
getSourcePath
Gets the sourcePath attribute of the AbstractConfigReader object- Returns:
- The sourcePath value
-
getDocMap
Gets the document attribute of the AbstractConfigReader object- Returns:
- The document value
- Throws:
Exception- Description of the Exception
-
getSource
Gets the source attribute of the AbstractConfigReader object- Returns:
- The source value
-
setSource
set source file, used when creating new CollectionConfig's by first reading a default config file and then assigning a new source so it will be written to a new config file- Parameters:
file- The new source value
-
getDocument
public org.dom4j.Document getDocument()Gets the localized Document for this reader. -
getDelocalizedDoc
Gets delocalized Document for this reader.- Throws:
Exception
-
flush
Write config document to disk and then force reread of values.- Throws:
Exception- Description of the Exception
-
refresh
public void refresh()Write Document to disk and then set docMap to null, forcing a re-read upon next access. -
getNodes
Get all Nodes satisfying the given xpath.- Parameters:
xpath- an XPath- Returns:
- a List of all modes satisfying given XPath, or null
-
getNode
Gets a single Node satisfying give XPath. If more than one Node is found, the first is returned (and a msg is printed).- Parameters:
xpath- an XPath- Returns:
- a dom4j Node
-
getNodeText
return the Text of a Node satisfying the given XPath.- Parameters:
xpath- an XPath\- Returns:
- Text of Node or empty String if no Node is found
-
setNodeText
Sets the nodeText for specified path, creating new node if necessary.- Parameters:
xpath- The new nodeText valuevalue- The new nodeText value
-
destroy
public void destroy()This method is called at the conclusion of processing and may be used for tear-down. -
prtln
Print a line to standard out.- Parameters:
s- The String to print.
-