[jbpm-commits] JBoss JBPM SVN: r2392 - in jbpm4/branches/tdiesler: modules/api/src/main/java/org/jbpm/api/client and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Sep 26 02:48:53 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-09-26 02:48:52 -0400 (Fri, 26 Sep 2008)
New Revision: 2392
Added:
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Deployment.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DeploymentService.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectHandler.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectRegistry.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineRegistry.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessService.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Service.java
Modified:
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/MicrocontainerConfiguration.java
jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java
jbpm4/branches/tdiesler/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
jbpm4/branches/tdiesler/pom.xml
Log:
WIP
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Deployment.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Deployment.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Deployment.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,102 @@
+/*
+ * 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.client;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * A deployment, containing all information to create a process that will be deployed to the {@link ProcessService}
+ *
+ * @author Tom Baeyens
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public class Deployment implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String procXML;
+
+ public Deployment(String procXML)
+ {
+ if (procXML == null)
+ throw new IllegalArgumentException("Null process definition");
+
+ this.procXML = procXML;
+ }
+
+ public Deployment(URL procURL) throws IOException
+ {
+ if (procURL == null)
+ throw new IllegalArgumentException("Null process definition");
+
+ StringBuilder strBuilder = new StringBuilder();
+ BufferedReader br = new BufferedReader(new InputStreamReader(procURL.openStream()));
+ String line = br.readLine();
+ while (line != null)
+ {
+ strBuilder.append(line);
+ line = br.readLine();
+ }
+ procXML = strBuilder.toString();
+ }
+
+ public String getProcessXML()
+ {
+ return procXML;
+ }
+
+ public URI getNamespaceURI()
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ Document doc;
+ try
+ {
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ doc = db.parse(new ByteArrayInputStream(procXML.getBytes()));
+ }
+ 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);
+ }
+}
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Deployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DeploymentService.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DeploymentService.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DeploymentService.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,49 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The marker interface for all Services
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class DeploymentService implements Service
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(DeploymentService.class);
+
+ /**
+ * Deploy a new process to the process service.
+ */
+ ObjectName deploy(Deployment deployment)
+ {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DeploymentService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectHandler.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectHandler.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectHandler.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,62 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * The DialectHandler converts a supported dialect to the Process model.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public interface DialectHandler
+{
+ URI DEFAULT_NAMESPACE_URI = URI.create("urn:bpm.jboss:pdl-0.1");
+
+ /**
+ * Get the the supported namespace from this dialect.
+ */
+ URI getNamespaceURI();
+
+ /**
+ * Create a {@link Process} from a descriptor.
+ * @param isInclude TODO
+ */
+ Process createProcess(String pXML);
+
+ /**
+ * Create a {@link Process} from a descriptor URL.
+ * @param isInclude TODO
+ */
+ Process createProcess(URL pURL) throws IOException;
+
+ /**
+ * Marshall the process to the given writer
+ */
+ void marshallProcess(Process proc, Writer out) throws IOException;
+}
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectRegistry.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectRegistry.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectRegistry.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,52 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * A registry that maps namespaceURI to a {@link DialectHandler}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jul-2008
+ */
+public abstract class DialectRegistry
+{
+ // Maps namespaceURI to a DialectHandler
+ protected Map<URI, DialectHandler> dialectHandlers;
+
+ /**
+ * Get the handler for the dialect with the given namespace URI
+ */
+ public DialectHandler getDialectHandler(URI nsURI)
+ {
+ DialectHandler dialectHandler = dialectHandlers.get(nsURI);
+ if (dialectHandler == null)
+ throw new IllegalStateException("No dialect handler registered for: " + nsURI);
+
+ return dialectHandler;
+ }
+
+}
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/DialectRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/MicrocontainerConfiguration.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/MicrocontainerConfiguration.java 2008-09-26 05:26:28 UTC (rev 2391)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/MicrocontainerConfiguration.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -88,7 +88,6 @@
}
ProcessEngine engine = (ProcessEngine)entry.getTarget();
- ProcessEngine.registerProcessEngine(engine);
return engine;
}
}
\ No newline at end of file
Modified: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java 2008-09-26 05:26:28 UTC (rev 2391)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -33,7 +33,18 @@
import org.slf4j.LoggerFactory;
/**
- * The process engine is an agregator of various manger objects used by the BPM engine
+ * The process engine is an agregator of various service objects used by the BPM engine.
+ * <p/>
+ * A ProcessEngine is always created via one of the available {@link Configuration} objects. Every implementation of the
+ * API has one default {@link Configuration} which is configured via a resource file with the fully qualified class name
+ * of {@link Configuration}.
+ * <p/>
+ * The API natively supports {@link MicrocontainerConfiguration}. To create and register a ProcessEngine explicitly, you
+ * would do
+ * <pre>
+ * ProcessEngine engine = new MicrocontainerConfiguration(cfgURL).getProcessEngine();
+ * ProcessEngineRegistry.registerProcessEngine(engine);
+ * </pre>
*
* @author thomas.diesler at jboss.com
* @since 18-Jun-2008
@@ -43,12 +54,10 @@
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessEngine.class);
- // The process engine registry
- private static Map<String, ProcessEngine> engineRegistry = new HashMap<String, ProcessEngine>();
+ // The map of registered services
+ private Map<Class<Service>, Service> services = new HashMap<Class<Service>, Service>();
// The name of this engine
private String name;
- // Flag to indicate that the Engine is shutting down
- private boolean prepareForShutdown;
// Hide public constructor
protected ProcessEngine()
@@ -56,8 +65,20 @@
}
/**
- * Get registered the default ProcessEngine
+ * Get the instance of the registered service
*
+ * @return null if there is no service registered for the given class
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getService(Class<T> clazz)
+ {
+ return (T)services.get(clazz);
+ }
+
+ /**
+ * Get the registered default ProcessEngine <p/> If there is no ProcessEngine registered, a call to this method will
+ * register the default engine automatically.
+ *
* @return The configured instance of a process engine
*/
public static ProcessEngine getProcessEngine()
@@ -68,14 +89,16 @@
/**
* Get a registered ProcessEngine
*
- * @return null, if there is no registered by this name
+ * @return null, if there is no ProcessEngine registered by this name
*/
public static ProcessEngine getProcessEngine(String name)
{
+ Map<String, ProcessEngine> engineRegistry = ProcessEngineRegistry.engineRegistry;
+
if (engineRegistry.size() == 0)
loadDefaultEngine();
-
- ProcessEngine pe = null;
+
+ ProcessEngine pe = null;
if (name == null && engineRegistry.size() == 1)
{
pe = engineRegistry.values().iterator().next();
@@ -86,7 +109,7 @@
}
return pe;
}
-
+
/**
* Get the name of this engine
*/
@@ -100,53 +123,14 @@
{
this.name = name;
}
-
- public static void registerProcessEngine(ProcessEngine pe)
- {
- log.debug("Register: " + pe);
- engineRegistry.put(pe.getName(), pe);
- }
- public static ProcessEngine unregisterProcessEngine(String name)
- {
- ProcessEngine pe = engineRegistry.remove(name);
- log.debug("Unregister: " + name + "=" + pe);
- return pe;
- }
-
- /**
- * Prepare the engine for shutdown. During shutdown the creation of new processes is disallowed.
- */
- public void prepareForShutdown()
- {
- log.debug("prepareForShutdown");
- prepareForShutdown = true;
- }
-
- /**
- * True, if engine is preparing for shutdown.
- */
- public boolean isPrepareForShutdown()
- {
- return prepareForShutdown;
- }
-
- /**
- * Cancel the prepare for shutdown request
- */
- public void cancelShutdown()
- {
- log.debug("cancelShutdown");
- prepareForShutdown = false;
- }
-
private static void loadDefaultEngine()
{
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
InputStream instream = ctxLoader.getResourceAsStream(Configuration.class.getName());
if (instream == null)
throw new IllegalStateException("Cannot find resource: " + Configuration.class.getName());
-
+
Configuration configuration = null;
try
{
@@ -159,12 +143,12 @@
{
throw new IllegalStateException("Cannot obtain configuration", ex);
}
-
+
ProcessEngine pe = configuration.getProcessEngine();
if (pe == null)
throw new IllegalStateException("Cannot obtain engine from configuration: " + configuration);
-
- registerProcessEngine(pe);
+
+ ProcessEngineRegistry.registerProcessEngine(pe);
}
@Override
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineRegistry.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineRegistry.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineRegistry.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,84 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A registry of ProcessEngine instances per VM
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public final class ProcessEngineRegistry
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(ProcessEngineRegistry.class);
+
+ // The process engine registry
+ static Map<String, ProcessEngine> engineRegistry = new HashMap<String, ProcessEngine>();
+
+ // Hide constructor
+ private ProcessEngineRegistry()
+ {
+ }
+
+ /**
+ * Get the set of registered engine names
+ */
+ public static Set<String> getRegisteredProcessEngines()
+ {
+ return engineRegistry.keySet();
+ }
+
+ /**
+ * Register a ProcessEngine
+ * @throws IllegalStateException If a ProcessEngine with that name is already registered
+ */
+ public static void registerProcessEngine(ProcessEngine pe)
+ {
+ if (engineRegistry.get(pe.getName()) != null)
+ throw new IllegalStateException("Process engine already regitered: " + pe.getName());
+
+ log.debug("Register: " + pe);
+ engineRegistry.put(pe.getName(), pe);
+ }
+
+ /**
+ * Unregister a ProcessEngine for a given name
+ */
+ public static ProcessEngine unregisterProcessEngine(String name)
+ {
+ ProcessEngine pe = engineRegistry.remove(name);
+ log.debug("Unregister: " + name + "=" + pe);
+ return pe;
+ }
+
+
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessService.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessService.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessService.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,73 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The marker interface for all Services
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class ProcessService implements Service
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(ProcessService.class);
+
+ // The set of registered processes
+ private Map<ObjectName, Process> procs = new HashMap<ObjectName, Process>();
+
+ // Hide public constructor
+ protected ProcessService()
+ {
+ }
+
+ /**
+ * Deploy a new process to the process service.
+ */
+ ObjectName deploy(Deployment deployment)
+ {
+
+ return null;
+ }
+
+ /**
+ * Get the set of registered Processes
+ */
+ public Set<Process> getProcesses()
+ {
+ Set<Process> procSet = new HashSet<Process>(procs.values());
+ return Collections.unmodifiableSet(procSet);
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/ProcessService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Service.java
===================================================================
--- jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Service.java (rev 0)
+++ jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Service.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -0,0 +1,38 @@
+/*
+ * 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.client;
+
+//$Id$
+
+/**
+ * The base interface for all Services
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 25-Sep-2008
+ */
+public interface Service
+{
+ /**
+ * Get the associated ProcessEngine
+ */
+ ProcessEngine getProcessEngine();
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tdiesler/modules/api/src/main/java/org/jbpm/api/client/Service.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/branches/tdiesler/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
===================================================================
--- jbpm4/branches/tdiesler/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java 2008-09-26 05:26:28 UTC (rev 2391)
+++ jbpm4/branches/tdiesler/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java 2008-09-26 06:48:52 UTC (rev 2392)
@@ -27,6 +27,7 @@
import org.jbpm.api.client.MicrocontainerConfiguration;
import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.client.ProcessEngineRegistry;
import org.jbpm.api.test.CTSTestCase;
/**
@@ -42,22 +43,39 @@
ProcessEngine engine = ProcessEngine.getProcessEngine();
assertNotNull("ProcessEngine not null", engine);
}
-
+
public void testUnregisteredProcessEngine() throws Exception
{
ProcessEngine engine = ProcessEngine.getProcessEngine("bogus");
assertNull("ProcessEngine null", engine);
}
-
+
public void testMicrocontainerConfiguration() throws Exception
{
+ // create an engine from an MC config
URL cfgURL = getResourceURL("cts/processengine/test-cfg-beans.xml");
ProcessEngine engineOne = new MicrocontainerConfiguration(cfgURL).getProcessEngine();
assertNotNull("ProcessEngine not null", engineOne);
-
+
+ // the engine is not automatically registered
ProcessEngine engineTwo = ProcessEngine.getProcessEngine("mock engine");
+ assertNull("ProcessEngine null", engineTwo);
+
+ // register the engine and do the lockup again
+ ProcessEngineRegistry.registerProcessEngine(engineOne);
+ engineTwo = ProcessEngine.getProcessEngine("mock engine");
assertNotNull("ProcessEngine not null", engineTwo);
-
assertSame("ProcessEngine same", engineOne, engineTwo);
+
+ // Try to register the engine twice
+ try
+ {
+ ProcessEngineRegistry.registerProcessEngine(engineTwo);
+ fail("Expceted IllegalStateException");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
}
}
Modified: jbpm4/branches/tdiesler/pom.xml
===================================================================
--- jbpm4/branches/tdiesler/pom.xml 2008-09-26 05:26:28 UTC (rev 2391)
+++ jbpm4/branches/tdiesler/pom.xml 2008-09-26 06:48:52 UTC (rev 2392)
@@ -192,7 +192,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>org/jbpm/test/cts/**/Test.java</include>
+ <include>org/jbpm/test/cts/**/*Test.java</include>
</includes>
</configuration>
</plugin>
More information about the jbpm-commits
mailing list