Source Code Cross Referenced for WfProcessMgrSSBean.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:        /* WfProcessMgrSSBean.java */
002:        package org.enhydra.shark.ejb;
003:
004:        import java.rmi.RemoteException;
005:        import java.util.Map;
006:
007:        import javax.ejb.EJBException;
008:        import javax.ejb.EJBObject;
009:        import javax.ejb.SessionBean;
010:        import javax.ejb.SessionContext;
011:        import javax.naming.Context;
012:        import javax.naming.InitialContext;
013:        import javax.rmi.PortableRemoteObject;
014:
015:        import org.enhydra.shark.api.client.wfmodel.InvalidRequester;
016:        import org.enhydra.shark.api.client.wfmodel.NotEnabled;
017:        import org.enhydra.shark.api.client.wfmodel.RequesterRequired;
018:        import org.enhydra.shark.api.client.wfmodel.TransitionNotAllowed;
019:        import org.enhydra.shark.api.client.wfmodel.WfProcess;
020:        import org.enhydra.shark.api.client.wfmodel.WfProcessIterator;
021:        import org.enhydra.shark.api.client.wfmodel.WfProcessMgr;
022:        import org.enhydra.shark.api.client.wfmodel.WfRequester;
023:        import org.enhydra.shark.api.client.wfmodel.process_mgr_stateType;
024:
025:        /**
026:         * @ejb.bean name="WfProcessMgrSS" type="Stateful" display-name="WfProcessMgr"
027:         *           jndi-name="org/enhydra/shark/ejb/WfProcessMgrSS"
028:         *           local-jndi-name="org/enhydra/shark/ejb/WfProcessMgrSSLocal"
029:         *           transaction-type="Container" 
030:         *           view-type="both"
031:         *           local-business-interface="org.enhydra.shark.api.client.wfmodel.WfProcessMgr"
032:         * @ejb.ejb-ref ejb-name="WfProcessSS" view-type="both"
033:         *              ref-name="org/enhydra/shark/ejb/WfProcessSS"
034:         * @ejb.ejb-ref ejb-name="WfProcessIteratorSS" view-type="both"
035:         *              ref-name="org/enhydra/shark/ejb/WfProcessIteratorSS"
036:         * @ejb.ejb-ref ejb-name="WfRequesterSS" view-type="both"
037:         *              ref-name="org/enhydra/shark/ejb/WfRequesterSS"
038:         * @ejb.ejb-ref ejb-name="WfActivitySS" view-type="both"
039:         *              ref-name="org/enhydra/shark/ejb/WfActivitySS"
040:         * @ejb:interface extends="org.enhydra.shark.api.client.wfmodel.WfProcessMgr,javax.ejb.EJBObject"
041:         * @ejb:transaction type="Required"
042:         * @jonas:bean ejb-name="WfProcessMgrSS" jndi-name="org/enhydra/shark/ejb/WfProcessMgrSS"
043:         *             OMG definition: A WfProcessMgr represents a template for a specific
044:         *             workflow process; it is used to create instances of a workflow process.
045:         *             Logically it is the factory and locator for WfProcess instances. It
046:         *             provides access to the meta information about the context a process
047:         *             requires and the result a process produces. A process manager is identified
048:         *             by its name which is unique within a given business domain. It could
049:         *             located, for example, via name using the OMG Naming Service, via name and
050:         *             other attributes (e.g., category) via the OMG Trader Service, or other
051:         *             infrastructure mechanisms.
052:         *             <p>
053:         *             We extended OMG's interface by duplicating methods, and adding additional
054:         *             parameter that represents transaction. If you use methods without
055:         *             SharkTransaction parameter, the transaction will be implicitly created, and
056:         *             if you use it with SharkTransaction parameter you must obey to some rules
057:         *             explained in HowTo documentation.
058:         * @author V.Puskas
059:         * @author S.Bojanic
060:         * @author T.Jovanovic
061:         * @version 0.1
062:         */
063:        public abstract class WfProcessMgrSSBean implements  WfProcessMgr,
064:                SessionBean {
065:
066:            private SessionContext context;
067:
068:            private org.enhydra.shark.api.client.wfmodel.WfProcessMgr sharkObj;
069:
070:            /**
071:             * @ejb:interface-method view-type="both" Zero or more WfProcesses are associated
072:             *                       with the WfProcessMgr that was used to create them. The
073:             *                       association is established when a WfProcess is created.
074:             *                       <p>
075:             *                       The following operation provide the information about the
076:             *                       number of WfProcess items associated with a WfProcessMgr.
077:             */
078:            public int how_many_process() throws Exception {
079:                return sharkObj.how_many_process();
080:            }
081:
082:            /**
083:             * @ejb:interface-method view-type="both" Zero or more WfProcesses are associated
084:             *                       with the WfProcessMgr that was used to create them. The
085:             *                       association is established when a WfProcess is created.
086:             *                       <p>
087:             *                       The following operation returns iterator for qurying
088:             *                       associated processes based on some criteria.
089:             */
090:            public WfProcessIterator get_iterator_process() throws Exception {
091:                WfProcessIterator wfshark = sharkObj.get_iterator_process();
092:                WfProcessIteratorSS wf = null;
093:                try {
094:                    Context initialContext = EJBJNDIContext.getInstance()
095:                            .getInitialContext();
096:                    wf = ((org.enhydra.shark.ejb.WfProcessIteratorSSHome) PortableRemoteObject
097:                            .narrow(
098:                                    initialContext
099:                                            .lookup("org/enhydra/shark/ejb/WfProcessIteratorSS"),
100:                                    org.enhydra.shark.ejb.WfProcessIteratorSSHome.class))
101:                            .create(wfshark);
102:                    return (WfProcessIteratorSS) wf.getPassedEJBObject();
103:                } catch (Exception ex) {
104:                    throw new EJBException(ex);
105:                }
106:            }
107:
108:            /**
109:             * @ejb:interface-method view-type="both" Zero or more WfProcesses are associated
110:             *                       with the WfProcessMgr that was used to create them. The
111:             *                       association is established when a WfProcess is created.
112:             *                       <p>
113:             *                       The following operation returns max_number of WfProcess
114:             *                       objects associated with an WfProcessMgr. If max_number is less
115:             *                       or eaqual to zero, or it is greater than the number of
116:             *                       existing processes, all associated WfProcess objects will be
117:             *                       returned.
118:             */
119:            public WfProcess[] get_sequence_process(int max_number)
120:                    throws Exception {
121:                WfProcess[] wfsshark = sharkObj
122:                        .get_sequence_process(max_number);
123:                WfProcessSSHome home = null;
124:                InitialContext initialContext = EJBJNDIContext.getInstance()
125:                        .getInitialContext();
126:                home = (WfProcessSSHome) PortableRemoteObject.narrow(
127:                        initialContext
128:                                .lookup("org/enhydra/shark/ejb/WfProcessSS"),
129:                        org.enhydra.shark.ejb.WfProcessSSHome.class);
130:                int len = wfsshark.length;
131:                WfProcessSS[] remotes = new WfProcessSS[len];
132:                for (int i = 0; i < len; i++) {
133:                    remotes[i] = (WfProcessSS) (home.create(wfsshark[i]))
134:                            .getPassedEJBObject();
135:                }
136:                return remotes;
137:            }
138:
139:            /**
140:             * @ejb:interface-method view-type="both" Zero or more WfProcesses are associated
141:             *                       with the WfProcessMgr that was used to create them. The
142:             *                       association is established when a WfProcess is created.
143:             *                       <p>
144:             *                       The following operation returns true if given process is
145:             *                       associated with WfProcessMgr.
146:             */
147:            public boolean is_member_of_process(WfProcess member)
148:                    throws Exception {
149:                try {
150:                    WfProcess[] procs = get_sequence_process(0);
151:                    boolean ret = false;
152:                    if (procs != null) {
153:                        for (int i = 0; i < procs.length; i++) {
154:                            if (procs[i].key().equals(member.key())) {
155:                                ret = true;
156:                                break;
157:                            }
158:                        }
159:                    }
160:                    return ret;
161:                } catch (Exception ex) {
162:                    throw new EJBException(ex);
163:                }
164:            }
165:
166:            /**
167:             * @ejb:interface-method view-type="both" A WfProcessMgr can be enabled or disabled.
168:             *                       This method returns its current state.
169:             */
170:            public process_mgr_stateType process_mgr_state() throws Exception {
171:                return sharkObj.process_mgr_state();
172:            }
173:
174:            /**
175:             * @ejb:interface-method view-type="both" A WfProcessMgr can be enabled or disabled.
176:             *                       This method sets its state.
177:             */
178:            public void set_process_mgr_state(process_mgr_stateType new_state)
179:                    throws Exception, TransitionNotAllowed {
180:                sharkObj.set_process_mgr_state(new_state);
181:            }
182:
183:            /**
184:             * @ejb:interface-method view-type="both" Returns the name of the process manager.
185:             *                       The name uniquely identifies the process manager in a business
186:             *                       domain. It is set when the process manager is initialized and
187:             *                       cannot be modified.
188:             */
189:            public String name() throws Exception {
190:                return sharkObj.name();
191:            }
192:
193:            /**
194:             * @ejb:interface-method view-type="both" Returns description of the process manager.
195:             *                       It is set when the process manager is initialized and cannot
196:             *                       be modified.
197:             */
198:            public String description() throws Exception {
199:                return sharkObj.description();
200:            }
201:
202:            /**
203:             * @ejb:interface-method view-type="both" The category of a process manager is used
204:             *                       for classification of process types. It is set when the
205:             *                       process manager is initialized and cannot be modified.
206:             */
207:            public String category() throws Exception {
208:                return sharkObj.category();
209:            }
210:
211:            /**
212:             * @ejb:interface-method view-type="both" The version attribute of a process manager
213:             *                       is used to distinguish between different versions of a process
214:             *                       model. Note that this is a means to distinguish between
215:             *                       different process managers that have the same name; it is left
216:             *                       to the implementation to define the format of the version
217:             *                       attribute. It is set when the process manager is initialized
218:             *                       and cannot be modified.
219:             */
220:            public String version() throws Exception {
221:                return sharkObj.version();
222:            }
223:
224:            /**
225:             * @ejb:interface-method view-type="both" Meta information that defines how to set
226:             *                       the context of an instance of this interface is returned by
227:             *                       this operation.
228:             *                       <p>
229:             *                       The Map entry identifies the name and the data type
230:             *                       (represented by its string name) of the data item. Map
231:             *                       contains an entry for each data item in the set of context.
232:             */
233:            public Map context_signature() throws Exception {
234:                return sharkObj.context_signature();
235:            }
236:
237:            /**
238:             * @ejb:interface-method view-type="both" Meta information that defines how to return
239:             *                       the result of an instance of this interface is returned by
240:             *                       this operation.
241:             *                       <p>
242:             *                       The Map entry identifies the name and the data type
243:             *                       (represented by its string name) of the data item. Map
244:             *                       contains an entry for each data item in the set of result data
245:             *                       for the WfProcess.
246:             */
247:            public Map result_signature() throws Exception {
248:                return sharkObj.result_signature();
249:            }
250:
251:            /**
252:             * @ejb:interface-method view-type="both" This operation is used to create instances
253:             *                       of a process model and link its requester. When the process is
254:             *                       created it enters state not_running.not_started.
255:             *                       <p>
256:             *                       It is up to the implementation of the WfM Facility to decide
257:             *                       which WfRequester objects to accept or not. When a WfRequester
258:             *                       is rejected, the invoking application might decide not to
259:             *                       register a WfRequester with the WfProcess.
260:             * @param requester a WfRequester
261:             * @return a WfProcess
262:             * @throws Exception
263:             * @throws NotEnabled raised when the process manager is disabled.
264:             * @throws InvalidRequester raised when a WfRequester is being identified that cannot
265:             *            be a 'parent' of instances of the process model.
266:             * @throws RequesterRequired raised when the process definition requires a WfRequester
267:             *            and an invalid WfRequester is supplied in the parameter.
268:             */
269:            public WfProcess create_process(WfRequester requester)
270:                    throws Exception, NotEnabled, InvalidRequester,
271:                    RequesterRequired {
272:                if (requester instanceof  WfActivitySS)
273:                    throw new EJBException("Requester is WfActivityEJB.");
274:                try {
275:                    WfLinkingRequesterForSS lr = new WfLinkingRequesterForSS();
276:                    WfProcess wfshark = sharkObj.create_process(lr);
277:                    WfLinkingRequesterForSS.setRequester(wfshark.key(),
278:                            (WfRequesterSS) requester);
279:
280:                    WfProcessSS wf = null;
281:                    try {
282:                        Context initialContext = EJBJNDIContext.getInstance()
283:                                .getInitialContext();
284:                        wf = ((org.enhydra.shark.ejb.WfProcessSSHome) PortableRemoteObject
285:                                .narrow(
286:                                        initialContext
287:                                                .lookup("org/enhydra/shark/ejb/WfProcessSS"),
288:                                        org.enhydra.shark.ejb.WfProcessSSHome.class))
289:                                .create(wfshark);
290:                        return (WfProcessSS) wf.getPassedEJBObject();
291:                    } catch (Exception ex) {
292:                        throw new EJBException(ex);
293:                    }
294:                } catch (Exception ex) {
295:                    throw new EJBException(ex);
296:                }
297:            }
298:
299:            /**
300:             * @ejb.interface-method view-type="both"
301:             */
302:            public EJBObject getPassedEJBObject() throws EJBException {
303:                try {
304:                    return context.getEJBObject();
305:                } catch (Exception ex) {
306:                    throw new EJBException(ex);
307:                }
308:            }
309:
310:            public void setSessionContext(SessionContext ctx)
311:                    throws EJBException, RemoteException {
312:                context = ctx;
313:            }
314:
315:            /**
316:             * @ejb:create-method
317:             */
318:            public void ejbCreate(
319:                    org.enhydra.shark.api.client.wfmodel.WfProcessMgr manager) {
320:                sharkObj = manager;
321:            }
322:
323:            /*
324:             * (non-Javadoc)
325:             * 
326:             * @see javax.ejb.SessionBean#ejbActivate()
327:             */
328:            public void ejbActivate() throws EJBException, RemoteException {
329:            }
330:
331:            /*
332:             * (non-Javadoc)
333:             * 
334:             * @see javax.ejb.SessionBean#ejbPassivate()
335:             */
336:            public void ejbPassivate() throws EJBException, RemoteException {
337:            }
338:
339:            /*
340:             * (non-Javadoc)
341:             * 
342:             * @see javax.ejb.SessionBean#ejbRemove()
343:             */
344:            public void ejbRemove() throws EJBException, RemoteException {
345:            }
346:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.