Source Code Cross Referenced for Engine2Installer.java in  » ESB » open-esb » com » sun » jbi » ui » cli » test » engine2 » boot » 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.ui.cli.test.engine2.boot 
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:         * @(#)Engine2Installer.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.ui.cli.test.engine2.boot;
030:
031:        import javax.jbi.component.Bootstrap;
032:        import javax.jbi.component.InstallationContext;
033:        import java.util.logging.Logger;
034:        import javax.jbi.JBIException;
035:        import javax.jbi.management.MBeanNames;
036:        import javax.management.MBeanServer;
037:        import javax.management.ObjectName;
038:        import javax.management.StandardMBean;
039:
040:        /**
041:         * Class to install the  engine.
042:         *
043:         * @author Sun Microsystems, Inc.
044:         */
045:        public class Engine2Installer implements  Bootstrap {
046:
047:            /**
048:             * Internal handle to the logger instance
049:             */
050:            private Logger mLogger;
051:            /** fix it */
052:            private ObjectName mConfigMBeanName;
053:            /** fix it */
054:            private ConfigMBean mConfigMBean;
055:            /**
056:             * fix it
057:             */
058:            private InstallationContext mContext;
059:
060:            /**
061:             * Creates a new instance of StockQuoteEngineBootstrap
062:             */
063:            public Engine2Installer() {
064:                mLogger = Logger
065:                        .getLogger("com.sun.jbi.ui.cli.test.engine2.boot");
066:                mLogger.info("Engine2Installer Constructor called");
067:            }
068:
069:            /**
070:             * Cleans up any resources allocated by the bootstrap implementation,
071:             * including deregistration of the extension MBean, if applicable.
072:             * This method will be called after the onInstall() or onUninstall() method
073:             * is called, whether it succeeds or fails.
074:             * @throws javax.jbi.JBIException when cleanup processing fails to complete
075:             * successfully.
076:             */
077:            public void cleanUp() throws javax.jbi.JBIException {
078:                deregisterConfigMBean();
079:            }
080:
081:            /**
082:             * Called to initialize the BC bootstrap.
083:             * @param installContext is the context containing information
084:             * from the install command and from the BC jar file.
085:             * @throws javax.jbi.JBIException when there is an error requiring that
086:             * the installation be terminated.
087:             */
088:            public void init(InstallationContext installContext)
089:                    throws javax.jbi.JBIException {
090:                mLogger.info("Engine2Installer INIT Called");
091:                this .mContext = installContext;
092:                // throw JBIException("Test Error on Engine2Installer init");
093:                registerConfigMBean();
094:                return;
095:            }
096:
097:            /**
098:             * Get the JMX ObjectName for the optional installation configuration MBean
099:             * for this BC. If there is none, the value is null.
100:             * @return ObjectName the JMX object name of the installation configuration
101:             * MBean or null if there is no MBean.
102:             */
103:            public javax.management.ObjectName getExtensionMBeanName() {
104:                mLogger.info("Engine2Installer getExtensionMBeanName Called");
105:                return this .mConfigMBeanName;
106:            }
107:
108:            /**
109:             * Called at the beginning of installation of BPEL Engine. For this
110:             * Engine, all the required installation tasks have been taken care
111:             * by the InstallationService.
112:             * @throws javax.jbi.JBIException when there is an error requiring that
113:             * the installation be terminated.
114:             */
115:            public void onInstall() throws javax.jbi.JBIException {
116:                mLogger.info("Engine2Installer onInstall Called.");
117:                //  throw new JBIException("*** Test Error Engine2Installer on Install");
118:
119:                if (this .mConfigMBean != null) {
120:                    /*
121:                    if ( !("chikkala".equalsIgnoreCase(this.mConfigMBean.getUser())) )
122:                    {
123:                        throw new JBIException("user is not chikkala. can not install");
124:                    }
125:                    
126:                    if ( !("7777".equalsIgnoreCase(this.mConfigMBean.getPort())) )
127:                    {
128:                        throw new JBIException("Port is not 7777. can not install");
129:                    }
130:                    
131:                    if ( this.mConfigMBean.getIntValue() != 1234 ) {
132:                        throw new JBIException("IntValue is not 1234. can not install");
133:                    }
134:                    
135:                    if ( this.mConfigMBean.getIntegerValue().intValue() != 9876 ) {
136:                        throw new JBIException("IntegerValue is not 9876. can not install");
137:                    }
138:                     */
139:
140:                } else {
141:                    throw new JBIException(
142:                            "Configuration MBean not initialized");
143:                }
144:            }
145:
146:            /**
147:             * Called at the beginning of uninstallation of FileEngine . For this
148:             * file engine, all the required uninstallation tasks have been taken care
149:             * of by the InstallationService
150:             * @throws javax.jbi.JBIException when there is an error requiring that
151:             * the uninstallation be terminated.
152:             */
153:            public void onUninstall() throws javax.jbi.JBIException {
154:                mLogger.info("*** Engine2Installer onUninstall Called");
155:                // throw new JBIException("Test Error Engine2Installer on UnInstall");
156:            }
157:
158:            /**
159:             * fix it
160:             * @throws JBIException fix it
161:             */
162:            public void createConfigMBean() throws JBIException {
163:                try {
164:                    if (this .mConfigMBean == null) {
165:                        this .mConfigMBean = new ConfigMBeanImpl();
166:                    }
167:
168:                    if (this .mConfigMBeanName == null) {
169:                        MBeanNames mbnHndl = this .mContext.getContext()
170:                                .getMBeanNames();
171:
172:                        this .mConfigMBeanName = mbnHndl
173:                                .createCustomComponentMBeanName("InstallerConfig");
174:                    }
175:                } catch (Exception e) {
176:                    e.printStackTrace();
177:                    throw new JBIException(
178:                            "cli Test Engine2 Installer ConfigurationMBean Creation Failed",
179:                            e);
180:                }
181:            }
182:
183:            /**
184:             * fix it
185:             * @throws JBIException fix it
186:             */
187:            public void registerConfigMBean() throws JBIException {
188:                createConfigMBean(); // make sure it is created.
189:
190:                try {
191:                    MBeanServer mbServer = this .mContext.getContext()
192:                            .getMBeanServer();
193:                    StandardMBean configBean = new StandardMBean(
194:                            this .mConfigMBean, ConfigMBean.class);
195:                    mbServer.registerMBean(configBean, this .mConfigMBeanName);
196:                } catch (Exception e) {
197:                    e.printStackTrace();
198:                    throw new JBIException(
199:                            "cli Test Engine2 Installer Config MBean Registration Failed",
200:                            e);
201:                }
202:
203:            }
204:
205:            /**
206:             * fix it
207:             * @throws JBIException fix it
208:             */
209:            public void deregisterConfigMBean() throws JBIException {
210:                if (this .mConfigMBeanName == null) {
211:                    this .mLogger
212:                            .warning("trying to unregister null Installer Config MBean in cli Test Engine 2 inst");
213:                }
214:
215:                try {
216:                    MBeanServer mbServer = this .mContext.getContext()
217:                            .getMBeanServer();
218:                    mbServer.unregisterMBean(this .mConfigMBeanName);
219:                    this .mConfigMBeanName = null;
220:                    this .mConfigMBean = null;
221:                } catch (Exception e) {
222:                    e.printStackTrace();
223:                    throw new JBIException("cli Test Engine2"
224:                            + "Installer Config MBean Deregistration Failed", e);
225:                }
226:
227:            }
228:
229:            public interface ConfigMBean {
230:                public void setUser(String user);
231:
232:                public String getUser();
233:
234:                public void setPort(String port);
235:
236:                public String getPort();
237:
238:                public void setIntValue(int intValue);
239:
240:                public int getIntValue();
241:
242:                public void setIntegerValue(Integer integerValue);
243:
244:                public Integer getIntegerValue();
245:            }
246:
247:            public class ConfigMBeanImpl implements  ConfigMBean {
248:                private String mUser;
249:                private String mPort;
250:                private int mIntValue;
251:                private Integer mIntegerValue;
252:
253:                public String getUser() {
254:                    return mUser;
255:                }
256:
257:                public void setUser(String user) {
258:                    System.out
259:                            .println("Setting the ConfigMBean attribute \"User\" : "
260:                                    + user);
261:                    mUser = user;
262:                }
263:
264:                public String getPort() {
265:                    return mPort;
266:                }
267:
268:                public void setPort(String port) {
269:                    mLogger
270:                            .info("Setting the ConfigMBean attribute \"Port\" : "
271:                                    + port);
272:                    mPort = port;
273:                }
274:
275:                public int getIntValue() {
276:                    return this .mIntValue;
277:                }
278:
279:                public void setIntValue(int intValue) {
280:                    mLogger
281:                            .info("Setting the ConfigMBean attribute \"IntValue\" : "
282:                                    + intValue);
283:                    this .mIntValue = intValue;
284:                }
285:
286:                public Integer getIntegerValue() {
287:                    return this .mIntegerValue;
288:                }
289:
290:                public void setIntegerValue(Integer integerValue) {
291:                    mLogger
292:                            .info("Setting the ConfigMBean attribute \"IntegerValue\" : "
293:                                    + integerValue);
294:                    this.mIntegerValue = integerValue;
295:                }
296:
297:            }
298:        }
ww_w_.__j___av_a_2___s___.__com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.