Author: norman.richards(a)jboss.com
Date: 2009-05-05 03:18:12 -0400 (Tue, 05 May 2009)
New Revision: 10781
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Configuration.xml
Log:
JBSEAM-3824
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Configuration.xml
===================================================================
---
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Configuration.xml 2009-05-05
06:47:47 UTC (rev 10780)
+++
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Configuration.xml 2009-05-05
07:18:12 UTC (rev 10781)
@@ -1230,13 +1230,17 @@
@Create
public void create() {
- for (Class clazz : fooClasses) {
+ for (Class clazz: fooClasses) {
handleClass(clazz);
}
- for (Class clazz : hotFooClasses) {
+ for (Class clazz: hotFooClasses) {
handleClass(clazz);
}
}
+
+ public void handleClass(Class clazz) {
+ // ...
+ }
}]]></programlisting>
@@ -1247,22 +1251,21 @@
</para>
<programlisting><![CDATA[public class FooDeploymentHandler implements
DeploymentHandler {
-
- private Set<InputStream> files = new HashSet<InputStream>();
-
+ private static DeploymentMetadata FOO_METADATA = new DeploymentMetadata()
+ {
+
+ public String getFileNameSuffix() {
+ return ".foo.xml";
+ }
+ };
+
public String getName() {
return "fooDeploymentHandler";
}
-
- public Set<InputStream> getFiles() {
- return files;
- }
-
- public void handle(String name, ClassLoader classLoader) {
- if (name.endsWith(".foo.xml")) {
- files.add(classLoader.getResourceAsStream(name));
- }
- }
+
+ public DeploymentMetadata getMetadata() {
+ return FOO_METADATA;
+ }
}]]></programlisting>
<para>
@@ -1271,8 +1274,10 @@
</para>
<para>
- Then, we need to register the deployment handler with Seam. In
- <literal>/META-INF/seam-deployment.properties</literal>:
+ Then, we need to register the deployment handler with Seam in
+ <literal>/META-INF/seam-deployment.properties</literal>.
+ You can register multiple deployment handler using a comma
+ separated list.
</para>
<programlisting><![CDATA[# For standard deployment
@@ -1281,15 +1286,12 @@
org.jboss.seam.deployment.hotDeploymentHandlers=com.acme.FooDeploymentHandler]]></programlisting>
<para>
- You can register multiple deployment handler using a comma
- separated list.
+
</para>
<para>
Seam uses deployment handlers internally to install components and
- namespaces, therefore the <literal>handle()</literal> is called
too
- early in inside Seam bootstrap to normally be useful. However, you
- can easily access the deployment handler during an
+ namespaces. You can easily access the deployment handler during an
<literal>APPLICATION</literal> scoped component's startup:
</para>
@@ -1298,22 +1300,26 @@
@Startup
public class FooStartup {
- @In("#{deploymentStrategy['fooDeploymentHandler']}")
- private MyDeploymentHandler myDeploymentHandler;
+
@In("#{deploymentStrategy.deploymentHandlers['fooDeploymentHandler']}")
+ private FooDeploymentHandler myDeploymentHandler;
- @In("#{hotDeploymentStrategy['fooDeploymentHandler']}")
- private MyDeploymentHandler myHotDeploymentHandler;
+
@In("#{hotDeploymentStrategy.deploymentHandlers['fooDeploymentHandler']}")
+ private FooDeploymentHandler myHotDeploymentHandler;
@Create
public void create() {
- for (InputStream is : myDeploymentHandler.getFiles()) {
- handleFooXml(is);
+ for (FileDescriptor fd: myDeploymentHandler.getResources()) {
+ handleFooXml(fd);
}
- for (InputStream is : myHotDeploymentHandler.getFiles()) {
- handleFooXml(is);
+
+ for (FileDescriptor f: myHotDeploymentHandler.getResources()) {
+ handleFooXml(fd);
}
}
+ public void handleFooXml(FileDescriptor fd) {
+ // ...
+ }
}]]></programlisting>
</sect1>