Source Code Cross Referenced for ConsumingEndpointStatisticsDataCreator.java in  » ESB » open-esb » com » sun » esb » management » common » data » helper » 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.helper 
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:         * @(#)ConsumingEndpointStatisticsDataCreator.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.common.data.helper;
030:
031:        import java.util.ArrayList;
032:        import java.util.Map;
033:        import java.util.Set;
034:
035:        import javax.management.openmbean.CompositeData;
036:        import javax.management.openmbean.CompositeDataSupport;
037:        import javax.management.openmbean.CompositeType;
038:        import javax.management.openmbean.OpenDataException;
039:        import javax.management.openmbean.OpenType;
040:        import javax.management.openmbean.SimpleType;
041:        import javax.management.openmbean.TabularData;
042:        import javax.management.openmbean.TabularDataSupport;
043:        import javax.management.openmbean.TabularType;
044:
045:        import com.sun.esb.management.common.ManagementRemoteException;
046:        import com.sun.esb.management.common.data.ConsumingEndpointStatisticsData;
047:        import com.sun.esb.management.common.data.IEndpointStatisticsData;
048:
049:        /**
050:         * @author graj
051:         *
052:         */
053:        public class ConsumingEndpointStatisticsDataCreator {
054:            /**  table index   */
055:            static String[] STATS_TABLE_INDEX = new String[] { "InstanceName" };
056:
057:            /**
058:             * 
059:             */
060:            public ConsumingEndpointStatisticsDataCreator() {
061:                // TODO Auto-generated constructor stub
062:            }
063:
064:            /**
065:             * 
066:             * @param data
067:             * @return
068:             * @throws ManagementRemoteException
069:             */
070:            public static TabularData createTabularData(
071:                    Map<String /* instanceName */, IEndpointStatisticsData> map)
072:                    throws ManagementRemoteException {
073:                Set<String> instanceNames = map.keySet();
074:
075:                TabularType endpointStatsTableType = null;
076:                TabularData endpointsStatsTable = null;
077:                CompositeData[] endpointStats = new CompositeData[instanceNames
078:                        .size()];
079:                int index = 0;
080:                for (String instanceName : instanceNames) {
081:                    IEndpointStatisticsData value = map.get(instanceName);
082:                    ConsumingEndpointStatisticsData data = (ConsumingEndpointStatisticsData) value;
083:                    endpointStats[index++] = composeConsumingEndpointStats(data);
084:                }
085:                // the tabular type could be constructed only after we have the endpoint
086:                // stats composite type so we need atleast one entry
087:                try {
088:                    if (index > 0 && endpointStats[0] != null) {
089:                        endpointStatsTableType = new TabularType(
090:                                "EndpointStats",
091:                                "Endpoint Statistic Information",
092:                                endpointStats[0].getCompositeType(),
093:                                STATS_TABLE_INDEX);
094:                        endpointsStatsTable = new TabularDataSupport(
095:                                endpointStatsTableType);
096:
097:                        for (int innerIndex = 0; innerIndex < index; innerIndex++) {
098:                            endpointsStatsTable.put(endpointStats[innerIndex]);
099:                        }
100:                    }
101:                } catch (OpenDataException e) {
102:                    throw new ManagementRemoteException(e);
103:                }
104:
105:                return endpointsStatsTable;
106:            }
107:
108:            /**
109:             * This method is used to compose consuming endpoint stats
110:             * @param instanceName
111:             * @param commonValues values common to both consuming and consumer
112:             * @param consumingValues values specific to consuming
113:             * @param ojcStats table of performance data
114:             * @return CompositeData composite data
115:             *
116:             */
117:            protected static CompositeData composeConsumingEndpointStats(
118:                    ConsumingEndpointStatisticsData data)
119:                    throws ManagementRemoteException {
120:
121:                TabularType ojcStatsType = null;
122:                if (data.getCategoryToPerformanceDataMap() != null) {
123:                    //ojcStatsType = ojcStats.getTabularType();
124:                }
125:
126:                ArrayList<String> consumerItemNames = new ArrayList<String>();
127:                consumerItemNames.add("InstanceName");
128:                consumerItemNames.add("NumSentRequests");
129:                consumerItemNames.add("NumReceivedReplies");
130:                consumerItemNames.add("NumReceivedDONEs");
131:                consumerItemNames.add("NumSentDONEs");
132:                consumerItemNames.add("NumReceivedFaults");
133:                consumerItemNames.add("NumSentFaults");
134:                consumerItemNames.add("NumReceivedErrors");
135:                consumerItemNames.add("NumSentErrors");
136:                consumerItemNames.add("NumActiveExchanges");
137:                consumerItemNames.add("ComponentName");
138:                consumerItemNames.add("ME-StatusTime-Avg");
139:                consumerItemNames.add("ME-ComponentTime-Avg");
140:                consumerItemNames.add("ME-DeliveryChannelTime-Avg");
141:                consumerItemNames.add("ME-MessageServiceTime-Avg");
142:                if (ojcStatsType != null) {
143:                    consumerItemNames.add("PerformanceMeasurements");
144:                }
145:
146:                ArrayList<String> consumerItemDescriptions = new ArrayList<String>();
147:                consumerItemDescriptions.add("Instance Name");
148:                consumerItemDescriptions.add("Number of Sent Requests");
149:                consumerItemDescriptions.add("Number of Received Replies");
150:                consumerItemDescriptions.add("Number of Received DONEs");
151:                consumerItemDescriptions.add("Number of Sent DONEs");
152:                consumerItemDescriptions.add("Number of Received Faults");
153:                consumerItemDescriptions.add("Number of Sent Faults");
154:                consumerItemDescriptions.add("Number of Received Errors");
155:                consumerItemDescriptions.add("Number of Sent Errors");
156:                consumerItemDescriptions.add("Number of active exchanges");
157:                consumerItemDescriptions.add("Name of the owning component");
158:                consumerItemDescriptions
159:                        .add("Message Exchange Status Time Avg in ns");
160:                consumerItemDescriptions
161:                        .add("Message Exchange ComponentTime Avg in ns");
162:                consumerItemDescriptions
163:                        .add("Message Exchange DeliveryChannelTime Avg in ns");
164:                consumerItemDescriptions
165:                        .add("Message Exchange MessageServiceTime  Avg in ns");
166:                if (ojcStatsType != null) {
167:                    consumerItemDescriptions
168:                            .add("Performance Measurements recorded by OJC Components");
169:                }
170:                ;
171:
172:                ArrayList<OpenType> consumerItemTypes = new ArrayList<OpenType>();
173:                consumerItemTypes.add(SimpleType.STRING);
174:                consumerItemTypes.add(SimpleType.LONG);
175:                consumerItemTypes.add(SimpleType.LONG);
176:                consumerItemTypes.add(SimpleType.LONG);
177:                consumerItemTypes.add(SimpleType.LONG);
178:                consumerItemTypes.add(SimpleType.LONG);
179:                consumerItemTypes.add(SimpleType.LONG);
180:                consumerItemTypes.add(SimpleType.LONG);
181:                consumerItemTypes.add(SimpleType.LONG);
182:                consumerItemTypes.add(SimpleType.LONG);
183:                consumerItemTypes.add(SimpleType.STRING);
184:                consumerItemTypes.add(SimpleType.LONG);
185:                consumerItemTypes.add(SimpleType.LONG);
186:                consumerItemTypes.add(SimpleType.LONG);
187:                consumerItemTypes.add(SimpleType.LONG);
188:                if (ojcStatsType != null) {
189:                    consumerItemTypes.add(ojcStatsType);
190:                }
191:
192:                ArrayList<Object> consumerItemValues = new ArrayList<Object>();
193:                consumerItemValues.add(data.getInstanceName());
194:                consumerItemValues.add(data.getNumberOfSentRequests());
195:                consumerItemValues.add(data.getNumberOfReceivedReplies());
196:                consumerItemValues.add(data.getNumberOfReceivedDones());
197:                consumerItemValues.add(data.getNumberOfSentDones());
198:                consumerItemValues.add(data.getNumberOfReceivedFaults());
199:                consumerItemValues.add(data.getNumberOfSentFaults());
200:                consumerItemValues.add(data.getNumberOfReceivedErrors());
201:                consumerItemValues.add(data.getNumberOfSentErrors());
202:                consumerItemValues.add(data.getNumberOfActiveExchanges());
203:                consumerItemValues.add(data.getComponentName());
204:                consumerItemValues.add(data
205:                        .getMessageExchangeStatusTimeAverage());
206:                consumerItemValues.add(data
207:                        .getMessageExchangeComponentTimeAverage());
208:                consumerItemValues.add(data
209:                        .getMessageExchangeDeliveryChannelTimeAverage());
210:                consumerItemValues.add(data
211:                        .getMessageExchangeServiceTimeAverage());
212:
213:                if (ojcStatsType != null) {
214:                    //consumerItemValues.add(ojcStats);
215:                }
216:
217:                try {
218:                    return new CompositeDataSupport(new CompositeType(
219:                            "ConsumerEndpointStats",
220:                            "Consumer Endpoint Statistics",
221:                            (String[]) consumerItemNames
222:                                    .toArray(new String[] {}),
223:                            (String[]) consumerItemDescriptions
224:                                    .toArray(new String[] {}),
225:                            (SimpleType[]) consumerItemTypes
226:                                    .toArray(new SimpleType[] {})),
227:                            (String[]) consumerItemNames
228:                                    .toArray(new String[] {}),
229:                            (Object[]) consumerItemValues
230:                                    .toArray(new Object[] {}));
231:                } catch (OpenDataException ode) {
232:                    throw new ManagementRemoteException(ode);
233:                }
234:
235:            }
236:
237:            /**
238:             * @param args
239:             */
240:            public static void main(String[] args) {
241:                // TODO Auto-generated method stub
242:
243:            }
244:
245:        }
w_w_w.j__a_v_a_2_s_.c__o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.