Source Code Cross Referenced for JBIFrameworkService.java in  » IDE-Netbeans » compapp » org » netbeans » modules » sun » manager » jbi » management » 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 » IDE Netbeans » compapp » org.netbeans.modules.sun.manager.jbi.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.sun.manager.jbi.management;
043:
044:        import java.io.IOException;
045:        import java.io.Serializable;
046:        import java.util.HashMap;
047:        import java.util.Iterator;
048:        import java.util.Map;
049:        import java.util.Set;
050:        import javax.management.AttributeNotFoundException;
051:        import javax.management.InstanceNotFoundException;
052:        import javax.management.MBeanException;
053:        import javax.management.MBeanServerConnection;
054:        import javax.management.MalformedObjectNameException;
055:        import javax.management.ObjectName;
056:        import javax.management.QueryExp;
057:        import javax.management.ReflectionException;
058:        import javax.management.remote.JMXConnector;
059:        import javax.management.remote.JMXConnectorFactory;
060:        import javax.management.remote.JMXServiceURL;
061:
062:        /**
063:         * Queries the runtime server to ensure that the JBI Container
064:         * is installed and is enabled. The JBI Container is installed as a
065:         * Lifecycle module on the server. This class also helps in configuring
066:         * the JBI Container at runtime. 
067:         *
068:         * @author Graj
069:         *
070:         */
071:        public class JBIFrameworkService implements  Serializable {
072:
073:            public static final String ADMIN_SERVICE_OBJECTNAME = "com.sun.jbi:ServiceName=JbiAdminUiService,ComponentType=System"; // NOI18N
074:
075:            /**
076:             * com.sun.jbi.home
077:             */
078:            public static final String JBI_CLASS_NAME_KEY = "class-name"; // NOI18N
079:
080:            /**
081:             * com.sun.jbi.binding.proxy.connection
082:             */
083:            public static final String JBI_CLASSPATH_KEY = "classpath"; // NOI18N
084:
085:            /**
086:             * disable-timeout-in-minutes - String - 30
087:             */
088:            public static final String DESCRIPTION_KEY = "description"; // NOI18N
089:
090:            /**
091:             * enabled - boolean - true
092:             */
093:            public static final String ENABLED_KEY = "enabled"; // NOI18N
094:
095:            /**
096:             * lb-enabled - boolean - false
097:             */
098:            public static final String IS_FAILURE_FATAL_KEY = "is-failure-fatal"; // NOI18N
099:
100:            /**
101:             * ref - String - JBIFramework
102:             */
103:            public static final String LOAD_ORDER_KEY = "load-order"; // NOI18N
104:
105:            /**
106:             * virtual-servers - String
107:             */
108:            public static final String NAME_KEY = "name"; // NOI18N
109:
110:            /**
111:             * DOCUMENT ME!
112:             */
113:            public static final String JBI_CONFIG_OBJECTNAME = "com.sun.appserv:name=JBIFramework,type=lifecycle-module,category=config"; // NOI18N
114:
115:            /**
116:             * DOCUMENT ME!
117:             */
118:            public static final String JBI_GETPROPERTYVALUE_OPERATION_NAME = "getPropertyValue"; // NOI18N
119:            public static final String JBI_SETPROPERTY_OPERATION_NAME = "setProperty"; // NOI18N
120:            private MBeanServerConnection serverConnection = null;
121:
122:            /**
123:             * DOCUMENT ME!
124:             */
125:            private String className;
126:
127:            /**
128:             * DOCUMENT ME!
129:             */
130:            private String classpath;
131:
132:            /**
133:             * DOCUMENT ME!
134:             */
135:            private String description;
136:
137:            /**
138:             * DOCUMENT ME!
139:             */
140:            private boolean enabled;
141:
142:            /**
143:             * DOCUMENT ME!
144:             */
145:            private boolean failureFatal;
146:
147:            /**
148:             * DOCUMENT ME!
149:             */
150:            private String loadOrder;
151:
152:            /**
153:             * DOCUMENT ME!
154:             */
155:            private String name;
156:
157:            boolean jbiFrameworkEnabled;
158:
159:            boolean isUIMBeanRegistered;
160:
161:            /**
162:             *
163:             */
164:            public JBIFrameworkService(MBeanServerConnection connection) {
165:                super ();
166:                this .serverConnection = connection;
167:                this .initialize();
168:            }
169:
170:            /**
171:             * DOCUMENT ME!
172:             */
173:            void initialize() {
174:                try {
175:                    this .jbiInitialize();
176:                } catch (MalformedObjectNameException e) {
177:                    // TODO Auto-generated catch block
178:                    e.printStackTrace();
179:                } catch (AttributeNotFoundException e) {
180:                    // TODO Auto-generated catch block
181:                    e.printStackTrace();
182:                } catch (InstanceNotFoundException e) {
183:                    // TODO Auto-generated catch block
184:                    e.printStackTrace();
185:                } catch (NullPointerException e) {
186:                    // TODO Auto-generated catch block
187:                    e.printStackTrace();
188:                } catch (MBeanException e) {
189:                    // TODO Auto-generated catch block
190:                    e.printStackTrace();
191:                } catch (ReflectionException e) {
192:                    // TODO Auto-generated catch block
193:                    e.printStackTrace();
194:                } catch (IOException e) {
195:                    // TODO Auto-generated catch block
196:                    e.printStackTrace();
197:                }
198:            }
199:
200:            /**
201:             * DOCUMENT ME!
202:             *
203:             * @throws MalformedObjectNameException DOCUMENT ME!
204:             * @throws NullPointerException DOCUMENT ME!
205:             * @throws IOException DOCUMENT ME!
206:             * @throws InstanceNotFoundException DOCUMENT ME!
207:             * @throws MBeanException DOCUMENT ME!
208:             * @throws ReflectionException DOCUMENT ME!
209:             */
210:            void jbiInitialize() throws MalformedObjectNameException,
211:                    NullPointerException, AttributeNotFoundException,
212:                    InstanceNotFoundException, MBeanException,
213:                    ReflectionException, IOException {
214:                QueryExp queryExpression = null;
215:                Set set = null;
216:                ObjectName objectName = null;
217:                objectName = new ObjectName(
218:                        JBIFrameworkService.JBI_CONFIG_OBJECTNAME);
219:                ObjectName uiMBeanObjectName = new ObjectName(
220:                        ADMIN_SERVICE_OBJECTNAME);
221:
222:                if (this .serverConnection != null) {
223:                    try {
224:                        isUIMBeanRegistered = this .serverConnection
225:                                .isRegistered(uiMBeanObjectName);
226:                    } catch (IOException ex) {
227:                        // ignore
228:                    }
229:
230:                    set = this .serverConnection.queryNames(objectName,
231:                            queryExpression);
232:
233:                    Iterator iterator = set.iterator();
234:
235:                    if ((iterator != null) && (iterator.hasNext() == true)) {
236:                        objectName = (ObjectName) iterator.next();
237:                    }
238:
239:                    if (objectName != null) {
240:
241:                        this .className = (String) this .serverConnection
242:                                .getAttribute(objectName,
243:                                        JBIFrameworkService.JBI_CLASS_NAME_KEY);
244:                        this .description = (String) this .serverConnection
245:                                .getAttribute(objectName,
246:                                        JBIFrameworkService.DESCRIPTION_KEY);
247:                        String value = (String) this .serverConnection
248:                                .getAttribute(objectName,
249:                                        JBIFrameworkService.ENABLED_KEY);
250:                        if (value != null) {
251:                            if (value.equalsIgnoreCase("True") == true) { // NOI18N
252:                                this .enabled = true;
253:                            } else {
254:                                this .enabled = false;
255:                            }
256:                        }
257:                        this .classpath = (String) this .serverConnection
258:                                .getAttribute(objectName,
259:                                        JBIFrameworkService.JBI_CLASSPATH_KEY);
260:                        value = (String) this .serverConnection.getAttribute(
261:                                objectName,
262:                                JBIFrameworkService.IS_FAILURE_FATAL_KEY);
263:                        if (value != null) {
264:                            if (value.equalsIgnoreCase("True") == true) { // NOI18N
265:                                this .failureFatal = true;
266:                            } else {
267:                                this .failureFatal = false;
268:                            }
269:                        }
270:                        this .loadOrder = (String) this .serverConnection
271:                                .getAttribute(objectName,
272:                                        JBIFrameworkService.LOAD_ORDER_KEY);
273:                        this .name = (String) this .serverConnection
274:                                .getAttribute(objectName,
275:                                        JBIFrameworkService.NAME_KEY);
276:                        this .jbiFrameworkEnabled = true;
277:                    } else {
278:                        this .jbiFrameworkEnabled = false;
279:                        System.out
280:                                .println("Cound not find the JBI Configuration MBean"); // NOI18N
281:                    }
282:                } else {
283:                    System.out
284:                            .println("Could not connect to application server"); // NOI18N
285:                }
286:            }
287:
288:            /**
289:             * DOCUMENT ME!
290:             *
291:             * @param objectName DOCUMENT ME!
292:             * @param paramObject DOCUMENT ME!
293:             *
294:             * @return DOCUMENT ME!
295:             *
296:             * @throws InstanceNotFoundException DOCUMENT ME!
297:             * @throws MBeanException DOCUMENT ME!
298:             * @throws ReflectionException DOCUMENT ME!
299:             * @throws IOException DOCUMENT ME!
300:             */
301:            Object invoke(ObjectName objectName, String paramObject) {
302:                String operationName = JBIFrameworkService.JBI_GETPROPERTYVALUE_OPERATION_NAME;
303:                Object resultObject = null;
304:                String[] params = { paramObject };
305:                String[] signature = { "java.lang.String" }; // NOI18N
306:
307:                try {
308:                    resultObject = (String) this .serverConnection.invoke(
309:                            objectName, operationName, params, signature);
310:                } catch (InstanceNotFoundException e) {
311:                    // TODO Auto-generated catch block
312:                    e.printStackTrace();
313:                } catch (MBeanException e) {
314:                    // TODO Auto-generated catch block
315:                    e.printStackTrace();
316:                } catch (ReflectionException e) {
317:                    // TODO Auto-generated catch block
318:                    e.printStackTrace();
319:                } catch (IOException e) {
320:                    // TODO Auto-generated catch block
321:                    e.printStackTrace();
322:                }
323:
324:                return resultObject;
325:            }
326:
327:            /**
328:             * DOCUMENT ME!
329:             *
330:             * @return Returns the serverConnection.
331:             */
332:            public MBeanServerConnection getServerConnection() {
333:                return this .serverConnection;
334:            }
335:
336:            /*
337:            public String getDefaultLogPropertyValue() {
338:                String operationName = JBIFrameworkService.JBI_GETPROPERTYVALUE_OPERATION_NAME;
339:                ObjectName objectName = null;
340:                try {
341:                     objectName = new ObjectName(JBIFrameworkService.JBI_CONFIG_OBJECTNAME);
342:                } catch (MalformedObjectNameException ex) {
343:                    ex.printStackTrace();
344:                } catch (NullPointerException ex) {
345:                    ex.printStackTrace();
346:                }
347:                String resultObject = null;
348:                String[] params = {JBIFrameworkService.JBI_LOG_DEFAULT_PROPERTY_NAME};
349:                String[] signature = {"java.lang.String"}; // NOI18N
350:
351:                try {
352:                    resultObject = (String) this.serverConnection.invoke(objectName, operationName, params, signature);
353:                } catch (InstanceNotFoundException e) {
354:                    // TODO Auto-generated catch block
355:                    e.printStackTrace();
356:                } catch (MBeanException e) {
357:                    // TODO Auto-generated catch block
358:                    e.printStackTrace();
359:                } catch (ReflectionException e) {
360:                    // TODO Auto-generated catch block
361:                    e.printStackTrace();
362:                } catch (IOException e) {
363:                    // TODO Auto-generated catch block
364:                    e.printStackTrace();
365:                }
366:
367:                return resultObject;
368:            }
369:             
370:            public void setDefaultLogPropertyValue(String logLevelString) {
371:                String operationName = JBIFrameworkService.JBI_SETPROPERTY_OPERATION_NAME;
372:                ObjectName objectName = null;
373:                try {
374:                     objectName = new ObjectName(JBIFrameworkService.JBI_CONFIG_OBJECTNAME);
375:                } catch (MalformedObjectNameException ex) {
376:                    ex.printStackTrace();
377:                } catch (NullPointerException ex) {
378:                    ex.printStackTrace();
379:                }
380:
381:                Attribute attribute = new Attribute(JBIFrameworkService.JBI_LOG_DEFAULT_PROPERTY_NAME, logLevelString);
382:                String resultObject = null;
383:                Object[] params = {attribute};
384:                String[] signature = {attribute.getClass().getName()};
385:
386:                try {
387:                    resultObject = (String) this.serverConnection.invoke(objectName, operationName, params, signature);
388:                } catch (InstanceNotFoundException e) {
389:                    // TODO Auto-generated catch block
390:                    e.printStackTrace();
391:                } catch (MBeanException e) {
392:                    // TODO Auto-generated catch block
393:                    e.printStackTrace();
394:                } catch (ReflectionException e) {
395:                    // TODO Auto-generated catch block
396:                    e.printStackTrace();
397:                } catch (IOException e) {
398:                    // TODO Auto-generated catch block
399:                    e.printStackTrace();
400:                }        
401:            }
402:             */
403:
404:            /**
405:             * @return Returns the className.
406:             */
407:            public String getClassName() {
408:                return this .className;
409:            }
410:
411:            /**
412:             * @return Returns the classpath.
413:             */
414:            public String getClasspath() {
415:                return this .classpath;
416:            }
417:
418:            /**
419:             * @return Returns the description.
420:             */
421:            public String getDescription() {
422:                return this .description;
423:            }
424:
425:            /**
426:             * @return Returns the enabled.
427:             */
428:            public boolean isEnabled() {
429:                return this .enabled;
430:            }
431:
432:            /**
433:             * @return Returns the failureFatal.
434:             */
435:            public boolean isFailureFatal() {
436:                return this .failureFatal;
437:            }
438:
439:            /**
440:             * @return Returns the loadOrder.
441:             */
442:            public String getLoadOrder() {
443:                return this .loadOrder;
444:            }
445:
446:            /**
447:             * @param loadOrder The loadOrder to set.
448:             */
449:            //    public void setLoadOrder(String loadOrder) {
450:            //        this.loadOrder = loadOrder;
451:            //    }
452:            /**
453:             * @return Returns the name.
454:             */
455:            public String getName() {
456:                return this .name;
457:            }
458:
459:            /**
460:             * @param name The name to set.
461:             */
462:            //    public void setName(String name) {
463:            //        this.name = name;
464:            //    }
465:            /**
466:             * @return Returns the jbiFrameworkEnabled.
467:             */
468:            public boolean isJbiFrameworkEnabled() {
469:                return this .jbiFrameworkEnabled && //this.isUIMBeanRegistered && 
470:                        this .isEnabled();
471:            }
472:
473:            /**
474:             * DOCUMENT ME!
475:             */
476:            public void printOut() {
477:                System.out
478:                        .println("//////////////////////////////////////////////////////////////////"); // NOI18N
479:                System.out
480:                        .println("//                 -- JBI Configuration --                      //"); // NOI18N
481:                System.out
482:                        .println("//////////////////////////////////////////////////////////////////"); // NOI18N
483:                System.out.println("// " + JBIFrameworkService.DESCRIPTION_KEY
484:                        + " is: " + this .getDescription()); // NOI18N
485:                System.out.println("// " + JBIFrameworkService.ENABLED_KEY
486:                        + " is: " + this .isEnabled()); // NOI18N
487:                System.out.println("// "
488:                        + JBIFrameworkService.IS_FAILURE_FATAL_KEY + " is: "
489:                        + this .isFailureFatal()); // NOI18N
490:                System.out.println("// "
491:                        + JBIFrameworkService.JBI_CLASS_NAME_KEY + " is: "
492:                        + this .getClassName()); // NOI18N
493:                System.out.println("// "
494:                        + JBIFrameworkService.JBI_CLASSPATH_KEY + " is: "
495:                        + this .getClasspath()); // NOI18N
496:                System.out.println("// " + JBIFrameworkService.LOAD_ORDER_KEY
497:                        + " is: " + this .getLoadOrder()); // NOI18N
498:                System.out.println("// " + JBIFrameworkService.NAME_KEY
499:                        + " is: " + this .getName()); // NOI18N
500:
501:                System.out
502:                        .println("//////////////////////////////////////////////////////////////////"); // NOI18N
503:            }
504:
505:            /**
506:             * DOCUMENT ME!
507:             *
508:             * @return DOCUMENT ME!
509:             */
510:            public static JBIFrameworkService getJBIConfiguration() {
511:                JBIFrameworkService configuration = null;
512:                return configuration;
513:            }
514:
515:            /**
516:             * 
517:             * @param connection
518:             */
519:            public static void test(MBeanServerConnection connection) {
520:                /*
521:                String LOG_LEVEL_INFO_KEY = "INFO";
522:                String LOG_LEVEL_FINEST_KEY = "FINEST";
523:                String LOG_LEVEL_FINER_KEY = "FINER";
524:                String LOG_LEVEL_FINE_KEY = "FINE";
525:                String LOG_WARNING_INFO_KEY = "WARNING";
526:                String LOG_SEVERE_INFO_KEY = "SEVERE";
527:                String LOG_OFF_INFO_KEY = "OFF";
528:                 */
529:                if (connection != null) {
530:                    JBIFrameworkService service = new JBIFrameworkService(
531:                            connection);
532:                    service.printOut();
533:                    if (service.isJbiFrameworkEnabled() == true) {
534:                        System.out
535:                                .println("**** JBI Framework is Enabled ****"); // NOI18N
536:                    } else {
537:                        System.out
538:                                .println("**** JBI Framework is NOT Enabled ****"); // NOI18N
539:                    }
540:
541:                    /*
542:                    String level = service.getDefaultLogPropertyValue();
543:                    service.setDefaultLogPropertyValue(LOG_SEVERE_INFO_KEY);
544:                     */
545:                }
546:            }
547:
548:            /**
549:             * Run an ant script. Starts a separate process to do so. This prevents potential undesireable
550:             * interactions, but it also means it should only be used in 'low-frequency' situations to
551:             * avoid performance issues with continually creating new processes.
552:             *
553:             * @param args full path to the ant script file
554:             *
555:             * @throws Exception DOCUMENT ME!
556:             */
557:            public static void main(String[] args) throws Exception {
558:                String PROTOCOL_CLASS = "com.sun.enterprise.admin.jmx.remote.protocol"; // NOI18N
559:                String HTTP_AUTH_PROPERTY_NAME = "com.sun.enterprise.as.http.auth"; // NOI18N
560:                String DEFAULT_HTTP_AUTH_SCHEME = "BASIC"; // NOI18N
561:                String ADMIN_USER_ENV_PROPERTY_NAME = "USER"; // NOI18N
562:                String ADMIN_PASSWORD_ENV_PROPERTY_NAME = "PASSWORD"; // NOI18N
563:                String RTS_HTTP_CONNECTOR = "s1ashttp"; // NOI18N
564:
565:                String hostName = null;
566:                String port = null;
567:                String userName = null;
568:                String password = null;
569:
570:                hostName = "localhost"; // NOI18N
571:                port = "4848"; // NOI18N
572:                userName = "admin"; // NOI18N
573:                password = "adminadmin"; // NOI18N
574:
575:                final Map<String, String> environment = new HashMap<String, String>();
576:                environment.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
577:                        PROTOCOL_CLASS);
578:                environment.put(HTTP_AUTH_PROPERTY_NAME,
579:                        DEFAULT_HTTP_AUTH_SCHEME);
580:                environment.put(ADMIN_USER_ENV_PROPERTY_NAME, userName);
581:                environment.put(ADMIN_PASSWORD_ENV_PROPERTY_NAME, password);
582:
583:                try {
584:                    int portValue = new Integer(port).intValue();
585:                    MBeanServerConnection connection = null;
586:                    JMXServiceURL serviceURL = new JMXServiceURL(
587:                            RTS_HTTP_CONNECTOR, hostName, portValue);
588:                    JMXConnector connector = JMXConnectorFactory.connect(
589:                            serviceURL, environment);
590:                    connection = connector.getMBeanServerConnection();
591:
592:                    System.out.println("Connection Retrieved."
593:                            + connection.toString()); // NOI18N
594:                    JBIFrameworkService.test(connection);
595:
596:                } catch (Exception ex) {
597:                    ex.printStackTrace();
598:                    System.out.println("Connection Failed " + ex.getMessage()); // NOI18N
599:                }
600:
601:            }
602:        }
w__ww.__ja__v___a_2___s__.__c__o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.