[jbpm-commits] JBoss JBPM SVN: r2919 - in projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview: client and 4 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Nov 14 02:51:48 EST 2008
Author: thomas.diesler at jboss.com
Date: 2008-11-14 02:51:48 -0500 (Fri, 14 Nov 2008)
New Revision: 2919
Added:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/MessageListener.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/PersistenceToken.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/ProcessAsync.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/SignalListener.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/UserTaskCallback.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/EventBuilder.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/GroupBuilder.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/MessageBuilder.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/ObjectNameFactory.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/SignalBuilder.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/BasicNodeHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/ExecutionHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/FlowHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/NodeHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/SignalHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/TokenExecutor.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/DeploymentService.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageBuilderService.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/PersistenceService.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalBuilderService.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalService.java
Log:
Refactor api preview packages
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,126 @@
+/*
+ * 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.preview.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.jbpm.api.client.ProcessDefinition;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.DialectHandler;
+import org.jbpm.api.service.DialectHandlerService;
+import org.jbpm.api.service.ProcessInstanceService;
+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 ProcessInstanceService}
+ *
+ * @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;
+ private ProcessDefinition process;
+
+ 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 Deployment(ProcessDefinition procDef)
+ {
+ this.process = procDef;
+ }
+
+ public ProcessDefinition getProcessDefinition(ProcessEngine engine)
+ {
+ if (process == null)
+ {
+ DialectHandlerService dhService = engine.getService(DialectHandlerService.class);
+ if (dhService == null)
+ throw new IllegalStateException("DialectHandlerService not registered");
+
+ URI nsURI = getNamespaceURI();
+ DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+ if (dialectHandler == null)
+ throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+
+ process = dialectHandler.createProcess(procXML);
+ }
+ return process;
+ }
+
+ private 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: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/MessageListener.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/MessageListener.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/MessageListener.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,47 @@
+/*
+ * 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.preview.client;
+
+import javax.management.ObjectName;
+
+import org.jbpm.preview.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 getKey();
+
+ /**
+ * Catch a message from the process that this listener is registered with
+ */
+ void catchMessage(Message message);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/MessageListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/PersistenceToken.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/PersistenceToken.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/PersistenceToken.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,41 @@
+/*
+ * 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.preview.client;
+
+// $Id$
+
+import org.hibernate.Session;
+import org.jbpm.api.client.Token;
+
+/**
+ * A Token that gives access to the persistence context
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public interface PersistenceToken extends Token
+{
+ /**
+ * Get the associated persistence session
+ */
+ Session getSession();
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/PersistenceToken.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/ProcessAsync.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/ProcessAsync.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/ProcessAsync.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -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.preview.client;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.client.Process;
+import org.jbpm.api.runtime.Attachments;
+
+/**
+ * A Process is any Activity performed within a company or organization.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface ProcessAsync extends Process
+{
+ /**
+ * Start the process asynchronously
+ */
+ ObjectName startProcessAsync();
+
+ /**
+ * Start the process asynchronously, with a given context data
+ */
+ ObjectName startProcessAsync(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.
+ */
+ ProcessStatus waitForEnd();
+
+ /**
+ * 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.
+ */
+ ProcessStatus waitForEnd(long timeout);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/ProcessAsync.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/SignalListener.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/SignalListener.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/SignalListener.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,46 @@
+/*
+ * 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.preview.client;
+
+//$Id$
+
+import org.jbpm.preview.model.Signal;
+import org.jbpm.preview.service.SignalService;
+
+/**
+ * A signal listener that can be registered with the {@link SignalService}
+ *
+ * @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
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/SignalListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/UserTaskCallback.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/UserTaskCallback.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/UserTaskCallback.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,135 @@
+/*
+ * 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.preview.client;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.BasicAttachments;
+import org.jbpm.preview.model.Message;
+import org.jbpm.preview.model.UserTask;
+import org.jbpm.preview.model.builder.MessageBuilder;
+import org.jbpm.preview.model.builder.ObjectNameFactory;
+import org.jbpm.preview.service.MessageBuilderService;
+import org.jbpm.preview.service.MessageService;
+
+/**
+ * A callback that can be attached to a {@link UserTask} to facilitate message handling;
+ *
+ * The callback registers a {@link MessageListener}, extracts the data from the received message
+ * and calls the user provided 'callback' method. The response message is then constructed from
+ * the user provided data and automatically sent back to the {@link UserTask}.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Oct-2008
+ */
+public abstract class UserTaskCallback
+{
+ private MessageListener messageListener;
+
+ /**
+ * Get the associated MessageListener
+ */
+ public MessageListener getMessageListener()
+ {
+ return messageListener;
+ }
+
+ /**
+ * Attached this callback to the user task
+ */
+ public void attach(UserTask userTask)
+ {
+ userTask.setUserTaskCallback(this);
+
+ messageListener = new CallbackMessageListener(userTask);
+
+ ProcessEngine engine = userTask.getProcessDefinition().getProcessEngine();
+ MessageService msgService = engine.getService(MessageService.class);
+ msgService.addMessageListener(messageListener);
+ }
+
+ /**
+ * Detach this callback from the user task
+ */
+ public void detach(UserTask userTask)
+ {
+ ProcessEngine engine = userTask.getProcessDefinition().getProcessEngine();
+ MessageService msgService = engine.getService(MessageService.class);
+ msgService.removeMessageListener(messageListener.getKey());
+ }
+
+ public abstract void callback(Attachments att);
+
+ class CallbackMessageListener implements MessageListener
+ {
+ private UserTask userTask;
+
+ public CallbackMessageListener(UserTask userTask)
+ {
+ this.userTask = userTask;
+ }
+
+ @Override
+ public void catchMessage(Message msg)
+ {
+ // Get the message data
+ Attachments att = new BasicAttachments();
+ for (String propName : msg.getPropertyNames())
+ {
+ String value = msg.getProperty(propName).getValue();
+ att.addAttachment(propName, value);
+ }
+
+ // Call the user callback
+ callback(att);
+
+ // Build the response message
+ Message msgRef = userTask.getInMessageRef();
+ MessageBuilder msgBuilder = MessageBuilderService.locateMessageBuilder();
+ msgBuilder.newMessage(msgRef.getName());
+ for (String propName : msgRef.getPropertyNames())
+ {
+ Object value = att.getAttachment(propName);
+ if (value == null)
+ throw new IllegalStateException("Cannot obtain required property: " + propName);
+ msgBuilder.addProperty(propName, value);
+ }
+ Message resMessage = msgBuilder.getMessage();
+
+ MessageService msgService = MessageService.locateMessageService();
+
+ ObjectName procID = userTask.getProcess().getKey();
+ msgService.sendMessage(procID, userTask.getName(), resMessage);
+ }
+
+ @Override
+ public ObjectName getKey()
+ {
+ String oname = userTask.getKey().getCanonicalName();
+ return ObjectNameFactory.create(oname + ",msgListener=UserTaskCallback");
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/UserTaskCallback.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/EventBuilder.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/EventBuilder.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/EventBuilder.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,46 @@
+/*
+ * 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.preview.model.builder;
+
+//$Id$
+
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.preview.model.Signal.SignalType;
+
+/**
+ * The EventBuilder can be used to build an Event dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface EventBuilder extends ProcessBuilder
+{
+ /**
+ * Add a signal ref to the last added EventDetail
+ */
+ EventBuilder addSignalRef(SignalType signalType, String signalMessage);
+
+ /**
+ * Add a message ref to the last added EventDetail
+ */
+ EventBuilder addMessageRef(String msgName);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/EventBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/GroupBuilder.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/GroupBuilder.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/GroupBuilder.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,50 @@
+/*
+ * 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.preview.model.builder;
+
+//$Id$
+
+import org.jbpm.preview.model.Group;
+import org.jbpm.preview.model.Group.GroupType;
+
+
+/**
+ * A GroupBuilder can be used to build a {@link Group} dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface GroupBuilder
+{
+ /** Add a new Group*/
+ GroupBuilder newGroup(GroupType type, String name);
+
+ /**
+ * Add a message property
+ */
+ GroupBuilder addProperty(String name, Object value);
+
+ /**
+ * Get the Group
+ */
+ Group getGroup();
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/GroupBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/MessageBuilder.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/MessageBuilder.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/MessageBuilder.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,68 @@
+/*
+ * 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.preview.model.builder;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jbpm.preview.model.Message;
+
+
+/**
+ * A MessageBuilder can be used to build a {@link Message} dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface MessageBuilder
+{
+ /**
+ * Create a {@link Message} with a given name
+ */
+ MessageBuilder newMessage(String msgName);
+
+ /**
+ * Add a message destination
+ */
+ MessageBuilder addToRef(ObjectName toRef);
+
+ /**
+ * Add a message source
+ */
+ MessageBuilder addFromRef(ObjectName fromRef);
+
+ /**
+ * Add a message property
+ */
+ MessageBuilder addProperty(String name, Object value);
+
+ /**
+ * Add a message property
+ */
+ MessageBuilder addProperty(String name, Object value, boolean isCorrelation);
+
+ /**
+ * Get the Message
+ */
+ Message getMessage();
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/MessageBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/ObjectNameFactory.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/ObjectNameFactory.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/ObjectNameFactory.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,74 @@
+/*
+ * 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.preview.model.builder;
+
+// $Id$
+
+import java.util.Hashtable;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A simple factory for creating safe object names.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-May-2006
+ */
+public class ObjectNameFactory
+{
+ public static ObjectName create(String name)
+ {
+ try
+ {
+ return new ObjectName(name);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + name + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, String key, String value)
+ {
+ try
+ {
+ return new ObjectName(domain, key, value);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, Hashtable<String, String> table)
+ {
+ try
+ {
+ return new ObjectName(domain, table);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
+ }
+ }
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/ObjectNameFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/SignalBuilder.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/SignalBuilder.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/SignalBuilder.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,44 @@
+/*
+ * 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.preview.model.builder;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jbpm.preview.model.Signal;
+import org.jbpm.preview.model.Signal.SignalType;
+
+
+/**
+ * A SignalBuilder can be used to build a {@link Signal} dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SignalBuilder
+{
+ /**
+ * Create a Signal
+ */
+ Signal newSignal(SignalType signalType, ObjectName fromRef, String message);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/model/builder/SignalBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/BasicNodeHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/BasicNodeHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/BasicNodeHandler.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -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.preview.runtime;
+
+import org.jbpm.api.model.Node;
+
+/**
+ * A handler that is associated with a node
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 30-Sep-2008
+ */
+public abstract class BasicNodeHandler implements NodeHandler
+{
+ private static final long serialVersionUID = 1L;
+
+ private Node node;
+
+ @Override
+ public Node getNode()
+ {
+ return node;
+ }
+
+ @Override
+ public void setNode(Node node)
+ {
+ this.node = node;
+ }
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/BasicNodeHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/ExecutionHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/ExecutionHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/ExecutionHandler.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,43 @@
+/*
+ * 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.preview.runtime;
+
+//$Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.Node;
+
+/**
+ * The ProcessEngine invokes the ExecutionHandler on a
+ * {@link Node} to execute user provided business logic.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface ExecutionHandler extends NodeHandler
+{
+ /**
+ * Execute the associated business logic.
+ */
+ void execute(Token token);
+
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/ExecutionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/FlowHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/FlowHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/FlowHandler.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,47 @@
+/*
+ * 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.preview.runtime;
+
+// $Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+
+/**
+ * The {@link ProcessEngine} invokes the FlowHandler on a {@link Node}
+ * to move the {@link Token} to the next {@link Node}.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface FlowHandler extends NodeHandler
+{
+ /**
+ * Execute the FlowHandler.
+ * <p/>
+ * The FlowHandler typically invoves one of the {@link TokenExecutor}
+ * methods to move the {@link Token} to the next {@link Node}.
+ */
+ void execute(TokenExecutor tokenExecutor, Token token);
+
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/FlowHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/NodeHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/NodeHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/NodeHandler.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,47 @@
+/*
+ * 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.preview.runtime;
+
+import java.io.Serializable;
+
+//$Id$
+
+import org.jbpm.api.model.Node;
+
+/**
+ * A handler that is associated with a node
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 30-Sep-2008
+ */
+public interface NodeHandler extends Serializable
+{
+ /**
+ * Get the associated node.
+ */
+ Node getNode();
+
+ /**
+ * Set the associated node.
+ */
+ void setNode(Node node);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/NodeHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/SignalHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/SignalHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/SignalHandler.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -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.preview.runtime;
+
+// $Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+import org.jbpm.preview.model.Signal;
+
+/**
+ * The {@link ProcessEngine} invokes the SignalHandler on a {@link Node}
+ * to send {@link Signal}s.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface SignalHandler extends NodeHandler
+{
+ /**
+ * Get signal for enter
+ */
+ void throwEnterSignal(Token token);
+
+ /**
+ * Get signal for exit
+ */
+ void throwExitSignal(Token token);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/SignalHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/TokenExecutor.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/TokenExecutor.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/TokenExecutor.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,72 @@
+/*
+ * 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.preview.runtime;
+
+//$Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.SequenceFlow;
+
+/**
+ * The {@link FlowHandler} invokes the TokenExecutor to move {@link Token}s along the {@link SequenceFlow}s in the
+ * {@link Process}.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface TokenExecutor
+{
+ /**
+ * Create a {@link Token} with an initial flow
+ */
+ void create(Token token, SequenceFlow flow);
+
+ /**
+ * Start a {@link Token}
+ */
+ void start(Token token);
+
+ /**
+ * Stop a {@link Token}
+ */
+ void stop(Token token);
+
+ /**
+ * Destroy a {@link Token}
+ */
+ void destroy(Token token);
+
+ /**
+ * Suspend a {@link Token}
+ */
+ void suspend(Token token);
+
+ /**
+ * Activate a {@link Token}
+ */
+ void activate(Token token);
+
+ /**
+ * Move a given {@link Token} along a given flow.
+ */
+ void move(Token token, SequenceFlow flow);
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/runtime/TokenExecutor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/DeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/DeploymentService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/DeploymentService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -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.preview.service;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.service.Service;
+import org.jbpm.preview.client.Deployment;
+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: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/DeploymentService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageBuilderService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageBuilderService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageBuilderService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,54 @@
+/*
+ * 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.preview.service;
+
+//$Id$
+
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.AbstractService;
+import org.jbpm.preview.model.Message;
+import org.jbpm.preview.model.builder.MessageBuilder;
+
+/**
+ * The MessageBuilder can be used to build a {@link Message} dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class MessageBuilderService extends AbstractService
+{
+ /**
+ * Locate the default MessageBuilder
+ */
+ public static MessageBuilder locateMessageBuilder()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ MessageBuilderService builderService = engine.getService(MessageBuilderService.class);
+ return builderService.getMessageBuilder();
+ }
+
+ /**
+ * Get the MessageBuilder
+ */
+ public abstract MessageBuilder getMessageBuilder();
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageBuilderService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,171 @@
+/*
+ * 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.preview.service;
+
+//$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.jbpm.api.client.Configuration;
+import org.jbpm.api.client.Process;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Event;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Task;
+import org.jbpm.api.service.AbstractService;
+import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.preview.client.MessageListener;
+import org.jbpm.preview.model.Message;
+import org.jbpm.preview.model.Participant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The ProcessEngine sends messages through the MessageService.
+ * <p/>
+ * A {@link Message} has an ID and is targeted to a
+ * specific Participant. A component can register a {@link MessageListener} with the MessageService.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class MessageService extends AbstractService
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(MessageService.class);
+
+ // The set of registered message listeners
+ private Map<ObjectName, MessageListener> listeners = new HashMap<ObjectName, MessageListener>();
+
+ /**
+ * Locate the default MessageService
+ */
+ public static MessageService locateMessageService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ return engine.getService(MessageService.class);
+ }
+
+ /**
+ * Add a MessageListener
+ */
+ public void addMessageListener(MessageListener listener)
+ {
+ synchronized (listeners)
+ {
+ if (hasMessageListener(listener.getKey()))
+ throw new IllegalStateException("Listener already registered: " + listener.getKey());
+
+ log.debug("addMessageListener: " + listener.getKey());
+ listeners.put(listener.getKey(), 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 void sendMessage(ObjectName procID, String targetName, Message msg)
+ {
+ ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ Process proc = procService.getProcess(procID);
+ if (proc == null)
+ throw new IllegalStateException("Cannot obtain registered process: " + procID);
+
+ Node targetNode = proc.getNode(targetName);
+ if (targetNode == null)
+ throw new IllegalArgumentException("Cannot find message target: " + targetName);
+ if (targetNode instanceof MessageListener == false)
+ throw new IllegalArgumentException("Message target is not a valid message receiver: " + targetName);
+
+ log.debug("sendMessage to " + targetNode + " => " + msg);
+ MessageListener msgListener = (MessageListener)targetNode;
+ msgListener.catchMessage(msg);
+ }
+
+ /**
+ * Send a message to a given {@link MessageListener}
+ */
+ public void sendMessage(Message msg)
+ {
+ Participant toRef = msg.getToRef();
+ 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
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/PersistenceService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/PersistenceService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/PersistenceService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,97 @@
+/*
+ * 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.preview.service;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.hibernate.Session;
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.Process;
+import org.jbpm.api.client.ProcessDefinition;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.service.AbstractService;
+
+/**
+ * The persistence service.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 17-Sep-2008
+ */
+public abstract class PersistenceService extends AbstractService
+{
+ /**
+ * Locate the default PersistenceService
+ */
+ public static PersistenceService locatePersistenceService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ return engine.getService(PersistenceService.class);
+ }
+
+ /**
+ * Create a new persistence session
+ */
+ public abstract Session createSession();
+
+ /**
+ * Save the ProcessDefinition to persistent storage
+ */
+ public abstract ObjectName saveProcessDefinition(ProcessDefinition procDef);
+
+ /**
+ * Load the ProcessDefinition from persistent storage
+ */
+ public abstract ProcessDefinition loadProcessDefinition(ObjectName procDefID);
+
+ /**
+ * Delete the ProcessDefinition from persistent storage
+ */
+ public abstract void deleteProcessDefinition(ProcessDefinition procDef);
+
+ /**
+ * Save the Process to persistent storage
+ */
+ public abstract ObjectName saveProcess(Process proc);
+
+ /**
+ * Load the Process from persistent storage
+ */
+ public abstract Process loadProcess(ObjectName procID);
+
+ /**
+ * Delete the Process from persistent storage
+ */
+ public abstract void deleteProcess(Process proc);
+
+ /**
+ * Save the Node to persistent storage
+ */
+ public abstract ObjectName saveNode(Session session, Node node);
+
+ /**
+ * Load the Node from persistent storage
+ */
+ public abstract <T extends Node> T loadNode(Session session, Class<T> clazz, ObjectName nodeID);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/PersistenceService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalBuilderService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalBuilderService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalBuilderService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,54 @@
+/*
+ * 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.preview.service;
+
+//$Id$
+
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.AbstractService;
+import org.jbpm.preview.model.Signal;
+import org.jbpm.preview.model.builder.SignalBuilder;
+
+/**
+ * The SignalBuilder can be used to build a {@link Signal} dynamically.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class SignalBuilderService extends AbstractService
+{
+ /**
+ * Locate the default SignalBuilder
+ */
+ public static SignalBuilder locateSignalBuilder()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ SignalBuilderService builderService = engine.getService(SignalBuilderService.class);
+ return builderService.getSignalBuilder();
+ }
+
+ /**
+ * Get the SignalBuilder
+ */
+ public abstract SignalBuilder getSignalBuilder();
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalBuilderService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalService.java 2008-11-14 07:51:48 UTC (rev 2919)
@@ -0,0 +1,137 @@
+/*
+ * 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.preview.service;
+
+//$Id$
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.AbstractService;
+import org.jbpm.preview.client.SignalListener;
+import org.jbpm.preview.model.Signal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A {@link Signal} is like an undirected flare shot up
+ * into the air. A component can register a {@link SignalListener} with the SignalService.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class SignalService extends AbstractService
+{
+ // provide logging
+ final static Logger log = LoggerFactory.getLogger(SignalService.class);
+
+ // The map of registered signal listeners
+ private Set<SignalListener> listeners = new HashSet<SignalListener>();
+
+ /**
+ * Locate the default SignalService
+ */
+ public static SignalService locateSignalService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ return engine.getService(SignalService.class);
+ }
+
+ /**
+ * 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
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/SignalService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbpm-commits
mailing list