[jbpm-commits] JBoss JBPM SVN: r3056 - in jbpm3/trunk/modules/integration: jboss42/src/main/java/org/jbpm/integration/jboss42 and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 24 09:37:38 EST 2008


Author: thomas.diesler at jboss.com
Date: 2008-11-24 09:37:38 -0500 (Mon, 24 Nov 2008)
New Revision: 3056

Modified:
   jbpm3/trunk/modules/integration/api/pom.xml
   jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java
Log:
Clean old CTS location

Modified: jbpm3/trunk/modules/integration/api/pom.xml
===================================================================
--- jbpm3/trunk/modules/integration/api/pom.xml	2008-11-24 14:27:07 UTC (rev 3055)
+++ jbpm3/trunk/modules/integration/api/pom.xml	2008-11-24 14:37:38 UTC (rev 3056)
@@ -108,6 +108,12 @@
           <filesets>
             <fileset>
               <directory>src/cts</directory>
+              <directory>src/test</directory>
+              <includes>
+                <include>java/org/jbpm/test/cts/**</include>
+                <include>java/org/jbpm/test/incubator/**</include>
+                <include>java/org/jbpm/test/pattern/**</include>
+              </includes>            
             </fileset>
           </filesets>
         </configuration>

Modified: jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java	2008-11-24 14:27:07 UTC (rev 3055)
+++ jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java	2008-11-24 14:37:38 UTC (rev 3056)
@@ -23,21 +23,17 @@
 
 //$Id$
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.net.URL;
 
+import javax.management.ObjectName;
+
 import org.jboss.deployment.DeploymentException;
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.deployment.SubDeployerSupport;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.command.DeleteProcessDefinitionCommand;
-import org.jbpm.command.DeployProcessCommand;
-import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.service.ProcessDefinitionService;
 
 /**
  * A deployer service that manages jBPM Process Archive Deployments
@@ -50,7 +46,7 @@
   /** The suffixes we accept, along with their relative order */
   private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] { "900:-process.xml" };
 
-  private JbpmConfiguration jbpmConfiguration;
+  private ProcessDefinitionService procDefService;
 
   public PARSubDeployer()
   {
@@ -62,8 +58,9 @@
   {
     super.startService();
 
-    // Deployer works with the default configuration
-    jbpmConfiguration = JbpmConfiguration.getInstance();
+    // Get get ProcessDefinitionService
+    ProcessEngine engine = Configuration.getProcessEngine();
+    procDefService = engine.getService(ProcessDefinitionService.class);
   }
 
   @Override
@@ -75,18 +72,14 @@
     URL pdURL = getProcessDefinitionURL(di);
     log.info("Deploy ProcessDefinition: " + pdURL);
 
-    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
     try
     {
-      // Get the process definition from the URL
-      String pdXML = getProcessDefinition(pdURL);
-      
-      // Deploy through the DeployProcessCommand
-      DeployProcessCommand command = new DeployProcessCommand(pdXML);
-      ProcessDefinition procDef = (ProcessDefinition)command.execute(jbpmContext);
+      // Parese and register the procdef
+      ProcessDefinition procDef = procDefService.parseProcessDefinition(pdURL);
+      procDefService.registerProcessDefinition(procDef);
 
-      // Remember the procDef ID
-      di.context.put(ProcessDefinition.class.getName(), new Long(procDef.getId()));
+      // Remember the procDefID
+      di.context.put(ProcessDefinition.class.getName(), procDef.getKey());
     }
     catch (RuntimeException rte)
     {
@@ -96,10 +89,6 @@
     {
       throw new DeploymentException("Cannot deploy: " + pdURL, ex);
     }
-    finally
-    {
-      jbpmContext.close();
-    }
   }
 
   @Override
@@ -107,16 +96,13 @@
   {
     URL pdURL = getProcessDefinitionURL(di);
     log.info("Undeploy ProcessDefinition: " + pdURL);
-    
-    Long procID = (Long)di.context.get(ProcessDefinition.class.getName());
-    if (procID != null)
+
+    ObjectName procDefID = (ObjectName)di.context.get(ProcessDefinition.class.getName());
+    if (procDefID != null)
     {
-      JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       try
       {
-        // Undeploy through the DeleteProcessDefinitionCommand
-        DeleteProcessDefinitionCommand command = new DeleteProcessDefinitionCommand(procID);
-        command.execute(jbpmContext);
+        procDefService.unregisterProcessDefinition(procDefID);
       }
       catch (RuntimeException rte)
       {
@@ -126,10 +112,6 @@
       {
         throw new DeploymentException("Cannot deploy: " + pdURL, ex);
       }
-      finally
-      {
-        jbpmContext.close();
-      }
     }
     super.destroy(di);
   }
@@ -139,22 +121,7 @@
     URL pdURL = di.localUrl != null ? di.localUrl : di.url;
     if (pdURL == null)
       throw new IllegalStateException("Cannot obtain process definition URL");
-    
+
     return pdURL;
   }
-
-  private String getProcessDefinition(URL pdURL) throws IOException
-  {
-    BufferedReader br = new BufferedReader(new InputStreamReader(pdURL.openStream()));
-    StringWriter strwr = new StringWriter();
-    PrintWriter pwr = new PrintWriter(strwr);
-    String line = br.readLine();
-    while (line != null)
-    {
-      pwr.println(line);
-      line = br.readLine();
-    }
-    String pdXML = strwr.toString();
-    return pdXML;
-  }
 }
\ No newline at end of file




More information about the jbpm-commits mailing list