Source Code Cross Referenced for ProcessContext.java in  » Workflow-Engines » bexee » bexee » core » 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 » bexee » bexee.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ProcessContext.java,v 1.22 2004/12/10 09:36:00 fornp1 Exp $
003:         *
004:         * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
005:         * Berne University of Applied Sciences
006:         * School of Engineering and Information Technology
007:         * All rights reserved.
008:         */
009:        package bexee.core;
010:
011:        import java.io.Serializable;
012:        import java.util.HashMap;
013:        import java.util.Map;
014:        import java.util.Set;
015:
016:        import bexee.event.Event;
017:        import bexee.model.activity.Activity;
018:        import bexee.model.elements.Variable;
019:
020:        /**
021:         * The ProcessContext contains state information about a very specific process
022:         * instance. This includes:
023:         * <ul>
024:         * <li>Link states</li>
025:         * <li>Global and local variable values</li>
026:         * <li>Detailed event information about each processed activity. This
027:         * information is vital for the <code>ProcessController</code> to be able to
028:         * resume asynchronous process execution. Another optional use of this
029:         * information might be a later process execution tracing (e.g. for graphical
030:         * representations of an executing or finished process).</li>
031:         * </ul>
032:         * <p>
033:         * The <code>ProcessContext</code> need to be made persistent for later
034:         * retrieval of asynchronous or long-running processes.
035:         * 
036:         * @version $Revision: 1.22 $, $Date: 2004/12/10 09:36:00 $
037:         * @author Patric Fornasier
038:         * @author Pawel Kowalski
039:         */
040:        public class ProcessContext implements  Serializable {
041:
042:            private Map variables;
043:
044:            private Map events;
045:
046:            private Object result;
047:
048:            private BexeeMessage currentMessage;
049:
050:            private String id;
051:
052:            /**
053:             * Creates a new <code>ProcessContext</code>.
054:             */
055:            public ProcessContext() {
056:                variables = new HashMap();
057:                events = new HashMap();
058:            }
059:
060:            /**
061:             * Get the result of this process instance.
062:             * 
063:             * @return
064:             */
065:            public Object getResult() {
066:                return result;
067:            }
068:
069:            /**
070:             * Provides a place to store the result of BPEL process instance that has
071:             * terminated it's execution.
072:             * <p>
073:             * After setting the result this method will call <code>notify()</code> on
074:             * itself to indicate locking threads that the result is available.
075:             * 
076:             * @param message
077:             */
078:            public synchronized void setResult(Object result) {
079:
080:                this .result = result;
081:                this .notify();
082:            }
083:
084:            /**
085:             * Set the current message.
086:             * 
087:             * @param message
088:             */
089:            public void setMessage(BexeeMessage message) {
090:                this .currentMessage = message;
091:            }
092:
093:            /**
094:             * Get the current message.
095:             * 
096:             * @return currentMessage
097:             */
098:            public BexeeMessage getMessage() {
099:                return currentMessage;
100:            }
101:
102:            /**
103:             * Stores the parts of a given <code>Variable</code>.
104:             * 
105:             * @param variable
106:             *            the <code>Variable</code> that will be used as the key
107:             * @param parts
108:             *            a <code>Map</code> containing the parts associated with the
109:             *            given <code>Variable</code>. The part names are used as
110:             *            keys in the parts <code>Map</code>.
111:             */
112:            public void setVariable(Variable variable, Map parts) {
113:                variables.put(variable, parts);
114:            }
115:
116:            /**
117:             * Gets the parts associated with a given <code>Variable</code>.
118:             * 
119:             * @param variable
120:             *            the <code>Variable</code> that will be used as the key
121:             * 
122:             * @return a <code>Map</code> containing the parts associated with the
123:             *         given <code>Variable</code>. The part names are used as keys
124:             *         in the returned <code>Map</code>.
125:             */
126:            public Map getVariable(Variable variable) {
127:                return (Map) variables.get(variable);
128:            }
129:
130:            /**
131:             * It is possible to retrieve all variable identifiers included in this
132:             * context (Variable class instances).
133:             * 
134:             * @return set a Set of <code>Variable</code> instances.
135:             */
136:            public Set getVariablesIdentifiers() {
137:                return variables.keySet();
138:            }
139:
140:            /**
141:             * Set a variable part identified by a <code>Variable</code> identifier
142:             * and a part name.
143:             * 
144:             * @param variable
145:             *            the variable identifier
146:             * @param part
147:             *            the part name
148:             * @param value
149:             *            part value
150:             */
151:            public void setVariablePart(Variable variable, String part,
152:                    Object value) {
153:                Map parts = getVariable(variable);
154:                if (parts == null) {
155:                    parts = new HashMap();
156:                }
157:                parts.put(part, value);
158:                setVariable(variable, parts);
159:            }
160:
161:            /**
162:             * Get a variable part identified by a <code>Variable</code> identifier
163:             * and a part name.
164:             * 
165:             * @param variable
166:             *            the variable identifier
167:             * @param part
168:             *            the part name
169:             * @return value
170:             */
171:            public Object getVariablePart(Variable variable, String part) {
172:                Map parts = getVariable(variable);
173:                return parts == null ? null : parts.get(part);
174:            }
175:
176:            /**
177:             * Remove the current message. This method will be called in order to
178:             * retrieve the current message and remove it from the
179:             * <code>ProcessContext</code> at the same time.
180:             * 
181:             * @return bexeeMessage a BexeeMessage
182:             */
183:            public BexeeMessage removeMessage() {
184:                BexeeMessage message = currentMessage;
185:                currentMessage = null;
186:                return message;
187:            }
188:
189:            /**
190:             * Add an Event to this <code>ProcessContext</code>. The
191:             * <code>Event</code> s represent processed activities in bexee. It is
192:             * possible to reconstruct states of the process by analyzing those
193:             * <code>Event</code>s.
194:             * 
195:             * @param event
196:             */
197:            public void addEvent(Event event) {
198:                events.put(event.getActivity(), event);
199:            }
200:
201:            /**
202:             * Get an <code>Event</code> for the given <code>Activity</code>.
203:             * 
204:             * @param activity
205:             * @return Event
206:             */
207:            public Event getEvent(Activity activity) {
208:                return (Event) events.get(activity);
209:            }
210:
211:            /**
212:             * Set the id of this <code>ProcessContext</code>.
213:             * 
214:             * @param id
215:             */
216:            public void setId(String id) {
217:                this .id = id;
218:            }
219:
220:            /**
221:             * Get the id of this <code>ProcessContext</code>.
222:             * 
223:             * @return
224:             */
225:            public String getId() {
226:                return id;
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.