Source Code Cross Referenced for ToolAgent.java in  » Workflow-Engines » shark » org » enhydra » shark » api » internal » toolagent » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » shark » org.enhydra.shark.api.internal.toolagent 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.shark.api.internal.toolagent;
002:
003:        import org.enhydra.shark.api.client.wfmc.wapi.WMConnectInfo;
004:        import org.enhydra.shark.api.client.wfmc.wapi.WMSessionHandle;
005:        import org.enhydra.shark.api.client.wfservice.WMEntity;
006:        import org.enhydra.shark.api.internal.working.CallbackUtilities;
007:
008:        /**
009:         * This interface is based on WfMC's definition of ToolAgents. It is pretty
010:         * close to the WfMC's specification, but expressed in Object oriented way.
011:         * <p>The following is different then WfMC spec proposes:
012:         * <ul>
013:         * <li> Every method is throwing additional {@link ToolAgentGeneralException}
014:         * <li> {@link AppParameter} class is different then WfMC's WMTPAttribute type -
015:         * it defines some additional fields.
016:         * <li> It has additional configure() method, that is used to pass
017:         * {@link CallbackUtilities} to tool agent, which provides ToolAgent to get
018:         * some configuration information from Shark, and provides a way to log tool
019:         * agent events.
020:         * <li> It has additional getInfo() method, that is used to get some information
021:         * about tool agent.
022:         * </ul>
023:         * <p> Also, when calling invokeApplication() method, as the first {@link AppParameter}
024:         * parameter in array, Shark is always passing a string representing
025:         * ExtendedAttributes section of the corresponding XPDL application, chopped
026:         * out from the XPDL definition, i.e.:
027:         * <pre>
028:         * &lt;ExtendedAttributes&gt;
029:         *    &lt;ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaScriptToolAgent"/&gt;
030:         *    &lt;ExtendedAttribute Name="Script" Value="java.lang.Thread.sleep(wait_ms);"/&gt;
031:         * &lt;/ExtendedAttributes&gt;
032:         * </pre>
033:         * <p> Shark uses tool agents like the following:
034:         * <ul>
035:         * <li> It aquires ToolAgent instance from {@link ToolAgentManager}. When it
036:         * creates ToolAgent instance, {@link ToolAgentManager} implementation has to
037:         * call ToolAgent's configure() method.
038:         * <li> It calls connect() method, and gets handle to ToolAgent
039:         * <li> It calls invokeApplication() method (the {@link AppParameter} array
040:         * passed to this method should be considered to be passed as a value, not as
041:         * a reference, because Shark doesn't care about it after calling this method).
042:         * <li> It calls requestAppStatus() method. Tool agent implementation
043:         * has to fill the {@link AppParameter} array that Shark passes to this method,
044:         * with the values of appropriate parameters (These parameters are the one
045:         * passed in invokeApplication() method call, that could be changed
046:         * during tool agent execution). It also expects the information on application
047:         * status to be returned, and in our standard implementation, if the status is
048:         * equal to -1, shark throws exception (Of course, ToolAgent can also signal an
049:         * exception to shark by throwing any of defined exceptions for a method).
050:         * <li> finally, shark calls disconnect().
051:         * </ul>
052:         *
053:         * @author Sasa Bojanic
054:         * @author Vladimir Puskas
055:         */
056:        public interface ToolAgent {
057:            public static final long APP_STATUS_INVALID = -1;
058:            public static final long APP_STATUS_RUNNING = 0;
059:            public static final long APP_STATUS_ACTIVE = 1;
060:            public static final long APP_STATUS_WAITING = 2;
061:            public static final long APP_STATUS_TERMINATED = 3;
062:            public static final long APP_STATUS_FINISHED = 4;
063:
064:            /**
065:             * Used to configure tool agent if needed.
066:             */
067:            void configure(CallbackUtilities cus) throws Exception;
068:
069:            /**
070:             * This is the first method that shark calls when accessing some tool agent.
071:             *
072:             * @param wmci structure holding connection request data
073:             *
074:             * @return   a SessionHandle.
075:             *
076:             * @throws   ConnectFailed       If application executed by tool agent needs
077:             * authentication, and userId and/or password are not valid
078:             * @throws   ToolAgentGeneralException If something unexpected happens.
079:             *
080:             */
081:            WMSessionHandle connect(WMConnectInfo wmci) throws ConnectFailed,
082:                    ToolAgentGeneralException;
083:
084:            /**
085:             * Method disconnect.
086:             *
087:             * @param    shandle             a  SessionHandle.
088:             *
089:             * @throws   InvalidSessionHandle      If the given session handle is not valid.
090:             * @throws   ToolAgentGeneralException If something unexpected happens.
091:             *
092:             */
093:            void disconnect(WMSessionHandle shandle)
094:                    throws InvalidSessionHandle, ToolAgentGeneralException;
095:
096:            /**
097:             * Executes tool agent application.
098:             *
099:             * @param    handle              a  long representing unique session Id.
100:             * @param    applicationName     the name of application which will be
101:             * executed by this tool agent
102:             * @param    processInstanceId   Id of process instance for which tool
103:             * agent application is called.
104:             * @param    workitemId          Id of assignment that is associated with
105:             * invoked application.
106:             * @param    parameters          array of parameters (engine variables)
107:             * passed to tool agent application. Some of these parameters will be changed
108:             * during application execution. These parameters should be considered the
109:             * input ones - the engine will not read there value after this method is
110:             * finished, but it will give to the {@link #requestAppStatus} method
111:             * the array of parameters to be filled with the result of tool agent
112:             * application execution.
113:             * <p> The value field of the first parameter in the parameter array
114:             * is always a string representing ExtendedAttributes section of the
115:             * corresponding XPDL application, chopped out from the XPDL definition, i.e.:
116:             * <pre>
117:             * &lt;ExtendedAttributes&gt;
118:             *    &lt;ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaScriptToolAgent"/&gt;
119:             *    &lt;ExtendedAttribute Name="Script" Value="java.lang.Thread.sleep(wait_ms);"/&gt;
120:             * &lt;/ExtendedAttributes&gt;
121:             * </pre>
122:             * @param    applicationMode        an Integer representing application mode.
123:             *
124:             * @throws   ApplicationNotStarted  If application can't be started.
125:             * @throws   ApplicationNotDefined  If there is no such application.
126:             * @throws   ApplicationBusy        If application is bussy.
127:             * @throws   ToolAgentGeneralException If something unexpected happens.
128:             *
129:             */
130:            void invokeApplication(WMSessionHandle shandle, long handle,
131:                    WMEntity appInfo, WMEntity toolInfo,
132:                    String applicationName, String processInstanceId,
133:                    String workitemId, AppParameter[] parameters,
134:                    Integer applicationMode) throws ApplicationNotStarted,
135:                    ApplicationNotDefined, ApplicationBusy,
136:                    ToolAgentGeneralException;
137:
138:            /**
139:             * Returns the status of tool agent application execution, and fills
140:             * the parameters with the results of tool agent application execution.
141:             *
142:             * @param    handle              a  long representing unique session Id.
143:             * @param    processInstanceId   Id of process instance for which tool
144:             * agent application is called.
145:             * @param    workitemId          Id of assignment that is associated with
146:             * invoked application.
147:             * @param    parameters          array of parameters (engine variables)
148:             * passed to application. This is a subset of parameters passed to the
149:             * invokeApplication() method, and these parameters need to be filled with
150:             * the result of tool agent's application execution.
151:             *
152:             * @return   The status of tool agent application.
153:             *
154:             * @throws   ApplicationBusy        If application is bussy.
155:             * @throws   InvalidToolAgentHandle If handle is invalid.
156:             * @throws   InvalidWorkitem        If there is no such workitem as the one
157:             * represented by given Id parameters.
158:             * @throws   InvalidProcessInstance If there is no process instance with
159:             * given Id.
160:             * @throws   ToolAgentGeneralException If something unexpected happens.
161:             *
162:             */
163:            long requestAppStatus(WMSessionHandle shandle, long handle,
164:                    WMEntity toolInfo, String processInstanceId,
165:                    String workitemId, AppParameter[] parameters)
166:                    throws ApplicationBusy, InvalidToolAgentHandle,
167:                    InvalidWorkitem, InvalidProcessInstance,
168:                    ToolAgentGeneralException;
169:
170:            /**
171:             * Terminates tool agent application.
172:             *
173:             * @param    handle              long representing unique session Id.
174:             * @param    processInstanceId   Id of process instance for which tool
175:             * agent application is called.
176:             * @param    workitemId          Id of assignment that is associated with
177:             * invoked application.
178:             *
179:             * @throws   ApplicationNotStopped  If application can't be stopped.
180:             * @throws   InvalidWorkitem        If there is no such workitem as the one
181:             * represented by given Id parameters.
182:             * @throws   InvalidProcessInstance If there is no process instance with
183:             * given Id.
184:             * @throws   ApplicationBusy        If application is bussy.
185:             * @throws   ToolAgentGeneralException If something unexpected happens.
186:             *
187:             */
188:            void terminateApp(WMSessionHandle shandle, long handle,
189:                    WMEntity toolInfo, String processInstanceId,
190:                    String workitemId) throws ApplicationNotStopped,
191:                    InvalidWorkitem, InvalidProcessInstance, ApplicationBusy,
192:                    ToolAgentGeneralException;
193:
194:            /**
195:             * Method getInfo.
196:             *
197:             * @return   a String representing brief description on tool agent use.
198:             *
199:             * @throws   ToolAgentGeneralException
200:             *
201:             */
202:            String getInfo(WMSessionHandle shandle)
203:                    throws ToolAgentGeneralException;
204:
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.