Source Code Cross Referenced for StatisticsBaseImpl.java in  » ESB » open-esb » com » sun » jbi » util » monitoring » 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.jbi.util.monitoring 
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:         * @(#)StatisticsBaseImpl.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.util.monitoring;
030:
031:        import com.sun.jbi.monitoring.StatisticsBase;
032:        import com.sun.jbi.util.jmx.MBeanUtils;
033:
034:        import java.util.ArrayList;
035:        import java.util.Hashtable;
036:        import java.util.Iterator;
037:        import java.util.List;
038:
039:        import javax.management.ObjectName;
040:
041:        /**
042:         * This class provides the common utility methods used by all of the statistics
043:         * gathering classes. The methods here provide the infrastucture for
044:         * creating an object tree that represents the statistics for the entire JBI
045:         * instance. Each instance of a statistics class has a parent and optionally
046:         * one or more children.
047:         *
048:         * @author Sun Microsystems, Inc.
049:         */
050:        public class StatisticsBaseImpl implements  StatisticsBase {
051:            /**
052:             * Flag to indicate whether statistics gathering is enabled.
053:             */
054:            private boolean mEnabled = true;
055:
056:            /**
057:             * Key for this statistics object.
058:             */
059:            private String mKey;
060:
061:            /**
062:             * Parent object in the tree.
063:             */
064:            private StatisticsBase mParent;
065:
066:            /**
067:             * Synchronized access to child objects.
068:             */
069:            private Hashtable mChildren;
070:
071:            /**
072:             * JMX Object Name for this MBean.
073:             */
074:            private ObjectName mMBeanName;
075:
076:            /**
077:             * Constructor.
078:             * @param key The key string for this statistics object.
079:             */
080:            public StatisticsBaseImpl(String key) {
081:                mKey = key;
082:            }
083:
084:            /**
085:             * Get the key of this object.
086:             * @return the string key for this instance.
087:             */
088:            public String getKey() {
089:                return mKey;
090:            }
091:
092:            /**
093:             * Set the parent of this object.
094:             * @param parent the StatisticsBase instance that is the parent of this
095:             * instance.
096:             */
097:            public void setParent(StatisticsBase parent) {
098:                mParent = parent;
099:            }
100:
101:            /**
102:             * Get the parent of this object.
103:             * @return the StatisticsBase instance that is the parent of this instance.
104:             */
105:            public StatisticsBase getParent() {
106:                return mParent;
107:            }
108:
109:            /**
110:             * Add a child.
111:             * @param child the StatisticsBase instance to be added to the list of
112:             * children of this instance.
113:             */
114:            public void addChild(StatisticsBase child) {
115:                if (null == mChildren) {
116:                    mChildren = new Hashtable();
117:                }
118:                if (null != child) {
119:                    child.setParent(this );
120:                    mChildren.put((Object) child.getKey(), (Object) child);
121:                }
122:            }
123:
124:            /**
125:             * Get a particular child of this object based on a key.
126:             * @param key the string key of the requested child.
127:             * @return the StatisticsBase instance referenced by the specified key,
128:             * or null if none is found.
129:             */
130:            public StatisticsBase getChild(String key) {
131:                StatisticsBase child = null;
132:                if (null != mChildren) {
133:                    child = (StatisticsBase) mChildren.get(key);
134:                }
135:                return child;
136:            }
137:
138:            /**
139:             * Get the list of children of this object.
140:             * @return the list of instances that are children of this instance.
141:             */
142:            public List getChildren() {
143:                if (null != mChildren) {
144:                    return new ArrayList(mChildren.values());
145:                } else {
146:                    return new ArrayList();
147:                }
148:            }
149:
150:            /**
151:             * Test whether or not statistics are enabled.
152:             * @return true if statistics are enabled, false if not.
153:             */
154:            public boolean isEnabled() {
155:                return mEnabled;
156:            }
157:
158:            /**
159:             * Disable statistics.
160:             */
161:            public void setDisabled() {
162:                mEnabled = false;
163:                if (null != mChildren) {
164:                    Iterator c = mChildren.values().iterator();
165:                    StatisticsBase child;
166:                    while (c.hasNext()) {
167:                        child = (StatisticsBase) c.next();
168:                        child.setDisabled();
169:                    }
170:                }
171:            }
172:
173:            /**
174:             * Enable statistics.
175:             */
176:            public void setEnabled() {
177:                mEnabled = true;
178:                if (null != mChildren) {
179:                    Iterator c = mChildren.values().iterator();
180:                    StatisticsBase child;
181:                    while (c.hasNext()) {
182:                        child = (StatisticsBase) c.next();
183:                        child.setEnabled();
184:                    }
185:                }
186:            }
187:
188:            /**
189:             * Create and register a StandardMBean for this instance, using the
190:             * specified interface and MBean ObjectName.
191:             * @param interfaceClass The interface implemented by the instance.
192:             * @param mbeanName The MBean ObjectName to use for this MBean.
193:             * @throws javax.jbi.JBIException If the MBean creation or registration
194:             * fails.
195:             */
196:            public void registerMBean(Class interfaceClass, Object instance,
197:                    javax.management.ObjectName mbeanName)
198:                    throws javax.jbi.JBIException {
199:                mMBeanName = mbeanName;
200:                MBeanUtils.registerStandardMBean(interfaceClass, instance,
201:                        mbeanName, true);
202:            }
203:
204:            /**
205:             * Unregister the MBean for this instance.
206:             * @throws javax.jbi.JBIException If the MBean unregistration fails.
207:             */
208:            public void unregisterMBean() throws javax.jbi.JBIException {
209:                MBeanUtils.unregisterMBean(mMBeanName);
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.