User: juhalindfors
Date: 01/12/05 06:18:34
Added: src/main/javax/management AttributeChangeNotification.java
MBeanServerDelegate.java
MBeanServerNotification.java
NotificationBroadcasterSupport.java
Log:
some more javax.management classes
Revision Changes Path
1.1 jmx/src/main/javax/management/AttributeChangeNotification.java
Index: AttributeChangeNotification.java
===================================================================
/*
* LGPL
*/
package javax.management;
public class AttributeChangeNotification extends Notification {
public static final java.lang.String ATTRIBUTE_CHANGE = "jmx.attribute.change";
public AttributeChangeNotification(java.lang.Object source,
long sequenceNumber,
long timeStamp,
java.lang.String msg,
java.lang.String attributeName,
java.lang.String attributeType,
java.lang.Object oldValue,
java.lang.Object newValue) {
super(ATTRIBUTE_CHANGE, source, sequenceNumber);
}
public java.lang.String getAttributeName() { return null; }
public java.lang.String getAttributeType() { return null; }
public java.lang.Object getOldValue() { return null; }
public java.lang.Object getNewValue() { return null; }
}
1.1 jmx/src/main/javax/management/MBeanServerDelegate.java
Index: MBeanServerDelegate.java
===================================================================
/*
* LGPL
*/
package javax.management;
public class MBeanServerDelegate implements MBeanServerDelegateMBean,
NotificationBroadcaster {
private MBeanNotificationInfo notificationInfo = null;
private NotificationBroadcasterSupport notifier = null;
public MBeanServerDelegate() {
this.notificationInfo = new MBeanNotificationInfo(
new String[] {
MBeanServerNotification.REGISTRATION_NOTIFICATION,
MBeanServerNotification.UNREGISTRATION_NOTIFICATION
},
MBeanServerNotification.class.getName(),
"Describes the MBean registration and unregistration events in a MBean
Server."
);
this.notifier = new NotificationBroadcasterSupport();
}
public java.lang.String getMBeanServerId() {
return "BOOM!";
}
public java.lang.String getSpecificationName() {
return "Java Management Extensions Instrumentation and Agent Specification";
}
public java.lang.String getSpecificationVersion() {
return "1.0";
}
public java.lang.String getSpecificationVendor() {
return "Sun Microsystems, Inc.";
}
public java.lang.String getImplementationName() {
return "JBossMX";
}
public java.lang.String getImplementationVersion() {
return "0.1";
}
public java.lang.String getImplementationVendor() {
return "JBoss Organization";
}
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
java.lang.Object handback)
throws java.lang.IllegalArgumentException {
notifier.addNotificationListener(listener, filter, handback);
}
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
notifier.removeNotificationListener(listener);
}
public MBeanNotificationInfo[] getNotificationInfo() {
return new MBeanNotificationInfo[] { notificationInfo };
}
public void sendNotification(Notification notification) {
notifier.sendNotification(notification);
}
}
1.1 jmx/src/main/javax/management/MBeanServerNotification.java
Index: MBeanServerNotification.java
===================================================================
/*
* LGPL
*/
package javax.management;
public class MBeanServerNotification extends Notification {
public static final java.lang.String REGISTRATION_NOTIFICATION =
"jmx.mbean.registered";
public static final java.lang.String UNREGISTRATION_NOTIFICATION =
"jmx.mbean.unregistered";
// name of the mbean registered/unregistered
private ObjectName mbeanName = null;
public MBeanServerNotification(String type, Object source, long sequenceNumber,
ObjectName objectName) {
super(type, source, sequenceNumber);
this.mbeanName = objectName;
}
public ObjectName getMBeanName() {
return mbeanName;
}
}
1.1
jmx/src/main/javax/management/NotificationBroadcasterSupport.java
Index: NotificationBroadcasterSupport.java
===================================================================
/*
* LGPL
*/
package javax.management;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
public class NotificationBroadcasterSupport implements NotificationBroadcaster {
private HashMap listenerMap = new HashMap();
public NotificationBroadcasterSupport() {}
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object handback) {
Map hbMap = (Map)listenerMap.get(listener);
if (hbMap != null)
hbMap.put(handback, filter);
else {
hbMap = new HashMap();
hbMap.put(handback, filter);
listenerMap.put(listener, hbMap);
}
}
public void removeNotificationListener(NotificationListener listener) throws
ListenerNotFoundException {
listenerMap.remove(listener);
}
public MBeanNotificationInfo[] getNotificationInfo() {
return null;
}
public void sendNotification(Notification notification) {
Iterator listenerIterator = listenerMap.keySet().iterator();
while(listenerIterator.hasNext()) {
NotificationListener listener =
(NotificationListener)listenerIterator.next();
Map hbMap = (Map)listenerMap.get(listener);
Iterator it = hbMap.keySet().iterator();
while(it.hasNext()) {
Object hb = it.next();
NotificationFilter filter = (NotificationFilter)hbMap.get(it.next());
if (filter == null)
listener.handleNotification(notification, hb);
else if (filter.isNotificationEnabled(notification))
listener.handleNotification(notification, hb);
}
}
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development