Source Code Cross Referenced for MBeanServerDelegate.java in  » JMX » jfoxmx » javax » management » 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 » JMX » jfoxmx » javax.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.org
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package javax.management;
009:
010:        import java.net.InetAddress;
011:        import java.net.UnknownHostException;
012:
013:        import org.huihoo.jfox.jmx.ExtendedMBeanServerNotification;
014:
015:        /**
016:         * Represents  the Mbean server from the management point of view.
017:         * The MBeanServerDelegate MBean emits the MBeanServerNotifications when an MBean is
018:         * registered/deregistered in the MBean server.
019:         *
020:         * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
021:         */
022:
023:        public class MBeanServerDelegate implements  MBeanServerDelegateMBean,
024:                NotificationBroadcaster {
025:
026:            static final String JMX_SPECIFICATION_NAME = "Java Management Extensions";
027:            static final String JMX_SPECIFICATION_VERSION = "1.2";
028:            static final String JMX_SPECIFICATION_VENDOR = "Sun Microsystems";
029:            static final String JMX_IMPLEMENTATION_NAME = "JFoxMX";
030:            static final String JMX_IMPLEMENTATION_VENDOR = "huihoo.org";
031:            static final String JMX_IMPLEMENTATION_VERSION = "v1.2";
032:
033:            /** The MBean server agent identification.*/
034:            private String mbeanServerId; // mbserverId = hostname_mserverdelegate-address
035:            /** The NotificationBroadcasterSupport object that sends the notifications */
036:            private NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
037:
038:            protected static ObjectName delegateObjectName;
039:            static {
040:                try {
041:                    delegateObjectName = new ObjectName(
042:                            "JMImplementation:type=MBeanServerDelegate");
043:                } catch (MalformedObjectNameException ignore) {
044:                }
045:            }
046:
047:            protected long sequence = 0;
048:
049:            public MBeanServerDelegate() {
050:                String host = "localhost";
051:                try {
052:                    host = InetAddress.getLocalHost().getHostName();
053:                } catch (UnknownHostException unknownhostexception) {
054:                }
055:
056:                // mbserverId = hostname_mserverdelegate-address
057:                mbeanServerId = new String(host + "_" + this .toString());
058:
059:            }
060:
061:            /**
062:             * Returns the MBean server agent identification
063:             */
064:            public String getMBeanServerId() {
065:                return mbeanServerId;
066:            }
067:
068:            /**
069:             * Returns the full name of the JMX specification implemented
070:             * by this product.
071:             */
072:            public String getSpecificationName() {
073:                return JMX_SPECIFICATION_NAME;
074:            }
075:
076:            /**
077:             * Returns the version of the JMX specification implemented
078:             * by this product.
079:             */
080:            public String getSpecificationVersion() {
081:                return JMX_IMPLEMENTATION_VERSION;
082:            }
083:
084:            /**
085:             * Returns the vendor of the JMX specification implemented
086:             * by this product.
087:             */
088:            public String getSpecificationVendor() {
089:                return JMX_IMPLEMENTATION_VENDOR;
090:            }
091:
092:            /**
093:             * Returns the JMX implementation name (the name of this product).
094:             */
095:            public String getImplementationName() {
096:                return JMX_IMPLEMENTATION_NAME;
097:            }
098:
099:            /**
100:             * Returns the JMX implementation version (the version of this product).
101:             */
102:            public String getImplementationVersion() {
103:                return JMX_IMPLEMENTATION_VERSION;
104:            }
105:
106:            /**
107:             * Returns the JMX implementation vendor (the vendor of this product).
108:             */
109:            public String getImplementationVendor() {
110:                return JMX_SPECIFICATION_VENDOR;
111:            }
112:
113:            /**
114:             * Enables to add a listener to a registered MBean.
115:             *
116:             * @param listener The listener object which will handle the notifications emitted by the registered MBean.
117:             * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications.
118:             * @param handback The context to be sent to the listener when a notification is emitted.
119:             *
120:             * @exception IllegalArgumentException Listener parameter is null.
121:             */
122:            public void addNotificationListener(NotificationListener listener,
123:                    NotificationFilter filter, Object handback)
124:                    throws IllegalArgumentException {
125:                broadcaster.addNotificationListener(listener, filter, handback);
126:            }
127:
128:            /**
129:             * Enables to remove a listener from a registered MBean.
130:             *
131:             * @param listener The listener object which will handle the notifications emitted by the registered MBean.
132:             * This method will remove all the information related to this listener.
133:             *
134:             * @exception ListenerNotFoundException The listener is not registered in the MBean.
135:             */
136:            public void removeNotificationListener(NotificationListener listener)
137:                    throws ListenerNotFoundException {
138:                broadcaster.removeNotificationListener(listener);
139:            }
140:
141:            /**
142:             * Enables the MBean server to send a notification.
143:             *
144:             *  @param notification The notification to send.
145:             */
146:            public void sendNotification(Notification notification) {
147:                broadcaster.sendNotification(notification);
148:            }
149:
150:            /**
151:             * Returns a NotificationInfo object contaning the name of the Java class of the notification
152:             * and the notification types sent.
153:             *
154:             * as extension, add the ExtendedMBeanServerNotification
155:             */
156:            public MBeanNotificationInfo[] getNotificationInfo() {
157:                MBeanNotificationInfo ninfo[] = {
158:                        new MBeanNotificationInfo(
159:                                new String[] {
160:                                        MBeanServerNotification.REGISTRATION_NOTIFICATION,
161:                                        MBeanServerNotification.UNREGISTRATION_NOTIFICATION },
162:                                "javax.management.MBeanServerNotification",
163:                                "Notifications sent by the MBeanServerDelegate MBean When MBean Registered or Unregistered"),
164:                        new MBeanNotificationInfo(
165:                                new String[] {
166:                                        ExtendedMBeanServerNotification.DESERIALIZE_NOTIFICATION,
167:                                        ExtendedMBeanServerNotification.GET_ATTRIBUTE_NOTIFICATION,
168:                                        ExtendedMBeanServerNotification.GET_ATTRIBUTES_NOTIFICATION,
169:                                        ExtendedMBeanServerNotification.GET_MBEANINFO_NOTIFICATION,
170:                                        ExtendedMBeanServerNotification.GET_OBJECTINSTANCE_NOTIFICATION,
171:                                        ExtendedMBeanServerNotification.INVOKE_NOTIFICATION,
172:                                        ExtendedMBeanServerNotification.ISINSTANCEOF_NOTIFICATION,
173:                                        ExtendedMBeanServerNotification.ISREGISTERED_NOTIFICATION,
174:                                        ExtendedMBeanServerNotification.QUERYMBEANS_NOTIFICATION,
175:                                        ExtendedMBeanServerNotification.REMOVE_NOTIFICATIONLISTENER_NOTIFICATION,
176:                                        ExtendedMBeanServerNotification.SET_ATTRIBUTE_NOTIFICATION,
177:                                        ExtendedMBeanServerNotification.SET_ATTRIBUTES_NOTIFICATION, },
178:                                "javax.management.ExtendedMBeanServerNotification",
179:                                "extension Notifications sent by the MBeanServerDelegate MBean exception the MBean Registered or Unregistered")
180:
181:                };
182:                return ninfo;
183:            }
184:
185:            /*
186:             public void sendNotification(String type ,ObjectName objectName){
187:             if(!(type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) && !(type.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)))
188:             throw new RuntimeOperationsException(new IllegalArgumentException("Wrong type of MBeanServerNotifacation " + type));
189:
190:             MBeanServerNotification notification = new MBeanServerNotification(type, delegateObjectName, sequence++, objectName);
191:             this.sendNotification(notification);
192:             }
193:             */
194:
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.