[seam-commits] Seam SVN: r8237 - in trunk: src/main/META-INF and 1 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue May 20 14:13:37 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-05-20 14:13:37 -0400 (Tue, 20 May 2008)
New Revision: 8237
Added:
trunk/src/main/org/jboss/seam/bpm/PageflowDeploymentHandler.java
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml
trunk/src/main/META-INF/seam-deployment.properties
trunk/src/main/org/jboss/seam/bpm/Jbpm.java
Log:
JBSEAM-979
Modified: trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml 2008-05-20 16:16:05 UTC (rev 8236)
+++ trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml 2008-05-20 18:13:37 UTC (rev 8237)
@@ -40,7 +40,7 @@
</itemizedlist>
<para>
- Don't get these two things confused ! They operate at very different levels
+ Don't get these two things confused! They operate at very different levels
or granularity. <emphasis>Pageflow</emphasis>, <emphasis>conversation</emphasis>
and <emphasis>task</emphasis> all refer to a single
interaction with a single user. A business process spans many tasks.
@@ -358,11 +358,19 @@
<section>
<title>Installing pageflows</title>
+
+ <para>
+ We need to install the Seam jBPM-related components, and place the
+ pageflow definitions (using the standard <literal>.jpdl.xml</literal>
+ extension) inside a Seam archive (an archive which
+ contains a <literal>seam.properties</literal> file):
+ </para>
+ <programlisting role="XML"><![CDATA[<bpm:jbpm />]]></programlisting>
+
<para>
- We need to install the Seam jBPM-related components, and tell them
- where to find our pageflow definition. We can specify this
- Seam configuration in <literal>components.xml</literal>.
+ We can also explicitly tell Seam where to find our pageflow
+ definition. We specify this in <literal>components.xml</literal>:
</para>
<programlisting role="XML"><![CDATA[<bpm:jbpm>
@@ -370,11 +378,6 @@
<value>pageflow.jpdl.xml</value>
</bpm:pageflow-definitions>
</bpm:jbpm>]]></programlisting>
-
- <para>
- The first line installs jBPM, the second points to a jPDL-based
- pageflow definition.
- </para>
</section>
Modified: trunk/src/main/META-INF/seam-deployment.properties
===================================================================
--- trunk/src/main/META-INF/seam-deployment.properties 2008-05-20 16:16:05 UTC (rev 8236)
+++ trunk/src/main/META-INF/seam-deployment.properties 2008-05-20 18:13:37 UTC (rev 8237)
@@ -0,0 +1 @@
+org.jboss.seam.deployment.deploymentHandlers=org.jboss.seam.bpm.PageflowDeploymentHandler
\ No newline at end of file
Modified: trunk/src/main/org/jboss/seam/bpm/Jbpm.java
===================================================================
--- trunk/src/main/org/jboss/seam/bpm/Jbpm.java 2008-05-20 16:16:05 UTC (rev 8236)
+++ trunk/src/main/org/jboss/seam/bpm/Jbpm.java 2008-05-20 18:13:37 UTC (rev 8237)
@@ -4,10 +4,12 @@
import java.io.InputStream;
import java.io.StringReader;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import javax.naming.NamingException;
@@ -27,6 +29,8 @@
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Init;
import org.jboss.seam.core.ResourceLoader;
+import org.jboss.seam.deployment.DeploymentStrategy;
+import org.jboss.seam.deployment.StandardDeploymentStrategy;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.util.Naming;
@@ -145,7 +149,7 @@
return pageflowProcessDefinitions.containsKey(pageflowName);
}
- public ProcessDefinition getPageflowDefinitionFromResource(String resourceName)
+ public static ProcessDefinition getPageflowDefinitionFromResource(String resourceName)
{
InputStream resource = ResourceLoader.instance().getResourceAsStream(resourceName);
if (resource==null)
@@ -228,14 +232,16 @@
}
private void installPageflowDefinitions() {
+ Set<String> mergedPageflowDefinitions = ((PageflowDeploymentHandler) ((DeploymentStrategy) Contexts.getEventContext().get(StandardDeploymentStrategy.NAME)).getDeploymentHandlers().get(PageflowDeploymentHandler.NAME)).getPageflowDefinitions();
if ( pageflowDefinitions!=null )
{
- for (String pageflow: pageflowDefinitions)
- {
- ProcessDefinition pd = getPageflowDefinitionFromResource(pageflow);
- pageflowProcessDefinitions.put( pd.getName(), pd );
- }
+ mergedPageflowDefinitions.addAll(Arrays.asList(pageflowDefinitions));
}
+ for (String pageflow: mergedPageflowDefinitions)
+ {
+ ProcessDefinition pd = getPageflowDefinitionFromResource(pageflow);
+ pageflowProcessDefinitions.put( pd.getName(), pd );
+ }
}
private void installProcessDefinitions()
Added: trunk/src/main/org/jboss/seam/bpm/PageflowDeploymentHandler.java
===================================================================
--- trunk/src/main/org/jboss/seam/bpm/PageflowDeploymentHandler.java (rev 0)
+++ trunk/src/main/org/jboss/seam/bpm/PageflowDeploymentHandler.java 2008-05-20 18:13:37 UTC (rev 8237)
@@ -0,0 +1,61 @@
+package org.jboss.seam.bpm;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.jboss.seam.deployment.AbstractDeploymentHandler;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.util.Resources;
+import org.jboss.seam.util.XML;
+
+
+public class PageflowDeploymentHandler extends AbstractDeploymentHandler
+{
+
+ private static LogProvider log = Logging.getLogProvider(PageflowDeploymentHandler.class);
+
+ public static final String NAME = "org.jboss.seam.bpm.PageflowDeploymentHandler";
+
+ private Set<String> pageflowDefinitions;
+
+ public PageflowDeploymentHandler()
+ {
+ pageflowDefinitions = new HashSet<String>();
+ }
+
+ public String getName()
+ {
+ return NAME;
+ }
+
+ public void handle(String name, ClassLoader classLoader)
+ {
+ if (name.endsWith(".jpdl.xml"))
+ {
+ InputStream inputStream = Resources.getResourceAsStream(name, null);
+ try
+ {
+ Element root = XML.getRootElementSafely(inputStream);
+ if ("pageflow-definition".equals(root.getName()))
+ {
+ pageflowDefinitions.add(name);
+ }
+ }
+ catch (DocumentException e)
+ {
+ log.debug("Unable to parse " + name, e);
+ }
+ }
+ }
+
+ public Set<String> getPageflowDefinitions()
+ {
+ return Collections.unmodifiableSet(pageflowDefinitions);
+ }
+
+}
Property changes on: trunk/src/main/org/jboss/seam/bpm/PageflowDeploymentHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the seam-commits
mailing list