You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2021/09/08 13:19:05 UTC
[turbine-fulcrum-factory] 03/49: (Hopefully) improve documentation
This is an automated email from the ASF dual-hosted git repository.
gk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/turbine-fulcrum-factory.git
commit 34a461d99660c7045b95f4ae7dcfda6a1e6594a9
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Tue Aug 5 16:32:32 2008 +0000
(Hopefully) improve documentation
git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/factory@682777 13f79535-47bb-0310-9956-ffa450edef68
---
xdocs/index.xml | 115 ++++++++++++++++++++++++++++++++++----------------------
xdocs/tasks.xml | 2 +-
2 files changed, 72 insertions(+), 45 deletions(-)
diff --git a/xdocs/index.xml b/xdocs/index.xml
index 74e7d09..b17ff14 100644
--- a/xdocs/index.xml
+++ b/xdocs/index.xml
@@ -22,7 +22,8 @@
<properties>
<title>Factory Component</title>
- <author email="epugh@upstate.com">Eric PUgh</author>
+ <author email="epugh@upstate.com">Eric Pugh</author>
+ <author email="tv@apache.org">Thomas Vandahl</author>
</properties>
<body>
@@ -47,42 +48,72 @@ The service provides the following benefits compared to Class.forName():
</section>
<section name="Configuration">
-
- <p>
- First, here is the role configuration.
- </p>
-
-<source>
-<![CDATA[
- <role
+ <subsection name="Role Configuration">
+ <source><![CDATA[
+ <role
name="org.apache.fulcrum.factory.FactoryService"
shorthand="factory"
default-class="org.apache.fulcrum.factory.DefaultFactoryService"/>
-]]>
-</source>
-
- <p>
- There is configuration values for classloaders, still need to add.
- </p>
-<source>
-
-<![CDATA[
- <factory/>
-]]>
-</source>
-
+ ]]></source>
+ </subsection>
+
+ <subsection name="Component Configuration">
+ <table>
+ <tr>
+ <th>Item</th>
+ <th>Datatype</th>
+ <th>Cardinality</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>classloader</td>
+ <td>String</td>
+ <td>[0..n]</td>
+ <td>
+ A class loader. Class loaders will be tried in sequence when
+ trying to create an object instance.
+ </td>
+ </tr>
+ <tr>
+ <td>object-factory</td>
+ <td>Complex</td>
+ <td>[0|1]</td>
+ <td>
+ The parent element for object factories. Sub-elements define
+ factories for certain class names. You can define one
+ <code>default</code> factory that will be used if no others
+ match. See the configuration example below.
+ </td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection name="Component Configuration Example">
+ <source><![CDATA[
+ <factory>
+ <classloader>java.net.URLClassLoader</classloader>
+ <object-factory>
+ <javax.xml.parsers.DocumentBuilder>
+ org.foo.xml.DomBuilderFactory
+ </javax.xml.parsers.DocumentBuilder>
+ <default>
+ org.some.default.Factory
+ </default>
+ </object-factory>
+ </factory>
+ ]]></source>
+ </subsection>
</section>
<section name="Usage">
+ <p>
+ In Turbine, the Factory Service is currently only used internally by the Pool Service.
+ Applications can also use the service instead of Class.forName() and for unifying
+ initialization, configuration and access to vendor specific object factories.
+ The following is a simplified example of a customized DOM parser factory:
+ </p>
-<p>
-In Turbine, the Factory Service is currently only used internally by the Pool Service.
-Applications can also use the service instead of Class.forName() and for unifying
-initialization, configuration and access to vendor specific object factories.
-The following is a simplified example of a customized DOM parser factory:
-</p>
-
-<source><![CDATA[
+ <source><![CDATA[
package org.foo.xml;
import javax.xml.parsers.DocumentBuilder;
@@ -170,22 +201,19 @@ public class DomBuilderFactory implements Factory
}
]]></source>
-<p>
-The customized DOM parser factory must be specified in Turbine Resources before it can be used:
-</p>
-
-<source><![CDATA[
-services.FactoryService.factory.javax.xml.parsers.DocumentBuilder=org.foo.xml.DomBuilderFactory
-]]></source>
+ <p>
+ The customized DOM parser factory must be specified in the component
+ configuration like in the configuration example above before it can
+ be used.
+ </p>
-<p>
-A DOM parser can now be instantiated with the following code fragment:
-</p>
+ <p>
+ A DOM parser can now be instantiated with the following code fragment:
+ </p>
-<source><![CDATA[
+ <source><![CDATA[
// Access the service singleton.
-FactoryService service = (FactoryService)
- TurbineServices.getInstance().getService(FactoryService.SERVICE_NAME);
+FactoryService service = (FactoryService)container.lookup(FactoryService.ROLE);
// Create a new DOM parser.
DocumentBuilder parser =
@@ -193,6 +221,5 @@ DocumentBuilder parser =
]]></source>
</section>
-
</body>
</document>
diff --git a/xdocs/tasks.xml b/xdocs/tasks.xml
index a8572e6..28a83f2 100644
--- a/xdocs/tasks.xml
+++ b/xdocs/tasks.xml
@@ -34,7 +34,7 @@
<p>
<ul>
<li>
- Need to test using the configuratio values. Currently it just uses the default Classloader.
+ Need to test using the configuration values. Currently it just uses the default Classloader.
</li>
<li>
Document using different classloaders.