Source Code Cross Referenced for PerformanceMeasurementServiceMBeanImpl.java in  » ESB » open-esb » com » sun » esb » management » impl » performance » 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.esb.management.impl.performance 
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:         * @(#)PerformanceMeasurementServiceMBeanImpl.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.esb.management.impl.performance;
030:
031:        import java.io.Serializable;
032:        import java.util.Map;
033:
034:        import javax.management.MalformedObjectNameException;
035:        import javax.management.ObjectName;
036:        import javax.management.openmbean.TabularData;
037:
038:        import com.sun.esb.management.api.performance.PerformanceMeasurementService;
039:        import com.sun.esb.management.base.services.AbstractServiceMBeansImpl;
040:        import com.sun.esb.management.common.ManagementRemoteException;
041:        import com.sun.esb.management.common.data.ComponentStatisticsData;
042:        import com.sun.esb.management.common.data.EndpointStatisticsData;
043:        import com.sun.esb.management.common.data.FrameworkStatisticsData;
044:        import com.sun.esb.management.common.data.IEndpointStatisticsData;
045:        import com.sun.esb.management.common.data.NMRStatisticsData;
046:        import com.sun.esb.management.common.data.PerformanceData;
047:        import com.sun.esb.management.common.data.ServiceAssemblyStatisticsData;
048:        import com.sun.jbi.EnvironmentContext;
049:        import com.sun.jbi.ui.common.JBIJMXObjectNames;
050:
051:        /**
052:         * Defines operations to measure performance statistics. e.g., time taken to
053:         * normalize/denormalize, encode/decode, wire-to-NMR on the endpoints, etc.
054:         * 
055:         * @author graj
056:         */
057:        public class PerformanceMeasurementServiceMBeanImpl extends
058:                AbstractServiceMBeansImpl implements 
059:                PerformanceMeasurementService, Serializable {
060:
061:            static final long serialVersionUID = -1L;
062:
063:            static final String STATISTICS_KEY = "Statistics";
064:
065:            /**
066:             * Constructor - Constructs a new instance of
067:             * PerformanceMeasurementServiceMBeanImpl
068:             * 
069:             * @param anEnvContext
070:             */
071:            public PerformanceMeasurementServiceMBeanImpl(
072:                    EnvironmentContext anEnvContext) {
073:                super (anEnvContext);
074:            }
075:
076:            /**
077:             * Resets the performance measurements on the endpoint.
078:             * 
079:             * @param componentName
080:             * @param endpoint
081:             * @param targetName
082:             * @param targetInstanceName 
083:             * @throws ManagementRemoteException
084:             * 
085:             * @see com.sun.esb.management.api.performance.PerformanceMeasurementService#clearPeformaceInstrumentationMeasurement(java.lang.String,
086:             *      java.lang.String, java.lang.String, java.lang.String)
087:             */
088:            public void clearPeformaceInstrumentationMeasurement(
089:                    String componentName, String endpoint, String targetName,
090:                    String targetInstanceName) throws ManagementRemoteException {
091:                if (false == this .isTargetUp(targetName)) {
092:                    return;
093:                }
094:
095:                Map<String /*instanceName*/, ObjectName[]> targetToObjectNamesMap = null;
096:                targetToObjectNamesMap = findLiveExtensionMBeanObjectNames(
097:                        componentName, CUSTOM_STATISTICS_NAME_KEY, targetName);
098:                if (targetToObjectNamesMap != null) {
099:                    for (String instanceName : targetToObjectNamesMap.keySet()) {
100:                        ObjectName[] objectNames = targetToObjectNamesMap
101:                                .get(instanceName);
102:                        if (targetInstanceName != null) {
103:                            if (instanceName.equals(targetInstanceName) == false) {
104:                                continue;
105:                            }
106:                        }
107:
108:                        if (objectNames != null) {
109:                            for (ObjectName objectName : objectNames) {
110:                                Object[] params = new Object[1];
111:                                params[0] = endpoint;
112:
113:                                String[] signature = new String[1];
114:                                signature[0] = "java.lang.String";
115:
116:                                this 
117:                                        .invokeMBeanOperation(
118:                                                objectName,
119:                                                "clearPeformaceInstrumentationMeasurement",
120:                                                params, signature);
121:                            }
122:                        }
123:                    }
124:                }
125:            }
126:
127:            /**
128:             * Retrieves the performance measurement enabling flag.
129:             * 
130:             * @param componentName
131:             * @param targetName
132:             * @param targetInstanceName 
133:             * @return true if measurement enabled, false if not
134:             * @throws ManagementRemoteException
135:             * 
136:             * @see com.sun.esb.management.api.performance.PerformanceMeasurementService#getPerformanceInstrumentationEnabled(java.lang.String,
137:             *      java.lang.String, java.lang.String)
138:             */
139:            public boolean getPerformanceInstrumentationEnabled(
140:                    String componentName, String targetName,
141:                    String targetInstanceName) throws ManagementRemoteException {
142:                Boolean result = Boolean.FALSE;
143:                if (false == this .isTargetUp(targetName)) {
144:                    return result.booleanValue();
145:                }
146:
147:                Map<String /*instanceName*/, ObjectName[]> targetToObjectNamesMap = null;
148:                targetToObjectNamesMap = findLiveExtensionMBeanObjectNames(
149:                        componentName, CUSTOM_STATISTICS_NAME_KEY, targetName);
150:                if (targetToObjectNamesMap != null) {
151:                    for (String instanceName : targetToObjectNamesMap.keySet()) {
152:                        ObjectName[] objectNames = targetToObjectNamesMap
153:                                .get(instanceName);
154:                        if (targetInstanceName != null) {
155:                            if (instanceName.equals(targetInstanceName) == false) {
156:                                continue;
157:                            }
158:                        }
159:
160:                        if (objectNames != null) {
161:                            for (ObjectName objectName : objectNames) {
162:                                Object[] params = null;
163:                                String[] signature = null;
164:
165:                                result = (Boolean) this .invokeMBeanOperation(
166:                                        objectName,
167:                                        "getPerformanceInstrumentationEnabled",
168:                                        params, signature);
169:                            }
170:                        }
171:                    }
172:                }
173:                return result.booleanValue();
174:            }
175:
176:            /**
177:             * Retrieves the performance measurement data for the specified endpoint.
178:             * 
179:             * @param componentName
180:             * @param endpoint
181:             * @param targetName
182:             * @param targetInstanceName 
183:             * @return XML string representing PerformanceData map
184:             * @throws ManagementRemoteException
185:             * 
186:             * @see com.sun.esb.management.api.performance.PerformanceMeasurementService#getPerformanceInstrumentationMeasurement(java.lang.String,
187:             *      java.lang.String, java.lang.String, java.lang.String)
188:             */
189:            public String getPerformanceInstrumentationMeasurement(
190:                    String componentName, String endpoint, String targetName,
191:                    String targetInstanceName) throws ManagementRemoteException {
192:                String xmlText = null;
193:                if (false == this .isTargetUp(targetName)) {
194:                    return xmlText;
195:                }
196:                Map<String /* Category */, PerformanceData> performanceDataMap = null;
197:
198:                Map<String /*instanceName*/, ObjectName[]> targetToObjectNamesMap = null;
199:                targetToObjectNamesMap = findLiveExtensionMBeanObjectNames(
200:                        componentName, CUSTOM_STATISTICS_NAME_KEY, targetName);
201:                if (targetToObjectNamesMap != null) {
202:                    for (String instanceName : targetToObjectNamesMap.keySet()) {
203:                        ObjectName[] objectNames = targetToObjectNamesMap
204:                                .get(instanceName);
205:                        if (targetInstanceName != null) {
206:                            if (instanceName.equals(targetInstanceName) == false) {
207:                                continue;
208:                            }
209:                        }
210:                        if (objectNames != null) {
211:                            for (ObjectName objectName : objectNames) {
212:                                Object[] params = new Object[1];
213:                                params[0] = endpoint;
214:
215:                                String[] signature = new String[1];
216:                                signature[0] = "java.lang.String";
217:
218:                                Object resultObject = this 
219:                                        .invokeMBeanOperation(
220:                                                objectName,
221:                                                "getPerformanceInstrumentationMeasurement",
222:                                                params, signature);
223:
224:                                if (resultObject != null) {
225:                                    performanceDataMap = PerformanceData
226:                                            .retrieveDataMap((TabularData) resultObject);
227:                                    xmlText = PerformanceData
228:                                            .convertDataMapToXML(performanceDataMap);
229:
230:                                }
231:                            }
232:                        }
233:                    }
234:                }
235:                return xmlText;
236:            }
237:
238:            /**
239:             * Retrieves the performance statistics categories. Each item in the array
240:             * is the key to the composite performance data, which also indicates the
241:             * type (e.g. normalization) of measurement.
242:             * 
243:             * @param componentName
244:             * @param targetName
245:             * @param targetInstanceName 
246:             * @return array of performance measurement categories
247:             * @throws ManagementRemoteException
248:             * 
249:             * @see com.sun.esb.management.api.performance.PerformanceMeasurementService#getPerformanceMeasurementCategories(java.lang.String,
250:             *      java.lang.String, java.lang.String)
251:             */
252:            public String[] getPerformanceMeasurementCategories(
253:                    String componentName, String targetName,
254:                    String targetInstanceName) throws ManagementRemoteException {
255:                String[] measurementCategories = null;
256:                if (false == this .isTargetUp(targetName)) {
257:                    return measurementCategories;
258:                }
259:
260:                Map<String /*instanceName*/, ObjectName[]> targetToObjectNamesMap = null;
261:                targetToObjectNamesMap = findLiveExtensionMBeanObjectNames(
262:                        componentName, CUSTOM_STATISTICS_NAME_KEY, targetName);
263:                if (targetToObjectNamesMap != null) {
264:                    for (String instanceName : targetToObjectNamesMap.keySet()) {
265:                        ObjectName[] objectNames = targetToObjectNamesMap
266:                                .get(instanceName);
267:                        if (targetInstanceName != null) {
268:                            if (instanceName.equals(targetInstanceName) == false) {
269:                                continue;
270:                            }
271:                        }
272:
273:                        if (objectNames != null) {
274:                            for (ObjectName objectName : objectNames) {
275:                                Object[] params = null;
276:                                String[] signature = null;
277:
278:                                measurementCategories = (String[]) this 
279:                                        .invokeMBeanOperation(
280:                                                objectName,
281:                                                "getPerformanceMeasurementCategories",
282:                                                params, signature);
283:                            }
284:                        }
285:                    }
286:                }
287:                return measurementCategories;
288:            }
289:
290:            /**
291:             * Sets the performance measurement enabling flag.
292:             * 
293:             * @param componentName
294:             * @param flag
295:             * @param targetName
296:             * @param targetInstanceName
297:             * @throws ManagementRemoteException
298:             * 
299:             * @see com.sun.esb.management.api.performance.PerformanceMeasurementService#setPerformanceInstrumentationEnabled(java.lang.String,
300:             *      boolean, java.lang.String, java.lang.String)
301:             */
302:            public void setPerformanceInstrumentationEnabled(
303:                    String componentName, boolean flag, String targetName,
304:                    String targetInstanceName) throws ManagementRemoteException {
305:                if (false == this .isTargetUp(targetName)) {
306:                    return;
307:                }
308:                Map<String /*instanceName*/, ObjectName[]> targetToObjectNamesMap = null;
309:                targetToObjectNamesMap = findLiveExtensionMBeanObjectNames(
310:                        componentName, CUSTOM_STATISTICS_NAME_KEY, targetName);
311:                if (targetToObjectNamesMap != null) {
312:                    for (String instanceName : targetToObjectNamesMap.keySet()) {
313:                        ObjectName[] objectNames = targetToObjectNamesMap
314:                                .get(instanceName);
315:                        if (targetInstanceName != null) {
316:                            if (instanceName.equals(targetInstanceName) == false) {
317:                                continue;
318:                            }
319:                        }
320:
321:                        if (objectNames != null) {
322:                            for (ObjectName objectName : objectNames) {
323:                                Object[] params = new Object[1];
324:                                params[0] = flag;
325:
326:                                String[] signature = new String[1];
327:                                signature[0] = "java.lang.boolean";
328:
329:                                this .invokeMBeanOperation(objectName,
330:                                        "setPerformanceInstrumentationEnabled",
331:                                        params, signature);
332:                            }
333:                        }
334:                    }
335:                }
336:            }
337:
338:            /**
339:             * This method is used to provide JBIFramework statistics in the given
340:             * target.
341:             * 
342:             * @param target
343:             *            target name.
344:             * @return TabularData table of framework statistics in the given target.
345:             * 
346:             * If the target is a standalone instance the table will have one entry. If
347:             * the target is a cluster the table will have an entry for each instance.
348:             * 
349:             * For more information about the type of the entries in table please refer
350:             * to <code>JBIStatisticsMBean</code>
351:             */
352:            public String getFrameworkStatistics(String targetName)
353:                    throws ManagementRemoteException {
354:                String xmlText = null;
355:                Map<String /* instanceName */, FrameworkStatisticsData> map = null;
356:                TabularData tabularResult = this 
357:                        .getFrameworkStatisticsAsTabularData(targetName);
358:                if (tabularResult != null) {
359:                    map = FrameworkStatisticsData
360:                            .retrieveDataMap(tabularResult);
361:                    xmlText = FrameworkStatisticsData.convertDataMapToXML(map);
362:                }
363:                return xmlText;
364:            }
365:
366:            /**
367:             * This method is used to provide JBIFramework statistics in the given
368:             * target.
369:             * 
370:             * @param target
371:             *            target name.
372:             * @return TabularData table of framework statistics in the given target.
373:             * 
374:             * If the target is a standalone instance the table will have one entry. If
375:             * the target is a cluster the table will have an entry for each instance.
376:             * 
377:             * For more information about the type of the entries in table please refer
378:             * to <code>JBIStatisticsMBean</code>
379:             */
380:            public TabularData getFrameworkStatisticsAsTabularData(
381:                    String targetName) throws ManagementRemoteException {
382:                TabularData tabularResult = null;
383:                String FRAMEWORK_STATS_METHOD = "getFrameworkStats";
384:                try {
385:                    tabularResult = (TabularData) invokeMBeanOperation(
386:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
387:                            FRAMEWORK_STATS_METHOD,
388:                            new Object[] { targetName },
389:                            new String[] { "java.lang.String" });
390:                } catch (MalformedObjectNameException me) {
391:                    throw new ManagementRemoteException(me);
392:                }
393:                return tabularResult;
394:            }
395:
396:            /**
397:             * This method is used to provide statistics for the given component in the
398:             * given target
399:             * 
400:             * @param targetName
401:             *            target name
402:             * @param componentName
403:             *            component name
404:             * @return TabularData table of component statistics
405:             * 
406:             * If the target is a standalone instance the table will have one entry. If
407:             * the target is a cluster the table will have an entry for each instance.
408:             * 
409:             * For more information about the type of the entries in table please refer
410:             * to <code>JBIStatisticsMBean</code>
411:             */
412:            public String getComponentStatistics(String componentName,
413:                    String targetName) throws ManagementRemoteException {
414:                String xmlText = null;
415:                Map<String /* instanceName */, ComponentStatisticsData> map = null;
416:                TabularData tabularResult = getComponentStatisticsAsTabularData(
417:                        componentName, targetName);
418:                if (tabularResult != null) {
419:                    map = ComponentStatisticsData
420:                            .retrieveDataMap(tabularResult);
421:                    xmlText = ComponentStatisticsData.convertDataMapToXML(map);
422:                }
423:                return xmlText;
424:            }
425:
426:            /**
427:             * This method is used to provide statistics for the given component in the
428:             * given target
429:             * 
430:             * @param targetName
431:             *            target name
432:             * @param componentName
433:             *            component name
434:             * @return TabularData table of component statistics
435:             * 
436:             * If the target is a standalone instance the table will have one entry. If
437:             * the target is a cluster the table will have an entry for each instance.
438:             * 
439:             * For more information about the type of the entries in table please refer
440:             * to <code>JBIStatisticsMBean</code>
441:             * 
442:             */
443:            public TabularData getComponentStatisticsAsTabularData(
444:                    String componentName, String targetName)
445:                    throws ManagementRemoteException {
446:                String COMPONENT_STATS_METHOD = "getComponentStats";
447:                TabularData tabularResult = null;
448:                try {
449:                    tabularResult = (TabularData) invokeMBeanOperation(
450:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
451:                            COMPONENT_STATS_METHOD, new Object[] {
452:                                    componentName, targetName }, new String[] {
453:                                    "java.lang.String", "java.lang.String" });
454:                } catch (MalformedObjectNameException me) {
455:                    throw new ManagementRemoteException(me);
456:                }
457:                return tabularResult;
458:            }
459:
460:            /**
461:             * This method is used to provide statistic information about the given
462:             * endpoint in the given target
463:             * 
464:             * @param targetName
465:             *            target name
466:             * @param endpointName
467:             *            the endpoint Name
468:             * @return TabularData table of endpoint statistics
469:             * 
470:             * If the target is a standalone instance the table will have one entry. If
471:             * the target is a cluster the table will have an entry for each instance.
472:             * 
473:             * For more information about the type of the entries in table please refer
474:             * to <code>JBIStatisticsMBean</code>
475:             */
476:            public String getEndpointStatistics(String endpointName,
477:                    String targetName) throws ManagementRemoteException {
478:                String xmlText = null;
479:                Map<String /* instanceName */, IEndpointStatisticsData> map = null;
480:                TabularData tabularResult = this 
481:                        .getEndpointStatisticsAsTabularData(endpointName,
482:                                targetName);
483:                if (tabularResult != null) {
484:                    map = EndpointStatisticsData.retrieveDataMap(tabularResult);
485:                    xmlText = EndpointStatisticsData.convertDataMapToXML(map);
486:                }
487:                return xmlText;
488:            }
489:
490:            /**
491:             * This method is used to provide statistic information about the given
492:             * endpoint in the given target
493:             * 
494:             * @param targetName
495:             *            target name
496:             * @param endpointName
497:             *            the endpoint Name
498:             * @return TabularData table of endpoint statistics
499:             * 
500:             * If the target is a standalone instance the table will have one entry. If
501:             * the target is a cluster the table will have an entry for each instance.
502:             * 
503:             * For more information about the type of the entries in table please refer
504:             * to <code>JBIStatisticsMBean</code>
505:             */
506:            public TabularData getEndpointStatisticsAsTabularData(
507:                    String endpointName, String targetName)
508:                    throws ManagementRemoteException {
509:                TabularData tabularResult = null;
510:                String ENDPOINT_STATS_METHOD = "getEndpointStats";
511:                try {
512:                    tabularResult = (TabularData) invokeMBeanOperation(
513:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
514:                            ENDPOINT_STATS_METHOD, new Object[] { endpointName,
515:                                    targetName }, new String[] {
516:                                    "java.lang.String", "java.lang.String" });
517:                } catch (MalformedObjectNameException me) {
518:                    throw new ManagementRemoteException(me);
519:                }
520:                return tabularResult;
521:            }
522:
523:            /**
524:             * This method is used to provide statistics about the message service in
525:             * the given target.
526:             * 
527:             * @param target
528:             *            target name.
529:             * @return TabularData table of NMR statistics in the given target.
530:             * 
531:             * If the target is a standalone instance the table will have one entry. If
532:             * the target is a cluster the table will have an entry for each instance.
533:             * 
534:             * For more information about the type of the entries in table please refer
535:             * to <code>JBIStatisticsMBean</code>
536:             */
537:            public String getNMRStatistics(String targetName)
538:                    throws ManagementRemoteException {
539:                String xmlText = null;
540:                Map<String /* instanceName */, NMRStatisticsData> map = null;
541:                TabularData tabularResult = this 
542:                        .getNMRStatisticsAsTabularData(targetName);
543:                if (tabularResult != null) {
544:                    map = NMRStatisticsData.retrieveDataMap(tabularResult);
545:                    xmlText = NMRStatisticsData.convertDataMapToXML(map);
546:                }
547:                return xmlText;
548:            }
549:
550:            /**
551:             * This method is used to provide statistics about the message service in
552:             * the given target.
553:             * 
554:             * @param target
555:             *            target name.
556:             * @return TabularData table of NMR statistics in the given target.
557:             * 
558:             * If the target is a standalone instance the table will have one entry. If
559:             * the target is a cluster the table will have an entry for each instance.
560:             * 
561:             * For more information about the type of the entries in table please refer
562:             * to <code>JBIStatisticsMBean</code>
563:             */
564:            public TabularData getNMRStatisticsAsTabularData(String targetName)
565:                    throws ManagementRemoteException {
566:                TabularData tabularResult = null;
567:                String NMR_STATS_METHOD = "getNMRStats";
568:                try {
569:                    tabularResult = (TabularData) invokeMBeanOperation(
570:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
571:                            NMR_STATS_METHOD, new Object[] { targetName },
572:                            new String[] { "java.lang.String" });
573:                } catch (MalformedObjectNameException me) {
574:                    throw new ManagementRemoteException(me);
575:                }
576:
577:                return tabularResult;
578:            }
579:
580:            /**
581:             * This method is used to provide statistics about a Service Assembly in the
582:             * given target.
583:             * 
584:             * @param target
585:             *            target name.
586:             * @param assemblyName
587:             *            the service assembly name.
588:             * @return TabularData table of NMR statistics in the given target.
589:             * 
590:             * If the target is a standalone instance the table will have one entry. If
591:             * the target is a cluster the table will have an entry for each instance.
592:             * 
593:             * For more information about the type of the entries in table please refer
594:             * to <code>JBIStatisticsMBean</code>
595:             */
596:            public String getServiceAssemblyStatistics(String assemblyName,
597:                    String targetName) throws ManagementRemoteException {
598:                String xmlText = null;
599:                Map<String /* instanceName */, ServiceAssemblyStatisticsData> map = null;
600:                TabularData tabularResult = this 
601:                        .getServiceAssemblyStatisticsAsTabularData(
602:                                assemblyName, targetName);
603:                if (tabularResult != null) {
604:                    map = ServiceAssemblyStatisticsData
605:                            .retrieveDataMap(tabularResult);
606:                    xmlText = ServiceAssemblyStatisticsData
607:                            .convertDataMapToXML(map);
608:                }
609:                return xmlText;
610:            }
611:
612:            /**
613:             * This method is used to provide statistics about a Service Assembly in the
614:             * given target.
615:             * 
616:             * @param target
617:             *            target name.
618:             * @param assemblyName
619:             *            the service assembly name.
620:             * @return TabularData table of NMR statistics in the given target.
621:             * 
622:             * If the target is a standalone instance the table will have one entry. If
623:             * the target is a cluster the table will have an entry for each instance.
624:             * 
625:             * For more information about the type of the entries in table please refer
626:             * to <code>JBIStatisticsMBean</code>
627:             */
628:            public TabularData getServiceAssemblyStatisticsAsTabularData(
629:                    String assemblyName, String targetName)
630:                    throws ManagementRemoteException {
631:                TabularData tabularResult = null;
632:                String SA_STATS_METHOD = "getServiceAssemblyStats";
633:                try {
634:                    tabularResult = (TabularData) invokeMBeanOperation(
635:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
636:                            SA_STATS_METHOD, new Object[] { assemblyName,
637:                                    targetName }, new String[] {
638:                                    "java.lang.String", "java.lang.String" });
639:                } catch (MalformedObjectNameException me) {
640:                    throw new ManagementRemoteException(me);
641:                }
642:                return tabularResult;
643:            }
644:
645:            /**
646:             * This method is used to provide a list of consuming endpoints for a component.
647:             * @param componentName component name
648:             * @param target target name.
649:             * @return TabularData list of consuming endpoints 
650:             *
651:             * If the target is a standalone instance the table will have one entry.
652:             * If the target is a cluster the table will have an entry for each instance.
653:             *
654:             * Each entry in this tabular data is of the following composite type
655:             * 
656:             *  String            - "InstanceName",
657:             *  String[]          - "Endpoints",
658:             */
659:            public TabularData getConsumingEndpointsForComponentAsTabularData(
660:                    String componentName, String targetName)
661:                    throws ManagementRemoteException {
662:                TabularData tabularResult = null;
663:                String ENDPOINTS_LIST_METHOD = "getConsumingEndpointsForComponent";
664:                try {
665:                    tabularResult = (TabularData) invokeMBeanOperation(
666:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
667:                            ENDPOINTS_LIST_METHOD, new Object[] {
668:                                    componentName, targetName }, new String[] {
669:                                    "java.lang.String", "java.lang.String" });
670:                } catch (MalformedObjectNameException me) {
671:                    throw new ManagementRemoteException(me);
672:                }
673:                return tabularResult;
674:
675:            }
676:
677:            /**
678:             * This method is used to provide a list of provisioning endpoints for a component.
679:             * @param componentName component name
680:             * @param target target name.
681:             * @return TabularData list of provisioning endpoints 
682:             *
683:             * If the target is a standalone instance the table will have one entry.
684:             * If the target is a cluster the table will have an entry for each instance.
685:             *
686:             * Each entry in this tabular data is of the following composite type
687:             * 
688:             *  String            - "InstanceName",
689:             *  String[]          - "Endpoints",
690:             */
691:            public TabularData getProvidingEndpointsForComponentAsTabularData(
692:                    String componentName, String targetName)
693:                    throws ManagementRemoteException {
694:                TabularData tabularResult = null;
695:                String ENDPOINTS_LIST_METHOD = "getProvidingEndpointsForComponent";
696:                try {
697:                    tabularResult = (TabularData) invokeMBeanOperation(
698:                            JBIJMXObjectNames.getJbiStatisticsMBeanObjectName(),
699:                            ENDPOINTS_LIST_METHOD, new Object[] {
700:                                    componentName, targetName }, new String[] {
701:                                    "java.lang.String", "java.lang.String" });
702:                } catch (MalformedObjectNameException me) {
703:                    throw new ManagementRemoteException(me);
704:                }
705:                return tabularResult;
706:            }
707:
708:            /**
709:             * This method is used to enable monitoring of timing information about
710:             * message exchanges
711:             * 
712:             * @param targetName
713:             *            the target name
714:             */
715:            public void enableMessageExchangeMonitoring(String targetName)
716:                    throws ManagementRemoteException {
717:                String ENABLE_TIMINGS_METHOD = "enableMessageExchangeMonitoring";
718:                try {
719:                    invokeMBeanOperation(JBIJMXObjectNames
720:                            .getJbiStatisticsMBeanObjectName(),
721:                            ENABLE_TIMINGS_METHOD, new Object[] { targetName },
722:                            new String[] { "java.lang.String" });
723:                } catch (MalformedObjectNameException me) {
724:                    throw new ManagementRemoteException(me);
725:                }
726:
727:            }
728:
729:            /**
730:             * This method is used to disable monitoring of timing information about
731:             * message exchanges
732:             * 
733:             * @param targetName
734:             *            the target name
735:             */
736:            public void disableMessageExchangeMonitoring(String targetName)
737:                    throws ManagementRemoteException {
738:                String DISABLE_TIMINGS_METHOD = "disableMessageExchangeMonitoring";
739:                try {
740:                    invokeMBeanOperation(JBIJMXObjectNames
741:                            .getJbiStatisticsMBeanObjectName(),
742:                            DISABLE_TIMINGS_METHOD,
743:                            new Object[] { targetName },
744:                            new String[] { "java.lang.String" });
745:                } catch (MalformedObjectNameException me) {
746:                    throw new ManagementRemoteException(me);
747:                }
748:
749:            }
750:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.