Source Code Cross Referenced for JonasObjectName.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jmx » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.jmx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2005 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JonasObjectName.java 9346 2006-08-03 14:35:11Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.jmx;
025:
026:        import javax.management.MalformedObjectNameException;
027:        import javax.management.ObjectName;
028:
029:        /**
030:         * A set of static classes used to build the names of proprietary MBeans used in JOnAS and in Joram.
031:         * @author Bruno Michel
032:         * @author Guillaume Riviere
033:         * @author Florent Benoit
034:         * @author Ludovic Bert
035:         * @author Miroslav Halas
036:         * @author Adriana Danes
037:         */
038:        public class JonasObjectName {
039:
040:            /**
041:             * domain name
042:             */
043:            private static String domain = null;
044:
045:            /**
046:             * Set the domain used by JOnAS server
047:             * @param domainName the domain to use
048:             */
049:            public static void setDomain(String domainName) {
050:                if (domain != null) {
051:                    throw new IllegalStateException(
052:                            "The setDomain method can be called only once.");
053:                }
054:                domain = domainName;
055:            }
056:
057:            /**
058:             * @return the domain name of the JOnAS server.
059:             */
060:            public static String getDomain() {
061:                if (domain == null) {
062:                    throw new IllegalStateException(
063:                            "The domain was not previously set, cannot return it.");
064:                }
065:                return domain;
066:            }
067:
068:            /**
069:             * Create ObjectName for the JMX Connector Server which is an MBean inside the target MBeanServer
070:             * @param protocol used protocol
071:             * @param connectorName name used to distinguish connector servers using the same protocol
072:             * @return ObjectName for the JMX Connector Server MBean
073:             */
074:            public static ObjectName jmxConnectorServer(String protocol,
075:                    String connectorName) {
076:                try {
077:                    return ObjectName.getInstance("connectors:protocol="
078:                            + protocol + ",name=" + connectorName);
079:                } catch (MalformedObjectNameException e) {
080:                    // this should never occur
081:                    return null;
082:                }
083:            }
084:
085:            /**
086:             * @return ObjectName for reconfiguration manager MBean
087:             */
088:            public static ObjectName serverConfig() {
089:                try {
090:                    return ObjectName.getInstance(getDomain()
091:                            + ":type=management,name=reconfigManager");
092:                } catch (MalformedObjectNameException e) {
093:                    // this should never occur
094:                    return null;
095:                }
096:            }
097:
098:            public static ObjectName wwwService() {
099:                try {
100:                    return ObjectName.getInstance(getDomain()
101:                            + ":type=webContainer,name=Jetty");
102:                } catch (MalformedObjectNameException e) {
103:                    // this should never occur
104:                    return null;
105:                }
106:            }
107:
108:            public static ObjectName wsService() {
109:                //TODO: Add a proper web service mbean instead.
110:                try {
111:                    return ObjectName.getInstance(getDomain()
112:                            + ":type=WebService,*");
113:                } catch (MalformedObjectNameException e) {
114:                    // this should never occur
115:                    return null;
116:                }
117:            }
118:
119:            public static ObjectName ejbService() {
120:                try {
121:                    return ObjectName.getInstance(getDomain()
122:                            + ":type=service,name=ejbContainers");
123:                } catch (MalformedObjectNameException e) {
124:                    // this should never occur
125:                    return null;
126:                }
127:            }
128:
129:            /**
130:             * Return the earService (Jmx).
131:             * @return the Ear service.
132:             */
133:            public static ObjectName earService() {
134:                try {
135:                    return ObjectName.getInstance(getDomain()
136:                            + ":type=service,name=ear");
137:                } catch (MalformedObjectNameException e) {
138:                    // this should never occur
139:                    return null;
140:                }
141:            }
142:
143:            /**
144:             * Return the mailService (Jmx).
145:             * @return the Mail service.
146:             */
147:            public static ObjectName mailService() {
148:                try {
149:                    return ObjectName.getInstance(getDomain()
150:                            + ":type=service,name=mail");
151:                } catch (MalformedObjectNameException e) {
152:                    // this should never occur
153:                    return null;
154:                }
155:            }
156:
157:            /**
158:             * Return the webContainerService (Jmx).
159:             * @return the web container service.
160:             */
161:            public static ObjectName webContainerService() {
162:                try {
163:                    return ObjectName.getInstance(getDomain()
164:                            + ":type=service,name=webContainers");
165:                } catch (MalformedObjectNameException e) {
166:                    // this should never occur
167:                    return null;
168:                }
169:            }
170:
171:            public static ObjectName databaseService() {
172:                try {
173:                    return ObjectName.getInstance(getDomain()
174:                            + ":type=service,name=database");
175:                } catch (MalformedObjectNameException e) {
176:                    // this should never occur
177:                    return null;
178:                }
179:            }
180:
181:            public static ObjectName resourceService() {
182:                try {
183:                    return ObjectName.getInstance(getDomain()
184:                            + ":type=service,name=resource");
185:                } catch (MalformedObjectNameException e) {
186:                    // this should never occur
187:                    return null;
188:                }
189:            }
190:
191:            public static ObjectName transactionService() {
192:                try {
193:                    return ObjectName.getInstance(getDomain()
194:                            + ":type=service,name=jtm");
195:                } catch (MalformedObjectNameException e) {
196:                    // this should never occur
197:                    return null;
198:                }
199:            }
200:
201:            public static ObjectName logService(String filename) {
202:                try {
203:                    return ObjectName.getInstance(getDomain()
204:                            + ":type=service,name=log,fname="
205:                            + fileNameForObjectName(filename));
206:                } catch (MalformedObjectNameException e) {
207:                    // this should never occur
208:                    return null;
209:                }
210:            }
211:
212:            /**
213:             * Construct ObjectName for the discovery service MBean
214:             * @return ObjectName for the discovery service MBean
215:             */
216:            public static ObjectName discoveryService() {
217:                try {
218:                    return ObjectName.getInstance(getDomain()
219:                            + ":type=service,name=discovery");
220:                } catch (MalformedObjectNameException e) {
221:                    // this should never occur
222:                    return null;
223:                }
224:            }
225:
226:            public static ObjectName allLogServices() {
227:                try {
228:                    return ObjectName.getInstance(getDomain()
229:                            + ":type=service,name=log,*");
230:                } catch (MalformedObjectNameException e) {
231:                    // this should never occur
232:                    return null;
233:                }
234:            }
235:
236:            public static ObjectName allServices() {
237:                try {
238:                    return ObjectName.getInstance(getDomain()
239:                            + ":type=service,*");
240:                } catch (MalformedObjectNameException e) {
241:                    // this should never occur
242:                    return null;
243:                }
244:            }
245:
246:            public static ObjectName jmsService() {
247:                try {
248:                    return ObjectName.getInstance(getDomain()
249:                            + ":type=service,name=jms");
250:                } catch (MalformedObjectNameException e) {
251:                    // this should never occur
252:                    return null;
253:                }
254:            }
255:
256:            public static ObjectName jmsService1() {
257:                try {
258:                    return ObjectName.getInstance(getDomain()
259:                            + ":type=service,name=jms");
260:                } catch (MalformedObjectNameException e) {
261:                    // this should never occur
262:                    return null;
263:                }
264:            }
265:
266:            public static ObjectName securityService() {
267:                try {
268:                    return ObjectName.getInstance(getDomain()
269:                            + ":type=service,name=security");
270:                } catch (MalformedObjectNameException e) {
271:                    // this should never occur
272:                    return null;
273:                }
274:            }
275:
276:            public static ObjectName jmxService() {
277:                try {
278:                    return ObjectName
279:                            .getInstance("JMImplementation:type=MBeanServerDelegate");
280:                } catch (MalformedObjectNameException e) {
281:                    // this should never occur
282:                    return null;
283:                }
284:            }
285:
286:            public static ObjectName haService() {
287:                try {
288:                    return ObjectName.getInstance(getDomain()
289:                            + ":type=service,name=ha");
290:                } catch (MalformedObjectNameException e) {
291:                    // this should never occur
292:                    return null;
293:                }
294:            }
295:
296:            public static ObjectName www(String subtype)
297:                    throws MalformedObjectNameException {
298:                return ObjectName.getInstance(getDomain()
299:                        + ":type=www,subtype=" + subtype);
300:            }
301:
302:            public static ObjectName rar(String filename)
303:                    throws MalformedObjectNameException {
304:                return ObjectName.getInstance(getDomain()
305:                        + ":type=resource,fname="
306:                        + fileNameForObjectName(filename));
307:            }
308:
309:            public static ObjectName war(String filename)
310:                    throws MalformedObjectNameException {
311:                return ObjectName.getInstance(getDomain() + ":type=war,fname="
312:                        + fileNameForObjectName(filename));
313:            }
314:
315:            public static ObjectName datasource(String name)
316:                    throws MalformedObjectNameException {
317:                return ObjectName.getInstance(getDomain()
318:                        + ":type=datasource,name=" + name);
319:            }
320:
321:            /**
322:             * Return an objectName for a Session type mail factory.
323:             * @param name the name of the mail factory
324:             * @return an objectName for the mail factory.
325:             * @throws MalformedObjectNameException if the objectname can't be build
326:             */
327:            public static ObjectName sessionMailFactory(String name)
328:                    throws MalformedObjectNameException {
329:                return ObjectName.getInstance(getDomain()
330:                        + ":type=sessionmailfactory,name=" + name);
331:            }
332:
333:            /**
334:             * Return an objectName for the WorkManager
335:             * @return an objectName for the WorkManager
336:             */
337:            public static ObjectName workManager() {
338:                try {
339:                    return ObjectName.getInstance(getDomain()
340:                            + ":type=workmanager");
341:                } catch (MalformedObjectNameException e) {
342:                    // this should never occur
343:                    return null;
344:                }
345:            }
346:
347:            /**
348:             * Return an objectName for a MimePartDataSource type mail factory.
349:             * @param name the name of the mail factory
350:             * @return an objectName for the mail factory.
351:             * @throws MalformedObjectNameException if the objectname can't be build
352:             */
353:            public static ObjectName mimeMailFactory(String name)
354:                    throws MalformedObjectNameException {
355:                return ObjectName.getInstance(getDomain()
356:                        + ":type=mimemailfactory,name=" + name);
357:            }
358:
359:            /**
360:             * Return an objectName for a Security memory factory.
361:             * @param name the name of the security memory factory
362:             * @return an objectName for the security memory factory.
363:             * @throws MalformedObjectNameException if the objectname can't be build
364:             */
365:            public static ObjectName securityMemoryFactory(String name)
366:                    throws MalformedObjectNameException {
367:                return ObjectName.getInstance(getDomain()
368:                        + ":type=securityfactory,subtype=memory,name=" + name);
369:            }
370:
371:            /**
372:             * Return an objectName for a Security datasource factory.
373:             * @param name the name of the security datasource factory
374:             * @return an objectName for the security datasource factory.
375:             * @throws MalformedObjectNameException if the objectname can't be build
376:             */
377:            public static ObjectName securityDatasourceFactory(String name)
378:                    throws MalformedObjectNameException {
379:                return ObjectName.getInstance(getDomain()
380:                        + ":type=securityfactory,subtype=datasource,name="
381:                        + name);
382:            }
383:
384:            /**
385:             * Return an objectName for a Security ldap factory.
386:             * @param name the name of the security ldap factory
387:             * @return an objectName for the security ldap factory.
388:             * @throws MalformedObjectNameException if the objectname can't be build
389:             */
390:            public static ObjectName securityLdapFactory(String name)
391:                    throws MalformedObjectNameException {
392:                return ObjectName.getInstance(getDomain()
393:                        + ":type=securityfactory,subtype=ldap,name=" + name);
394:            }
395:
396:            /**
397:             * Return an objectName for a user
398:             * @param resource the name of the resource on which the user depends
399:             * @param username the name of the user
400:             * @return an objectName for the user MBean
401:             * @throws MalformedObjectNameException if the objectname can't be build
402:             */
403:            public static ObjectName user(String resource, String username)
404:                    throws MalformedObjectNameException {
405:                return ObjectName.getInstance(getDomain()
406:                        + ":type=security,subtype=users,resource=" + resource
407:                        + ",name=" + username);
408:            }
409:
410:            /**
411:             * Return an objectName for all the users
412:             * @return an objectName for all the users
413:             * @throws MalformedObjectNameException if the objectname can't be build
414:             */
415:            public static ObjectName allUsers() {
416:                try {
417:                    return ObjectName.getInstance(getDomain()
418:                            + ":type=security,subtype=users,*");
419:                } catch (MalformedObjectNameException e) {
420:                    // this should never occur
421:                    return null;
422:                }
423:            }
424:
425:            /**
426:             * Return an objectName for a group
427:             * @param resource the name of the resource on which the group depends
428:             * @param groupname the name of the group
429:             * @return an objectName for the group MBean
430:             * @throws MalformedObjectNameException if the objectname can't be build
431:             */
432:            public static ObjectName group(String resource, String groupname)
433:                    throws MalformedObjectNameException {
434:                return ObjectName.getInstance(getDomain()
435:                        + ":type=security,subtype=groups,resource=" + resource
436:                        + ",name=" + groupname);
437:            }
438:
439:            /**
440:             * Return an objectName for all the groups
441:             * @return an objectName for all the groups
442:             * @throws MalformedObjectNameException if the objectname can't be build
443:             */
444:            public static ObjectName allGroups() {
445:                try {
446:                    return ObjectName.getInstance(getDomain()
447:                            + ":type=security,subtype=groups,*");
448:                } catch (MalformedObjectNameException e) {
449:                    // this should never occur
450:                    return null;
451:                }
452:            }
453:
454:            /**
455:             * Return an objectName for a role
456:             * @param resource the name of the resource on which the role depends
457:             * @param rolename the name of the role
458:             * @return an objectName for the user MBean
459:             * @throws MalformedObjectNameException if the objectname can't be build
460:             */
461:            public static ObjectName role(String resource, String rolename)
462:                    throws MalformedObjectNameException {
463:                return ObjectName.getInstance(getDomain()
464:                        + ":type=security,subtype=roles,resource=" + resource
465:                        + ",name=" + rolename);
466:            }
467:
468:            /**
469:             * Return an objectName for all the roles
470:             * @return an objectName for all the roles
471:             * @throws MalformedObjectNameException if the objectname can't be build
472:             */
473:            public static ObjectName allRoles() {
474:                try {
475:                    return ObjectName.getInstance(getDomain()
476:                            + ":type=security,subtype=roles,*");
477:                } catch (MalformedObjectNameException e) {
478:                    // this should never occur
479:                    return null;
480:                }
481:            }
482:
483:            public static ObjectName resourceAdapters()
484:                    throws MalformedObjectNameException {
485:                return ObjectName.getInstance(getDomain()
486:                        + ":type=resourceadapter,*");
487:            }
488:
489:            public static ObjectName resourceAdapter(String name)
490:                    throws MalformedObjectNameException {
491:                return ObjectName.getInstance(getDomain()
492:                        + ":type=resourceadapter,name=" + name);
493:            }
494:
495:            public static ObjectName rmiConnector() {
496:                try {
497:                    return ObjectName.getInstance(getDomain()
498:                            + ":type=connector,name=rmiconnector");
499:                } catch (MalformedObjectNameException e) {
500:                    // this should never occur
501:                    return null;
502:                }
503:            }
504:
505:            public static ObjectName allWWW() {
506:                try {
507:                    return ObjectName.getInstance(getDomain()
508:                            + ":type=service,name=www,*");
509:                } catch (MalformedObjectNameException e) {
510:                    // this should never occur
511:                    return null;
512:                }
513:            }
514:
515:            public static ObjectName allEars() {
516:                try {
517:                    return ObjectName.getInstance(getDomain() + ":type=ear,*");
518:                } catch (MalformedObjectNameException e) {
519:                    // this should never occur
520:                    return null;
521:                }
522:            }
523:
524:            public static ObjectName allRars() {
525:                try {
526:                    return ObjectName.getInstance(getDomain()
527:                            + ":type=resource,*");
528:                } catch (MalformedObjectNameException e) {
529:                    // this should never occur
530:                    return null;
531:                }
532:            }
533:
534:            public static ObjectName allWars() {
535:                try {
536:                    return ObjectName.getInstance(getDomain() + ":type=war,*");
537:                } catch (MalformedObjectNameException e) {
538:                    // this should never occur
539:                    return null;
540:                }
541:            }
542:
543:            public static ObjectName allDatasources() {
544:                try {
545:                    return ObjectName.getInstance(getDomain()
546:                            + ":type=datasource,*");
547:                } catch (MalformedObjectNameException e) {
548:                    // this should never occur
549:                    return null;
550:                }
551:            }
552:
553:            /**
554:             * Return an objectName specifying all the session mail factories.
555:             * @return an objectName referencing all session mail factories.
556:             */
557:            public static ObjectName allSessionMailFactories() {
558:                try {
559:                    return ObjectName.getInstance(getDomain()
560:                            + ":type=sessionmailfactory,*");
561:                } catch (MalformedObjectNameException e) {
562:                    // this should never occur
563:                    return null;
564:                }
565:            }
566:
567:            /**
568:             * Return an objectName specifying all the mime mail factories.
569:             * @return an objectName referencing all mime mail factories.
570:             */
571:            public static ObjectName allMimeMailFactories() {
572:                try {
573:                    return ObjectName.getInstance(getDomain()
574:                            + ":type=mimemailfactory,*");
575:                } catch (MalformedObjectNameException e) {
576:                    // this should never occur
577:                    return null;
578:                }
579:            }
580:
581:            public static ObjectName allResourceAdaptors() {
582:                try {
583:                    return ObjectName.getInstance(getDomain()
584:                            + ":type=resourceadapter,*");
585:                } catch (MalformedObjectNameException e) {
586:                    // this should never occur
587:                    return null;
588:                }
589:            }
590:
591:            public static String getType(ObjectName obj) {
592:                return obj.getKeyProperty("type");
593:            }
594:
595:            public static String fileNameForObjectName(String fileName) {
596:                return fileName.replace(':', '|');
597:            }
598:
599:            /**
600:             * Return an objectName for the Security factory name.
601:             *
602:             * @param pName The name of the wanted security factory
603:             * @return an objectName for the security factory name.
604:             * @throws MalformedObjectNameException if the objectname can't be build
605:             */
606:            public static ObjectName securityFactories(String pName)
607:                    throws MalformedObjectNameException {
608:                return ObjectName.getInstance(JonasObjectName.getDomain()
609:                        + ":type=securityfactory,name=" + pName);
610:            }
611:
612:            /**
613:             * Return an objectName for the Security factory name.
614:             *
615:             * @return an objectName for the security factory name.
616:             * @throws MalformedObjectNameException if the objectname can't be build
617:             */
618:            public static ObjectName allSecurityFactories()
619:                    throws MalformedObjectNameException {
620:                return ObjectName.getInstance(JonasObjectName.getDomain()
621:                        + ":type=securityfactory,*");
622:            }
623:
624:            /**
625:             * Return an objectName for all the Security memory factories.
626:             *
627:             * @return an objectName for all the security memory factories
628:             * @throws MalformedObjectNameException if the objectname can't be build
629:             */
630:            public static ObjectName allSecurityMemoryFactories()
631:                    throws MalformedObjectNameException {
632:                return ObjectName.getInstance(JonasObjectName.getDomain()
633:                        + ":type=securityfactory,subtype=memory,*");
634:            }
635:
636:            /**
637:             * Return an objectName for all the Security datasource factories.
638:             *
639:             * @return an objectName for all the security datasource factories
640:             * @throws MalformedObjectNameException if the objectname can't be build
641:             */
642:            public static ObjectName allSecurityDatasourceFactories()
643:                    throws MalformedObjectNameException {
644:                return ObjectName.getInstance(JonasObjectName.getDomain()
645:                        + ":type=securityfactory,subtype=datasource,*");
646:            }
647:
648:            /**
649:             * Return an objectName for all the Security ldap factories.
650:             *
651:             * @return an objectName for all the security ldap factories
652:             * @throws MalformedObjectNameException if the objectname can't be build
653:             */
654:            public static ObjectName allSecurityLdapFactories()
655:                    throws MalformedObjectNameException {
656:                return ObjectName.getInstance(JonasObjectName.getDomain()
657:                        + ":type=securityfactory,subtype=ldap,*");
658:            }
659:
660:            /**
661:             * Return an objectName for all users in a resource.
662:             *
663:             * @param pResource the name of the resource on which the user depends
664:             * @return an objectName for the user MBean
665:             * @throws MalformedObjectNameException if the objectname can't be build
666:             */
667:            public static ObjectName allUsers(String pResource)
668:                    throws MalformedObjectNameException {
669:                return ObjectName.getInstance(JonasObjectName.getDomain()
670:                        + ":type=security,subtype=users,resource=" + pResource
671:                        + ",*");
672:            }
673:
674:            /**
675:             * Return an objectName for all roles in a resource.
676:             *
677:             * @param pResource the name of the resource on which the role depends
678:             * @return an objectName for the user MBean
679:             * @throws MalformedObjectNameException if the objectname can't be build
680:             */
681:            public static ObjectName allRoles(String pResource)
682:                    throws MalformedObjectNameException {
683:                return ObjectName.getInstance(JonasObjectName.getDomain()
684:                        + ":type=security,subtype=roles,resource=" + pResource
685:                        + ",*");
686:            }
687:
688:            /**
689:             * Return an objectName for all groups in a resource.
690:             *
691:             * @param pResource the name of the resource on which the group depends
692:             * @return an objectName for the user MBean
693:             * @throws MalformedObjectNameException if the objectname can't be build
694:             */
695:            public static ObjectName allGroups(String pResource)
696:                    throws MalformedObjectNameException {
697:                return ObjectName.getInstance(JonasObjectName.getDomain()
698:                        + ":type=security,subtype=groups,resource=" + pResource
699:                        + ",*");
700:            }
701:
702:            /**
703:             * A different implementation should allow returning a logical name.
704:             * This String is used within the Exception messages when throwing a ManagementException.
705:             * This is done currently in the invoke method of ManagementReprImpl/Mx4jManagementReprImpl classes.
706:             * @return String representation of the ObjectName
707:             */
708:            public String toString() {
709:                return super .toString();
710:            }
711:
712:            // Joram integration
713:            // ------------------
714:            /**
715:             * @return ObjectName for the local Joram server
716:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
717:             */
718:            public static ObjectName joramLocalServer()
719:                    throws MalformedObjectNameException {
720:                return ObjectName.getInstance("joram:type=JMSlocalServer");
721:            }
722:
723:            /**
724:             * Create ObjectName for a remote Joram server
725:             * @param id remote server identifier
726:             * @return ObjectName for a remote Joram server
727:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
728:             */
729:            public static ObjectName joramRemoteServer(String id)
730:                    throws MalformedObjectNameException {
731:                return ObjectName.getInstance("joram:type=JMSremoteServer,id="
732:                        + id);
733:            }
734:
735:            /**
736:             * Create ObjectName for a Joram managed queue
737:             * @param name queue name
738:             * @return ObjectName for a Joram managed queue
739:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
740:             */
741:            public static ObjectName joramQueue(String name)
742:                    throws MalformedObjectNameException {
743:                return ObjectName.getInstance("joram:type=JMSqueue,name="
744:                        + name);
745:            }
746:
747:            /**
748:             * Create ObjectName for a Joram managed topic
749:             * @param name topic name
750:             * @return ObjectName for a Joram managed topic
751:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
752:             */
753:            public static ObjectName joramTopic(String name)
754:                    throws MalformedObjectNameException {
755:                return ObjectName.getInstance("joram:type=JMStopic,name="
756:                        + name);
757:            }
758:
759:            /**
760:             * @return ObjectName for discovery manager MBean
761:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
762:             */
763:            public static ObjectName discoveryManager()
764:                    throws MalformedObjectNameException {
765:                return ObjectName
766:                        .getInstance(getDomain()
767:                                + ":type=management,name=discoveryManager,server=JOnAS");
768:            }
769:
770:            /**
771:             * @return ObjectName for discovery client MBean
772:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
773:             */
774:            public static ObjectName discoveryClient()
775:                    throws MalformedObjectNameException {
776:                return ObjectName.getInstance(getDomain()
777:                        + ":type=management,name=discoveryClient,server=JOnAS");
778:            }
779:
780:            /**
781:             * @return ObjectName for discovery enroller MBean
782:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
783:             */
784:            public static ObjectName discoveryEnroller()
785:                    throws MalformedObjectNameException {
786:                return ObjectName
787:                        .getInstance(getDomain()
788:                                + ":type=management,name=discoveryEnroller,server=JOnAS");
789:            }
790:
791:            /**
792:             * @return ObjectName for domain monitor MBean
793:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
794:             */
795:            public static ObjectName domainMonitor()
796:                    throws MalformedObjectNameException {
797:                return ObjectName.getInstance(getDomain()
798:                        + ":type=management,name=domainMonitor,server=JOnAS");
799:            }
800:
801:            /**
802:             * @return ObjectName for ServerProxy MBean
803:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
804:             */
805:            public static ObjectName serverProxy(String serverName)
806:                    throws MalformedObjectNameException {
807:                return ObjectName.getInstance(getDomain()
808:                        + ":type=ServerProxy,name=" + serverName);
809:            }
810:
811:            /**
812:             * @return ObjectName for ServerProxy MBean
813:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
814:             */
815:            public static ObjectName serverProxys()
816:                    throws MalformedObjectNameException {
817:                return ObjectName.getInstance(getDomain()
818:                        + ":type=ServerProxy,*");
819:            }
820:
821:            /**
822:             * Build an ObjectName for a Cluster defined by its type and its name.
823:             * @param name Name of the Cluster
824:             * @param type Type: JkCluster, TomcatCluster, JoramCluster, EjbHaCluster, CmiCluster, ...
825:             * @return ObjectName for a Cluster
826:             * @throws MalformedObjectNameException
827:             */
828:            public static ObjectName cluster(String name, String type)
829:                    throws MalformedObjectNameException {
830:                return ObjectName.getInstance(getDomain() + ":type=" + type
831:                        + ",name=" + name);
832:            }
833:
834:            /**
835:             * Build an ObjectName for a Cluster defined by its type only.
836:             * @param type Type: JkCluster, TomcatCluster, JoramCluster, EjbHaCluster, CmiCluster, ...
837:             * @return ObjectName for a Cluster
838:             * @throws MalformedObjectNameException
839:             */
840:            public static ObjectName clusters(String type)
841:                    throws MalformedObjectNameException {
842:                return ObjectName.getInstance(getDomain() + ":type=" + type
843:                        + ",name=*");
844:            }
845:
846:            /**
847:             * Build an ObjectName for a ClusterMember.
848:             * All ClusterMember have the same type, regardless the cluster type.
849:             * @param name Name of the ClusterMember
850:             * @param type type of the cluster (ex: JkCluster or TomcatCluster)
851:             * @param cluster Name of the Cluster
852:             * @return ObjectName for a ClusterMember
853:             * @throws MalformedObjectNameException
854:             */
855:            public static ObjectName clusterMember(String name, String type,
856:                    String cluster) throws MalformedObjectNameException {
857:                return ObjectName.getInstance(getDomain() + ":type=" + type
858:                        + "Member,name=" + name + "," + type + "=" + cluster);
859:            }
860:
861:            public static ObjectName clusterDaemon() throws Exception {
862:                return ObjectName.getInstance(getDomain()
863:                        + ":type=ClusterDaemon");
864:            }
865:
866:            /**
867:             * @param name name of the ClusterDaemon
868:             * @return
869:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
870:             */
871:            public static ObjectName clusterDaemonProxy(String name)
872:                    throws MalformedObjectNameException {
873:                return ObjectName.getInstance(getDomain()
874:                        + ":type=ClusterDaemonProxy,name=" + name);
875:            }
876:
877:            /**
878:             * @return ObjectName for Catalina Connectors Factory
879:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
880:             * @param pDomain domain name
881:             */
882:            public static ObjectName catalinaConnectorFactory(String pDomain)
883:                    throws MalformedObjectNameException {
884:                return new ObjectName(pDomain + ":type=ConnectorFactory");
885:            }
886:
887:            /**
888:             * @return ObjectName for WebModule Proxy
889:             * @exception MalformedObjectNameException Could not create ObjectName with the given String
890:             * @param pDomain domain name
891:             */
892:            public static ObjectName webModuleProxy(String pDomain)
893:                    throws MalformedObjectNameException {
894:                return new ObjectName(pDomain + ":type=WebModuleProxy");
895:            }
896:
897:            /**
898:             * @return ObjectName for the generic archive configurationMBean
899:             */
900:            public static ObjectName ArchiveConfig() {
901:                try {
902:                    return new ObjectName(
903:                            ":type=archiveConfig,name=ArchiveConfigMBean");
904:                } catch (javax.management.MalformedObjectNameException e) {
905:                    // this should never occur
906:                    return null;
907:                }
908:            }
909:
910:            /**
911:             * @return ObjectName for RAR specific archive configuration MBean
912:             */
913:            public static ObjectName RarConfig() {
914:                try {
915:                    return new ObjectName(
916:                            ":type=archiveConfig,name=RarConfigMBean");
917:                } catch (javax.management.MalformedObjectNameException e) {
918:                    // this should never occur
919:                    return null;
920:                }
921:            }
922:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.