Source Code Cross Referenced for EJBWorkflow.java in  » Workflow-Engines » OSWorkflow » com » opensymphony » workflow » 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 » OSWorkflow » com.opensymphony.workflow.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.workflow.ejb;
006:
007:        import com.opensymphony.module.propertyset.PropertySet;
008:
009:        import com.opensymphony.util.EJBUtils;
010:
011:        import com.opensymphony.workflow.*;
012:        import com.opensymphony.workflow.config.Configuration;
013:        import com.opensymphony.workflow.loader.WorkflowDescriptor;
014:        import com.opensymphony.workflow.query.WorkflowExpressionQuery;
015:        import com.opensymphony.workflow.query.WorkflowQuery;
016:        import com.opensymphony.workflow.spi.WorkflowEntry;
017:
018:        import org.apache.commons.logging.Log;
019:        import org.apache.commons.logging.LogFactory;
020:
021:        import java.rmi.RemoteException;
022:
023:        import java.util.Collections;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import javax.ejb.CreateException;
028:
029:        import javax.naming.NamingException;
030:
031:        /**
032:         * EJB based workflow class.
033:         * This class acts as a wrapper around a workflow session bean.
034:         *
035:         * @author plightbo
036:         * @version $Revision: 1.13 $
037:         */
038:        public class EJBWorkflow implements  Workflow {
039:            //~ Static fields/initializers /////////////////////////////////////////////
040:
041:            private static final Log log = LogFactory.getLog(EJBWorkflow.class);
042:
043:            //~ Instance fields ////////////////////////////////////////////////////////
044:
045:            private WorkflowRemote wf;
046:
047:            //~ Constructors ///////////////////////////////////////////////////////////
048:
049:            public EJBWorkflow(String location) throws CreateException,
050:                    RemoteException, WorkflowException {
051:                WorkflowHome home = null;
052:
053:                try {
054:                    home = (WorkflowHome) EJBUtils.lookup(location,
055:                            WorkflowHome.class);
056:                } catch (NamingException e) {
057:                    try {
058:                        home = (WorkflowHome) EJBUtils.lookup(
059:                                WorkflowHomeFactory.COMP_NAME,
060:                                WorkflowHome.class);
061:                    } catch (NamingException e1) {
062:                        try {
063:                            home = (WorkflowHome) EJBUtils.lookup(
064:                                    WorkflowHomeFactory.JNDI_NAME,
065:                                    WorkflowHome.class);
066:                        } catch (NamingException e2) {
067:                            throw new WorkflowException(
068:                                    "Could not get a handle on the workflow Home EJB",
069:                                    e);
070:                        }
071:                    }
072:                }
073:
074:                wf = home.create();
075:            }
076:
077:            public EJBWorkflow() throws CreateException, RemoteException,
078:                    WorkflowException {
079:                this (WorkflowHomeFactory.JNDI_NAME);
080:            }
081:
082:            //~ Methods ////////////////////////////////////////////////////////////////
083:
084:            public int[] getAvailableActions(long id) {
085:                try {
086:                    return wf.getAvailableActions(id);
087:                } catch (RemoteException e) {
088:                    log.error("Error getting available actions", e);
089:
090:                    return new int[0];
091:                }
092:            }
093:
094:            public int[] getAvailableActions(long id, Map inputs) {
095:                try {
096:                    return wf.getAvailableActions(id, inputs);
097:                } catch (RemoteException e) {
098:                    log.error("Error getting available actions", e);
099:
100:                    return new int[0];
101:                }
102:            }
103:
104:            public void setConfiguration(Configuration configuration) {
105:                try {
106:                    wf.setConfiguration(configuration);
107:                } catch (RemoteException e) {
108:                    log.fatal("Error setting configuration", e);
109:                }
110:            }
111:
112:            public List getCurrentSteps(long id) {
113:                try {
114:                    return wf.getCurrentSteps(id);
115:                } catch (RemoteException e) {
116:                    log.error("Error getting current steps", e);
117:
118:                    return Collections.EMPTY_LIST;
119:                }
120:            }
121:
122:            public int getEntryState(long id) {
123:                try {
124:                    return wf.getEntryState(id);
125:                } catch (RemoteException e) {
126:                    log.error("Error getting entry state", e);
127:
128:                    return WorkflowEntry.UNKNOWN;
129:                }
130:            }
131:
132:            public List getHistorySteps(long id) {
133:                try {
134:                    return wf.getHistorySteps(id);
135:                } catch (RemoteException e) {
136:                    log.error("Error getting history steps", e);
137:
138:                    return Collections.EMPTY_LIST;
139:                }
140:            }
141:
142:            public PropertySet getPropertySet(long id) {
143:                try {
144:                    return wf.getPropertySet(id);
145:                } catch (RemoteException e) {
146:                    log.error("Error getting PropertySet", e);
147:
148:                    return null;
149:                }
150:            }
151:
152:            public List getSecurityPermissions(long id) {
153:                try {
154:                    return wf.getSecurityPermissions(id);
155:                } catch (RemoteException e) {
156:                    log.error("Error getting security permissions", e);
157:
158:                    return Collections.EMPTY_LIST;
159:                }
160:            }
161:
162:            public List getSecurityPermissions(long id, Map inputs) {
163:                try {
164:                    return wf.getSecurityPermissions(id, inputs);
165:                } catch (RemoteException e) {
166:                    log.error("Error getting security permissions", e);
167:
168:                    return Collections.EMPTY_LIST;
169:                }
170:            }
171:
172:            public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {
173:                try {
174:                    return wf.getWorkflowDescriptor(workflowName);
175:                } catch (RemoteException e) {
176:                    log.error("Error getting descriptor", e);
177:
178:                    return null;
179:                }
180:            }
181:
182:            public String getWorkflowName(long id) {
183:                try {
184:                    return wf.getWorkflowName(id);
185:                } catch (RemoteException e) {
186:                    log.error("Error getting workflow name", e);
187:
188:                    return null;
189:                }
190:            }
191:
192:            public String[] getWorkflowNames() {
193:                try {
194:                    return wf.getWorkflowNames();
195:                } catch (RemoteException e) {
196:                    log.error("Error calling getWorkflowNames", e);
197:
198:                    return new String[0];
199:                }
200:            }
201:
202:            public boolean canInitialize(String workflowName, int initialState) {
203:                try {
204:                    return wf.canInitialize(workflowName, initialState);
205:                } catch (RemoteException e) {
206:                    log.error("Error checking canInitialize", e);
207:
208:                    return false;
209:                }
210:            }
211:
212:            public boolean canInitialize(String workflowName,
213:                    int initialAction, Map inputs) {
214:                try {
215:                    return wf
216:                            .canInitialize(workflowName, initialAction, inputs);
217:                } catch (RemoteException e) {
218:                    log.error("Error checking canInitialize", e);
219:
220:                    return false;
221:                }
222:            }
223:
224:            public boolean canModifyEntryState(long id, int newState) {
225:                try {
226:                    return wf.canModifyEntryState(id, newState);
227:                } catch (RemoteException e) {
228:                    log.error("Error checking modifying entry state", e);
229:
230:                    return false;
231:                }
232:            }
233:
234:            public void changeEntryState(long id, int newState)
235:                    throws WorkflowException {
236:                try {
237:                    wf.changeEntryState(id, newState);
238:                } catch (RemoteException e) {
239:                    log.error("Error modifying entry state", e);
240:                    throw new WorkflowException(e);
241:                }
242:            }
243:
244:            public void doAction(long id, int actionId, Map inputs)
245:                    throws InvalidInputException, WorkflowException {
246:                try {
247:                    wf.doAction(id, actionId, inputs);
248:                } catch (RemoteException e) {
249:                    log.error("Error performing action", e);
250:                    throw new WorkflowException(e);
251:                }
252:            }
253:
254:            public void executeTriggerFunction(long id, int triggerId)
255:                    throws WorkflowException {
256:                try {
257:                    wf.executeTriggerFunction(id, triggerId);
258:                } catch (RemoteException e) {
259:                    log.error("Error executing trigger", e);
260:                    throw new WorkflowException(e);
261:                }
262:            }
263:
264:            public long initialize(String workflowName, int initialState,
265:                    Map inputs) throws InvalidRoleException,
266:                    InvalidInputException, WorkflowException {
267:                try {
268:                    return wf.initialize(workflowName, initialState, inputs);
269:                } catch (RemoteException e) {
270:                    log.error("Error initializing", e);
271:                    throw new WorkflowException(e);
272:                }
273:            }
274:
275:            public List query(WorkflowExpressionQuery query)
276:                    throws WorkflowException {
277:                throw new QueryNotSupportedException(
278:                        "EJB Store does not support queries");
279:            }
280:
281:            public List query(WorkflowQuery query) throws WorkflowException {
282:                throw new QueryNotSupportedException(
283:                        "EJB Store does not support queries");
284:            }
285:
286:            public boolean removeWorkflowDescriptor(String workflowName)
287:                    throws FactoryException {
288:                try {
289:                    return wf.removeWorkflowDescriptor(workflowName);
290:                } catch (RemoteException e) {
291:                    log.error("Error removing workflow " + workflowName, e);
292:
293:                    return false;
294:                }
295:            }
296:
297:            public boolean saveWorkflowDescriptor(String workflowName,
298:                    WorkflowDescriptor descriptor, boolean replace)
299:                    throws FactoryException {
300:                try {
301:                    return wf.saveWorkflowDescriptor(workflowName, descriptor,
302:                            replace);
303:                } catch (RemoteException e) {
304:                    log.error("Error saving workflow", e);
305:                    throw new FactoryException(e);
306:                }
307:            }
308:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.