Source Code Cross Referenced for ProvisioningEndpointStatisticsDataCreator.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:         * @(#)ProvisioningEndpointStatisticsDataCreator.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.IEndpointStatisticsData;
047:        import com.sun.esb.management.common.data.ProvisioningEndpointStatisticsData;
048:
049:        /**
050:         * @author graj
051:         *
052:         */
053:        public class ProvisioningEndpointStatisticsDataCreator {
054:            /**  table index   */
055:            static String[] STATS_TABLE_INDEX = new String[] { "InstanceName" };
056:
057:            /**
058:             * 
059:             */
060:            public ProvisioningEndpointStatisticsDataCreator() {
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:                    ProvisioningEndpointStatisticsData data = (ProvisioningEndpointStatisticsData) value;
083:                    endpointStats[index++] = composeProviderEndpointStats(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 provider endpoint stats
110:             * @param instanceName
111:             * @param commonValues values common to both provider and consumer
112:             * @param providerValues values specific to provider
113:             * @param ojcStats table of performance data
114:             * @return CompositeData composite data
115:             *
116:             */
117:            protected static CompositeData composeProviderEndpointStats(
118:                    ProvisioningEndpointStatisticsData data)
119:                    throws ManagementRemoteException {
120:
121:                TabularType ojcStatsType = null;
122:                if (data.getCategoryToPerformanceDataMap() != null) {
123:                    //ojcStatsType = ojcStats.getTabularType();
124:                }
125:
126:                ArrayList<String> providerItemNames = new ArrayList<String>();
127:                providerItemNames.add("InstanceName");
128:                providerItemNames.add("ActivationTime");
129:                providerItemNames.add("UpTime");
130:                providerItemNames.add("NumActiveExchanges");
131:                providerItemNames.add("NumReceivedRequests");
132:                providerItemNames.add("NumSentReplies");
133:                providerItemNames.add("NumReceivedDONEs");
134:                providerItemNames.add("NumSentDONEs");
135:                providerItemNames.add("NumReceivedFaults");
136:                providerItemNames.add("NumSentFaults");
137:                providerItemNames.add("NumReceivedErrors");
138:                providerItemNames.add("NumSentErrors");
139:                providerItemNames.add("ComponentName");
140:                providerItemNames.add("ME-ResponseTime-Avg");
141:                providerItemNames.add("ME-ComponentTime-Avg");
142:                providerItemNames.add("ME-DeliveryChannelTime-Avg");
143:                providerItemNames.add("ME-MessageServiceTime-Avg");
144:                if (ojcStatsType != null) {
145:                    providerItemNames.add("PerformanceMeasurements");
146:                }
147:
148:                ArrayList<String> providerItemDescriptions = new ArrayList<String>();
149:                providerItemDescriptions.add("Instance Name");
150:                providerItemDescriptions.add("Time taken for activation");
151:                providerItemDescriptions.add("Endpoint upTime");
152:                providerItemDescriptions.add("Number of Active Exchanges");
153:                providerItemDescriptions.add("Number of Received Requests");
154:                providerItemDescriptions.add("Number of Sent Replies");
155:                providerItemDescriptions.add("Number of Received DONEs");
156:                providerItemDescriptions.add("Number of Sent DONEs");
157:                providerItemDescriptions.add("Number of Received Faults");
158:                providerItemDescriptions.add("Number of Sent Faults");
159:                providerItemDescriptions.add("Number of Received Errors");
160:                providerItemDescriptions.add("Number of Sent Errors");
161:                providerItemDescriptions.add("Component Name");
162:                providerItemDescriptions
163:                        .add("Message Exchange ResponseTime Avg in ns");
164:                providerItemDescriptions
165:                        .add("Message Exchange ComponentTime Avg in ns");
166:                providerItemDescriptions
167:                        .add("Message Exchange DeliveryChannelTime Avg in ns");
168:                providerItemDescriptions
169:                        .add("Message Exchange MessageServiceTime  Avg in ns");
170:                if (ojcStatsType != null) {
171:                    providerItemDescriptions
172:                            .add("Performance Measurements recorded by OJC Components");
173:                }
174:
175:                ArrayList<OpenType> providerItemTypes = new ArrayList<OpenType>();
176:                providerItemTypes.add(SimpleType.STRING);
177:                providerItemTypes.add(SimpleType.LONG);
178:                providerItemTypes.add(SimpleType.LONG);
179:                providerItemTypes.add(SimpleType.LONG);
180:                providerItemTypes.add(SimpleType.LONG);
181:                providerItemTypes.add(SimpleType.LONG);
182:                providerItemTypes.add(SimpleType.LONG);
183:                providerItemTypes.add(SimpleType.LONG);
184:                providerItemTypes.add(SimpleType.LONG);
185:                providerItemTypes.add(SimpleType.LONG);
186:                providerItemTypes.add(SimpleType.LONG);
187:                providerItemTypes.add(SimpleType.LONG);
188:                providerItemTypes.add(SimpleType.STRING);
189:                providerItemTypes.add(SimpleType.LONG);
190:                providerItemTypes.add(SimpleType.LONG);
191:                providerItemTypes.add(SimpleType.LONG);
192:                providerItemTypes.add(SimpleType.LONG);
193:                if (ojcStatsType != null) {
194:                    providerItemTypes.add(ojcStatsType);
195:                }
196:                ;
197:
198:                ArrayList<Object> providerItemValues = new ArrayList<Object>();
199:                providerItemValues.add(data.getInstanceName());
200:                providerItemValues.add(data.getActivationTime()); //ActivationTimestamp
201:                providerItemValues.add(new Long(Long.MIN_VALUE)); //todo calculate uptime
202:                providerItemValues.add(data.getNumberOfActiveExchanges()); //ActiveExchanges
203:                providerItemValues.add(data.getNumberOfReceivedRequests()); //ReceiveRequest
204:                providerItemValues.add(data.getNumberOfSentReplies()); //SendReply
205:                providerItemValues.add(data.getNumberOfReceivedDones()); //ReceiveDONE
206:                providerItemValues.add(data.getNumberOfSentDones()); //SendDONE
207:                providerItemValues.add(data.getNumberOfReceivedFaults()); //ReceiveFault
208:                providerItemValues.add(data.getNumberOfSentFaults()); //SendFault
209:                providerItemValues.add(data.getNumberOfReceivedErrors()); //ReceiveERROR                        
210:                providerItemValues.add(data.getNumberOfSentErrors()); //SendERROR
211:                providerItemValues.add(data.getComponentName()); //OwningChannel
212:                providerItemValues.add(data
213:                        .getMessageExchangeResponseTimeAverage()); //Response Time
214:                providerItemValues.add(data
215:                        .getMessageExchangeDeliveryChannelTimeAverage()); //ChannelTimeAvg
216:                providerItemValues.add(data
217:                        .getMessageExchangeComponentTimeAverage()); //ComponenTimeAvg
218:                providerItemValues.add(data
219:                        .getMessageExchangeServiceTimeAverage()); //NMRTimeAvg
220:                if (ojcStatsType != null) {
221:                    //providerItemValues.add(ojcStats);
222:                }
223:
224:                try {
225:                    return new CompositeDataSupport(new CompositeType(
226:                            "ProviderEndpointStats",
227:                            "Provider Endpoint Statistics",
228:                            (String[]) providerItemNames
229:                                    .toArray(new String[] {}),
230:                            (String[]) providerItemDescriptions
231:                                    .toArray(new String[] {}),
232:                            (SimpleType[]) providerItemTypes
233:                                    .toArray(new SimpleType[] {})),
234:                            (String[]) providerItemNames
235:                                    .toArray(new String[] {}),
236:                            (Object[]) providerItemValues
237:                                    .toArray(new Object[] {}));
238:                } catch (OpenDataException ode) {
239:                    throw new ManagementRemoteException(ode);
240:                }
241:            }
242:
243:            /**
244:             * @param args
245:             */
246:            public static void main(String[] args) {
247:                // TODO Auto-generated method stub
248:
249:            }
250:
251:        }
w__w__w_.ja__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.