Source Code Cross Referenced for WrappedExecutionObject.java in  » Workflow-Engines » wfmopen-2.1.1 » common » 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 » wfmopen 2.1.1 » common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: WrappedExecutionObject.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021:         *
022:         * $Log: WrappedExecutionObject.java,v $
023:         * Revision 1.2  2006/09/29 12:32:08  drmlipp
024:         * Consistently using WfMOpen as projct name now.
025:         *
026:         * Revision 1.1.1.1  2003/12/19 13:01:46  drmlipp
027:         * Updated to 1.1rc1
028:         *
029:         * Revision 1.2  2003/10/28 14:06:13  huaiyang
030:         * refactor it.
031:         *
032:         * Revision 1.1  2003/10/27 15:32:20  huaiyang
033:         * initial.
034:         *
035:         *
036:         *
037:         */
038:        package common;
039:
040:        import java.rmi.RemoteException;
041:        import java.util.Collection;
042:        import java.util.ArrayList;
043:        import java.util.Iterator;
044:
045:        import javax.naming.TimeLimitExceededException;
046:
047:        import de.danet.an.workflow.omgcore.AlreadySuspendedException;
048:        import de.danet.an.workflow.omgcore.CannotResumeException;
049:        import de.danet.an.workflow.omgcore.CannotStopException;
050:        import de.danet.an.workflow.omgcore.CannotSuspendException;
051:        import de.danet.an.workflow.omgcore.InvalidStateException;
052:        import de.danet.an.workflow.omgcore.NotRunningException;
053:        import de.danet.an.workflow.omgcore.NotSuspendedException;
054:        import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
055:        import de.danet.an.workflow.omgcore.WfExecutionObject;
056:        import de.danet.an.workflow.omgcore.WfActivity;
057:        import de.danet.an.workflow.omgcore.ProcessData;
058:        import de.danet.an.workflow.omgcore.WfExecutionObject.State;
059:
060:        import process.EventWatch;
061:
062:        /**
063:         * Describe class <code>WrappedExecutionObject</code> here.
064:         *
065:         * @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
066:         * @version 1.0
067:         */
068:        public class WrappedExecutionObject {
069:
070:            /**
071:             * Describe variable <code>wfeo</code> here.
072:             *
073:             */
074:            protected WfExecutionObject wfeo = null;
075:
076:            private EventWatch eventWatch;
077:
078:            private String awaitingState;
079:
080:            /**
081:             * Creates a new <code>WrappedExecutionObject</code> instance.
082:             *
083:             * @param wfeo a <code>WfExecutionObject</code> value
084:             */
085:            public WrappedExecutionObject(WfExecutionObject wfeo)
086:                    throws Exception {
087:                this .wfeo = wfeo;
088:                eventWatch = new EventWatch(wfeo.key());
089:            }
090:
091:            /**
092:             * Return the key.
093:             * @return the key.
094:             */
095:            public String key() {
096:                while (true) {
097:                    try {
098:                        return wfeo.key();
099:                    } catch (RemoteException re) {
100:                    }
101:                }
102:            }
103:
104:            /**
105:             * Describe <code>waitForState</code> method here.
106:             *
107:             * @param stateToCheck a <code>String</code> value
108:             * @exception Exception if an error occurs
109:             */
110:            public void setupWaitForState(String stateToCheck) throws Exception {
111:                setupWaitForState(stateToCheck, false);
112:            }
113:
114:            /**
115:             * Describe <code>waitForState</code> method here.
116:             *
117:             * @param stateToCheck a <code>String</code> value
118:             * @exception Exception if an error occurs
119:             */
120:            public void setupWaitForState(String stateToCheck, boolean log)
121:                    throws Exception {
122:                awaitingState = stateToCheck;
123:                if (this  instanceof  WrappedProcess) {
124:                    eventWatch.setup(key(), null, null, stateToCheck, log);
125:                } else {
126:                    eventWatch.setup(null, key(), null, stateToCheck, log);
127:                }
128:            }
129:
130:            public void waitForState() throws Exception {
131:                try {
132:                    eventWatch.waitForEvent();
133:                } catch (TimeLimitExceededException e) {
134:                    throw new Exception(e.getMessage());
135:                }
136:            }
137:
138:            /**
139:             * Describe <code>state</code> method here.
140:             *
141:             * @return a <code>String</code> value
142:             */
143:            public String state() {
144:                String state = "";
145:                while (true) {
146:                    try {
147:                        state = wfeo.state();
148:                        break;
149:                    } catch (RemoteException re) {
150:                    }
151:                }
152:                return state;
153:            }
154:
155:            /**
156:             * Describe <code>hasState</code> method here.
157:             *
158:             * @param stateToCheck a <code>String</code> value
159:             * @return a <code>boolean</code> value
160:             */
161:            public boolean hasState(String stateToCheck) {
162:                return state().startsWith(stateToCheck);
163:            }
164:
165:            /**
166:             * Describe <code>name</code> method here.
167:             *
168:             * @return a <code>String</code> value
169:             */
170:            public String name() {
171:                String name = "";
172:                while (true) {
173:                    try {
174:                        name = wfeo.name();
175:                        break;
176:                    } catch (RemoteException re) {
177:                    }
178:                }
179:                return name;
180:            }
181:
182:            /**
183:             * Describe <code>description</code> method here.
184:             *
185:             * @return a <code>String</code> value
186:             */
187:            public String description() {
188:                String description = "";
189:                while (true) {
190:                    try {
191:                        description = wfeo.description();
192:                        break;
193:                    } catch (RemoteException re) {
194:                    }
195:                }
196:                return description;
197:            }
198:
199:            /**
200:             * Describe <code>priority</code> method here.
201:             *
202:             * @return a <code>int</code> value
203:             */
204:            public int priority() throws RemoteException {
205:                return wfeo.priority();
206:            }
207:
208:            /**
209:             * Describe <code>priority</code> method here.
210:             *
211:             * @return a <code>int</code> value
212:             */
213:            public void setPriority(int priority) throws Exception {
214:                while (true) {
215:                    try {
216:                        wfeo.setPriority(priority);
217:                        break;
218:                    } catch (RemoteException re) {
219:                    }
220:                }
221:            }
222:
223:            /**
224:             * Sets the state of a WfExecutionObject by calling  
225:             * suspend().
226:             * The intended transition is from open.running to 
227:             * open.not_running.suspended.
228:             * @exception RemoteException if an error occurs
229:             * @exception CannotSuspendException if an error occurs
230:             * @exception NotRunningException if an error occurs
231:             * @exception AlreadySuspendedException if an error occurs
232:             * @exception InvalidStateException if an error occurs
233:             * @exception TransitionNotAllowedException if an error occurs
234:             */
235:            public void suspend() throws RemoteException,
236:                    CannotSuspendException, NotRunningException,
237:                    AlreadySuspendedException, InvalidStateException,
238:                    TransitionNotAllowedException {
239:                while (true) {
240:                    try {
241:                        wfeo.suspend();
242:                        break;
243:                    } catch (RemoteException re) {
244:                    }
245:                }
246:            }
247:
248:            /**
249:             * Sets the state of a WfExecutionObject by calling  
250:             * resume().
251:             * The intended transition is from open.not_running.suspended to 
252:             * open.running.
253:             * @exception RemoteException if an error occurs
254:             * @exception CannotResumeException if an error occurs
255:             * @exception NotRunningException if an error occurs
256:             * @exception NotSuspendedException if an error occurs
257:             * @exception InvalidStateException if an error occurs
258:             * @exception TransitionNotAllowedException if an error occurs
259:             */
260:            public void resume() throws RemoteException, CannotResumeException,
261:                    NotRunningException, NotSuspendedException,
262:                    InvalidStateException, TransitionNotAllowedException {
263:                while (true) {
264:                    try {
265:                        wfeo.resume();
266:                        break;
267:                    } catch (RemoteException re) {
268:                    }
269:                }
270:            }
271:
272:            /**
273:             * Sets the state of a WfExecutionObject by calling  
274:             * abort() (setStateDirectly == false) or by calling  
275:             * setState() (setStateDirectly == true). 
276:             * The intended transition is from open.not_running.suspended to 
277:             * closed.aborted.
278:             * @exception RemoteException if an error occurs
279:             * @exception NotRunningException if an error occurs
280:             * @exception NotSuspendedException if an error occurs
281:             * @exception InvalidStateException if an error occurs
282:             * @exception TransitionNotAllowedException if an error occurs
283:             * @exception CannotStopException if an error occurs
284:             */
285:            public void abort() throws RemoteException, NotRunningException,
286:                    NotSuspendedException, InvalidStateException,
287:                    TransitionNotAllowedException, CannotStopException {
288:                while (true) {
289:                    try {
290:                        wfeo.abort();
291:                        break;
292:                    } catch (RemoteException re) {
293:                    }
294:                }
295:            }
296:
297:            /**
298:             * Sets the state of a WfExecutionObject by calling  
299:             * terminate().
300:             * The intended transition is to 
301:             * closed.terminate.
302:             * @exception RemoteException if an error occurs
303:             * @exception CannotStopException if an error occurs
304:             * @exception InvalidStateException if an error occurs
305:             * @exception NotRunningException if an error occurs
306:             * @exception TransitionNotAllowedException if an error occurs
307:             */
308:            public void terminate() throws RemoteException,
309:                    CannotStopException, InvalidStateException,
310:                    NotRunningException, TransitionNotAllowedException {
311:                while (true) {
312:                    try {
313:                        wfeo.terminate();
314:                        break;
315:                    } catch (RemoteException re) {
316:                    }
317:                }
318:            }
319:
320:            /**
321:             * Describe <code>changeState</code> method here.
322:             *
323:             * @param state a <code>String</code> value
324:             * @exception RemoteException if an error occurs
325:             * @exception TransitionNotAllowedException if an error occurs
326:             * @exception InvalidStateException if an error occurs
327:             */
328:            public void changeState(String state) throws RemoteException,
329:                    TransitionNotAllowedException, InvalidStateException {
330:                while (true) {
331:                    try {
332:                        wfeo.changeState(state);
333:                        break;
334:                    } catch (RemoteException re) {
335:                    }
336:                }
337:            }
338:
339:            /**
340:             * Set the name of this <code>WfExecutionObject</code>.
341:             * @param newValue the description of this <code>WfExecutionObject</code>.
342:             * @throws RemoteException If a communication error occurred.
343:             */
344:            public void setName(String newValue) {
345:                while (true) {
346:                    try {
347:                        wfeo.setName(newValue);
348:                        break;
349:                    } catch (RemoteException re) {
350:                    }
351:                }
352:            }
353:
354:            /**
355:             * Set the description of this <code>WfExecutionObject</code>.
356:             * @param newValue the description of this <code>WfExecutionObject</code>.
357:             * @throws RemoteException If a communication error occurred.
358:             */
359:            public void setDescription(String newValue) {
360:                while (true) {
361:                    try {
362:                        wfeo.setDescription(newValue);
363:                        break;
364:                    } catch (RemoteException re) {
365:                    }
366:                }
367:            }
368:
369:            /**
370:             * Return the current state.
371:             *
372:             * @return the current <code>state</code>.
373:             * @throws RemoteException if a system-level error occurs.
374:             */
375:            public State workflowState() {
376:                while (true) {
377:                    try {
378:                        return wfeo.workflowState();
379:                    } catch (RemoteException re) {
380:                        // try again
381:                    }
382:                }
383:            }
384:
385:            /**
386:             * Return the context of this <code>WfExecutionObject</code>.
387:             * @return the process relevant data that define the context of the 
388:             * execution object.
389:             * @throws RemoteException If a communication error occurred.
390:             */
391:            public ProcessData processContext() {
392:                while (true) {
393:                    try {
394:                        return wfeo.processContext();
395:                    } catch (RemoteException re) {
396:                        // try again
397:                    }
398:                }
399:            }
400:
401:            public String toString() {
402:                return name() + "[key=" + key() + "]";
403:            }
404:
405:            /**
406:             * Describe <code>wrapActivities</code> method here.
407:             *
408:             * @param activityCollection a <code>Collection</code> value
409:             * @return a <code>Collection</code> value
410:             */
411:            protected Collection wrapActivities(Collection activityCollection)
412:                    throws Exception {
413:                Collection newCollection = new ArrayList();
414:                Iterator it = activityCollection.iterator();
415:                while (it.hasNext()) {
416:                    WfActivity activity = (WfActivity) it.next();
417:                    newCollection.add(new WrappedActivity(activity));
418:                }
419:                return newCollection;
420:            }
421:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.