FileDocCategorySizeDatePackage
MonitoringObjectNames.javaAPI DocGlassfish v2 API23714Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.registry.spi

MonitoringObjectNames

public final class MonitoringObjectNames extends Object
A class to provide the ObjectNames of various monitoring entities. It has a bunch of static methods to generate the ObjectName.
author
Kedar Mhaswade
since
S1AS8.0
version
$Revision: 1.13 $

Fields Summary
private static final String
SERVER_ID
private static final Logger
logger
private static final String
CATEGORY_PROPERTY
private static final String
CATEGORY_PROPERTY_VAL
private static final String
SERVER_PROPERTY
Constructors Summary
private MonitoringObjectNames()

	
	  
		//disallow
	
Methods Summary
private static javax.management.ObjectNameformObjectName(java.util.Hashtable t)

	

		final String domain = getDomainName();
		t.put(CATEGORY_PROPERTY,  CATEGORY_PROPERTY_VAL);
		t.put(SERVER_PROPERTY,  SERVER_ID);
		
		ObjectName on = null;
		try {
			on = new ObjectName(domain, t);
			logger.fine("MonitoringObjectNames:formObjectName - ObjectName = " + on.toString());
		}
		catch (Exception cause) {
			//actually give one more chance if cause is an instance of MalformedObjectNameException - TBD
			throw new RuntimeException(cause);
		}
		return ( on ); // may not return null
	
static javax.management.ObjectNamegetApplicationObjectName(java.lang.String app)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.APPLICATION.getTypeName());
		t.put("name", app);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetApplicationsObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.APPLICATIONS.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetConnectionFactoriesObjectName()

        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.CONNECTION_FACTORIES.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetConnectionFactoryObjectName(java.lang.String factoryName)

        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.CONNECTION_FACTORY.getTypeName());
        t.put("name", factoryName);
        return(formObjectName(t));
    
static javax.management.ObjectNamegetConnectionManagersObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.CONNECTION_MANAGERS.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetConnectionPoolObjectName(java.lang.String name, com.sun.enterprise.admin.monitor.registry.MonitoredObjectType type)

		final Hashtable t = new Hashtable();
		if (type == MonitoredObjectType.CONNECTOR_CONN_POOL)
			t.put("type", MonitoredObjectType.CONNECTOR_CONN_POOL.getTypeName());
		else
			t.put("type", MonitoredObjectType.JDBC_CONN_POOL.getTypeName());
		t.put("name", name);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetConnectionPoolObjectName(java.lang.String poolName, java.lang.String j2eeAppName, java.lang.String moduleName)

        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.CONNECTOR_CONN_POOL.getTypeName());
        t.put("name", poolName);
        if(j2eeAppName != null) {
            t.put(MonitoredObjectType.CONNECTOR_MODULE.getTypeName(), j2eeAppName + "#" + moduleName);
        } else
        {
            t.put(MonitoredObjectType.STANDALONE_CONNECTOR_MODULE.getTypeName(), moduleName);
        }
        return(formObjectName(t));
    
static javax.management.ObjectNamegetConnectionPoolsObjectName(java.lang.String j2eeAppName, java.lang.String moduleName)

        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.CONNECTION_POOLS.getTypeName());
        if(j2eeAppName != null) {
            t.put(MonitoredObjectType.CONNECTOR_MODULE.getTypeName(), j2eeAppName + "#" + moduleName);
        } else
        {
            t.put(MonitoredObjectType.STANDALONE_CONNECTOR_MODULE.getTypeName(), moduleName);
        }
        return(formObjectName(t));
    
static javax.management.ObjectNamegetConnectionQueueObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.CONNECTION_QUEUE.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetConnectorModuleObjectName(java.lang.String j2eeAppName, java.lang.String moduleName)

        
        final Hashtable t = new Hashtable();
        
        if (j2eeAppName != null) {
            t.put("name", j2eeAppName + "#" + moduleName);
            t.put("type", MonitoredObjectType.CONNECTOR_MODULE.getTypeName());
        }
        else {
            t.put("name", moduleName);
            t.put("type", MonitoredObjectType.STANDALONE_CONNECTOR_MODULE.getTypeName());
        }
        return( formObjectName(t));
    
static javax.management.ObjectNamegetConnectorServiceObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type",MonitoredObjectType.CONNECTOR_SERVICE.getTypeName());
        return (formObjectName(t));
    
static javax.management.ObjectNamegetConnectorWorkMgmtObjectName(java.lang.String j2eeAppName, java.lang.String moduleName, boolean isJms)

        
        final Hashtable t = new Hashtable();
        
        t.put("type", MonitoredObjectType.CONNECTOR_WORKMGMT.getTypeName());
        if(!isJms) {
            if(j2eeAppName != null) {
                t.put(MonitoredObjectType.CONNECTOR_MODULE.getTypeName(), j2eeAppName + "#" + moduleName);
            } else
            {
                t.put(MonitoredObjectType.STANDALONE_CONNECTOR_MODULE.getTypeName(), moduleName);
            }
        }
        return (formObjectName(t));
    
static javax.management.ObjectNamegetDnsObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.DNS.getTypeName());
        return(formObjectName(t));
    
private static java.lang.StringgetDomainName()

		final AdminContext ac = AdminService.getAdminService().getAdminContext();
		return ( ac.getDomainName() );
	
static javax.management.ObjectNamegetEjbCacheObjectName(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejb, java.lang.String module, java.lang.String app)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.BEAN_CACHE.getTypeName());
		t.put("name", MonitoredObjectType.BEAN_CACHE.getTypeName());
		t.put( ejbType.getTypeName(), ejb);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetEjbMethodObjectName(java.lang.String method, com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejb, java.lang.String module, java.lang.String app)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.BEAN_METHOD.getTypeName());
		t.put("name", method);
		t.put( ejbType.getTypeName(), ejb);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetEjbMethodsObjectName(java.lang.String app, java.lang.String module, com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejb)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.BEAN_METHODS.getTypeName());
		t.put( ejbType.getTypeName(), ejb);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetEjbModuleObjectName(java.lang.String app, java.lang.String module)

		final Hashtable t = new Hashtable();
		t.put("name", module);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put("type", MonitoredObjectType.EJBMODULE.getTypeName());
		}
		else
			t.put("type", MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetEjbObjectName(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType type, java.lang.String ejb, java.lang.String module, java.lang.String app)

		final Hashtable t = new Hashtable();
		t.put("type", type.getTypeName());
		t.put("name", ejb);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetEjbPoolObjectName(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejb, java.lang.String module, java.lang.String app)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.BEAN_POOL.getTypeName());
		t.put("name", MonitoredObjectType.BEAN_POOL.getTypeName());
		t.put( ejbType.getTypeName(), ejb);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetFileCacheObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.FILE_CACHE.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetHttpListenerObjectName(java.lang.String vs, java.lang.String ls)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.HTTP_LISTENER.getTypeName());
		t.put(MonitoredObjectType.VIRTUAL_SERVER.getTypeName(), vs);
		t.put("name", ls);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetHttpServiceObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.HTTP_SERVICE.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetJVMClassLoadingObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_CLASSLOADING.getTypeName());
        t.put("name", MonitoredObjectType.JVM_CLASSLOADING.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMCompilationObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_COMPILATION.getTypeName());
        t.put("name", MonitoredObjectType.JVM_COMPILATION.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMGCObjectName(java.lang.String gcName)

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_GC.getTypeName());
        t.put("name", gcName);
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMGCSSObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_GCS.getTypeName());
        t.put("name", MonitoredObjectType.JVM_GCS.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMMemoryObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_MEMORY.getTypeName());
        t.put("name", MonitoredObjectType.JVM_MEMORY.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMOSObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_OS.getTypeName());
        t.put("name", MonitoredObjectType.JVM_OS.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMRuntimeObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_RUNTIME.getTypeName());
        t.put("name", MonitoredObjectType.JVM_RUNTIME.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMThreadInfoObjectName(java.lang.String threadName)

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_THREAD_INFO.getTypeName());
        t.put("name", threadName);
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJVMThreadObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.JVM_THREAD.getTypeName());
        t.put("name", MonitoredObjectType.JVM_THREAD.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetJmsServiceObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type",MonitoredObjectType.JMS_SERVICE.getTypeName());
        return (formObjectName(t));
    
static javax.management.ObjectNamegetJndiObjectName()

                final Hashtable t = new Hashtable();
                t.put("type", MonitoredObjectType.JNDI.getTypeName());
                return ( formObjectName(t) );
        
static javax.management.ObjectNamegetJvmObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.JVM.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetKeepAliveObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.KEEP_ALIVE.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetOrbConnectionManagerObjectName(java.lang.String name)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.CONNECTION_MANAGER.getTypeName());
		t.put("name", name);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetOrbObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.ORB.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetPWCThreadPoolObjectName()

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.PWC_THREAD_POOL.getTypeName());
        return(formObjectName(t));
    
static javax.management.ObjectNamegetRequestObjectName(java.lang.String vsId)

        
        final Hashtable t = new Hashtable();
        t.put("type", MonitoredObjectType.REQUEST.getTypeName());
        t.put(MonitoredObjectType.VIRTUAL_SERVER.getTypeName(), vsId);
        return(formObjectName(t));
    
static javax.management.ObjectNamegetResourcesObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.RESOURCES.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetRootObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.ROOT.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetServletObjectName(java.lang.String app, java.lang.String ctxRoot, java.lang.String vs, java.lang.String servlet)

        
        final ObjectName    virtualServerObjectName =
            getVirtualServerObjectName( app, ctxRoot, vs );

		final Hashtable t = new Hashtable();
		t.put("name", servlet);
		t.put("type", MonitoredObjectType.SERVLET.getTypeName());
        t.put(MonitoredObjectType.WEBAPP_VIRTUAL_SERVER.getTypeName(),
            virtualServerObjectName.getKeyProperty( "name" ));

		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetStatefulSessionStoreObjectName(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejbName, java.lang.String moduleName, java.lang.String j2eeAppName)

        
        final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.SESSION_STORE.getTypeName());
		t.put("name", MonitoredObjectType.SESSION_STORE.getTypeName());
		t.put( ejbType.getTypeName(), ejbName);
		if (j2eeAppName != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), j2eeAppName);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), moduleName);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), moduleName);
		}
		return ( formObjectName(t) );
    
static javax.management.ObjectNamegetThreadPoolObjectName(java.lang.String name)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.THREAD_POOL.getTypeName());
		t.put("name", name);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetThreadPoolsObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.THREAD_POOLS.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetTimerObjectName(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType ejbType, java.lang.String ejbName, java.lang.String moduleName, java.lang.String j2eeAppName)

        
        final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.TIMERS.getTypeName());
		t.put("name", MonitoredObjectType.TIMERS.getTypeName());
		t.put( ejbType.getTypeName(), ejbName);
		if (j2eeAppName != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), j2eeAppName);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), moduleName);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), moduleName);
		}
		return ( formObjectName(t) );
    
static javax.management.ObjectNamegetTransactionServiceObjectName()

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.TRANSACTION_SERVICE.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetVirtualServerObjectName(java.lang.String vs)

		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.VIRTUAL_SERVER.getTypeName());
		t.put("name", vs);
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetVirtualServerObjectName(java.lang.String app, java.lang.String ctxRoot, java.lang.String vs)


        String module = "//" + ((vs==null) ? "DEFAULT" : vs) +
            (("".equals(ctxRoot)) ? "/" : ctxRoot);

		final Hashtable t = new Hashtable();
		t.put("name", module);
        t.put("type", MonitoredObjectType.WEBAPP_VIRTUAL_SERVER.getTypeName());

		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetWebModuleObjectName(java.lang.String app, java.lang.String ctxRoot, java.lang.String vs)


                String module = "//" + ((vs==null) ? "DEFAULT" : vs) +
                    (("".equals(ctxRoot)) ? "/" : ctxRoot);

		final Hashtable t = new Hashtable();
		t.put("name", module);

		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put("type", MonitoredObjectType.WEBMODULE.getTypeName());
		}
		else
			t.put("type", MonitoredObjectType.STANDALONE_WEBMODULE.getTypeName());
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetWebServiceObjectNameForEjb(java.lang.String endpoint, java.lang.String module, java.lang.String app)

 
		final Hashtable t = new Hashtable();
		t.put("type", MonitoredObjectType.WEBSERVICE_ENDPOINT.getTypeName());
		t.put("name", endpoint);
		if (app != null) {
			t.put(MonitoredObjectType.APPLICATION.getTypeName(), app);
			t.put(MonitoredObjectType.EJBMODULE.getTypeName(), module);
		}
		else {
			t.put(MonitoredObjectType.STANDALONE_EJBMODULE.getTypeName(), 
                    module);
		}
		return ( formObjectName(t) );
	
static javax.management.ObjectNamegetWebServiceObjectNameForWeb(java.lang.String endpoint, java.lang.String app, java.lang.String ctxRoot, java.lang.String virtualServer)

 
		final Hashtable t = new Hashtable();
		
		// this is the webmodule-virtual-server it belongs to
		final ObjectName virtualServerObjectName   =
		    getVirtualServerObjectName( app, ctxRoot, virtualServer );
		
		t.put("type", MonitoredObjectType.WEBSERVICE_ENDPOINT.getTypeName());
		t.put("name", endpoint);
		
		// form pair based on virtual server type/name
        t.put(
            virtualServerObjectName.getKeyProperty( "type" ),
            virtualServerObjectName.getKeyProperty( "name" ) );
            
        final String appPropName = MonitoredObjectType.APPLICATION.getTypeName();
        String appName = virtualServerObjectName.getKeyProperty( appPropName );
        if (appName == null) {
            appName = "null";
        }
        t.put(appPropName, appName);

		return formObjectName(t);