Source Code Cross Referenced for FrameworkStatisticsData.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:         * 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:         * @(#)FrameworkStatisticsData.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;
030:
031:        import java.io.Serializable;
032:        import java.util.HashMap;
033:        import java.util.Iterator;
034:        import java.util.Map;
035:
036:        import javax.management.openmbean.CompositeData;
037:        import javax.management.openmbean.CompositeType;
038:        import javax.management.openmbean.TabularData;
039:        import javax.xml.parsers.ParserConfigurationException;
040:        import javax.xml.transform.TransformerException;
041:
042:        import com.sun.esb.management.common.ManagementRemoteException;
043:        import com.sun.esb.management.common.data.helper.FrameworkStatisticsDataWriter;
044:
045:        /**
046:         * @author graj
047:         *
048:         */
049:        public class FrameworkStatisticsData implements  Serializable {
050:            static final long serialVersionUID = -1L;
051:
052:            public static final String INSTANCENAME_KEY = "InstanceName";
053:            public static final String STARTUPTIME_KEY = "StartupTime (ms)";
054:            public static final String UPTIME_KEY = "UpTime (ms)";
055:
056:            String instanceName;
057:            long startupTime;
058:            long upTime;
059:
060:            /**
061:             * Generate Tabular Data for this object
062:             * @return tabular data of this object
063:             */
064:            static public TabularData generateTabularData(
065:                    Map<String /* instanceName */, FrameworkStatisticsData> map) {
066:                TabularData tabularData = null;
067:                try {
068:                    tabularData = FrameworkStatisticsDataCreator
069:                            .createTabularData(map);
070:                } catch (ManagementRemoteException e) {
071:                }
072:                return tabularData;
073:            }
074:
075:            /**
076:             * Retrieves the Framework Statistics Data Map
077:             * 
078:             * @param tabularData
079:             * @return Framework Statistics Data
080:             */
081:            @SuppressWarnings("unchecked")
082:            static public Map<String /* instanceName */, FrameworkStatisticsData> retrieveDataMap(
083:                    TabularData tabularData) {
084:                FrameworkStatisticsData data = null;
085:                Map<String /* instanceName */, FrameworkStatisticsData> dataMap = null;
086:                dataMap = new HashMap<String /* instanceName */, FrameworkStatisticsData>();
087:                for (Iterator dataIterator = tabularData.values().iterator(); dataIterator
088:                        .hasNext();) {
089:                    CompositeData compositeData = (CompositeData) dataIterator
090:                            .next();
091:                    CompositeType compositeType = compositeData
092:                            .getCompositeType();
093:                    data = new FrameworkStatisticsData();
094:                    for (Iterator<String> itemIterator = compositeType.keySet()
095:                            .iterator(); itemIterator.hasNext();) {
096:                        String item = (String) itemIterator.next();
097:                        if (true == item
098:                                .equals(FrameworkStatisticsData.INSTANCENAME_KEY)) {
099:                            String value = (String) compositeData.get(item);
100:                            data.setInstanceName(value);
101:                        }
102:                        if (true == item
103:                                .equals(FrameworkStatisticsData.STARTUPTIME_KEY)) {
104:                            Long value = (Long) compositeData.get(item);
105:                            data.setStartupTime(value.longValue());
106:                        }
107:                        if (true == item
108:                                .equals(FrameworkStatisticsData.UPTIME_KEY)) {
109:                            Long value = (Long) compositeData.get(item);
110:                            data.setUpTime(value.longValue());
111:                        }
112:                    }
113:                    dataMap.put(data.getInstanceName(), data);
114:
115:                }
116:                return dataMap;
117:            }
118:
119:            /**
120:             * Converts a Framework Statistics Data to an XML String
121:             * 
122:             * @param map
123:             * @return XML string representing a Framework Statistics Datum
124:             * @throws ManagementRemoteException
125:             */
126:            static public String convertDataMapToXML(
127:                    Map<String /* instanceName */, FrameworkStatisticsData> map)
128:                    throws ManagementRemoteException {
129:                String xmlText = null;
130:                try {
131:                    xmlText = FrameworkStatisticsDataWriter.serialize(map);
132:                } catch (ParserConfigurationException e) {
133:                    throw new ManagementRemoteException(e);
134:                } catch (TransformerException e) {
135:                    throw new ManagementRemoteException(e);
136:                }
137:
138:                return xmlText;
139:
140:            }
141:
142:            /**
143:             * @return the instanceName
144:             */
145:            public String getInstanceName() {
146:                return this .instanceName;
147:            }
148:
149:            /**
150:             * @param instanceName the instanceName to set
151:             */
152:            public void setInstanceName(String instanceName) {
153:                this .instanceName = instanceName;
154:            }
155:
156:            /**
157:             * @return the startupTime
158:             */
159:            public long getStartupTime() {
160:                return this .startupTime;
161:            }
162:
163:            /**
164:             * @param startupTime the startupTime to set
165:             */
166:            public void setStartupTime(long startupTime) {
167:                this .startupTime = startupTime;
168:            }
169:
170:            /**
171:             * @return the upTime
172:             */
173:            public long getUpTime() {
174:                return this .upTime;
175:            }
176:
177:            /**
178:             * @param upTime the upTime to set
179:             */
180:            public void setUpTime(long uptime) {
181:                this .upTime = uptime;
182:            }
183:
184:            /**
185:             * 
186:             * @return
187:             */
188:            public String getDisplayString() {
189:                StringBuffer buffer = new StringBuffer();
190:                buffer.append("\n  Instance Name" + "="
191:                        + this .getInstanceName());
192:                buffer.append("\n  Startup Time" + "=" + this .getStartupTime());
193:                buffer.append("\n  Up Time" + "=" + this .getUpTime());
194:                buffer.append("\n  ========================================\n");
195:                return buffer.toString();
196:
197:            }
198:
199:            /**
200:             * @param args
201:             */
202:            public static void main(String[] args) {
203:                // TODO Auto-generated method stub
204:
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.