Java Doc for ConfigurationXMLDocument.java in  » Forum » mvnforum-1.1 » net » myvietnam » mvncore » configuration » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » mvnforum 1.1 » net.myvietnam.mvncore.configuration 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.myvietnam.mvncore.configuration.ConfigurationXMLDocument

ConfigurationXMLDocument
public class ConfigurationXMLDocument (Code)

A helper class that supports XML-like processing for configuration objects.

This class provides a set of methods that all have something to do with treating a Configuration object as a XML document. So a configuration can be transformed into a Document (either dom4j or w3c), saved as an XML file or passed to Digester.

Implementation note: This class is not thread safe.


author:
   Oliver Heger
version:
   $Id: ConfigurationXMLDocument.java,v 1.1 2003/12/09 08:25:30 huumai Exp $


Field Summary
final protected static  StringATTR_NAME
     Constant for the name attribute.
final protected static  StringATTR_VALUE
     Constant for the value attribute.
final protected static  StringELEM_CLASS
     Constant for the class element.
final protected static  StringELEM_PROPERTY
     Constant for the property element.

Constructor Summary
public  ConfigurationXMLDocument(Configuration config)
     Creates a new instance of ConfigurationXMLDocument and sets the configuration object to be processed.

Method Summary
public  ObjectcallDigester(String prefix)
    

Creates and initializes an object specified in the configuration using Digester.

This method first constructs a subset configuration with the keys starting with the given prefix.

protected  DigestercreateDefaultDigester(String prefix)
     Creates the default Digester instance for the given prefix.
public static  ConfigurationXMLReadercreateXMLReader(Configuration config)
     Returns a XMLReader object for the specified configuration object.
public  ConfigurationXMLReadercreateXMLReader()
     Returns a XMLReader object for the actual configuration object.
public  ConfigurationXMLReadercreateXMLReader(String prefix)
     Returns a ConfigurationXMLReader object for the subset configuration specified by the given prefix.
public  ConfigurationgetConfiguration()
     Returns the Configuration object for this document.
protected  DigestergetDefaultDigester(String prefix)
     Returns a default Digester instance.
public  DocumentgetDocument(String prefix, String rootName)
     Transforms the wrapped configuration into a dom4j document.
public  DocumentgetDocument(String prefix)
     Transforms the wrapped configuration into a dom4j document.
public  DocumentgetDocument()
     Transforms the wrapped configuration into a dom4j document.
public  org.w3c.dom.DocumentgetW3cDocument(String prefix, String rootName)
     Transforms the wrapped configuration into a w3c document.
public  org.w3c.dom.DocumentgetW3cDocument(String prefix)
     Transforms the wrapped configuration into a w3c document.
public  org.w3c.dom.DocumentgetW3cDocument()
     Transforms the wrapped configuration into a w3c document.
public  voidsetConfiguration(Configuration configuration)
     Sets the Configuration object this document operates on.
protected  voidsetupDefaultDigester(Digester digester)
     Initializes the default digester instance used for simple object creation.
static  org.w3c.dom.DocumenttoW3cDocument(Document doc)
     Converts a dom4j document into a w3c document.
public  voidwrite(Writer out, String prefix, String root, boolean pretty)
     Writes a configuration (or parts of it) to the given writer.
public  voidwrite(Writer out, String prefix, String root)
     Writes a configuration (or parts of it) to the given writer.
public  voidwrite(Writer out, String prefix, boolean pretty)
     Writes a configuration (or parts of it) to the given writer.
public  voidwrite(Writer out, String prefix)
     Writes a configuration (or parts of it) to the given writer.
public  voidwrite(Writer out, boolean pretty)
     Writes the wrapped configuration to the given writer.
public  voidwrite(Writer out)
     Writes the wrapped configuration to the given writer.

Field Detail
ATTR_NAME
final protected static String ATTR_NAME(Code)
Constant for the name attribute.



ATTR_VALUE
final protected static String ATTR_VALUE(Code)
Constant for the value attribute.



ELEM_CLASS
final protected static String ELEM_CLASS(Code)
Constant for the class element.



ELEM_PROPERTY
final protected static String ELEM_PROPERTY(Code)
Constant for the property element.




Constructor Detail
ConfigurationXMLDocument
public ConfigurationXMLDocument(Configuration config)(Code)
Creates a new instance of ConfigurationXMLDocument and sets the configuration object to be processed.
Parameters:
  config - the configuration object




Method Detail
callDigester
public Object callDigester(String prefix) throws IOException, SAXException(Code)

Creates and initializes an object specified in the configuration using Digester.

This method first constructs a subset configuration with the keys starting with the given prefix. It then transforms this subset into a XML document and let that be processed by Digester. The result of this processing is returned.

The method is intended to be used for creating simple objects that are specified somewhere in the configuration in a standard way. The following fragment shows how a configuration file must look like to be understood by the default Digester rule set used by this method:

 ...
 <class name="mypackage.MyClass"/>
 <args>
 <property name="myFirstProperty" value="myFirstValue"/>
 <property name="MySecondProperty" value="mySecondValue"/>
 ...
 </args>
 ...
 


Parameters:
  prefix - the prefix of the keys that are passed to Digester; canbe null, then the whole configuration will be processed the result of the Digester processing
throws:
  IOException - if an IOException occurs
throws:
  SAXException - if a SAXException occurs



createDefaultDigester
protected Digester createDefaultDigester(String prefix)(Code)
Creates the default Digester instance for the given prefix. This method is called by getDefaultDigester().
Parameters:
  prefix - the prefix of the keys to be processed; can benull, then the whole configuration is meant the default Digester instance



createXMLReader
public static ConfigurationXMLReader createXMLReader(Configuration config)(Code)
Returns a XMLReader object for the specified configuration object. This reader can then be used to perform XML-like processing on the configuration.
Parameters:
  config - the configuration object a XMLReader for this configuration



createXMLReader
public ConfigurationXMLReader createXMLReader()(Code)
Returns a XMLReader object for the actual configuration object. a XMLReader for the actual configuration



createXMLReader
public ConfigurationXMLReader createXMLReader(String prefix)(Code)
Returns a ConfigurationXMLReader object for the subset configuration specified by the given prefix. If no properties are found under this prefix, a NoSuchElementException exception will be thrown.
Parameters:
  prefix - the prefix of the configuration keys that belong to thesubset; can be null, then the whole configuration is affected a XMLReader for the specified subset configuration



getConfiguration
public Configuration getConfiguration()(Code)
Returns the Configuration object for this document. the Configuration object



getDefaultDigester
protected Digester getDefaultDigester(String prefix)(Code)
Returns a default Digester instance. This instance is used for the simple object creation feature.
Parameters:
  prefix - the prefix of the keys to be processed; can benull, then the whole configuration is meant the default Digester instance



getDocument
public Document getDocument(String prefix, String rootName) throws DocumentException(Code)
Transforms the wrapped configuration into a dom4j document.
Parameters:
  prefix - a prefix for the keys to process; can be null,then all keys in the configuration will be added to the document
Parameters:
  rootName - the name of the root element in the document; can benull, then a default name will be used the document
throws:
  DocumentException - if an error occurs



getDocument
public Document getDocument(String prefix) throws DocumentException(Code)
Transforms the wrapped configuration into a dom4j document. The root element will be given a default name.
Parameters:
  prefix - a prefix for the keys to process; can be null,then all keys in the configuration will be added to the document the document
throws:
  DocumentException - if an error occurs



getDocument
public Document getDocument() throws DocumentException(Code)
Transforms the wrapped configuration into a dom4j document. The root element will be given a default name. the document
throws:
  DocumentException - if an error occurs



getW3cDocument
public org.w3c.dom.Document getW3cDocument(String prefix, String rootName) throws DocumentException(Code)
Transforms the wrapped configuration into a w3c document.
Parameters:
  prefix - a prefix for the keys to process; can be null,then all keys in the configuration will be added to the document
Parameters:
  rootName - the name of the root element in the document; can benull, then a default name will be used the document
throws:
  DocumentException - if an error occurs



getW3cDocument
public org.w3c.dom.Document getW3cDocument(String prefix) throws DocumentException(Code)
Transforms the wrapped configuration into a w3c document. The root element will be given a default name.
Parameters:
  prefix - a prefix for the keys to process; can be null,then all keys in the configuration will be added to the document the document
throws:
  DocumentException - if an error occurs



getW3cDocument
public org.w3c.dom.Document getW3cDocument() throws DocumentException(Code)
Transforms the wrapped configuration into a w3c document. The root element will be given a default name. the document
throws:
  DocumentException - if an error occurs



setConfiguration
public void setConfiguration(Configuration configuration)(Code)
Sets the Configuration object this document operates on.
Parameters:
  configuration - the Configuration object



setupDefaultDigester
protected void setupDefaultDigester(Digester digester)(Code)
Initializes the default digester instance used for simple object creation. Here all needed properties and rules can be set. This base implementation sets default rules for object creation as explained in the comment for the callDigester() methods.
Parameters:
  digester - the digester instance to be initialized



toW3cDocument
static org.w3c.dom.Document toW3cDocument(Document doc) throws DocumentException(Code)
Converts a dom4j document into a w3c document.
Parameters:
  doc - the dom4j document the w3c document
throws:
  DocumentException - if an error occurs



write
public void write(Writer out, String prefix, String root, boolean pretty) throws IOException, DocumentException(Code)
Writes a configuration (or parts of it) to the given writer.
Parameters:
  out - the output writer
Parameters:
  prefix - the prefix of the subset to write; if null, thewhole configuration is written
Parameters:
  root - the name of the root element of the resulting document;null for a default name
Parameters:
  pretty - flag for the pretty print mode
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



write
public void write(Writer out, String prefix, String root) throws IOException, DocumentException(Code)
Writes a configuration (or parts of it) to the given writer. This overloaded version always uses pretty print mode.
Parameters:
  out - the output writer
Parameters:
  prefix - the prefix of the subset to write; if null, thewhole configuration is written
Parameters:
  root - the name of the root element of the resulting document;null for a default name
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



write
public void write(Writer out, String prefix, boolean pretty) throws IOException, DocumentException(Code)
Writes a configuration (or parts of it) to the given writer. The resulting document's root element will be given a default name.
Parameters:
  out - the output writer
Parameters:
  prefix - the prefix of the subset to write; if null, thewhole configuration is written
Parameters:
  pretty - flag for the pretty print mode
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



write
public void write(Writer out, String prefix) throws IOException, DocumentException(Code)
Writes a configuration (or parts of it) to the given writer. The resulting document's root element will be given a default name. This overloaded version always uses pretty print mode.
Parameters:
  out - the output writer
Parameters:
  prefix - the prefix of the subset to write; if null, thewhole configuration is written
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



write
public void write(Writer out, boolean pretty) throws IOException, DocumentException(Code)
Writes the wrapped configuration to the given writer. The resulting document's root element will be given a default name.
Parameters:
  out - the output writer
Parameters:
  pretty - flag for the pretty print mode
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



write
public void write(Writer out) throws IOException, DocumentException(Code)
Writes the wrapped configuration to the given writer. The resulting document's root element will be given a default name. This overloaded version always uses pretty print mode.
Parameters:
  out - the output writer
throws:
  IOException - if an IO error occurs
throws:
  DocumentException - if there is an error during processing



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.