[jbpm-commits] JBoss JBPM SVN: r2653 - in projects/spec/trunk: modules/api/src/main/java/org/jbpm/api/service and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Oct 29 07:00:07 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-10-29 07:00:07 -0400 (Wed, 29 Oct 2008)
New Revision: 2653

Added:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestCase.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestHelper.java
   projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/DialectHandlerServiceImpl.java
Removed:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestHelper.java
   projects/spec/trunk/modules/dialects/api10/src/test/
   projects/spec/trunk/modules/dialects/stp/src/test/
Modified:
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessDefinitionService.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/ConfigurationTestSetup.java
   projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/IntegrationTestHelper.java
   projects/spec/trunk/modules/cts/pom.xml
   projects/spec/trunk/modules/dialects/stp/.classpath
   projects/spec/trunk/modules/ri/pom.xml
   projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml
   projects/spec/trunk/pom.xml
Log:
Add support for DialectService

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/DialectHandlerService.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -33,7 +33,7 @@
  * @author thomas.diesler at jboss.com
  * @since 18-Jul-2008
  */
-public abstract class DialectHandlerService
+public abstract class DialectHandlerService extends AbstractService
 {
   // Maps namespaceURI to a DialectHandler
   protected Map<URI, DialectHandler> dialectHandlers;
@@ -49,5 +49,4 @@
 
     return dialectHandler;
   }
-
 }

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessDefinitionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessDefinitionService.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessDefinitionService.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -23,18 +23,27 @@
 
 //$Id$
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
 import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.jbpm.api.client.Deployment;
 import org.jbpm.api.client.ProcessEngine;
 import org.jbpm.api.model.ProcessDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 /**
  * The ProcessDefinitionService is the entry point to create, find and otherwise manage process definitions.
@@ -65,6 +74,36 @@
   }
 
   /**
+   * Create a ProcessDefinition from a XML string in one of the supported formats
+   */
+  public final ProcessDefinition createProcessDefinition(String pXML)
+  {
+    URI nsURI = getNamespaceURI(new ByteArrayInputStream(pXML.getBytes()));
+    DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
+    DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+    if (dialectHandler == null)
+      throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+    
+    ProcessDefinition procDef = dialectHandler.createProcessDefinition(pXML);
+    return procDef;
+  }
+
+  /**
+   * Create a ProcessDefinition from an URL to a XML descritor in one of the supported formats
+   */
+  public final ProcessDefinition createProcessDefinition(URL pURL) throws IOException
+  {
+    URI nsURI = getNamespaceURI(pURL.openStream());
+    DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
+    DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+    if (dialectHandler == null)
+      throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+    
+    ProcessDefinition procDef = dialectHandler.createProcessDefinition(pURL);
+    return procDef;
+  }
+  
+  /**
    * Deploy a new ProcessDefinition to the ProcessDefinition service.
    */
   public ObjectName deploy(Deployment dep)
@@ -140,4 +179,27 @@
   {
     return Collections.unmodifiableSet(procDefs.keySet());
   }
+
+  private URI getNamespaceURI(InputStream procXML)
+  {
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setNamespaceAware(true);
+    Document doc;
+    try
+    {
+      DocumentBuilder db = dbf.newDocumentBuilder();
+      doc = db.parse(procXML);
+    }
+    catch (Exception ex)
+    {
+      throw new IllegalStateException("Cannot parse process descriptor", ex);
+    }
+
+    Element root = doc.getDocumentElement();
+    String nsURI = root.getNamespaceURI();
+    if (nsURI == null)
+      throw new IllegalStateException("Cannot get namespace URI from root element");
+
+    return URI.create(nsURI);
+  }
 }
\ No newline at end of file

Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestCase.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestCase.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestCase.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.api.test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.jbpm.api.Constants;
+import org.jbpm.api.model.builder.ObjectNameFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An API test case
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class APITestCase extends TestCase
+{
+  // Provide logging
+  final Logger log = LoggerFactory.getLogger(APITestCase.class);
+
+  private APITestHelper delegate = new APITestHelper();
+  
+  @Override
+  protected void setUp() throws Exception
+  {
+    log.debug("### START " + getLongName());
+    super.setUp();
+  }
+  
+  @Override
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+    log.debug("### END " + getLongName());
+  }
+
+  protected URL getResourceURL(String resource) throws MalformedURLException
+  {
+    return delegate.getResourceURL(resource);
+  }
+
+  protected File getResourceFile(String resource)
+  {
+    return delegate.getResourceFile(resource);
+  }
+
+  protected String getShortName()
+  {
+    String shortName = getClass().getName();
+    shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
+    return shortName;
+  }
+  
+  protected String getLongName()
+  {
+    return getClass().getName() + "." + getName();
+  }
+
+  public ObjectName getTestID()
+  {
+    String shortName = getShortName();
+    shortName = shortName.replace("DescriptorTest", "Test"); 
+    shortName = shortName.replace("MarshallerTest", "Test"); 
+    return ObjectNameFactory.create(Constants.ID_DOMAIN, "test", shortName);
+  }
+}


Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestHelper.java (from rev 2649, projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestHelper.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestHelper.java	                        (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/APITestHelper.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.api.test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * An CTS test helper
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class APITestHelper
+{
+  private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+
+  private static String testResourcesDir;
+
+  /** Try to discover the URL for the test resource */
+  public URL getResourceURL(String resource) throws MalformedURLException
+  {
+    return getResourceFile(resource).toURI().toURL();
+  }
+
+  /** Try to discover the File for the test resource */
+  public File getResourceFile(String resource)
+  {
+    File file = new File(resource);
+    if (file.exists())
+      return file;
+
+    file = new File(getTestResourcesDir() + "/" + resource);
+    if (file.exists())
+      return file;
+
+    throw new IllegalArgumentException("Cannot obtain '" + getTestResourcesDir() + "/" + resource + "'");
+  }
+
+  public String getTestResourcesDir()
+  {
+    if (testResourcesDir == null)
+      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
+
+    return testResourcesDir;
+  }
+}

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestCase.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -21,9 +21,6 @@
  */
 package org.jbpm.api.test;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -31,9 +28,6 @@
 
 import javax.management.ObjectName;
 
-import junit.framework.TestCase;
-
-import org.jbpm.api.Constants;
 import org.jbpm.api.client.MessageListener;
 import org.jbpm.api.client.ProcessEngine;
 import org.jbpm.api.client.SignalListener;
@@ -41,7 +35,6 @@
 import org.jbpm.api.model.ProcessDefinition;
 import org.jbpm.api.model.Signal;
 import org.jbpm.api.model.Signal.SignalType;
-import org.jbpm.api.model.builder.ObjectNameFactory;
 import org.jbpm.api.model.builder.SignalBuilder;
 import org.jbpm.api.service.MessageService;
 import org.jbpm.api.service.ProcessDefinitionService;
@@ -56,12 +49,11 @@
  * @author Thomas.Diesler at jboss.org
  * @since 25-Sep-2008
  */
-public class CTSTestCase extends TestCase
+public class CTSTestCase extends APITestCase
 {
   // Provide logging
   final Logger log = LoggerFactory.getLogger(CTSTestCase.class);
 
-  private CTSTestHelper delegate = new CTSTestHelper();
   // The embedded SignalListener
   private SignalListener signalListener;
   // The signals caught by this test case
@@ -87,7 +79,6 @@
   @Override
   protected void setUp() throws Exception
   {
-    log.debug("### START " + getLongName());
     super.setUp();
     
     ProcessEngine engine = getProcessEngine();
@@ -156,39 +147,8 @@
     }
 
     super.tearDown();
-    log.debug("### END " + getLongName());
   }
 
-  protected URL getResourceURL(String resource) throws MalformedURLException
-  {
-    return delegate.getResourceURL(resource);
-  }
-
-  protected File getResourceFile(String resource)
-  {
-    return delegate.getResourceFile(resource);
-  }
-
-  protected String getShortName()
-  {
-    String shortName = getClass().getName();
-    shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
-    return shortName;
-  }
-  
-  protected String getLongName()
-  {
-    return getClass().getName() + "." + getName();
-  }
-
-  public ObjectName getTestID()
-  {
-    String shortName = getShortName();
-    shortName = shortName.replace("DescriptorTest", "Test"); 
-    shortName = shortName.replace("MarshallerTest", "Test"); 
-    return ObjectNameFactory.create(Constants.ID_DOMAIN, "test", shortName);
-  }
-  
   public List<Signal> getSignals()
   {
     synchronized (signals)

Deleted: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestHelper.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestHelper.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/CTSTestHelper.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.api.test;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * An CTS test helper
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 25-Sep-2008
- */
-public class CTSTestHelper
-{
-  private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
-
-  private static String testResourcesDir;
-
-  /** Try to discover the URL for the test resource */
-  public URL getResourceURL(String resource) throws MalformedURLException
-  {
-    return getResourceFile(resource).toURI().toURL();
-  }
-
-  /** Try to discover the File for the test resource */
-  public File getResourceFile(String resource)
-  {
-    File file = new File(resource);
-    if (file.exists())
-      return file;
-
-    file = new File(getTestResourcesDir() + "/" + resource);
-    if (file.exists())
-      return file;
-
-    throw new IllegalArgumentException("Cannot obtain '" + getTestResourcesDir() + "/" + resource + "'");
-  }
-
-  public String getTestResourcesDir()
-  {
-    if (testResourcesDir == null)
-      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
-
-    return testResourcesDir;
-  }
-}

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/ConfigurationTestSetup.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/ConfigurationTestSetup.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/ConfigurationTestSetup.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -42,7 +42,7 @@
   // Provide logging
   final Logger log = LoggerFactory.getLogger(ConfigurationTestSetup.class);
   
-  private CTSTestHelper helper = new CTSTestHelper();
+  private APITestHelper helper = new APITestHelper();
   private String beansConfig;
   
 

Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/IntegrationTestHelper.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/IntegrationTestHelper.java	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/test/IntegrationTestHelper.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -39,7 +39,7 @@
  * @author Thomas.Diesler at jboss.org
  * @since 14-Oct-2004
  */
-public class IntegrationTestHelper extends CTSTestHelper
+public class IntegrationTestHelper extends APITestHelper
 {
   private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
 

Modified: projects/spec/trunk/modules/cts/pom.xml
===================================================================
--- projects/spec/trunk/modules/cts/pom.xml	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/cts/pom.xml	2008-10-29 11:00:07 UTC (rev 2653)
@@ -37,23 +37,6 @@
       <artifactId>jbpm-spec-api</artifactId>
       <version>${version}</version>
     </dependency>
-    
-    <!-- Test Dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <!-- Plugins -->

Modified: projects/spec/trunk/modules/dialects/stp/.classpath
===================================================================
--- projects/spec/trunk/modules/dialects/stp/.classpath	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/dialects/stp/.classpath	2008-10-29 11:00:07 UTC (rev 2653)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>

Modified: projects/spec/trunk/modules/ri/pom.xml
===================================================================
--- projects/spec/trunk/modules/ri/pom.xml	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/ri/pom.xml	2008-10-29 11:00:07 UTC (rev 2653)
@@ -70,6 +70,27 @@
       <version>${version}</version>
     </dependency>
     <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-dialect-api10</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-dialect-jpdl32</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-dialect-stp</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-dialect-xpdl21</artifactId>
+      <version>${version}</version>
+    </dependency>
+    
+    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate</artifactId>
     </dependency>
@@ -85,23 +106,6 @@
       <groupId>org.mvel</groupId>
       <artifactId>mvel</artifactId>
     </dependency>
-    
-    <!-- Test Dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <!-- Plugins -->

Added: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/DialectHandlerServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/DialectHandlerServiceImpl.java	                        (rev 0)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/DialectHandlerServiceImpl.java	2008-10-29 11:00:07 UTC (rev 2653)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ri.service;
+
+// $Id$
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.DialectHandler;
+import org.jbpm.api.service.DialectHandlerService;
+
+/**
+ * A registry that maps namespaceURI to a {@link DialectHandler}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class DialectHandlerServiceImpl extends DialectHandlerService implements MutableService
+{
+  @Override
+  public void setProcessEngine(ProcessEngine engine)
+  {
+    super.setProcessEngine(engine);
+  }
+
+  public void setDialectHandlers(Map<URI, DialectHandler> dialectHandlers)
+  {
+    this.dialectHandlers = dialectHandlers;
+  }
+}
\ No newline at end of file


Property changes on: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/DialectHandlerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml
===================================================================
--- projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml	2008-10-29 11:00:07 UTC (rev 2653)
@@ -8,6 +8,7 @@
     <bean name="jBPMProcessEngine" class="org.jbpm.ri.client.ProcessEngineImpl">
       <property name="services">
         <set elementClass="org.jbpm.api.service.Service">
+          <inject bean="jBPMDialectHandlerService" />
           <inject bean="jBPMExecutionService" />
           <inject bean="jBPMMessageService" />
           <inject bean="jBPMMessageBuilderService" />
@@ -69,6 +70,22 @@
       </property>
     </bean>
     
+    <!-- The DialectHandlerService -->
+    <bean name="jBPMDialectHandlerService" class="org.jbpm.ri.service.DialectHandlerServiceImpl" >
+      <property name="dialectHandlers">
+        <map keyClass="java.net.URI" valueClass="org.jbpm.api.service.DialectHandler">
+          <entry><key>urn:jbpm.jboss:api-0.1</key><value><inject bean="jBPMDialectHandlerAPI10"/></value></entry>
+          <entry><key>urn:jbpm.org:jpdl-3.2</key><value><inject bean="jBPMDialectHandlerJPDL32"/></value></entry>
+          <entry><key>http://stp.eclipse.org/bpmn</key><value><inject bean="jBPMDialectHandlerSTP"/></value></entry>
+          <entry><key>http://www.wfmc.org/2008/XPDL2.1</key><value><inject bean="jBPMDialectHandlerXPDL21"/></value></entry>
+        </map>
+      </property>
+    </bean>
+    <bean name="jBPMDialectHandlerAPI10" class="org.jbpm.dialect.api10.DialectHandlerImpl"/>
+    <bean name="jBPMDialectHandlerJPDL32" class="org.jbpm.dialect.jpdl32.DialectHandlerImpl"/>
+    <bean name="jBPMDialectHandlerSTP" class="org.jbpm.dialect.stp.DialectHandlerImpl"/>
+    <bean name="jBPMDialectHandlerXPDL21" class="org.jbpm.dialect.xpdl21.DialectHandlerImpl"/>
+    
     <!-- Other Services -->
     <bean name="jBPMExecutionService" class="org.jbpm.ri.service.ExecutionServiceImpl" />
     <bean name="jBPMMessageService" class="org.jbpm.ri.service.MessageServiceImpl" />

Modified: projects/spec/trunk/pom.xml
===================================================================
--- projects/spec/trunk/pom.xml	2008-10-29 10:27:43 UTC (rev 2652)
+++ projects/spec/trunk/pom.xml	2008-10-29 11:00:07 UTC (rev 2653)
@@ -91,6 +91,26 @@
     </dependencies>
   </dependencyManagement>
 
+  <!-- Dependencies -->
+  <dependencies>
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
   <scm>
     <connection>scm:svn:http://anonsvn.jboss.org/repos/jbpm/jbpm4</connection>
     <developerConnection>scm:svn:https://svn.jboss.org/repos/jbpm/jbpm4</developerConnection>




More information about the jbpm-commits mailing list