Class AbstractConfigReader

java.lang.Object
org.dlese.dpc.schemedit.config.AbstractConfigReader
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AccessManager, CollectionConfigReader, FrameworkConfigReader, SuggestionServiceManager

public class AbstractConfigReader extends Object implements Serializable
Abstract class for extracting information from, and writing to, XML config files
Author:
ostwald

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static boolean
    Description of the Field
    protected org.dom4j.DocumentFactory
     
    protected DocMap
     
    protected String
     
    protected String
     
    protected File
     
    protected static boolean
    Description of the Field
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a AbstractConfigReader.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is called at the conclusion of processing and may be used for tear-down.
    void
    Write config document to disk and then force reread of values.
    org.dom4j.Document
    Gets delocalized Document for this reader.
    Gets the document attribute of the AbstractConfigReader object
    org.dom4j.Document
    Gets the localized Document for this reader.
    org.dom4j.Node
    getNode(String xpath)
    Gets a single Node satisfying give XPath.
    Get all Nodes satisfying the given xpath.
    return the Text of a Node satisfying the given XPath.
    Gets the source attribute of the AbstractConfigReader object
    Gets the sourcePath attribute of the AbstractConfigReader object
    protected static void
    Print a line to standard out.
    void
    Write Document to disk and then set docMap to null, forcing a re-read upon next access.
    protected void
    setNodeText(String xpath, String value)
    Sets the nodeText for specified path, creating new node if necessary.
    protected void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • debug

      protected static boolean debug
      Description of the Field
    • writeOnDestroy

      protected static boolean writeOnDestroy
      Description of the Field
    • rootElementName

      protected String rootElementName
    • nameSpaceInfo

      protected String nameSpaceInfo
    • docMap

      protected DocMap docMap
    • source

      protected File source
    • df

      protected org.dom4j.DocumentFactory df
  • Constructor Details

    • AbstractConfigReader

      public AbstractConfigReader(File source) throws Exception
      Create a AbstractConfigReader.
      Parameters:
      source - Description of the Parameter
      Throws:
      Exception
    • AbstractConfigReader

      public AbstractConfigReader(String xmlSource) throws Exception
      Throws:
      Exception
  • Method Details

    • getSourcePath

      public String getSourcePath()
      Gets the sourcePath attribute of the AbstractConfigReader object
      Returns:
      The sourcePath value
    • getDocMap

      public DocMap getDocMap() throws Exception
      Gets the document attribute of the AbstractConfigReader object
      Returns:
      The document value
      Throws:
      Exception - Description of the Exception
    • getSource

      public File getSource()
      Gets the source attribute of the AbstractConfigReader object
      Returns:
      The source value
    • setSource

      protected void setSource(File file)
      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

      public org.dom4j.Document getDelocalizedDoc() throws Exception
      Gets delocalized Document for this reader.
      Throws:
      Exception
    • flush

      public void flush() throws Exception
      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

      public List getNodes(String xpath)
      Get all Nodes satisfying the given xpath.
      Parameters:
      xpath - an XPath
      Returns:
      a List of all modes satisfying given XPath, or null
    • getNode

      public org.dom4j.Node getNode(String xpath)
      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

      public String getNodeText(String xpath)
      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

      protected void setNodeText(String xpath, String value)
      Sets the nodeText for specified path, creating new node if necessary.
      Parameters:
      xpath - The new nodeText value
      value - 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

      protected static void prtln(String s)
      Print a line to standard out.
      Parameters:
      s - The String to print.