epugh 2003/06/06 23:40:41
Modified: configuration/xdocs overview.xml
Log:
Enhanced documentation on using ConfigurationFactory.
Revision Changes Path
1.3 +69 -0 jakarta-commons-sandbox/configuration/xdocs/overview.xml
Index: overview.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/configuration/xdocs/overview.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- overview.xml 2 Jun 2003 18:18:49 -0000 1.2
+++ overview.xml 7 Jun 2003 06:40:41 -0000 1.3
@@ -87,6 +87,75 @@
</p>
</subsection>
</section>
+ <section name="Configuration Details">
+ <p>
+ Configuration is done by taking the configuration XML file and using included
Digester rules,
+ parsing the individual configurations. Make sure to include the various
dependencies required for
+ each type of configuration! If you have an XML file, you'll need dom4j.jar
for instance!
+ </p>
+ <subsection name="Classic Properties File">
+ <source>
+<![CDATA[
+ <properties className="org.apache.commons.configuration.PropertiesConfiguration"
fileName="conf/test.properties"/>
+]]>
+ </source>
+ <p>
+ This configuration file is very simple. You just need to specify the path to
the property file.
+ </p>
+ </subsection>
+ <subsection name="XML Properties File">
+ <source>
+<![CDATA[
+ <dom4j className="org.apache.commons.configuration.DOM4JConfiguration"
fileName="conf/test.xml"/>
+]]>
+ </source>
+ <p>
+ The configuration is very similar to the classic properties file. However,
the xml file must be in a specific
+ format. Currently there is no DTD.
+ </p>
+ <source>
+<![CDATA[
+<baseElement>
+ <element>value</element>
+ <element2>
+ <subelement>
+ <subsubelement>I'm complex!</subsubelement>
+ </subelement>
+ </element2>
+ <test>
+ <short>8</short>
+ </test>
+</baseElement>
+]]>
+ </source>
+ <p>
+ In the above example, the root element is ignored. So to get the value
"8", you would request from your
+ Configuration object the key "test.short". The root element can be called
anything.
+ </p>
+ </subsection>
+ <subsection name="JNDI Properties File">
+ <source>
+<![CDATA[
+ <jndi className="org.apache.commons.configuration.JNDIConfiguration"
prefix="java:comp/env"/>
+]]>
+ </source>
+ <p>
+ This configuration is very useful for setting environment specific settings
like mail servers! The
+ prefix tells the ConfigurationFactory what the root will be to look up your
configuration settings. To
+ enter a value under the key "test.short" you would add this to your web.xml.
+ </p>
+ <source>
+<![CDATA[
+ <env-entry>
+ <env-entry-name>test/short</env-entry-name>
+ <env-entry-value>80</env-entry-value>
+ <env-entry-type>java.lang.String</env-entry-type>
+ </env-entry>
+
+]]>
+ </source>
+ </subsection>
+ </section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]