Source Code Cross Referenced for ActivityFinder.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » ejbs » admin » 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 » de.danet.an.workflow.ejbs.admin 
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: ActivityFinder.java,v 1.4 2007/01/26 14:37:35 drmlipp Exp $
021:         *
022:         * $Log: ActivityFinder.java,v $
023:         * Revision 1.4  2007/01/26 14:37:35  drmlipp
024:         * Made access to instance id public.
025:         *
026:         * Revision 1.3  2006/09/29 12:32:10  drmlipp
027:         * Consistently using WfMOpen as projct name now.
028:         *
029:         * Revision 1.2  2005/10/17 10:44:15  drmlipp
030:         * Added serial version id.
031:         *
032:         * Revision 1.1.1.2  2004/08/18 15:17:38  drmlipp
033:         * Update to 1.2
034:         *
035:         * Revision 1.10  2004/02/21 21:52:11  lipp
036:         * Moved ActivityFinder and ProcessMgrStub back to admin package.
037:         *
038:         * Revision 1.1  2004/02/21 21:31:00  lipp
039:         * Some more refactoring to resolve cyclic dependencies.
040:         *
041:         * Revision 1.8  2003/06/27 08:51:45  lipp
042:         * Fixed copyright/license information.
043:         *
044:         * Revision 1.7  2003/05/02 14:55:59  lipp
045:         * Resolved some more package dependencies.
046:         *
047:         * Revision 1.12  2003/04/25 14:50:58  lipp
048:         * Fixed javadoc errors and warnings.
049:         *
050:         * Revision 1.11  2003/03/31 16:50:28  huaiyang
051:         * Logging using common-logging.
052:         *
053:         * Revision 1.10  2002/12/19 21:37:42  lipp
054:         * Reorganized interfaces.
055:         *
056:         * Revision 1.9  2002/11/26 11:23:29  lipp
057:         * Modified RemoteException comment.
058:         *
059:         * Revision 1.8  2002/10/15 13:22:32  huaiyang
060:         * Remove system.out.println and printStackTrace.
061:         *
062:         * Revision 1.7  2002/08/30 13:37:05  lipp
063:         * Using Workflow engine facade now.
064:         *
065:         * Revision 1.6  2002/02/04 22:42:44  lipp
066:         * Moved initProcessDefinitions and findActivity from Configuration user
067:         * api to EJB remote interface.
068:         *
069:         * Revision 1.5  2002/01/26 19:17:55  lipp
070:         * Optimized.
071:         *
072:         * Revision 1.4  2002/01/25 22:07:14  lipp
073:         * Removed no longer needed code.
074:         *
075:         * Revision 1.3  2002/01/16 09:21:34  robert
076:         * replace ConfigurationHome interface
077:         * from workflow/ejbs/admin to workflow/api/ejbhomes
078:         *
079:         * Revision 1.2  2002/01/15 15:07:08  robert
080:         * replace Configuration interface from workflow/domain to workflow/api
081:         *
082:         * Revision 1.1  2001/12/19 10:04:59  lipp
083:         * ActivityFinder moved to ejbs/util.
084:         *
085:         * Revision 1.5  2001/12/18 22:58:47  lipp
086:         * equals implementation redone.
087:         *
088:         * Revision 1.4  2001/12/16 21:48:11  lipp
089:         * Fixed equals and hashCode
090:         *
091:         * Revision 1.3  2001/12/15 16:42:08  lipp
092:         * Cleand up exception declaration for finder methods in home interfaces.
093:         *
094:         * Revision 1.2  2001/12/15 12:47:07  lipp
095:         * Getting an ActivityFinder implemented.
096:         *
097:         * Revision 1.1  2001/12/14 16:05:45  lipp
098:         * Partial implementation of ActivityFinder.
099:         *
100:         */
101:        package de.danet.an.workflow.ejbs.admin;
102:
103:        import java.io.IOException;
104:        import java.io.Serializable;
105:
106:        import java.rmi.RemoteException;
107:
108:        import javax.ejb.FinderException;
109:        import javax.ejb.Handle;
110:        import javax.naming.NamingException;
111:        import javax.rmi.PortableRemoteObject;
112:
113:        import de.danet.an.util.EJBUtil;
114:
115:        import de.danet.an.workflow.omgcore.WfActivity;
116:
117:        import de.danet.an.workflow.ejbs.admin.Configuration;
118:        import de.danet.an.workflow.ejbs.admin.ConfigurationHome;
119:        import de.danet.an.workflow.spis.ras.NoSuchActivityException;
120:
121:        /**
122:         * The implementation of {@link
123:         * de.danet.an.workflow.spis.ras.ActivityFinder
124:         * <code>ActivityFinder</code>} for this workflow package.
125:         */
126:        public class ActivityFinder implements 
127:                de.danet.an.workflow.spis.ras.ActivityFinder, Serializable {
128:
129:            /** Serial version UID. */
130:            static final long serialVersionUID = -3457954784067616090L;
131:
132:            private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
133:                    .getLog(ActivityFinder.class);
134:
135:            private static transient Handle handleCache = null;
136:            private static transient String instIdCache = null;
137:
138:            private Handle handle = null;
139:            private String installationId = null;
140:
141:            private transient Configuration conf = null;
142:
143:            /**
144:             * Construct a new <code>ActivityFinder</code>. This
145:             * implementation of <code>ActivityFinder</code> relies on the 
146:             * {@link de.danet.an.workflow.api.Configuration 
147:             * configuration EJB}. It stores this entity EJB's handle as attribute
148:             * and uses the 
149:             * {@link de.danet.an.workflow.ejbs.admin.Configuration#findActivity
150:             * <code>findActivity</code>} method to restore an activity in
151:             * {@link #find <code>find</code>}. We "abuse" the configuration EJB
152:             * for this purpose as it provides an ever lasting object.
153:             *
154:             * @param confHome the JNDI name (usually
155:             * <code>java:comp/env/ejb/Configuration</code>) used to lookup the
156:             * configuration EJB. Passing the name as parameter is not so much
157:             * motivated by the desire for flexibility, it will rarely be anything
158:             * but <code>java:comp/env/ejb/Configuration</code>. It should, however,
159:             * remind the user of this constructor that an appropriate entry
160:             * has to be made in the <code>ejb-jar.xml</code>.
161:             */
162:            public ActivityFinder(String confHome) {
163:                synchronized (ActivityFinder.class) {
164:                    if (handleCache == null) {
165:                        try {
166:                            ConfigurationHome ch = (ConfigurationHome) EJBUtil
167:                                    .lookupEJBHome(ConfigurationHome.class,
168:                                            confHome);
169:                            Configuration conf = (Configuration) ch
170:                                    .findByPrimaryKey(new Integer(0));
171:                            handleCache = conf.getHandle();
172:                            instIdCache = conf.workflowEngineInstanceKey();
173:                        } catch (NamingException nex) {
174:                            logger.error("NamingException in calling "
175:                                    + "ActivityFinder()!");
176:                        } catch (FinderException onf) {
177:                            logger.error("FinderException in calling "
178:                                    + "ActivityFinder()!");
179:                        } catch (RemoteException rex) {
180:                            throw new RuntimeException(rex.getMessage());
181:                        } catch (IOException ioe) {
182:                            throw new RuntimeException(ioe.getMessage());
183:                        }
184:                    }
185:                    handle = handleCache;
186:                    installationId = instIdCache;
187:                }
188:            }
189:
190:            /**
191:             * Return the activity that is associated with the given id.
192:             * As activity ids in this implementation are unique not only
193:             * with respect to the containing process but within the complete
194:             * workflow engine, the implementation is rather simple.
195:             *
196:             * @param actId the activity id (unique in the scope of this
197:             * <code>ActivityFinder</code>.
198:             * @return the <code>WfActivity</code> found.
199:             * @throws NoSuchActivityException if no activity with the given
200:             * <code>actId</code> can be found.
201:             * @throws RemoteException if a system-level error occurs.
202:             */
203:            public WfActivity find(String actId)
204:                    throws NoSuchActivityException, RemoteException {
205:                if (conf == null) {
206:                    conf = (Configuration) PortableRemoteObject.narrow(handle
207:                            .getEJBObject(), Configuration.class);
208:                }
209:                return conf.findActivity(actId);
210:            }
211:
212:            /**
213:             * Two <code>ActivityFinder</code>s are equal if the installation ids
214:             * are identical.
215:             *
216:             * @param obj the object to compare with.
217:             * @return <code>true</code> if the objects are equal.
218:             */
219:            public boolean equals(Object obj) {
220:                return installationId
221:                        .equals(((ActivityFinder) obj).installationId);
222:            }
223:
224:            /**
225:             * The hash code is the hash code of the installation id.
226:             * @return the hash code.
227:             */
228:            public int hashCode() {
229:                return installationId.hashCode();
230:            }
231:
232:            /**
233:             * For debugging purposes only.
234:             * @return a string representation
235:             */
236:            public String toString() {
237:                return "ActivityFinder/id=" + installationId;
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.