[jbpm-commits] JBoss JBPM SVN: r4226 - in jbpm4/trunk/modules: distro and 21 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Mar 11 07:37:42 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-03-11 07:37:42 -0400 (Wed, 11 Mar 2009)
New Revision: 4226

Added:
   jbpm4/trunk/modules/integration/console/
   jbpm4/trunk/modules/integration/console/integration-console.iml
   jbpm4/trunk/modules/integration/console/pom.xml
   jbpm4/trunk/modules/integration/console/src/
   jbpm4/trunk/modules/integration/console/src/main/
   jbpm4/trunk/modules/integration/console/src/main/java/
   jbpm4/trunk/modules/integration/console/src/main/java/org/
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ManagementFactoryImpl.java
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ServiceLocator.java
   jbpm4/trunk/modules/integration/console/src/main/resources/
   jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/
   jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/
   jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.integration.ManagementFactory
Removed:
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/
   jbpm4/trunk/modules/enterprise/src/main/resources/META-INF/services/
Modified:
   jbpm4/trunk/modules/db/jbpm4-db.iml
   jbpm4/trunk/modules/distro/pom.xml
   jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml
   jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
   jbpm4/trunk/modules/enterprise/pom.xml
   jbpm4/trunk/modules/examples/jbpm4-examples.iml
   jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
   jbpm4/trunk/modules/integration/jboss5/integration-jboss5.iml
   jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
   jbpm4/trunk/modules/integration/pom.xml
   jbpm4/trunk/modules/integration/spi/integration-spi.iml
Log:
Move the console integration to modules/integration

Modified: jbpm4/trunk/modules/db/jbpm4-db.iml
===================================================================
--- jbpm4/trunk/modules/db/jbpm4-db.iml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/db/jbpm4-db.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -9,9 +9,9 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="toplevel" />
-    <orderEntry type="module" module-name="jpdl" />
-    <orderEntry type="module" module-name="pvm" />
+    <orderEntry type="module" module-name="toplevel" exported="" />
+    <orderEntry type="module" module-name="jpdl" exported="" />
+    <orderEntry type="module" module-name="pvm" exported="" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: javax.transaction:jta:jar:1.0.1B:compile">
         <CLASSES>
@@ -339,7 +339,7 @@
         </SOURCES>
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
+    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: hsqldb:hsqldb:jar:1.8.0.7:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar!/" />
@@ -348,7 +348,7 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
+    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: mysql:mysql-connector-java:jar:5.0.8:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/mysql/mysql-connector-java/5.0.8/mysql-connector-java-5.0.8.jar!/" />
@@ -357,7 +357,7 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
+    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: net.sourceforge.jtds:jtds:jar:1.2.2:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/net/sourceforge/jtds/jtds/1.2.2/jtds-1.2.2.jar!/" />
@@ -366,7 +366,7 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
+    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: postgresql:postgresql:jar:8.3-603.jdbc3:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/postgresql/postgresql/8.3-603.jdbc3/postgresql-8.3-603.jdbc3.jar!/" />

Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/distro/pom.xml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -119,6 +119,11 @@
 
     <!-- GWT Console -->
     <dependency>
+      <artifactId>jbpm-console-integration</artifactId>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.bpm</groupId>
       <artifactId>gwt-console</artifactId>
       <type>war</type>

Modified: jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -178,7 +178,7 @@
       <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true">        
         <include name="jbpm-pvm.jar" />
         <include name="jbpm-jpdl.jar" />
-        <include name="jbpm-task.jar" />
+        <include name="jbpm-console-integration.jar" />
       </fileset>
 
       <!-- jbpm/jbpm-enterprise.jar -->

Modified: jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
===================================================================
--- jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -13,10 +13,7 @@
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module" module-name="toplevel" exported="" />
     <orderEntry type="module" module-name="jpdl" exported="" />
-    <orderEntry type="module" module-name="gwt-parent" exported="" />
-    <orderEntry type="module" module-name="integration-spi" exported="" />
     <orderEntry type="module" module-name="pvm" exported="" />
-    <orderEntry type="module" module-name="gwt-server-integration" exported="" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: cargo:cargo:jar:0.5:test">
         <CLASSES>
@@ -489,15 +486,6 @@
         </SOURCES>
       </library>
     </orderEntry>
-    <orderEntry type="module-library" exported="">
-      <library name="M2 Dep: com.google.code.gson:gson:jar:1.2.2:provided">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/com/google/code/gson/gson/1.2.2/gson-1.2.2.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
     <orderEntryProperties />
   </component>
 </module>

Modified: jbpm4/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/pom.xml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/enterprise/pom.xml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -39,13 +39,8 @@
       <groupId>org.jbpm.jbpm4</groupId>
       <artifactId>jbpm-pvm</artifactId>
       <version>${version}</version>
-    </dependency>    
+    </dependency>        
     <dependency>
-      <groupId>org.jboss.bpm</groupId>
-      <artifactId>gwt-console-server-integration</artifactId>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
       <groupId>org.jbpm.jbpm4</groupId>
       <artifactId>jbpm-spi</artifactId>
       <version>${version}</version>

Modified: jbpm4/trunk/modules/examples/jbpm4-examples.iml
===================================================================
--- jbpm4/trunk/modules/examples/jbpm4-examples.iml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/examples/jbpm4-examples.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -9,9 +9,9 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="toplevel" exported="" />
-    <orderEntry type="module" module-name="jpdl" exported="" />
-    <orderEntry type="module" module-name="pvm" exported="" />
+    <orderEntry type="module" module-name="toplevel" />
+    <orderEntry type="module" module-name="jpdl" />
+    <orderEntry type="module" module-name="pvm" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: javax.transaction:jta:jar:1.0.1B:compile">
         <CLASSES>

Added: jbpm4/trunk/modules/integration/console/integration-console.iml
===================================================================
--- jbpm4/trunk/modules/integration/console/integration-console.iml	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/integration-console.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+  <component name="ModuleRootManager" />
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="gwt-parent" />
+    <orderEntry type="module" module-name="toplevel" />
+    <orderEntry type="module" module-name="gwt-server-integration" />
+    <orderEntry type="module-library">
+      <library name="M2 Dep: com.google.code.gson:gson:jar:1.2.2:provided">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/com/google/code/gson/gson/1.2.2/gson-1.2.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: hsqldb:hsqldb:jar:1.8.0.7:test">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: jboss:jboss-j2ee:jar:4.2.2.GA:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/jboss/jboss-j2ee/4.2.2.GA/jboss-j2ee-4.2.2.GA.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.xml.bind:jaxb-api:jar:2.1:provided">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.xml.stream:stax-api:jar:1.0-2:provided">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.activation:activation:jar:1.1:provided">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/activation/activation/1.1/activation-1.1-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntryProperties />
+  </component>
+</module>
+

Added: jbpm4/trunk/modules/integration/console/pom.xml
===================================================================
--- jbpm4/trunk/modules/integration/console/pom.xml	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/pom.xml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <name>jBPM 4 - Integration Console</name>
+  <description>JBoss jBPM - GWT console integration</description>
+
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>jbpm-console-integration</artifactId>
+  <packaging>jar</packaging>
+
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm-integration</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+  </parent>
+
+  <!-- Properties -->
+  <properties>
+    <javax.jaxb.version>2.1</javax.jaxb.version>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-api</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.bpm</groupId>
+      <artifactId>gwt-console-server-integration</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>${javax.jaxb.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+</project>

Added: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ManagementFactoryImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ManagementFactoryImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ManagementFactoryImpl.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.console;
+
+import org.jboss.bpm.console.server.util.InvocationProxy;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.TaskManagement;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.server.integration.UserManagement;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ManagementFactoryImpl extends ManagementFactory
+{
+  public ProcessManagement createProcessManagement()
+  {
+    return (ProcessManagement)
+        InvocationProxy.newInstance(new ProcessManagementImpl());
+  }
+
+  public TaskManagement createTaskManagement()
+  {
+    throw new RuntimeException("Not implemented");
+  }
+
+  public UserManagement createUserManagement()
+  {
+    throw new RuntimeException("Not implemented");
+  }
+}

Added: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.console;
+
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+import org.jbpm.model.OpenExecution;
+import org.jbpm.model.OpenProcessDefinition;
+import org.jbpm.model.Transition;
+
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ModelAdaptor
+{
+  public static ProcessDefinitionRef adoptDefinition(OpenProcessDefinition p0)
+  {
+    ProcessDefinitionRef def = new ProcessDefinitionRef();
+    def.setId( p0.getId() );
+    def.setName(p0.getName());
+    def.setVersion(p0.getVersion());
+
+    def.setKey( p0.getKey() );
+    def.setDescription(p0.getDescription());
+    def.setPackageName(p0.getPackageName());
+    
+    return def;
+
+  }
+
+  public static ProcessInstanceRef adoptExecution(OpenExecution e0)
+  {
+    ProcessInstanceRef ref = new ProcessInstanceRef();
+    ref.setId( e0.getId() );
+    ref.setKey(e0.getKey());
+    ref.setDefinitionId(e0.getProcessDefinition().getId() );    
+    ref.setStartDate( new Date() );                   // TODO: FIXME
+
+    OpenExecution topLevelExecution = e0.getProcessInstance();
+    TokenReference tok = execution2TokenReference(topLevelExecution);
+
+    Collection<OpenExecution> childExecutions = topLevelExecution.getExecutions();
+    if(childExecutions!=null)
+    {
+      for(OpenExecution childExecution : childExecutions)
+      {
+        TokenReference childTok = execution2TokenReference(childExecution);
+        tok.getChildren().add(childTok);
+      }
+    }
+
+    ref.setRootToken(tok);
+    
+    return ref;
+  }
+
+  private static TokenReference execution2TokenReference(OpenExecution topLevelExecution)
+  {
+    TokenReference tok = new TokenReference();
+    tok.setName(topLevelExecution.getName());
+    tok.setId(topLevelExecution.getId());
+    tok.setCurrentNodeName( topLevelExecution.getActivityName() );    
+
+    List<String> availableSignals = new ArrayList<String>();
+    for(Transition t : topLevelExecution.getActivity().getOutgoingTransitions())
+    {
+      availableSignals.add(t.getName());
+    }
+
+    tok.setAvailableSignals(availableSignals);
+    return tok;
+  }
+}

Added: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.console;
+
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jbpm.model.OpenProcessDefinition;
+import org.jbpm.model.OpenExecution;
+import org.jbpm.*;
+
+import javax.naming.InitialContext;
+import java.util.*;
+import java.io.InputStream;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+class ProcessManagementImpl implements ProcessManagement
+{
+  private ProcessEngine processEngine;
+
+  public ProcessManagementImpl()
+  {    
+      try
+      {
+        InitialContext ctx = new InitialContext();
+        this.processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
+      }
+      catch (Exception e)
+      {
+        throw new RuntimeException("Failed to lookup process engine");
+      }
+
+  }
+
+  public List<ProcessDefinitionRef> getProcessDefinitions()
+  {
+    List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+
+    ProcessService processService = this.processEngine.getProcessService();
+    List<String> keys = processService.findProcessDefinitionKeys();
+    Set<ProcessDefinition> definitions = new HashSet<ProcessDefinition>();
+    for(String key : keys)
+    {
+      definitions.addAll(
+          processService.findProcessDefinitionsByKey(key)
+      );            
+    }
+
+    // adopt ProcessDefinition to console model
+    for(ProcessDefinition p0 : definitions)
+    {
+      results.add( ModelAdaptor.adoptDefinition((OpenProcessDefinition)p0) );
+    }
+
+    return results;
+
+  }
+
+  public ProcessDefinitionRef getProcessDefinition(String procDefId)
+  {
+    ProcessService processService = this.processEngine.getProcessService();
+    ProcessDefinition p0 = processService.findProcessDefinitionById(procDefId);
+    return ModelAdaptor.adoptDefinition((OpenProcessDefinition)p0);
+  }
+
+  public List<ProcessDefinitionRef> removeProcessDefinition(String procDefId)
+  {
+    ProcessService processService = this.processEngine.getProcessService();
+    processService.deleteProcessDefinitionCascade(procDefId);
+    return getProcessDefinitions();
+  }
+
+  public List<ProcessInstanceRef> getProcessInstances(String procDefId)
+  {
+    ExecutionService execService = this.processEngine.getExecutionService();
+    ExecutionQuery query = execService.createExecutionQuery();
+    query.processDefinitionId(String.valueOf(procDefId));
+    
+    List<Execution> executions = query.execute();
+
+    List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+
+    return results;
+  }
+
+  private List<ProcessInstanceRef> adoptTopLevelExecutions(List<Execution> executions)
+  {
+    List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
+    for(Execution exec : executions)
+    {
+      if(exec.isEnded())
+      {
+        System.out.println("*** JBPM-2055: Execution ("+exec.getId()+") is already ended. Should not show up in query");
+        continue;
+      }
+
+      if(exec.isProcessInstance()) // parent execution
+      {
+        results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
+      }
+    }
+    return results;
+  }
+
+  public ProcessInstanceRef getProcessInstance(String instanceId)
+  {
+    ExecutionService execService = this.processEngine.getExecutionService();
+    ExecutionQuery query = execService.createProcessInstanceQuery();
+    query.processInstanceId(instanceId);
+    List<Execution> executions = query.execute();
+
+    if(executions.size()>1 || executions.isEmpty())
+      throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+
+    return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
+  }
+
+  public ProcessInstanceRef newInstance(String definitionId)
+  {
+    ExecutionService execService = this.processEngine.getExecutionService();
+    Execution exec = execService.startProcessInstanceById(definitionId);
+    return ModelAdaptor.adoptExecution((OpenExecution)exec);
+  }
+
+  public void setProcessState(String executionId, ProcessInstanceRef.STATE nextState)
+  {
+    if(ProcessInstanceRef.STATE.ENDED==nextState)
+    {
+      // TODO: It's actually a delte call. Once we got the 'cancel' notion this should be changed
+      ExecutionService execService = this.processEngine.getExecutionService();
+      Execution exec = execService.findExecution(executionId);
+      if(null==exec)
+        throw new IllegalArgumentException("No such execution with id "+ executionId);
+      
+      execService.deleteProcessInstance(executionId);
+    }
+    else
+    {
+      throw new IllegalArgumentException("State " + nextState + " currently not supported");
+    }
+  }
+
+  public void signalExecution(String executionId, String signal)
+  {        
+    ExecutionService execService = this.processEngine.getExecutionService();
+
+    if(null==signal)
+      execService.signalExecutionById(executionId);
+    else
+      execService.signalExecutionById(executionId, signal);
+            
+  }
+
+  public void deploy(String fileName, String contentType, InputStream deployment)
+  {
+    List<ProcessDefinition> definitions =
+        this.processEngine.getProcessService()
+        .createDeployment()
+        .addInputStream(fileName, deployment)
+        .deploy()
+        .getProcessDefinitions();
+    
+  }
+}
+

Added: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ServiceLocator.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ServiceLocator.java	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ServiceLocator.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.console;
+
+import javax.ejb.EJBLocalHome;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+class ServiceLocator
+{
+  public static EJBLocalHome getEjbLocalHome(String localHomeJndiName)
+  {
+    EJBLocalHome localHome = null;
+    try
+    {
+      Context ctx = createContext();
+      localHome = (EJBLocalHome) ctx.lookup(localHomeJndiName);
+    }
+    catch (Exception cce)
+    {
+      throw new RuntimeException("Failed load access EJB: " +localHomeJndiName, cce);
+    }
+
+    return localHome;
+  }
+
+  public static UserTransaction getUserTransaction()
+  {
+    UserTransaction tx = null;
+
+    try
+    {
+      Context ctx = createContext();
+      tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
+    }
+    catch (Exception e)
+    {
+      throw new RuntimeException("Failed to create UserTransaction");
+    }
+
+    return tx;
+  }
+
+  private static Context createContext()
+      throws NamingException
+  {
+    InitialContext ctx = new InitialContext();
+    return ctx;
+  }
+}
\ No newline at end of file

Added: jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.integration.ManagementFactory
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.integration.ManagementFactory	                        (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.integration.ManagementFactory	2009-03-11 11:37:42 UTC (rev 4226)
@@ -0,0 +1 @@
+org.jbpm.integration.console.ManagementFactoryImpl
\ No newline at end of file

Modified: jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
===================================================================
--- jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -125,9 +125,9 @@
           subDeploymentRefs = adaptor.deploy(md);
           allProcessRefs.addAll(subDeploymentRefs);
         }
-        catch (Throwable e)
+        catch (Throwable t)
         {
-          log.error("Failed to deploy " + rootDeployment.url, e);
+          log.error("Failed to deploy " + rootDeployment.url, t);
         }                
       }
 

Modified: jbpm4/trunk/modules/integration/jboss5/integration-jboss5.iml
===================================================================
--- jbpm4/trunk/modules/integration/jboss5/integration-jboss5.iml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/integration/jboss5/integration-jboss5.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -9,10 +9,9 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="toplevel" exported="" />
-    <orderEntry type="module" module-name="jpdl" exported="" />
-    <orderEntry type="module" module-name="integration-spi" exported="" />
-    <orderEntry type="module" module-name="pvm" exported="" />
+    <orderEntry type="module" module-name="toplevel" />
+    <orderEntry type="module" module-name="jpdl" />
+    <orderEntry type="module" module-name="pvm" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: org.jboss.identity:idm-spi:jar:1.0.0-SNAPSHOT:compile">
         <CLASSES>
@@ -1064,17 +1063,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library" exported="">
-      <library name="M2 Dep: javax.transaction:jta:jar:1.1:compile">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.1/jta-1.1-sources.jar!/" />
-        </SOURCES>
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: javassist:javassist:jar:3.9.0.GA:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar!/" />
@@ -1103,6 +1091,15 @@
         <SOURCES />
       </library>
     </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.transaction:jta:jar:1.0.1B:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntryProperties />
   </component>
 </module>

Modified: jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
===================================================================
--- jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java	2009-03-11 11:37:42 UTC (rev 4226)
@@ -61,11 +61,17 @@
     // associate classloader
     deployment.setClassloader(unit.getClassLoader());
 
-    List<ProcessDeploymentRef> processRefs = adaptor.deploy(deployment);
+    try
+    {
+      List<ProcessDeploymentRef> processRefs = adaptor.deploy(deployment);
+      // TODO: mark the process 'ready', classloader assoc
+      unit.addAttachment("jbpm.deployer.reference", processRefs);
+    }
+    catch (Throwable t)
+    {
+       log.error("Failed to deploy " + deployment, t);
+    }
 
-     // TODO: mark the process 'ready', classloader assoc
-    unit.addAttachment("jbpm.deployer.reference", processRefs);
-
   }
 
   public void undeploy(DeploymentUnit unit, JBPMDeploymentMetaData deployment)

Modified: jbpm4/trunk/modules/integration/pom.xml
===================================================================
--- jbpm4/trunk/modules/integration/pom.xml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/integration/pom.xml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -120,6 +120,7 @@
     <module>spi</module>
     <module>jboss5</module>
     <module>jboss4</module>
+    <module>console</module>
   </modules>
 
 </project>

Modified: jbpm4/trunk/modules/integration/spi/integration-spi.iml
===================================================================
--- jbpm4/trunk/modules/integration/spi/integration-spi.iml	2009-03-11 10:11:59 UTC (rev 4225)
+++ jbpm4/trunk/modules/integration/spi/integration-spi.iml	2009-03-11 11:37:42 UTC (rev 4226)
@@ -9,9 +9,9 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="toplevel" exported="" />
-    <orderEntry type="module" module-name="jpdl" exported="" />
-    <orderEntry type="module" module-name="pvm" exported="" />
+    <orderEntry type="module" module-name="toplevel" />
+    <orderEntry type="module" module-name="jpdl" />
+    <orderEntry type="module" module-name="pvm" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: hsqldb:hsqldb:jar:1.8.0.7:test">
         <CLASSES>
@@ -309,17 +309,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library" exported="">
-      <library name="M2 Dep: javax.transaction:jta:jar:1.1:compile">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.1/jta-1.1-sources.jar!/" />
-        </SOURCES>
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library" exported="">
       <library name="M2 Dep: oswego-concurrent:concurrent:jar:1.3.4-jboss-update1:provided">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/oswego-concurrent/concurrent/1.3.4-jboss-update1/concurrent-1.3.4-jboss-update1.jar!/" />
@@ -1100,6 +1089,15 @@
         <SOURCES />
       </library>
     </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.transaction:jta:jar:1.0.1B:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntryProperties />
   </component>
 </module>




More information about the jbpm-commits mailing list