Source Code Cross Referenced for MBeanNamesImpl.java in  » ESB » open-esb » com » sun » jbi » management » support » 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.management.support 
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:         * @(#)MBeanNamesImpl.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.management.support;
030:
031:        import com.sun.jbi.ComponentType;
032:        import java.util.logging.Logger;
033:
034:        import javax.management.ObjectName;
035:
036:        /**
037:         * Implementation of MBeanNames interface.
038:         * 
039:         * @author Sun Microsystems, Inc.
040:         */
041:        public class MBeanNamesImpl implements 
042:                com.sun.jbi.management.MBeanNames {
043:
044:            public static final String JBI_DOMAIN = "com.sun.jbi";
045:
046:            public static final String SERVICE_TYPE_KEY = "ServiceType";
047:
048:            public static final String SERVICE_NAME_KEY = "ServiceName";
049:
050:            private static final String TARGET_KEY = "Target";
051:
052:            private static final String COMPONENT_NAME_KEY = "ComponentName";
053:
054:            private static final String EQUAL = "=";
055:
056:            private static final String COLON = ":";
057:
058:            private static final String COMMA = ",";
059:
060:            /**
061:             * The JMX domain name for our implementation.
062:             */
063:            private String mDomainName;
064:
065:            /**
066:             * The instance name of this runtime.
067:             */
068:            private String mInstanceName;
069:
070:            /**
071:             * Constructor.
072:             * 
073:             * @param jmxDomain -
074:             *            JMX Domain Name.
075:             * @param instanceName -
076:             *            instance name of the runtime.
077:             */
078:            public MBeanNamesImpl(String jmxDomain, String instanceName) {
079:                mDomainName = jmxDomain;
080:                mInstanceName = instanceName;
081:            }
082:
083:            // ///////////////////////////////////
084:            // Implementation of public interface
085:            // ///////////////////////////////////
086:
087:            /**
088:             * Retrieve the default JMX Domain Name for MBeans registered in this
089:             * instance of the JBI implementation.
090:             * 
091:             * @return the JMX domain name for this instance of the JBI implemention;
092:             *         must be non-null and non-empty
093:             */
094:            public String getJmxDomainName() {
095:                return (mDomainName);
096:            }
097:
098:            /**
099:             * Formulate and return an MBean ObjectName for a custom control of this
100:             * name creator's JBI component.
101:             * <p>
102:             * This is used by components to create JMX names for their own JMX
103:             * controls, allowing the JBI implementation to prefix the created name to
104:             * fit within the implementation's own naming scheme.
105:             * <p>
106:             * Standard extensions must use the following custom name constants:
107:             * <ul>
108:             * <li>Bootstrap (installer) extension: {@link #BOOTSTRAP_EXTENSION}.</li>
109:             * <li>Component life cycle extension:
110:             * {@link #COMPONENT_LIFE_CYCLE_EXTENSION}. </li>
111:             * </ul>
112:             * All other custom component MBeans must use custom names that do not
113:             * collide with the standard extension names.
114:             * 
115:             * @param customName
116:             *            the name of the custom control; must be non-null and
117:             *            non-empty; must be legal for use in a JMX object name
118:             * @return the JMX ObjectName of the MBean, or <code>null</code> if the
119:             *         <code>customName</code> is invalid
120:             */
121:            public ObjectName createCustomComponentMBeanName(String customName) {
122:                return null;
123:            }
124:
125:            // /////////////////////////////////////////
126:            // Implementation of Sun internal interface
127:            // /////////////////////////////////////////
128:
129:            /**
130:             * Utility method to get a component's MBean name based on the component's
131:             * type (binding or engine).  This saves clients from coding the same
132:             * conditional (e.g. if type == binding call getBindingMBeanName) over
133:             * and over again.
134:             * @param componentName component name
135:             * @param serviceType type of MBean
136:             * @param target administration target
137:             * @return ObjectName in the component's namespace for the given service
138:             */
139:            public ObjectName getComponentMBeanName(String compName,
140:                    ComponentType compType, ComponentServiceType serviceType,
141:                    String target) {
142:                ObjectName mbn;
143:
144:                switch (compType) {
145:                case BINDING:
146:                    mbn = getBindingMBeanName(compName, serviceType, target);
147:                    break;
148:
149:                case ENGINE:
150:                    mbn = getEngineMBeanName(compName, serviceType, target);
151:                    break;
152:
153:                default:
154:                    throw new IllegalArgumentException(compType.toString());
155:                }
156:
157:                return mbn;
158:            }
159:
160:            /**
161:             * Formulate and return the MBean ObjectName of a control MBean for a
162:             * Binding Component.
163:             * 
164:             * @param bindingName
165:             *            the name of the Binding Component.
166:             * @param controlType
167:             *            the type of control (MBean type).
168:             * @return the JMX ObjectName of the MBean, or <code>null</code> if
169:             *         <code>controlType</code> is invalid.
170:             */
171:            public ObjectName getBindingMBeanName(String bindingName,
172:                    String controlType) {
173:                String tmp = createBindingMBeanName(null, bindingName,
174:                        controlType);
175:
176:                ObjectName mbname = null;
177:                try {
178:                    mbname = new ObjectName(tmp);
179:                } catch (Exception e) {
180:                    mbname = null;
181:                    e.printStackTrace();
182:                }
183:
184:                return (mbname);
185:            }
186:
187:            /**
188:             * Formulate and return the MBean ObjectName of custom control MBean for a
189:             * Binding Component.
190:             * 
191:             * @param customName
192:             *            the name of the custom control.
193:             * @param bindingName
194:             *            the name of the Binding Component.
195:             * @return the JMX ObjectName or <code>null</code> if illegal name.
196:             */
197:            public ObjectName getCustomBindingMBeanName(String customName,
198:                    String bindingName) {
199:                String tmp = createBindingMBeanName(customName, bindingName,
200:                        CONTROL_TYPE_CUSTOM);
201:
202:                ObjectName mbname = null;
203:                try {
204:                    mbname = new ObjectName(tmp);
205:                } catch (Exception e) {
206:                    mbname = null;
207:                    e.printStackTrace();
208:                }
209:
210:                return (mbname);
211:            }
212:
213:            /**
214:             * Formulate and return the MBean ObjectName of custom control MBean for a
215:             * Service Engine.
216:             * 
217:             * @param customName
218:             *            the name of the custom control.
219:             * @param engineName
220:             *            the name of the Service Engine.
221:             * @return the JMX ObjectName or <code>null</code> if illegal name.
222:             */
223:            public ObjectName getCustomEngineMBeanName(String customName,
224:                    String engineName) {
225:                String tmp = createEngineMBeanName(customName, engineName,
226:                        CONTROL_TYPE_CUSTOM);
227:
228:                ObjectName mbname = null;
229:                try {
230:                    mbname = new ObjectName(tmp);
231:                } catch (Exception e) {
232:                    mbname = null;
233:                    e.printStackTrace();
234:                }
235:
236:                return (mbname);
237:            }
238:
239:            /**
240:             * Formulate and return the MBean ObjectName of a control MBean for a
241:             * Service Engine.
242:             * 
243:             * @param engineName
244:             *            the name of the Service Engine.
245:             * @param controlType
246:             *            the type of control (MBean type).
247:             * @return the JMX ObjectName of the MBean, or <code>null</code> if
248:             *         <code>controlType</code> is invalid.
249:             */
250:            public ObjectName getEngineMBeanName(String engineName,
251:                    String controlType) {
252:                String tmp = createEngineMBeanName(null, engineName,
253:                        controlType);
254:
255:                ObjectName mbname = null;
256:                try {
257:                    mbname = new ObjectName(tmp);
258:                } catch (Exception e) {
259:                    mbname = null;
260:                    e.printStackTrace();
261:                }
262:
263:                return (mbname);
264:            }
265:
266:            /**
267:             * Formulate and return the MBean ObjectName of control MBean for a JBI
268:             * system service.
269:             * 
270:             * @param serviceName
271:             *            the name of the system service.
272:             * @param type
273:             *            the type of the MBean.
274:             * @return the JMX ObjectName of the specified MBean, or null if the
275:             *         serviceName or type is illegal.
276:             */
277:            public ObjectName getSystemServiceMBeanName(String serviceName,
278:                    String type) {
279:                String tmp = createSystemServiceMBeanName(serviceName, type);
280:
281:                // System.out.println("getSystemServiceMBeanName: tmp='" + tmp + "'");
282:
283:                ObjectName mbname = null;
284:                try {
285:                    mbname = new ObjectName(tmp);
286:                } catch (Exception e) {
287:                    mbname = null;
288:                    e.printStackTrace();
289:                }
290:
291:                return (mbname);
292:            }
293:
294:            /**
295:             * Formulate and return the MBean ObjectName of control MBean for a JBI
296:             * system service for the specified instance name.
297:             * 
298:             * @param serviceName
299:             *            the name of the system service.
300:             * @param type
301:             *            the type of the MBean.
302:             * @param instanceName
303:             *            the name of the server instance.
304:             * @return the JMX ObjectName of the specified MBean, or null if the
305:             *         serviceName or type is illegal.
306:             */
307:            public ObjectName getSystemServiceMBeanName(String serviceName,
308:                    String type, String instanceName) {
309:                String tmp = createSystemServiceMBeanNameForInstance(
310:                        serviceName, type, instanceName);
311:
312:                // System.out.println("getSystemServiceMBeanName: tmp='" + tmp + "'");
313:
314:                ObjectName mbname = null;
315:                try {
316:                    mbname = new ObjectName(tmp);
317:                } catch (Exception e) {
318:                    mbname = null;
319:                    e.printStackTrace();
320:                }
321:
322:                return (mbname);
323:            }
324:
325:            /**
326:             * Formulate and return the LoggerMBean ObjectName of a JBI Framework system
327:             * service.
328:             * 
329:             * @param name -
330:             *            the name of the system service.
331:             * @param logger -
332:             *            the Logger instance.
333:             * @return the JMX ObjectName of the service, or null if illegal name.
334:             */
335:            public ObjectName getSystemServiceLoggerMBeanName(String name,
336:                    Logger logger) {
337:                String tmp = createSystemServiceLoggerMBeanName(name, logger
338:                        .getName());
339:
340:                ObjectName mbname = null;
341:                try {
342:                    mbname = new ObjectName(tmp);
343:                } catch (Exception e) {
344:                    mbname = null;
345:                    e.printStackTrace();
346:                }
347:
348:                return (mbname);
349:            }
350:
351:            /**
352:             * Return the name of this JBI Framework runtime
353:             * 
354:             * @return the instance name of this runtime.
355:             */
356:            public String getJbiInstanceName() {
357:                return mInstanceName;
358:            }
359:
360:            /**
361:             * Formulate and return the MBean ObjectName of a local JBI Framework system
362:             * service. A local services does not include the jbi runtime instance name.
363:             * 
364:             * @param name -
365:             *            the name of the system service
366:             * @param type -
367:             *            the type of the MBean
368:             * @return the JMX ObjectName of the service, or null if illegal name
369:             */
370:            public ObjectName getLocalSystemServiceMBeanName(String name,
371:                    String type) {
372:                String tmp = createLocalSystemServiceMBeanName(name, type);
373:
374:                // System.out.println("getSystemServiceMBeanName: tmp='" + tmp + "'");
375:
376:                ObjectName mbname = null;
377:                try {
378:                    mbname = new ObjectName(tmp);
379:                } catch (Exception e) {
380:                    mbname = null;
381:                    e.printStackTrace();
382:                }
383:
384:                return (mbname);
385:            }
386:
387:            // ////////////////
388:            // PRIVATE METHODS
389:            // ////////////////
390:
391:            /**
392:             * formulate and return a String representing the MBean name of a JBI
393:             * Framework system service.
394:             * 
395:             * @param aServiceName -
396:             *            the name of the system service
397:             * @param aControlType -
398:             *            the type of control (mbean type)
399:             * @return a String to be used to create the ObjectName for the system
400:             *         service MBean.
401:             */
402:            private String createSystemServiceMBeanName(String aServiceName,
403:                    String aControlType) {
404:                String tmp = mDomainName; // domain name
405:
406:                tmp += ":" + INSTANCE_NAME_KEY + "=" + mInstanceName;
407:                tmp += "," + SERVICE_NAME_KEY + "=" + aServiceName;
408:                tmp += "," + CONTROL_TYPE_KEY + "=" + aControlType;
409:                tmp += "," + COMPONENT_TYPE_KEY + "=" + COMPONENT_TYPE_SYSTEM;
410:
411:                return (tmp);
412:            }
413:
414:            /**
415:             * formulate and return a String representing the MBean name of a JBI
416:             * Framework system service.
417:             * 
418:             * @param aServiceName -
419:             *            the name of the system service
420:             * @param aControlType -
421:             *            the type of control (mbean type)
422:             * @param anInstanceName -
423:             *            the name of the server instance
424:             * @return a String to be used to create the ObjectName for the system
425:             *         service MBean.
426:             */
427:            private String createSystemServiceMBeanNameForInstance(
428:                    String aServiceName, String aControlType,
429:                    String anInstanceName) {
430:                String tmp = mDomainName; // domain name
431:
432:                tmp += ":" + INSTANCE_NAME_KEY + "=" + anInstanceName;
433:                tmp += "," + SERVICE_NAME_KEY + "=" + aServiceName;
434:                tmp += "," + CONTROL_TYPE_KEY + "=" + aControlType;
435:                tmp += "," + COMPONENT_TYPE_KEY + "=" + COMPONENT_TYPE_SYSTEM;
436:
437:                return (tmp);
438:            }
439:
440:            /**
441:             * formulate and return a String representing the MBean name of a JBI
442:             * Framework system service.
443:             * 
444:             * @param aServiceName -
445:             *            the name of the system service
446:             * @param aControlType -
447:             *            the type of control (mbean type)
448:             * @return a String to be used to create the ObjectName for the system
449:             *         service MBean.
450:             */
451:            private String createLocalSystemServiceMBeanName(
452:                    String aServiceName, String aControlType) {
453:                String tmp = mDomainName; // domain name
454:
455:                tmp += ":" + SERVICE_NAME_KEY + "=" + aServiceName;
456:                tmp += "," + CONTROL_TYPE_KEY + "=" + aControlType;
457:                tmp += "," + COMPONENT_TYPE_KEY + "=" + COMPONENT_TYPE_SYSTEM;
458:
459:                return (tmp);
460:            }
461:
462:            /**
463:             * formulate and return a String representing the LoggerMBean name of a JBI
464:             * Framework system service.
465:             * 
466:             * @param aServiceName -
467:             *            the name of the system service
468:             * @param aLoggerName -
469:             *            the name of the logger instance
470:             * @return a String to be used to create the ObjectName for the system
471:             *         service MBean.
472:             */
473:            private String createSystemServiceLoggerMBeanName(
474:                    String aServiceName, String aLoggerName) {
475:                String tmp = mDomainName; // domain name
476:
477:                tmp += ":" + INSTANCE_NAME_KEY + "=" + mInstanceName;
478:                tmp += "," + SERVICE_NAME_KEY + "=" + aServiceName;
479:                tmp += "," + CONTROL_TYPE_KEY + "=" + CONTROL_TYPE_LOGGER;
480:                tmp += "," + COMPONENT_TYPE_KEY + "=" + COMPONENT_TYPE_SYSTEM;
481:                tmp += "," + LOGGER_NAME_KEY + "=" + aLoggerName;
482:
483:                return (tmp);
484:            }
485:
486:            /**
487:             * formulate and return a String representing the MBean name of a JBI
488:             * Framework engine component
489:             * 
490:             * @param aCustomName -
491:             *            the CustomControlName. can be null.
492:             * @param theName -
493:             *            the unique name of the engine component
494:             * @param aControlType -
495:             *            the type of control (mbean type)
496:             * @return a String to be used to create the ObjectName for the engine
497:             *         MBean.
498:             */
499:            private String createEngineMBeanName(String aCustomName,
500:                    String theName, String aControlType) {
501:                return createComponentMBeanName(aCustomName,
502:                        INSTALLED_TYPE_ENGINE, theName, aControlType);
503:            }
504:
505:            /**
506:             * formulate and return a String representing the MBean name of a JBI
507:             * Framework binding component
508:             * 
509:             * 
510:             * @param aCustomName -
511:             *            the CustomControlName. can be null.
512:             * @param theName -
513:             *            the unique name of the binding component
514:             * @param aControlType -
515:             *            the type of control (mbean type)
516:             * @return a String to be used to create the ObjectName for the engine
517:             *         MBean.
518:             */
519:            private String createBindingMBeanName(String aCustomName,
520:                    String theName, String aControlType) {
521:                return createComponentMBeanName(aCustomName,
522:                        INSTALLED_TYPE_BINDING, theName, aControlType);
523:            }
524:
525:            /**
526:             * Internal method to create an engine or binding MBean Name.
527:             * 
528:             * @param aCustomName -
529:             *            if non-null, add CustomControlName pair.
530:             * @param aType -
531:             *            either InstalledTypeEngine or InstalledTypeBinding
532:             * @param theName -
533:             *            the unique name of the component
534:             * @param aControlType -
535:             *            the type of control (mbean type)
536:             * @return a String to be used to create the ObjectName for the engine
537:             *         MBean.
538:             */
539:            private String createComponentMBeanName(String aCustomName,
540:                    String aType, String theName, String aControlType) {
541:                String tmp = mDomainName; // domain name
542:
543:                tmp += ":" + INSTANCE_NAME_KEY + "=" + mInstanceName;
544:
545:                if (null != aCustomName && CONTROL_TYPE_LOGGER != aControlType) {
546:                    tmp += "," + CUSTOM_CONTROL_NAME_KEY + "=" + aCustomName;
547:                }
548:
549:                tmp += "," + COMPONENT_ID_KEY + "=" + theName;
550:                tmp += "," + CONTROL_TYPE_KEY + "=" + aControlType;
551:                tmp += "," + COMPONENT_TYPE_KEY + "="
552:                        + COMPONENT_TYPE_INSTALLED;
553:                tmp += "," + INSTALLED_TYPE_KEY + "=" + aType;
554:
555:                if (CONTROL_TYPE_LOGGER == aControlType) {
556:                    if (null != aCustomName) {
557:                        tmp += "," + LOGGER_NAME_KEY + "=" + aCustomName;
558:                    }
559:                }
560:
561:                return (tmp);
562:            }
563:
564:            // ////////////////////////////
565:            // -- Overloaded methods --
566:            // ////////////////////////////
567:            /**
568:             * Returns object name of type a Binding Object Name:
569:             * com.sun.jbi:Target={target}, ServiceType={serviceType},
570:             * ComponentName="bindingName"
571:             * 
572:             * @param bindingName -
573:             *            binding component name
574:             * @param serviceType
575:             * @param target -
576:             *            administration target
577:             * @return the Object name of the facade AdminServiceMBean for the desired
578:             *         target.
579:             */
580:            public ObjectName getBindingMBeanName(String bindingName,
581:                    ComponentServiceType serviceType, String target) {
582:                // -- only allowed svc types are ComponentLifeCycle and Installer
583:                String adminMBeanName = JBI_DOMAIN + COLON + TARGET_KEY + EQUAL
584:                        + target + COMMA + SERVICE_TYPE_KEY + EQUAL
585:                        + serviceType.toString() + COMMA + COMPONENT_NAME_KEY
586:                        + EQUAL + bindingName;
587:                try {
588:                    return new ObjectName(adminMBeanName);
589:                } catch (Exception e) {
590:                    return null;
591:                }
592:            }
593:
594:            /**
595:             * Returns object name of type a Engine Object Name:
596:             * com.sun.jbi:Target={target}, ServiceType={serviceType},
597:             * ComponentName="engineName"
598:             * 
599:             * @param engineName -
600:             *            service engine name
601:             * @param serviceType
602:             * @param target -
603:             *            administration target
604:             * @return the Object name of the facade AdminServiceMBean for the desired
605:             *         target.
606:             */
607:            public ObjectName getEngineMBeanName(String engineName,
608:                    ComponentServiceType serviceType, String target) {
609:                // -- only allowed svc types are ComponentLifeCycle and Installer
610:                String adminMBeanName = JBI_DOMAIN + COLON + TARGET_KEY + EQUAL
611:                        + target + COMMA + SERVICE_TYPE_KEY + EQUAL
612:                        + serviceType.toString() + COMMA + COMPONENT_NAME_KEY
613:                        + EQUAL + engineName;
614:                try {
615:                    return new ObjectName(adminMBeanName);
616:                } catch (Exception e) {
617:                    return null;
618:                }
619:            }
620:
621:            /**
622:             * Returns object name of type a SystemService Object Name:
623:             * com.sun.jbi:Target={target},ServiceName={serviceName},ServiceType={serviceType}
624:             * 
625:             * @param serviceName the system service name
626:             * @param serviceType the system service type
627:             * @param target -
628:             *            administration target
629:             * @return the Object name of the facade AdminServiceMBean for the desired
630:             *         target.
631:             */
632:            public ObjectName getSystemServiceMBeanName(
633:                    ServiceName serviceName, ServiceType serviceType,
634:                    String target) {
635:                String adminMBeanName = JBI_DOMAIN + COLON + TARGET_KEY + EQUAL
636:                        + target + COMMA + SERVICE_NAME_KEY + EQUAL
637:                        + serviceName.toString() + COMMA + SERVICE_TYPE_KEY
638:                        + EQUAL + serviceType.toString();
639:
640:                try {
641:                    return new ObjectName(adminMBeanName);
642:                } catch (Exception e) {
643:                    return null;
644:                }
645:            }
646:
647:            /**
648:             * Returns the ObjectName to be used to filter component registered custom MBeans : 
649:             * com.sun.jbi:JbiName={instanceName}, ControlType=Custom
650:             *
651:             * @param instanceName  - instance name
652:             * @param customName    - custom control name
653:             * @param componentName - component name
654:             * @return the custom component MBean ObjectName
655:             */
656:            public ObjectName getCustomComponentMBeanNameFilter(
657:                    String instanceName, String customName, String componentName) {
658:                StringBuffer customMBeanFilter = new StringBuffer(mDomainName); // domain name
659:
660:                customMBeanFilter.append(":" + INSTANCE_NAME_KEY + "="
661:                        + instanceName);
662:                customMBeanFilter.append("," + CUSTOM_CONTROL_NAME_KEY + "="
663:                        + customName);
664:                customMBeanFilter.append("," + COMPONENT_ID_KEY + "="
665:                        + componentName);
666:                customMBeanFilter.append("," + CONTROL_TYPE_KEY + "="
667:                        + CONTROL_TYPE_CUSTOM);
668:                customMBeanFilter.append(",*");
669:
670:                try {
671:                    return new ObjectName(customMBeanFilter.toString());
672:                } catch (Exception e) {
673:                    return null;
674:                }
675:            }
676:
677:            /**
678:             * Returns the ObjectName to be used to filter Logger MBeans registered for a component : 
679:             * com.sun.jbi:JbiName=instanceName,CustomControlName=logName,ComponentName=mComponentName,ControlType=Logger,*
680:             *
681:             * @param instanceName - target instance name
682:             * @param componentName - target component name
683:             * @return the ObjectName to be used to filter component registered custom MBeans
684:             */
685:            public ObjectName getComponentLoggerMBeanNameFilter(
686:                    String instanceName, String componentName) {
687:                StringBuffer customMBeanFilter = new StringBuffer(mDomainName); // domain name
688:
689:                customMBeanFilter.append(":" + INSTANCE_NAME_KEY + "="
690:                        + instanceName);
691:                customMBeanFilter.append("," + COMPONENT_ID_KEY + "="
692:                        + componentName);
693:                customMBeanFilter.append("," + CONTROL_TYPE_KEY + "="
694:                        + CONTROL_TYPE_LOGGER);
695:                customMBeanFilter.append(",*");
696:
697:                try {
698:                    return new ObjectName(customMBeanFilter.toString());
699:                } catch (Exception e) {
700:                    return null;
701:                }
702:            }
703:
704:            /**
705:             * Returns the ObjectName of the ComponentExtension facade MBean registered for
706:             * the component.
707:             *
708:             * @param target - target name
709:             * @param componentName - target component name
710:             * @return the ObjectName of the component extension facade MBean.
711:             */
712:            public ObjectName getComponentExtensionFacadeMBeanName(
713:                    String componentName, String target) {
714:                ObjectName extensionMBeanObjectName = null;
715:
716:                StringBuffer objNameBuff = new StringBuffer(JBI_DOMAIN + ":");
717:                objNameBuff.append(TARGET_KEY + "=" + target);
718:                objNameBuff.append("," + COMPONENT_NAME_KEY + "="
719:                        + componentName);
720:                objNameBuff.append("," + SERVICE_TYPE_KEY + "="
721:                        + ComponentServiceType.Extension);
722:
723:                try {
724:                    extensionMBeanObjectName = new ObjectName(objNameBuff
725:                            .toString());
726:                } catch (javax.management.MalformedObjectNameException exception) {
727:                    extensionMBeanObjectName = null;
728:                }
729:                return extensionMBeanObjectName;
730:            }
731:
732:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.