Source Code Cross Referenced for NMRStatisticsDataCreator.java in  » ESB » open-esb » com » sun » esb » management » common » data » 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.common.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package com.sun.esb.management.common.data;
004:
005:        import java.io.IOException;
006:        import java.net.MalformedURLException;
007:        import java.net.URISyntaxException;
008:        import java.util.Map;
009:        import java.util.Set;
010:
011:        import javax.management.openmbean.ArrayType;
012:        import javax.management.openmbean.CompositeData;
013:        import javax.management.openmbean.CompositeDataSupport;
014:        import javax.management.openmbean.CompositeType;
015:        import javax.management.openmbean.OpenDataException;
016:        import javax.management.openmbean.OpenType;
017:        import javax.management.openmbean.SimpleType;
018:        import javax.management.openmbean.TabularData;
019:        import javax.management.openmbean.TabularDataSupport;
020:        import javax.management.openmbean.TabularType;
021:        import javax.xml.parsers.ParserConfigurationException;
022:
023:        import org.xml.sax.SAXException;
024:
025:        import com.sun.esb.management.common.ManagementRemoteException;
026:        import com.sun.esb.management.common.data.helper.NMRStatisticsDataReader;
027:
028:        /**
029:         * @author graj
030:         *
031:         */
032:        public class NMRStatisticsDataCreator {
033:
034:            /** nmr CompositeType item names   */
035:            static String[] NMR_STATS_ITEM_NAMES = { "InstanceName",
036:                    "ListActiveChannels", "ListActiveEndpoints" };
037:
038:            /** nmr CompositeType item descriptions   */
039:            static String[] NMR_STATS_ITEM_DESCRIPTIONS = { "Instance Name",
040:                    "List of active delivery channels",
041:                    "List of active endpoints" };
042:
043:            /** nmr stats table index   */
044:            static String[] NMR_STATS_TABLE_INDEX = new String[] { "InstanceName" };
045:
046:            /** nmr stats active channels */
047:            static String NMR_ACTIVE_CHANNELS = "ActiveChannels";
048:
049:            /** nmr stats active endpoints */
050:            static String NMR_ACTIVE_ENDPOINTS = "ActiveEndpoints";
051:
052:            /**
053:             * 
054:             */
055:            public NMRStatisticsDataCreator() {
056:            }
057:
058:            /**
059:             * 
060:             * @param data
061:             * @return
062:             * @throws ManagementRemoteException
063:             */
064:            public static TabularData createTabularData(
065:                    Map<String /* instanceName */, NMRStatisticsData> map)
066:                    throws ManagementRemoteException {
067:                TabularData nmrStatsTable = null;
068:
069:                try {
070:                    ArrayType activeChannelsArray = new ArrayType(1,
071:                            SimpleType.STRING);
072:                    ArrayType activeEndpointsArray = new ArrayType(1,
073:                            SimpleType.STRING);
074:
075:                    OpenType[] nmrStatsItemTypes = { SimpleType.STRING,
076:                            activeChannelsArray, activeEndpointsArray };
077:                    CompositeType NMRStatsEntriesType = new CompositeType(
078:                            "NMRStatistics", "NMR Statistics",
079:                            NMR_STATS_ITEM_NAMES, NMR_STATS_ITEM_DESCRIPTIONS,
080:                            nmrStatsItemTypes);
081:
082:                    TabularType nmrStatsType = new TabularType("NMRStats",
083:                            "NMR Statistic Information", NMRStatsEntriesType,
084:                            NMR_STATS_TABLE_INDEX);
085:
086:                    nmrStatsTable = new TabularDataSupport(nmrStatsType);
087:
088:                    Set<String> instances = map.keySet();
089:                    for (String instanceName : instances) {
090:                        NMRStatisticsData data = map.get(instanceName);
091:                        nmrStatsTable.put(getNMRStatistics(NMRStatsEntriesType,
092:                                data));
093:                    }
094:
095:                } catch (OpenDataException e) {
096:                    throw new ManagementRemoteException(e);
097:                }
098:                return nmrStatsTable;
099:
100:            }
101:
102:            /**
103:             * This method is used to provide query framework statistics from the
104:             * given NMRStatisticsData
105:             * 
106:             * @param NMRStatsEntriesType
107:             * @param data
108:             * @return
109:             * @throws ManagementRemoteException
110:             */
111:            protected static CompositeData getNMRStatistics(
112:                    CompositeType NMRStatsEntriesType, NMRStatisticsData data)
113:                    throws ManagementRemoteException {
114:                try {
115:                    Object[] values = { data.getInstanceName(),
116:                            data.getActiveChannelsArray(),
117:                            data.getActiveEndpointsArray() };
118:
119:                    return new CompositeDataSupport(NMRStatsEntriesType,
120:                            NMR_STATS_ITEM_NAMES, values);
121:
122:                } catch (Exception ex) {
123:                    throw new ManagementRemoteException(ex);
124:                }
125:            }
126:
127:            /**
128:             * @param args
129:             */
130:            public static void main(String[] args) {
131:                String uri = "C:/test/schema/nmrstatistics/NMRStatisticsData.xml";
132:                try {
133:
134:                    Map<String /* instanceName */, NMRStatisticsData> map = null;
135:                    map = NMRStatisticsDataReader.parseFromFile(uri);
136:                    for (String instanceName : map.keySet()) {
137:                        System.out.println(map.get(instanceName)
138:                                .getDisplayString());
139:                    }
140:                    TabularData data = NMRStatisticsDataCreator
141:                            .createTabularData(map);
142:                    System.out.println(data);
143:                } catch (MalformedURLException e) {
144:                    e.printStackTrace();
145:                } catch (ManagementRemoteException e) {
146:                    e.printStackTrace();
147:                } catch (ParserConfigurationException e) {
148:                    e.printStackTrace();
149:                } catch (SAXException e) {
150:                    e.printStackTrace();
151:                } catch (URISyntaxException e) {
152:                    e.printStackTrace();
153:                } catch (IOException e) {
154:                    e.printStackTrace();
155:                }
156:            }
157:
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.