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


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