de.danet.an.workflow.spis.aii

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 » wfmopen 2.1.1 » de.danet.an.workflow.spis.aii 
de.danet.an.workflow.spis.aii

This package defines the application invocation interface used by the workflow package to invoke tool agents that control applications.

Java classes that are to be used as tool agents must implement the interface {@link de.danet.an.workflow.spis.aii.ToolAgent ToolAgent}. Tool agents are declared in a workflow using the application tag in the XPDL. This declaration is associated with the implementation class of ToolAgent using an extension. The extension syntax supported allows to specify the Java class to use and additional properties of the tool agent (see the User Manual for details).

Note that a tool agent can be implemented with full functionallity based on the tool agent interface only. The remainder of this package description explains how tool agent implementation may be simplified and how the performance of tool agent invocations may be improved. As with the {@link de.danet.an.workflow.api client API}, we have tried to keep this extended interface as independant of the implementation framework (J2EE) as possible. However, this attempt is limited by requirements imposed by transaction handling. While the interfaces could be kept clean of dependencies on J2EE interfaces or classes, their usage pattern is partially motivated by EJB transaction semantics.

From the workflow engine's point of view, tool agent invocation is asynchronous, i.e. it does not expect a result from the {@link de.danet.an.workflow.spis.aii.ToolAgent#invoke invoke} method. The invoked application must at some point in time call {@link de.danet.an.workflow.omgcore.WfActivity#setResult WfActivity.setResult} and {@link de.danet.an.workflow.omgcore.WfActivity#complete WfActivity.complete} to signal completion of its work. Although the tool agent model assumes that this is done "later" (e.g. by the application process), these calls may also be made in the implementation of the invoke method, thus effectively combining the tool agent with the application that it controls (making the tool agent a tool).

If you try to call setResult and complete in the invoke method of your tool implementation, you'll sooner or later notice that these methods (being remote calls) may throw RemoteExceptions, indicating some temporary failure. If you do not handle these exceptions, they will be handled by the workflow engine and your tool will simply be re-invoked. If, however, your invoke method is "expensive" or has side effects, you may not want it to be re-executed because of a temporary failure during setResult or complete.

Consequently, you put a while loop around these calls, repeating them until they run without a RemoteException. Regrettably, this is where EJB semantics come in. While the repeat pattern works in a stand-alone EJB client, it won't work here because invoke is called in the context of an EJB method and the RemoteException from setResult or complete is noticed by the EJB container, and the complete tool agent invocation transaction will be rolled back. So you have to execute the calls to setResult and complete in a new transaction. This is what {@link de.danet.an.workflow.spis.aii.ToolAgentContext#finishActivity ToolAgentContext.finishActivity} has been defined for. This method calls setResult and complete in a new transaction (and repeats the calls until no RemoteException is thrown). If you want to use this method (or another method from the tool agent context), your tool agent must implement {@link de.danet.an.workflow.spis.aii.ContextRequester ContextRequester} in order to receive the context before invoke is called.

Having a closer look at transactions, there is a drawback to the solution described above. If we look at open transactions, we find that there is one transaction handling the tool invocation; this has been suspended for a new transaction that executes the actual tool agent invocation (this must be done in its own transaction, else the workflow engine cannot terminate an activity if an exception is thrown by the tool agent as, again, the invoking transaction would be marked for rollback by the application server). By calling finishActivity during invoke, the transaction executing the tool invocation will also be suspended in favour of the transaction that finishes the activity. This situation may, under certain circumstances lead to deadlocks.

To avoid these "excessive" nested transaction suspends, the calls to setResult and complete should better be done after tool invocation by the the same transaction that has invoked the tool. Tools (i.e. tool agents that want to return a result and complete the activity during invoke) should therefore implement {@link de.danet.an.workflow.spis.aii.ResultProvider ResultProvider}. This allows the tool to simply leave the result evaluated during invoke in an attribute from where it will be retrieved after invoke by the workflow engine. The workflow engine then calls setResult and complete on the activity. Besides avoiding transaction problems, usage of ResultProvider actually simplifies the tool implementation.

@since V1.0
Java Source File NameTypeComment
ApplicationNotStoppedException.javaClass This exception is thrown by a ToolAgentToolAgent if it cannot ToolAgent.terminateterminate the execution of a running application.
CannotExecuteException.javaClass This exception is thrown by a ToolAgentToolAgent if it cannot execute a given activity.

As of version 1.3.2, this exception can be used as a wrapper for an exception that caused the tool failure.

ContextRequester.javaInterface This interface marks a ToolAgent ToolAgent as a requester of a ToolAgentContextToolAgentContext .
ExceptionMappingProvider.javaInterface This interface must be implemented by ToolAgents that want the workflow engine to map the causes of CannotExecuteExceptionCannotExecuteExceptions to process exceptions that cause the current activity to be abandoned.
ExecutionModeProvider.javaInterface This interface can be implemented by ToolAgentToolAgents that provide information about their preferred execution mode.

Note that if a tool agent implements this interface, the mode returned by executionMode overrides any settings in XPDL.

ResultProvider.javaInterface This interface marks a ToolAgent as provider of a result during invoke.
ToolAgent.javaInterface This interface is used to control applications that execute work items.
ToolAgentContext.javaInterface This interface defines methods of the workflow engine that are available to a tool agent.
XMLArgumentTypeProvider.javaInterface This interface can be implemented by ToolAgentToolAgents that provide information about the accepted coding of arguments that describe XML data.

Note that if a tool agent implements this interface, the type returned by requestedXMLArgumentType overrides any settings in XPDL.

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.