J2EEDomainMdlpublic class J2EEDomainMdl extends J2EEEventProviderMOMdl implements NotificationListener
Fields Summary |
---|
public static final String | DOMAINNAME | private static final ObjectName | jmImpl | private final boolean | debug | private static final String | MANAGED_OBJECT_TYPE | private final String[] | eventTypes | static final boolean | REBROADCAST |
Constructors Summary |
---|
public J2EEDomainMdl()
super(DOMAINNAME, false, false);
/*
try {
getMBeanServer().addNotificationListener(jmImpl, this, null, "J2EEDomain");
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
*/
| public J2EEDomainMdl(String domainname)
super(domainname == null ? DOMAINNAME : domainname, false, false);
if ( ! domainname.equals( DOMAINNAME ) )
{
throw new IllegalArgumentException();
}
/*
try {
getMBeanServer().addNotificationListener(jmImpl, this, null, "J2EEDomain");
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
*/
| public J2EEDomainMdl(String domainname, String serverName)
super(domainname, serverName, false, false);
/*
DOMAINNAME = domainname;
try {
getMBeanServer().addNotificationListener(jmImpl, this, null, "J2EEDomain");
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
*/
| public J2EEDomainMdl(String[] location)
this(location[0]);
|
Methods Summary |
---|
public java.lang.String | getapplicationServerFullVersion()The full version of the application server product.
return Version.getFullVersion();
| public java.lang.String | getapplicationServerVersion()The version of the application server product.
return Version.getVersion();
| public java.lang.String[] | geteventTypes()
return eventTypes;
| public java.lang.String | getj2eeType()The type of the J2EEManagedObject as specified by JSR77. The class that implements a specific type must override this method and return the appropriate type string.
return MANAGED_OBJECT_TYPE;
| public java.lang.String[] | getservers()A list of all J2EE Servers in this domain.
Set servers = findNames("j2eeType=J2EEServer");
Iterator it = servers.iterator();
String [] ret = new String[servers.size()];
int i =0;
while(it.hasNext()) {
ret[i++] = ((ObjectName)it.next()).toString();
}
return ret;
| public void | handleNotification(javax.management.Notification n, java.lang.Object handback)
if (! (n instanceof MBeanServerNotification)) {
return;
}
final ObjectName selfObjectName = getObjectName();
// do not listen to itself
final ObjectName source = ((MBeanServerNotification)n).getMBeanName();
if (source.equals( selfObjectName ) ) {
return;
}
// J2EEDomain managed object must emit all events from all
// event providers in the domain. Note that it is not restricted
// to jsr77 types but applicable for all events in this domain.
// So make sure the events belong to this domain and not other domains.
if (! source.getDomain().equalsIgnoreCase( selfObjectName.getDomain() )) {
return;
}
// Handle register and unregister event notifications.
final String nType = n.getType();
MBeanServerNotification jsr77N = null;
if (nType.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
if ( isEventProvider(source) ) {
try {
getMBeanServer().addNotificationListener( source, this, null, getname() );
} catch (Exception e) {
if (debug) e.printStackTrace();
}
}
jsr77N = new MBeanServerNotification("j2ee.object.created", selfObjectName, n.getSequenceNumber(), source);
}
else if ( nType.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION) ) {
jsr77N = new MBeanServerNotification("j2ee.object.deleted", selfObjectName, n.getSequenceNumber(), source);
}
if (jsr77N != null) {
// notify listeners of an new MBean in the domain
sendNotification(jsr77N);
return;
}
// send the original Notification
sendNotification( n );
| boolean | isEventProvider(javax.management.ObjectName candidate)
boolean isEventProvider = false;
try {
final MBeanInfo info = getMBeanServer().getMBeanInfo( candidate);
if ( JMXUtil.getMBeanAttributeInfo( info, "eventProvider" ) != null ) {
isEventProvider = (Boolean)getMBeanServer().getAttribute(
candidate, "eventProvider");
}
} catch (Exception e) {
if (debug) e.printStackTrace();
}
return isEventProvider;
| public void | postRegister(java.lang.Boolean registrationDone) // turned on, pending testing
if ( registrationDone.booleanValue() ) {
if ( ! getObjectName().getDomain().equals( DOMAINNAME ) )
{
throw new IllegalArgumentException();
}
if ( REBROADCAST ) {
try {
getMBeanServer().addNotificationListener(jmImpl, this, null, "J2EEDomain");
}
catch( Exception e ) {
mLogger.warning( e.toString() );
throw new RuntimeException( "J2EEDomainMdl.postRegister", e );
}
}
}
|
|