Source Code Cross Referenced for WfRequesterSSBean.java in  » Workflow-Engines » shark » org » enhydra » shark » ejb » 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.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* WfRequesterSSBean.java */
002:        package org.enhydra.shark.ejb;
003:
004:        import java.rmi.RemoteException;
005:
006:        import javax.ejb.EJBException;
007:        import javax.ejb.EJBObject;
008:        import javax.ejb.SessionBean;
009:        import javax.ejb.SessionContext;
010:        import javax.naming.Context;
011:        import javax.naming.InitialContext;
012:        import javax.rmi.PortableRemoteObject;
013:
014:        import org.enhydra.shark.api.client.wfmodel.InvalidPerformer;
015:        import org.enhydra.shark.api.client.wfmodel.WfEventAudit;
016:        import org.enhydra.shark.api.client.wfmodel.WfProcess;
017:        import org.enhydra.shark.api.client.wfmodel.WfProcessIterator;
018:        import org.enhydra.shark.api.client.wfmodel.WfRequester;
019:
020:        /**
021:         * @ejb.bean 
022:         *    name="WfRequesterSS"
023:         *    type="Stateful"
024:         *    display-name="WfRequester"
025:         *    jndi-name="org/enhydra/shark/ejb/WfRequesterSS"
026:         *    local-jndi-name="org/enhydra/shark/ejb/WfRequesterSSLocal"
027:         *    transaction-type="Container"
028:         *    view-type="both"
029:         *    local-business-interface="org.enhydra.shark.api.client.wfmodel.WfRequester"
030:         *
031:         * @ejb.ejb-ref ejb-name="WfProcessIteratorSS"
032:         *           view-type="both"
033:         *           ref-name="org/enhydra/shark/ejb/WfProcessIteratorSS" 
034:         * @ejb.ejb-ref ejb-name="WfProcessSS"
035:         *           view-type="both"
036:         *           ref-name="org/enhydra/shark/ejb/WfProcessSS" 
037:         * @ejb.ejb-ref ejb-name="WfAssignmentEventAuditSS"
038:         *           view-type="both"
039:         *           ref-name="org/enhydra/shark/ejb/WfAssignmentEventAuditSS" 
040:         * @ejb.ejb-ref ejb-name="WfCreateProcessEventAuditSS"
041:         *           view-type="both"
042:         *           ref-name="org/enhydra/shark/ejb/WfCreateProcessEventAuditSS" 
043:         * @ejb.ejb-ref ejb-name="WfDataEventAuditSS"
044:         *           view-type="both"
045:         *           ref-name="org/enhydra/shark/ejb/WfDataEventAuditSS" 
046:         * @ejb.ejb-ref ejb-name="WfPackageEventAuditSS"
047:         *           view-type="both"
048:         *           ref-name="org/enhydra/shark/ejb/WfPackageEventAuditSS"  
049:         * @ejb.ejb-ref ejb-name="WfStateEventAuditSS"
050:         *           view-type="both"
051:         *           ref-name="org/enhydra/shark/ejb/WfStateEventAuditSS" 
052:         *           
053:         * @ejb:interface
054:         *      extends="org.enhydra.shark.api.client.wfmodel.WfRequester,javax.ejb.EJBObject"
055:         *
056:         * @ejb:transaction
057:         *    type="Required"
058:         *
059:         * @jonas:bean
060:         *    ejb-name="WfRequesterSS"
061:         *    jndi-name="org/enhydra/shark/ejb/WfRequesterSS"
062:         *    
063:         * OMG definition: WfRequester is the interface that has a direct concern with the
064:         * execution and results of a workflow process - it represents the request for some work
065:         * to be done. Its performer, a WfProcess, is expected to handle its request and
066:         * communicate significant status changes; in particular to inform the requester when it
067:         * has completed performing the requested work. A single requester can have many processes
068:         * associated with it.
069:         * <p>
070:         * Often WfRequester will also be the interface to the object that starts the process. As
071:         * a process starter some of the control actions on the process include setting up the
072:         * context, starting the process, and getting results and status. There are two usage
073:         * scenarios for the association of a WfProcess with a WfRequester:
074:         * <p>
075:         * 1. Nesting of workflow processes - a WfActivity can be refined into a WfRequester and
076:         * may therefore request that a WfProcess be its performer (i.e., implementation). In this
077:         * case, the WfActivity would be registered as the requester with the implementing
078:         * sub-process when the WfProcess is created and would receive notifications of status
079:         * changes of that sub-process; upon completion of the subprocess, the WfActivity would
080:         * enter completed state.
081:         * <p>
082:         * 2. Linking a workflow process to another (initiating or controlling) application. When
083:         * used as a linked process the requester should be a WfRequester, which is not the
084:         * linking WfActivity. Requesters that are not activities are roles or adapters for
085:         * external clients.
086:         * <p>
087:         * We extended OMG's interface by duplicating methods, and adding additional parameter
088:         * that represents transaction. If you use methods without SharkTransaction parameter, the
089:         * transaction will be implicitly created, and if you use it with SharkTransaction
090:         * parameter you must obey to some rules explained in HowTo documentation.
091:         * <p>
092:         * Also, we require that WfRequester implement Serializable interface.
093:         *
094:         * @author V.Puskas
095:         * @author S.Bojanic
096:         * @author T.Jovanovic
097:         * @version 0.1
098:         */
099:        public abstract class WfRequesterSSBean implements  WfRequester,
100:                SessionBean { // interface is serializable
101:
102:            private SessionContext context;
103:            private org.enhydra.shark.api.client.wfmodel.WfRequester sharkObj;
104:
105:            /**
106:             * @ejb:interface-method
107:             * view-type="both"
108:             * Zero or more WfProcesses can be associated with a WfRequester. A requester is
109:             * associated with a WfProcess when the process is created.
110:             * <p>
111:             * The following operation provide the information about the number of WfProcess items
112:             * currently associated with a WfRequester.
113:             */
114:            public int how_many_performer() throws Exception {
115:                return sharkObj.how_many_performer();
116:            }
117:
118:            /**
119:             * @ejb:interface-method
120:             * view-type="both"
121:             * Zero or more WfProcesses can be associated with a WfRequester. A requester is
122:             * associated with a WfProcess when the process is created.
123:             * <p>
124:             * The following operation returns iterator for qurying associated processes based on
125:             * some criteria.
126:             */
127:            public WfProcessIterator get_iterator_performer() throws Exception {
128:                WfProcessIterator wfshark = sharkObj.get_iterator_performer();
129:                WfProcessIteratorSS wf = null;
130:                try {
131:                    Context initialContext = EJBJNDIContext.getInstance()
132:                            .getInitialContext();
133:                    wf = ((org.enhydra.shark.ejb.WfProcessIteratorSSHome) PortableRemoteObject
134:                            .narrow(
135:                                    initialContext
136:                                            .lookup("org/enhydra/shark/ejb/WfProcessIteratorSS"),
137:                                    org.enhydra.shark.ejb.WfProcessIteratorSSHome.class))
138:                            .create(wfshark);
139:                    return (WfProcessIteratorSS) wf.getPassedEJBObject();
140:                } catch (Exception ex) {
141:                    throw new EJBException(ex);
142:                }
143:            }
144:
145:            /**
146:             * @ejb:interface-method
147:             * view-type="both"
148:             * Zero or more WfProcesses can be associated with a WfRequester. A requester is
149:             * associated with a WfProcess when the process is created.
150:             * <p>
151:             * The following operation returns max_number of WfProcess objects associated with an
152:             * WfRequester. If max_number is less or eaqual to zero, or it is greater than the
153:             * number of existing processes, all associated WfProcess objects will be returned.
154:             */
155:            public WfProcess[] get_sequence_performer(int max_number)
156:                    throws Exception {
157:                WfProcess[] wfsshark = sharkObj
158:                        .get_sequence_performer(max_number);
159:                WfProcessSSHome home = null;
160:                InitialContext initialContext = EJBJNDIContext.getInstance()
161:                        .getInitialContext();
162:                home = (WfProcessSSHome) PortableRemoteObject.narrow(
163:                        initialContext
164:                                .lookup("org/enhydra/shark/ejb/WfProcessSS"),
165:                        org.enhydra.shark.ejb.WfProcessSSHome.class);
166:                int len = wfsshark.length;
167:                WfProcessSS[] remotes = new WfProcessSS[len];
168:                for (int i = 0; i < len; i++) {
169:                    remotes[i] = (WfProcessSS) (home.create(wfsshark[i]))
170:                            .getPassedEJBObject();
171:                }
172:                return remotes;
173:            }
174:
175:            /**
176:             * @ejb:interface-method
177:             * view-type="both"
178:             * Zero or more WfProcesses can be associated with a WfRequester. A requester is
179:             * associated with a WfProcess when the process is created.
180:             * <p>
181:             * The following operation returns true if given process is associated with
182:             * WfRequester.
183:             */
184:            public boolean is_member_of_performer(WfProcess member)
185:                    throws Exception {
186:                try {
187:                    boolean ret = false;
188:                    WfProcess[] perfs = sharkObj.get_sequence_performer(0);
189:                    if (perfs != null) {
190:                        for (int i = 0; i < perfs.length; i++) {
191:                            WfProcess perf = perfs[i];
192:                            if (perf.key().equals(member.key())) {
193:                                ret = true;
194:                                break;
195:                            }
196:                        }
197:                    }
198:                    return ret;
199:                } catch (Exception ex) {
200:                    throw new EJBException(ex);
201:                }
202:            }
203:
204:            /**
205:             * @ejb:interface-method
206:             * view-type="both"
207:             * The following operation is used by WfProcess to notify its requester of workflow
208:             * events. In particular the WfProcess must notify the requester of complete,
209:             * terminate, or abort events or the transition to a closed state.
210:             * <p>
211:             * The workflow event contains the source of the event; an InvalidPerformer exception
212:             * is raised if the source of the event is not a performer associated with the
213:             * WfRequester.
214:             */
215:            public void receive_event(WfEventAudit event) throws Exception,
216:                    InvalidPerformer {
217:                /*try {
218:                	WfEventAudit eaudit = event.getWfEventAudit(); 
219:                	reqInternal.receive_event(eaudit);
220:                } catch (InvalidPerformer ex) {
221:                	throw new InvalidPerformer();
222:                } catch (Exception ex) {
223:                	throw new EJBException(ex);
224:                }
225:                 */
226:            }
227:
228:            /**
229:             * @ejb.interface-method
230:             *	view-type="both" 
231:             **/
232:            public EJBObject getPassedEJBObject() throws EJBException {
233:                try {
234:                    return context.getEJBObject();
235:                } catch (Exception ex) {
236:                    throw new EJBException(ex);
237:                }
238:            }
239:
240:            public void setSessionContext(SessionContext ctx)
241:                    throws EJBException, RemoteException {
242:                context = ctx;
243:            }
244:
245:            /**
246:             * @ejb:create-method
247:             */
248:            public void ejbCreate(
249:                    org.enhydra.shark.api.client.wfmodel.WfRequester req) {
250:                sharkObj = req;
251:            }
252:
253:            /* (non-Javadoc)
254:             * @see javax.ejb.SessionBean#ejbActivate()
255:             */
256:            public void ejbActivate() throws EJBException, RemoteException {
257:            }
258:
259:            /* (non-Javadoc)
260:             * @see javax.ejb.SessionBean#ejbPassivate()
261:             */
262:            public void ejbPassivate() throws EJBException, RemoteException {
263:            }
264:
265:            /* (non-Javadoc)
266:             * @see javax.ejb.SessionBean#ejbRemove()
267:             */
268:            public void ejbRemove() throws EJBException, RemoteException {
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.