FileDocCategorySizeDatePackage
J2EEManagedObjectMdl.javaAPI DocGlassfish v2 API7303Fri May 18 10:42:56 BST 2007com.sun.enterprise.management.model

J2EEManagedObjectMdl

public abstract class J2EEManagedObjectMdl extends Object implements MBeanRegistration
The base class for all Managed Objects
author
Hans Hrasna

Fields Summary
private final String
name
private final boolean
stateManageable
private final boolean
statisticsProvider
private final boolean
eventProvider
private final String
serverName
private volatile MBeanServer
mServer
private volatile ObjectName
mSelfObjectName
protected final Logger
mLogger
Constructors Summary
J2EEManagedObjectMdl(String name, boolean state, boolean statistics, boolean events)

        this( name, null, state, statistics, events );
    
J2EEManagedObjectMdl(String name, String serverName, boolean state, boolean statistics, boolean events)

        this.name = name;
        stateManageable = state;
        statisticsProvider = statistics;
        eventProvider = events;
        this.serverName = serverName;
        
        mLogger = LogDomains.getLogger(AdminConstants.kLoggerName);
    
Methods Summary
public final java.util.SetfindNames(java.lang.String keys)

        return J2EEModuleUtil.findNames(keys);
    
public final java.lang.StringgetJ2EEServer()
Accessor method for the parent key

        if (serverName != null) {
                return serverName;
        } else {
                return "no-server";
        }
    
protected final javax.management.MBeanServergetMBeanServer()

           return mServer;
    
protected final javax.management.j2ee.ManagementgetMEJB()

        Management mejb=null;
        try {
            Context ic = new InitialContext();
            String ejbName = System.getProperty("mejb.name","ejb/mgmt/MEJB");
            java.lang.Object objref = ic.lookup(ejbName);
            ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(objref, ManagementHome.class);
            mejb = home.create();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return mejb;
    
protected final com.sun.enterprise.management.agent.MEJBUtilitygetMEJBUtility()

        //FIXME
        //return com.sun.enterprise.Switch.getSwitch().getManagementObjectManager().getMEJBUtility();
        return MEJBUtility.getMEJBUtility();
    
protected final javax.management.ObjectNamegetObjectName()

        return mSelfObjectName;
    
public abstract java.lang.Stringgetj2eeType()
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.

public final java.lang.Stringgetname()
Accessor method for the parent key

        return this.name;
    
public final java.lang.StringgetobjectName()
The name of the J2EEManagedObject. All managed objects must have a unique name within the context of the management domain. The name must not be null.

        return getObjectName().toString();
    
public booleaniseventProvider()
If true, indicates that the managed object provides event notification about events that occur on that object. All managed objects that support state management are by default event providers. If the stateManageable attribute for this managed object is true then the eventProvider attribute must also be true.

        return eventProvider;
    
public booleanisstateManageable()
If true, indicates that this managed object implements the StateManageable interface and is state manageable. If false, the managed object does not support state management.

        return stateManageable;
    
public final booleanisstatisticsProvider()
If true, indicates that the managed object supports performance statistics and therefore implements the StatisticsProvider model. If false, the J2EEManagedObject does not support performance statistics

        return statisticsProvider;
    
protected final longnow()

        return System.currentTimeMillis();
    
public final voidpostDeregister()

        mServer					= null;
		mSelfObjectName			= null;
	
public voidpostRegister(java.lang.Boolean registrationDone)

        // nothing to do
	
public final voidpreDeregister()

        // nothing to do
	
public final javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName nameIn)

		assert( nameIn != null );
		mServer			= server;
		mSelfObjectName	= nameIn;
		
		// ObjectName could still be modified by subclass, but it then carries
        // the responsibility for updating this variable.
		return( mSelfObjectName );