| java.lang.Object org.josso.util.config.XUpdateConfigurationHandler
All known Subclasses: org.josso.util.config.SSOConfigurationEventHandler,
XUpdateConfigurationHandler | public class XUpdateConfigurationHandler implements ConfigurationHandler(Code) | | This is a base configuration handler that uses XUpdate to add, update and remove elements from a XML files.
The XML file to be updated is referred by the ConfigurationContext instance related to this handler.
author: Sebastian Gonzalez Oyuela version: $Id: XUpdateConfigurationHandler.java 508 2008-02-18 13:32:29Z sgonzalez $ |
Method Summary | |
protected void | backupConfigFile() Makes a backup of the configuration file to disk. | protected String | buildXAppendElementQueryString(String xpathExpr, String element, String value) Builds a XUpdate query string to append a new element to the document. | protected String | buildXAppendElementXMLQueryString(String xpathExpr, String element, String xml) Builds a XUpdate query string to append a new element with the specified XML as body. | protected String | buildXDeleteElementQuery(String xpathExpr, String element) Builds a XUpdate query string to delete the specified element. | protected String | buildXInsertAfterElementQueryString(String xpathExpr, String element, String value) Builds a XUpdate query string to insert an element after another. | protected String | buildXUPdateElementQueryString(String xpathExpr, String newValue) Builds an XUpdate query string to update an element's value. | public static boolean | canEncode(char c) | protected String | getElementsBaseLocation() | protected String | getNewElementsBaseLocation() | public ConfigurationContext | getSSOConfigurationContext() Getter for this handler configuration context. | protected Node | readConfigFile() This method reads a configuration into a DOM tree. | public void | removeElement(String element) This method will remove the specified element. | public void | saveElement(String element, String oldValue, String newValue) This method will add/update the specified element based on it's old and new values. | public void | setSSOConfigurationContext(ConfigurationContext ctx) Setter for this handler configuration context. | public String | unicodeEscape(String v) This will scape all spetial chars like <, >, &, \, " and unicode chars. | protected void | updateConfiguration(String qry) Updates the element located after the xpathExpr. | protected void | writeConfigFile(Node document) | protected void | writeConfigFile(Node document, File file) |
XUPDATE_END | final public static String XUPDATE_END(Code) | | XUPDATE constant used to end all queries.
|
XUPDATE_START | final public static String XUPDATE_START(Code) | | XUPDATE constant used to begin all queries.
|
XUpdateConfigurationHandler | public XUpdateConfigurationHandler(ConfigurationContext ctx, String elementsBaseLocation, String newElementsBaseLocation)(Code) | | Parameters: ctx - The configuration context used by this handler. Parameters: elementsBaseLocation - XPath expression to find where existing elements are found in the document. Parameters: newElementsBaseLocation - XPath expression to find where new elements will be inserted AFTER in the document (as siblings) |
XUpdateConfigurationHandler | public XUpdateConfigurationHandler(String elementsBaseLocation, String newElementsBaseLocation)(Code) | | Parameters: elementsBaseLocation - XPath expression to find where existing elements are found in the document. Parameters: newElementsBaseLocation - XPath expression to find where new elements will be inserted AFTER in the document (as siblings) |
backupConfigFile | protected void backupConfigFile() throws Exception(Code) | | Makes a backup of the configuration file to disk.
|
buildXAppendElementQueryString | protected String buildXAppendElementQueryString(String xpathExpr, String element, String value)(Code) | | Builds a XUpdate query string to append a new element to the document.
Parameters: xpathExpr - the XPath expression to locate the element where the new element will be appended. Parameters: element - the new element name Parameters: value - new element value, must be already escaped. |
buildXAppendElementXMLQueryString | protected String buildXAppendElementXMLQueryString(String xpathExpr, String element, String xml)(Code) | | Builds a XUpdate query string to append a new element with the specified XML as body.
Parameters: xpathExpr - Parameters: element - Parameters: xml - |
buildXDeleteElementQuery | protected String buildXDeleteElementQuery(String xpathExpr, String element)(Code) | | Builds a XUpdate query string to delete the specified element.
Parameters: xpathExpr - Parameters: element - |
buildXInsertAfterElementQueryString | protected String buildXInsertAfterElementQueryString(String xpathExpr, String element, String value)(Code) | | Builds a XUpdate query string to insert an element after another.
Parameters: xpathExpr - the XPath expression to locate the element where the new element will be inserted. Parameters: element - the new element name Parameters: value - new element value, must be already escaped. |
buildXUPdateElementQueryString | protected String buildXUPdateElementQueryString(String xpathExpr, String newValue)(Code) | | Builds an XUpdate query string to update an element's value.
Parameters: xpathExpr - the XPath expression to locate the element. Parameters: newValue - the new element value, must be already escaped. |
canEncode | public static boolean canEncode(char c)(Code) | | |
getElementsBaseLocation | protected String getElementsBaseLocation()(Code) | | |
getNewElementsBaseLocation | protected String getNewElementsBaseLocation()(Code) | | |
getSSOConfigurationContext | public ConfigurationContext getSSOConfigurationContext()(Code) | | Getter for this handler configuration context.
|
saveElement | public void saveElement(String element, String oldValue, String newValue)(Code) | | This method will add/update the specified element based on it's old and new values.
If the oldValue is null, this method will insert the element, if it's not, it will try to update an existing element.
Parameters: element - Parameters: oldValue - Parameters: newValue - |
setSSOConfigurationContext | public void setSSOConfigurationContext(ConfigurationContext ctx)(Code) | | Setter for this handler configuration context.
|
unicodeEscape | public String unicodeEscape(String v)(Code) | | This will scape all spetial chars like <, >, &, \, " and unicode chars.
|
writeConfigFile | protected void writeConfigFile(Node document) throws Exception(Code) | | Save this file to disk
|
writeConfigFile | protected void writeConfigFile(Node document, File file) throws Exception(Code) | | Save this file to disk
|
|
|