Source Code Cross Referenced for TransformationEngineLifeCycle.java in  » ESB » open-esb » com » sun » jbi » engine » xslt » 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.xslt 
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:         * @(#)TransformationEngineLifeCycle.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.xslt;
030:
031:        import com.sun.jbi.engine.xslt.util.ServiceManager;
032:        import com.sun.jbi.engine.xslt.util.StringTranslator;
033:
034:        import java.util.logging.Logger;
035:
036:        import javax.jbi.component.ComponentContext;
037:        import javax.jbi.component.ServiceUnitManager;
038:
039:        import javax.jbi.messaging.DeliveryChannel;
040:        import javax.management.ObjectName;
041:
042:        /**
043:         * This class implements ComponentLifeCycle. The JBI framework will start this
044:         * engine class automatically when JBI framework starts up.
045:         *
046:         * @author Sun Microsystems, Inc.
047:         */
048:        public class TransformationEngineLifeCycle implements 
049:                javax.jbi.component.ComponentLifeCycle, TEResources {
050:            /**
051:             * Engine context passed down from framework to this transformation engine.
052:             */
053:            private ComponentContext mContext = null;
054:
055:            /**
056:             * Engine context passed down from framework to this transformation engine.
057:             */
058:            private DeliveryChannel mChannel = null;
059:
060:            /**
061:             * Refernce to logger.
062:             */
063:            private Logger mLogger = null;
064:
065:            /**
066:             * Refernce to Receiver.
067:             */
068:            private Receiver mRcvrProcessor = null;
069:
070:            /**
071:             * Refernce to service manager.
072:             */
073:            private ServiceManager mServiceManager = null;
074:
075:            /**
076:             *    
077:             */
078:            private StringTranslator mTranslator = null;
079:
080:            /**
081:             *    
082:             */
083:            private TransformationEngineSUManager mSUManager = null;
084:
085:            /**
086:             *    
087:             */
088:            private boolean mInitSuccess = false;
089:
090:            /**
091:             * Get the JMX ObjectName for any additional MBean for this BC. If there is
092:             * none, return null.
093:             *
094:             * @return ObjectName the JMX object name of the additional MBean or null
095:             *         if there is no additional MBean.
096:             */
097:            public ObjectName getExtensionMBeanName() {
098:                return null;
099:            }
100:
101:            public ServiceUnitManager getSUManager() {
102:                return mSUManager;
103:            }
104:
105:            //javax.jbi.component.ComponentLifeCycle methods
106:
107:            /**
108:             * Initialize the transformation engine. This performs initialization
109:             * required by  the transformation engine but does not make it ready to
110:             * process messages.  This method is called immediately after installation
111:             * of the Transformation engine. It is also called when the JBI framework
112:             * is starting up, and any time the transformation engine is being
113:             * restarted after previously being shut down through a call to
114:             * shutDown().
115:             *
116:             * @param context the JBI environment mContext
117:             *
118:             * @throws javax.jbi.JBIException if the transformation engine is unable to
119:             *         initialize.
120:             */
121:            public void init(javax.jbi.component.ComponentContext context)
122:                    throws javax.jbi.JBIException {
123:                if (context == null) {
124:                    throw (new javax.jbi.JBIException(mTranslator
125:                            .getString(TEResources.CONTEXT_IS_NULL),
126:                            new NullPointerException()));
127:                }
128:
129:                mContext = context;
130:
131:                //Set ComponentContext on TransformationEngineContext
132:                TransformationEngineContext teCtx = TransformationEngineContext
133:                        .getInstance();
134:                teCtx.setContext(context);
135:
136:                mTranslator = new StringTranslator("com.sun.jbi.engine.xslt",
137:                        this .getClass().getClassLoader());
138:
139:                mLogger = TransformationEngineContext.getInstance().getLogger(
140:                        "");
141:
142:                mServiceManager = ServiceManager.getInstance();
143:                mServiceManager.setComponentContext(mContext);
144:
145:                mSUManager = new TransformationEngineSUManager();
146:                mSUManager.setContext(mContext);
147:
148:                mInitSuccess = true;
149:                mLogger.info(mTranslator.getString(TEResources.INIT_END));
150:            }
151:
152:            /**
153:             * Shutdown the transformation engine. This performs cleanup before the BPE
154:             * is terminated. Once this method has been called, init() must be called
155:             * before the transformation engine can be started again with a call to
156:             * start().
157:             *
158:             * @throws javax.jbi.JBIException if the transformation engine is unable to
159:             *         shut down.
160:             */
161:            public void shutDown() throws javax.jbi.JBIException {
162:                mLogger.info(mTranslator
163:                        .getString(TEResources.TE_SHUTDOWN_START));
164:                mContext = null;
165:                mSUManager = null;
166:                mServiceManager = null;
167:                mRcvrProcessor = null;
168:                mLogger
169:                        .info(mTranslator
170:                                .getString(TEResources.TE_SHUTDOWN_END));
171:            }
172:
173:            /**
174:             * Start the transformation engine. This makes the BPE ready to  process
175:             * messages. This method is called after init() completes when the JBI
176:             * framework is starting up, and when the transformation engine is being
177:             * restarted after a previous call to shutDown().  If stop() was called
178:             * previously but shutDown() was not, start() can be called without a call
179:             * to init().
180:             *
181:             * @throws javax.jbi.JBIException if the transformation engine is unable to
182:             *         start.
183:             */
184:            public void start() throws javax.jbi.JBIException {
185:                mLogger.info(mTranslator.getString(TEResources.ENGINE_STARTED));
186:
187:                if (!mInitSuccess) {
188:                    mLogger.severe(mTranslator
189:                            .getString(TEResources.INIT_FAILED));
190:
191:                    return;
192:                }
193:
194:                mChannel = mContext.getDeliveryChannel();
195:
196:                if (mChannel == null) {
197:                    throw (new javax.jbi.JBIException(mTranslator
198:                            .getString(TEResources.ENGINE_CHANNEL_IS_NULL),
199:                            new NullPointerException()));
200:                }
201:
202:                mRcvrProcessor = new Receiver(mContext);
203:
204:                mServiceManager.setComponentContext(mContext);
205:                (new Thread(mRcvrProcessor)).start();
206:
207:                mLogger.info(mTranslator.getString(TEResources.TE_START_END));
208:            }
209:
210:            /**
211:             * Stop the transformation engine. This makes the BPE stop accepting
212:             * messages for processing. After a call to this method, start() can be
213:             * called again without first calling init().
214:             *
215:             * @throws javax.jbi.JBIException if the transformation engine is unable to
216:             *         stop.
217:             */
218:            public void stop() throws javax.jbi.JBIException {
219:                mLogger.info(mTranslator.getString(TEResources.TE_STOP_START));
220:
221:                // To add code to stop all services
222:                try {
223:                    mServiceManager.stopAllServices();
224:
225:                    if (mRcvrProcessor != null) {
226:                        mRcvrProcessor.cease();
227:                    }
228:
229:                    if (mChannel != null) {
230:                        mChannel.close();
231:                    }
232:                } catch (Throwable ex) {
233:                    ex.printStackTrace();
234:                }
235:
236:                mLogger.info(mTranslator.getString(TEResources.TE_STOP_END));
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.