001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: ExtProcessLocal.java,v 1.2.2.1 2007/11/02 16:00:33 drmlipp Exp $
021: *
022: * $Log: ExtProcessLocal.java,v $
023: * Revision 1.2.2.1 2007/11/02 16:00:33 drmlipp
024: * Merged bug fixes from HEAD.
025: *
026: * Revision 1.3 2007/09/20 21:19:25 mlipp
027: * Removed superfluous import.
028: *
029: * Revision 1.2 2007/07/04 21:32:22 mlipp
030: * Using local interface whereever possible.
031: *
032: * Revision 1.1 2007/05/03 21:58:21 mlipp
033: * Internal refactoring for making better use of local EJBs.
034: *
035: */
036: package de.danet.an.workflow.internalapi;
037:
038: import java.util.List;
039: import java.util.Map;
040:
041: import java.io.Serializable;
042: import java.security.Principal;
043:
044: import de.danet.an.workflow.api.Process;
045: import de.danet.an.workflow.localapi.ActivityLocal;
046: import de.danet.an.workflow.localapi.ProcessLocal;
047: import de.danet.an.workflow.localapi.ProcessDefinitionDirectoryLocal;
048: import de.danet.an.workflow.omgcore.InvalidDataException;
049: import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
050: import de.danet.an.workflow.omgcore.WfExecutionObject.State;
051:
052: /**
053: * This interface defines additional methods known to the domain
054: * classes only.
055: *
056: * @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
057: * @version $Revision: 1.2.2.1 $
058: */
059:
060: public interface ExtProcessLocal extends ExtExecutionObjectLocal,
061: ProcessLocal {
062:
063: /**
064: * Return the process definition directory.
065: * While there is no immediate relation between a process
066: * instance and the known process definitions, the definitions
067: * nevertheless make up part of the environment of a process.
068: * Specifically, this method is needed to start a sub-process
069: * in an activity.
070: * @return the process definition directory
071: */
072: ProcessDefinitionDirectoryLocal processDefinitionDirectoryLocal();
073:
074: /**
075: * Copy the process definition in xpdl string in this process.
076: * If the process definition need to be removed, use this method
077: * to copy process definition in the database field of xpdl so that
078: * the process definition can still be reconstructed.
079: * @param procDefXpdl the given process definition in xpdl string.
080: */
081: void copyProcessDefinition(String procDefXpdl);
082:
083: /**
084: * Return the creator of the process.
085: * @return the process creator.
086: */
087: Principal processCreator();
088:
089: /**
090: * Gets a list of transitions for this process
091: * as <code>ExtTransitionLocal</code>s.
092: * @return list of transitions for this process
093: */
094: List transitionsLocal();
095:
096: /**
097: * Evaluate the given script using the process specific scope.
098: * @param script the script
099: * @return the result
100: * @throws ScriptException if evaluation fails
101: */
102: Serializable evalScript(String script) throws ScriptException;
103:
104: /**
105: * Evaluate the given expression using the process specific context.
106: * @param expressionData an array of object arrays containing the result
107: * type and the expression
108: * @return an array that contains the result of each evaluation.
109: * Note that the result may be an exception.
110: */
111: Serializable[] evalExpressions(Object[][] expressionData);
112:
113: /**
114: * Close the given activity. This method may be called only by the
115: * activity passed as argument, and calls {@link
116: * ExtActivityLocal.doCloseActivity <code>doCloseActivity</code>} on
117: * the activity.<P>
118: *
119: * Activities may not set their state to "closed" themselves as
120: * this state change has implications on the process and must be
121: * tracked by a transition manager. Calling this method ensures
122: * that there is a transition manager reflecting the situation
123: * before the state change; the state is then changed by the
124: * process calling <code>doCloseActivity</code>, and depending
125: * actions may then be taken.
126: *
127: * @param activity the activity
128: * @param closedState the new state of the activity
129: */
130: void closeActivity(ExtActivityLocal activity, State closedState);
131:
132: /**
133: * Makes the given activity the chosen one in a set of activities
134: * started by an AND split with the "deferred choice" option
135: * set. All other activities in the set are reset to their initial
136: * state.
137: *
138: * <P>If the activity does not participate in a deferred choice,
139: * this method does nothing and returns <code>true</code>.
140: *
141: * @param activity the activity to be chosen
142: * @return <code>true</code> if the activity could be made the
143: * effectively chosen one
144: * @throws TransitionNotAllowedException if the activity is
145: * neither running nor suspended
146: */
147: boolean choose(ExtActivityLocal activity)
148: throws TransitionNotAllowedException;
149:
150: /**
151: * Handle the process related tasks resulting from the receipt
152: * of an exception by an activity.
153: *
154: * @param activity the activity that has received the exception
155: * @param exceptionName the exception name
156: */
157: void handleException(ExtActivityLocal activity, String exceptionName);
158:
159: /**
160: * Deliver a message on the given channel to a receiver tool
161: * listening on that channel. If no tool is listening, store the
162: * message.
163: *
164: * @param channel the channel name
165: * @param message the message
166: * @throws InvalidDataException if the message contains invalid data
167: */
168: void submitChannelMessage(String channel, Map message)
169: throws InvalidDataException;
170:
171: /**
172: * Return the remote version of this object.
173: *
174: * @return the client side object.
175: */
176: Process toProcess();
177: }
|