[jbpm-commits] JBoss JBPM SVN: r2351 - in jbpm4/trunk/modules/api/src/main: java/org/jboss/bpm and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Sep 24 10:09:43 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-09-24 10:09:42 -0400 (Wed, 24 Sep 2008)
New Revision: 2351
Added:
jbpm4/trunk/modules/api/src/main/java/
Removed:
jbpm4/trunk/modules/api/src/main/java/
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectHandler.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectRegistry.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageManager.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalListener.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/
jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/
Log:
Add api module
Copied: jbpm4/trunk/modules/api/src/main/java (from rev 2307, projects/jbpm-spec/trunk/modules/api/src/main/java)
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectHandler.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectHandler.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectHandler.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,64 +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.jboss.bpm.client;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URL;
-
-import org.jboss.bpm.model.Process;
-
-/**
- * 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, boolean isInclude);
-
- /**
- * Create a {@link Process} from a descriptor URL.
- * @param isInclude TODO
- */
- Process createProcess(URL pURL, boolean isInclude) throws IOException;
-
- /**
- * Marshall the process to the given writer
- */
- void marshallProcess(Process proc, Writer out) throws IOException;
-}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectRegistry.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectRegistry.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/DialectRegistry.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,51 +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.jboss.bpm.client;
-
-//$Id$
-
-import java.net.URI;
-import java.util.Map;
-
-/**
- * A registry that Maps namespaceURI to dialect Id
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jul-2008
- */
-public class DialectRegistry
-{
- public static final Object BEAN_NAME = "jBPMDialectRegistry";
-
- // Maps namespaceURI to dialect Id
- private Map<URI,String> registry;
-
- public void setRegistry(Map<URI, String> registry)
- {
- this.registry = registry;
- }
-
- public String getDialect(URI nsURI)
- {
- return registry.get(nsURI);
- }
-}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,97 +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.jboss.bpm.client;
-
-// $Id: $
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.StartEvent;
-import org.jboss.bpm.model.Process.ProcessStatus;
-import org.jboss.bpm.runtime.Attachments;
-
-/**
- * The ExecutionManager executes processes
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ExecutionManager
-{
- private ExecutorService procExecutor = Executors.newCachedThreadPool();
-
- // Hide public constructor
- protected ExecutionManager()
- {
- }
-
- /**
- * Locate the ExecutionManager
- */
- public static ExecutionManager locateExecutionManager()
- {
- ProcessEngine engine = ProcessEngine.locateProcessEngine();
- return engine.getExecutionManager();
- }
-
- /**
- * Get the process executor service
- */
- public ExecutorService getProcessExecutor()
- {
- return procExecutor;
- }
-
- /**
- * Start the Process
- *
- * @param proc The Process to start
- * @param att The Attachments in the ExecutionContext
- */
- public abstract void startProcess(Process proc, Attachments att);
-
- /**
- * Start the Process from a given start event
- *
- * @param start The StartEvent that triggers the process
- * @param att The Attachments in the ExecutionContext
- */
- public abstract void startProcess(StartEvent start, Attachments att);
-
- /**
- * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event.
- * The Process will be in a running state until all Tokens are consumed.
- * <p/>
- * This method until the process ends without timeout.
- */
- public abstract ProcessStatus waitForEnd(Process proc);
-
- /**
- * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event.
- * The Process will be in a running state until all Tokens are consumed.
- * <p/>
- * This method until the process ends with a given timeout.
- */
- public abstract ProcessStatus waitForEnd(Process proc, long timeout);
-}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,47 +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.jboss.bpm.client;
-
-import javax.management.ObjectName;
-
-import org.jboss.bpm.model.Message;
-
-//$Id$
-
-/**
- * A MessageListener that can be registered with the ProcessEngine
- *
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public interface MessageListener
-{
- /**
- * Get the id for this listener
- */
- ObjectName getID();
-
- /**
- * Catch a message from the process that this listener is registered with
- */
- void catchMessage(Message message);
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageManager.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageManager.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageManager.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,146 +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.jboss.bpm.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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.model.Event;
-import org.jboss.bpm.model.Message;
-import org.jboss.bpm.model.Participant;
-import org.jboss.bpm.model.Task;
-
-/**
- * The ProcessEngine sends mesages through the MessageManager. <p/> A {@link Message} has an ID and is targeted to a
- * specific Participant. A component can register a {@link MessageListener} with the MessageManager.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class MessageManager
-{
- // provide logging
- private static final Log log = LogFactory.getLog(MessageManager.class);
-
- // The set of registered message listeners
- private Map<ObjectName, MessageListener> listeners = new HashMap<ObjectName, MessageListener>();
-
- /**
- * Locate the MessageManager
- */
- public static MessageManager locateMessageManager()
- {
- ProcessEngine engine = ProcessEngine.locateProcessEngine();
- return engine.getMessageManager();
- }
-
- /**
- * Add a MessageListener
- */
- public void addMessageListener(MessageListener listener)
- {
- synchronized (listeners)
- {
- if (hasMessageListener(listener.getID()))
- throw new IllegalStateException("Listener already registered: " + listener.getID());
-
- log.debug("addMessageListener: " + listener.getID());
- listeners.put(listener.getID(), listener);
- }
- }
-
- /**
- * Get the set of registered MessageListeners
- */
- public Set<MessageListener> getMessageListeners()
- {
- synchronized (listeners)
- {
- HashSet<MessageListener> set = new HashSet<MessageListener>(listeners.values());
- return Collections.unmodifiableSet(set);
- }
- }
-
- /**
- * Get a MessageListener for a given ID
- *
- * @return null if there is none
- */
- public MessageListener getMessageListener(ObjectName listenerID)
- {
- synchronized (listeners)
- {
- return listeners.get(listenerID);
- }
- }
-
- /**
- * True if there is a MessageListener for a given ID
- */
- public boolean hasMessageListener(ObjectName listenerID)
- {
- return getMessageListener(listenerID) != null;
- }
-
- /**
- * Remove an MessageListener
- */
- public void removeMessageListener(ObjectName listenerID)
- {
- synchronized (listeners)
- {
- log.debug("removeMessageListener: " + listenerID);
- listeners.remove(listenerID);
- }
- }
-
- /**
- * Send a message to a given {@link Task} or {@link Event}
- */
- public abstract void sendMessage(ObjectName procID, String targetName, Message msg);
-
- /**
- * Send a message to a given {@link MessageListener}
- */
- public void sendMessage(Message msg)
- {
- Participant toRef = msg.getToRef().getEntityRef();
- if (toRef == null)
- throw new IllegalArgumentException("Target entity cannot be null");
-
- MessageListener msgListener = getMessageListener(toRef.getName());
- if (msgListener == null)
- throw new IllegalStateException("No message listener registered for: " + toRef);
-
- log.debug("sendMessage to '" + toRef + "' => " + msg);
- msgListener.catchMessage(msg);
- }
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,44 +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.jboss.bpm.client;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.bpm.model.Process;
-
-/**
- * The persistence service for a process.
- *
- * @author thomas.diesler at jboss.com
- * @since 17-Sep-2008
- */
-public interface PersistenceService
-{
- ObjectName saveProcess(Process proc);
-
- Process loadProcess(ObjectName procID);
-
- void deleteProcess(Process proc);
-
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,211 +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.jboss.bpm.client;
-
-// $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.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.EngineShutdownException;
-import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.Process.ProcessStatus;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * The process manager is the entry point to create, find and otherwise manage processes.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ProcessManager implements PersistenceService
-{
- // provide logging
- private static final Log log = LogFactory.getLog(ProcessManager.class);
-
- // The map of registerd dialect handlers
- protected Map<String, DialectHandler> dialectHandlers;
- // The dialect registry
- protected DialectRegistry dialectRegistry;
- // The set of registered processes
- private Map<ObjectName, Process> procs = new HashMap<ObjectName, Process>();
-
- // Hide public constructor
- protected ProcessManager()
- {
- }
-
- /**
- * Locate the ProcessManager
- */
- public static ProcessManager locateProcessManager()
- {
- ProcessEngine engine = ProcessEngine.locateProcessEngine();
- return engine.getProcessManager();
- }
-
- /**
- * Create a Process from a XML string in one of the supported formats.
- * Note, the Process is not automatically registered.
- */
- public final Process createProcess(String pXML)
- {
- URI nsURI = getNamespaceURI(new ByteArrayInputStream(pXML.getBytes()));
- Process proc = getDialectHandler(nsURI).createProcess(pXML, false);
- return proc;
- }
-
- /**
- * Create a Process from an URL to a XML descritor in one of the supported formats.
- * Note, the Process is not automatically registered.
- */
- public final Process createProcess(URL pURL) throws IOException
- {
- URI nsURI = getNamespaceURI(pURL.openStream());
- Process proc = getDialectHandler(nsURI).createProcess(pURL, false);
- return proc;
- }
-
- /**
- * Get the set of registered Processes
- */
- public Set<Process> getProcesses()
- {
- Set<Process> procSet = new HashSet<Process>(procs.values());
- return Collections.unmodifiableSet(procSet);
- }
-
- /**
- * Get a set of Processes for a given name and status.
- * <p/>
- * If the given status is null, all processes with the given name are included.
- *
- * @param name The process name
- * @param status The optional process status
- * @return An empty set if the process cannot be found
- */
- public Set<Process> getProcesses(String name, ProcessStatus status)
- {
- Set<Process> procSet = new HashSet<Process>();
- for (Process aux : procs.values())
- {
- if (aux.getName().equals(name))
- {
- if (status == null || aux.getProcessStatus() == status)
- procSet.add(aux);
- }
- }
- return procSet;
- }
-
- /**
- * Get a Process for a given id
- */
- public Process getProcessByID(ObjectName procID)
- {
- Process proc = procs.get(procID);
- return proc;
- }
-
- /**
- * Register a Process explicitly.
- * <p/>
- * A Process that is registered explicitly, can be started by name.
- * <p/>
- * An implementation may replace the given process with a copy of itself. The copy
- * can then be started without effecting the just registered process.
- * <p/>
- *
- */
- public Process registerProcess(Process proc)
- {
- if (ProcessEngine.locateProcessEngine().isPrepareForShutdown())
- throw new EngineShutdownException("Cannot register a process while engine is shutting down");
-
- log.debug("registerProcess: " + proc);
- procs.put(proc.getID(), proc);
- return proc;
- }
-
- /**
- * Unregister a Process.
- */
- public Process unregisterProcess(ObjectName procID)
- {
- log.debug("unregisterProcess: " + procID);
- return procs.remove(procID);
- }
-
- private URI getNamespaceURI(InputStream inStream)
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- Document doc;
- try
- {
- DocumentBuilder db = dbf.newDocumentBuilder();
- doc = db.parse(inStream);
- }
- 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);
- }
-
- /**
- * Get the handler for the dialect with the given namespace URI
- */
- public DialectHandler getDialectHandler(URI nsURI)
- {
- String dialectId = dialectRegistry.getDialect(nsURI);
- if (dialectId == null)
- throw new IllegalStateException("No dialect registered for: " + nsURI);
-
- DialectHandler dialectHandler = dialectHandlers.get(dialectId);
- if (dialectHandler == null)
- throw new IllegalStateException("No dialect handler registered for: " + dialectId);
-
- return dialectHandler;
- }
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalListener.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalListener.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalListener.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,45 +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.jboss.bpm.client;
-
-//$Id$
-
-import org.jboss.bpm.model.Signal;
-
-/**
- * A signal listener that can be registered with the {@link SignalManager}
- *
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public interface SignalListener
-{
- /**
- * Returns true if the listener accepts a given signal
- */
- boolean acceptSignal(Signal signal);
-
- /**
- * Catch a previously accepted signal
- */
- void catchSignal(Signal signal);
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-09-22 14:04:07 UTC (rev 2307)
+++ jbpm4/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-09-24 14:09:42 UTC (rev 2351)
@@ -1,133 +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.jboss.bpm.client;
-
-//$Id$
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.model.Signal;
-
-/**
- * The ProcessEngine sends signals through the SignalManager. <p/> A {@link Signal} is like an undirected flare shot up
- * into the air. A component can register a {@link SignalListener} with the SignalManager.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class SignalManager
-{
- // provide logging
- private static final Log log = LogFactory.getLog(SignalManager.class);
-
- // The map of registered signal listeners
- private Set<SignalListener> listeners = new HashSet<SignalListener>();
-
- /**
- * Locate the SignalManager
- */
- public static SignalManager locateSignalManager()
- {
- ProcessEngine engine = ProcessEngine.locateProcessEngine();
- return engine.getSignalManager();
- }
-
- /**
- * Add a SignalListener for a given source
- */
- public void addSignalListener(SignalListener listener)
- {
- synchronized (listeners)
- {
- log.debug("addSignalListener: " + listener);
- listeners.add(listener);
- }
- }
-
- /**
- * Get the set of registered SignalListeners
- */
- public Set<SignalListener> getSignalListeners()
- {
- synchronized (listeners)
- {
- HashSet<SignalListener> set = new HashSet<SignalListener>(listeners);
- return Collections.unmodifiableSet(set);
- }
- }
-
- /**
- * Remove a SignalListener for a given source
- */
- public void removeSignalListener(SignalListener listener)
- {
- synchronized (listeners)
- {
- log.debug("removeSignalListener: " + listener);
- listeners.remove(listener);
- }
- }
-
- /**
- * Throw a signal to all registered listeners
- */
- public void throwSignal(Signal signal)
- {
- log.debug("throwSignal: " + signal);
- Set<SignalListener> currentSet = getSignalListeners();
- for (SignalListener listener : currentSet)
- {
- if (failsafeAccept(listener, signal))
- failsafeThrow(listener, signal);
- }
- }
-
- private boolean failsafeAccept(SignalListener listener, Signal signal)
- {
- try
- {
- boolean accept = listener.acceptSignal(signal);
- return accept;
- }
- catch (RuntimeException rte)
- {
- log.error("Signal processing error", rte);
- return false;
- }
- }
-
- private void failsafeThrow(SignalListener listener, Signal signal)
- {
- try
- {
- listener.catchSignal(signal);
- }
- catch (RuntimeException rte)
- {
- log.error("Signal processing error", rte);
- }
- }
-}
\ No newline at end of file
More information about the jbpm-commits
mailing list