Source Code Cross Referenced for SequencingEngineLifeCycle.java in  » Workflow-Engines » Dalma » com » sun » jbi » engine » sequencing » 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 » Dalma » com.sun.jbi.engine.sequencing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (c) 2004-2005 Sun Microsystems Inc., All Rights Reserved.
002:
003:        /*
004:         * SequencingEngineLifecycle.java
005:         *
006:         * SUN PROPRIETARY/CONFIDENTIAL
007:         * This software is the proprietary information of Sun Microsystems, Inc.
008:         * Use is subject to license term
009:         */
010:        package com.sun.jbi.engine.sequencing;
011:
012:        import com.sun.jbi.engine.sequencing.util.StringTranslator;
013:
014:        import java.util.logging.Logger;
015:
016:        import javax.jbi.component.Component;
017:        import javax.jbi.component.ComponentContext;
018:        import javax.jbi.component.ComponentLifeCycle;
019:        import javax.jbi.messaging.DeliveryChannel;
020:
021:        /**
022:         * This class implements EngineLifeCycle. The JBI framework will start this
023:         * engine class automatically when JBI framework starts up.
024:         *
025:         * @author Sun Microsystems, Inc.
026:         */
027:        public class SequencingEngineLifeCycle implements  ComponentLifeCycle,
028:                SequencingEngineResources {
029:            /**
030:             * Component context passed down from framework to this sequencing engine.
031:             */
032:            private ComponentContext mContext = null;
033:
034:            /**
035:             * Engine channel
036:             */
037:            private DeliveryChannel mChannel;
038:
039:            /**
040:             * Deployment registry to keep track of deployments.
041:             */
042:            private DeploymentRegistry mRegistry;
043:
044:            /**
045:             * Refernce to logger.
046:             */
047:            private Logger mLog = null;
048:
049:            /**
050:             * Receiver object for this engine.
051:             */
052:            private MessageReceiver mMessageReceiver;
053:
054:            /**
055:             * Deployer object.
056:             */
057:            private SequencingEngineSUManager mSUManager;
058:
059:            /**
060:             * Service manager.
061:             */
062:            private ServiceManager mManager;
063:
064:            /**
065:             * Translator object for internationalization.
066:             */
067:            private StringTranslator mTranslator;
068:
069:            /**
070:             * Thread object for receiver.
071:             */
072:            private Thread mReceiverThread;
073:
074:            /**
075:             * Denotes if init is a success / failure.
076:             */
077:            private boolean mInitSuccess = false;
078:
079:            /**
080:             * Get the JMX ObjectName for any additional MBean for this BC. If there is
081:             * none, return null.
082:             *
083:             * @return ObjectName the JMX object name of the additional MBean or null
084:             *         if there is no additional MBean.
085:             */
086:            public javax.management.ObjectName getExtensionMBeanName() {
087:                return null;
088:            }
089:
090:            /**
091:             * Sets the SU manager.
092:             *
093:             * @param manager  su manager.
094:             */
095:            public void setSUManager(SequencingEngineSUManager manager) {
096:                mSUManager = manager;
097:            }
098:
099:            /**
100:             * Initialize the sequence engine. This performs initialization required by
101:             * the sequencing engine but does not make it ready to process messages.
102:             * This method is called immediately after installation of the sequencing
103:             * engine. It is also called when the JBI framework is starting up, and
104:             * any time the sequencing engine is being restarted after previously
105:             * being shut down through a call to shutdown().
106:             *
107:             * @param jbiContext the JBI environment mContext
108:             *
109:             * @throws javax.jbi.JBIException if the sequencing engine is unable to
110:             *         initialize.
111:             */
112:            public void init(javax.jbi.component.ComponentContext jbiContext)
113:                    throws javax.jbi.JBIException {
114:                mTranslator = new StringTranslator();
115:
116:                if (jbiContext == null) {
117:                    throw new javax.jbi.JBIException(mTranslator
118:                            .getString(SEQ_INVALID_BINDINGCONTEXT));
119:                }
120:
121:                /* Assign values */
122:                mContext = jbiContext;
123:
124:                SequencingEngineContext seqContext = SequencingEngineContext
125:                        .getInstance();
126:                seqContext.setContext(mContext);
127:                mLog = mContext.getLogger("engine.sequencing", null);
128:                seqContext.setLogger(mLog);
129:                mLog.info(mTranslator.getString(SEQ_INIT_START));
130:                mManager = new ServiceManager();
131:                mSUManager.setValues(mContext, mManager);
132:
133:                try {
134:                    mRegistry = DeploymentRegistry.getInstance();
135:                } catch (Exception e) {
136:                    e.printStackTrace();
137:                }
138:
139:                mInitSuccess = true;
140:            }
141:
142:            /**
143:             * Shutdown the SE. This performs cleanup before the SE is terminated. Once
144:             * this has been called, init() must be called before the SE can be
145:             * started again with a call to start().
146:             *
147:             * @throws javax.jbi.JBIException if the SE is unable to shut down.
148:             */
149:            public void shutDown() throws javax.jbi.JBIException {
150:                mLog.info(mTranslator.getString(SEQ_SHUTDOWN_BEGIN));
151:                mSUManager = null;
152:                mManager = null;
153:                mRegistry.clearRegistry();
154:
155:                /* Unregister any other MBeans
156:                 */
157:                mLog.info(mTranslator.getString(SEQ_SHUTDOWN_END));
158:            }
159:
160:            /**
161:             * Start the seqeuncing engine. This makes the SE ready to  process
162:             * messages. This method is called after init() completes when the JBI
163:             * framework is starting up, and when the sequencing engine is being
164:             * restarted after a previous call to shutdown().  If stop() was called
165:             * previously but shutdown() was not, start() can be called without a call
166:             * to init().
167:             *
168:             * @throws javax.jbi.JBIException if the sequencing engine is unable to
169:             *         start.
170:             */
171:            public void start() throws javax.jbi.JBIException {
172:                mLog.info(mTranslator.getString(SEQ_START_BEGIN));
173:
174:                if (!mInitSuccess) {
175:                    mLog.severe(mTranslator.getString(SEQ_INIT_FAILED));
176:
177:                    return;
178:                }
179:
180:                mChannel = SequencingEngineContext.getInstance().getContext()
181:                        .getDeliveryChannel();
182:
183:                if (mChannel == null) {
184:                    mLog
185:                            .severe(mTranslator
186:                                    .getString(SEQ_ENGINECHANNEL_FAILED));
187:
188:                    return;
189:                }
190:
191:                mManager.setContext(mContext);
192:                mMessageReceiver = new MessageReceiver(mChannel);
193:                mReceiverThread = new Thread(mMessageReceiver);
194:                mReceiverThread.start();
195:                mLog.info(mTranslator.getString(SEQ_START_END));
196:            }
197:
198:            /**
199:             * Stop the sequqencing engine. This makes the SE stop accepting  messages
200:             * for processing. After a call to this method, start() can be called
201:             * again without first calling init().
202:             *
203:             * @throws javax.jbi.JBIException if the sequencing engine is unable to
204:             *         stop.
205:             */
206:            public void stop() throws javax.jbi.JBIException {
207:                mLog.info(mTranslator.getString(SEQ_STOP_BEGIN));
208:
209:                try {
210:                    if (mMessageReceiver != null) {
211:                        mMessageReceiver.stopNewRequests();
212:                    }
213:
214:                    if (mMessageReceiver != null) {
215:                        mMessageReceiver.stopReceiving();
216:                    }
217:
218:                    if (mChannel != null) {
219:                        mChannel.close();
220:                    }
221:                } catch (Exception e) {
222:                    e.printStackTrace();
223:                }
224:
225:                mLog.info(mTranslator.getString(SEQ_STOP_END));
226:            }
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.