FileDocCategorySizeDatePackage
ObjectNameHelper.javaAPI DocGlassfish v2 API6886Fri May 04 22:33:16 BST 2007com.sun.enterprise.admin.common

ObjectNameHelper

public class ObjectNameHelper extends Object
A Class to derive cues for Bean in Config API from ObjectName.

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringgetApplicationName(javax.management.ObjectName objectName)

		String app = null;
		
		app = objectName.getKeyProperty(ObjectNames.kApplicationNameKeyName);
		
		return ( app );
	
public static java.lang.StringgetClassId(javax.management.ObjectName objectName)

        String classId = objectName.getKeyProperty(ObjectNames.kClassIdKeyName);
        return ( classId );
    
public static java.lang.StringgetGroupId(javax.management.ObjectName objectName)

		String moduleType = null;
		
		moduleType = objectName.getKeyProperty(ObjectNames.kGroupIdKeyName);
		
		return ( moduleType );
	
public static java.lang.StringgetHttpListenerId(javax.management.ObjectName objectName)

        String listenerId = null;
        listenerId = objectName.getKeyProperty(ObjectNames.kHTTPListenerIdKeyName);
        return ( listenerId );
    
public static javax.management.ObjectName[]getInstanceRelatedMBeans(javax.management.MBeanServer mbs, java.lang.String instanceName)
Returns array of config MBeans created for given server instance

        final ObjectName pattern = ObjectNames.getAllObjectNamesPattern();  //aka "ias:*"
        final Set names  = mbs.queryMBeans(pattern, null);
        /* gets all the mbeans in the "ias" domain */
        final Iterator iter = names.iterator();
        final ArrayList arr = new ArrayList();
        while(iter.hasNext()) {
            final ObjectInstance objectInstance = (ObjectInstance) iter.next();
            final ObjectName objectName = objectInstance.getObjectName();
            final String name = ObjectNameHelper.getServerInstanceName(objectName);
            if(instanceName.equals(name)) {
                arr.add(objectName);
            }
        }
        return (ObjectName [])arr.toArray(new ObjectName[arr.size()]);
    
public static java.lang.StringgetModuleType(javax.management.ObjectName objectName)

		String moduleType = null;
		
		moduleType = objectName.getKeyProperty(ObjectNames.kModuleTypeKeyName);
		
		return ( moduleType );
	
public static java.lang.StringgetName(javax.management.ObjectName objectName)
Returns the name of the MBean denoted by this ObjectName. Name is the value of property with name "name" in key properties.

        String name = objectName.getKeyProperty(ObjectNames.kNameKeyName);
        
        return ( name );
    
public static java.lang.StringgetServerId(javax.management.ObjectName objectName)

        String serverId = objectName.getKeyProperty(ObjectNames.kServerIdKeyName);
        return ( serverId );
    
public static java.lang.StringgetServerInstanceName(javax.management.ObjectName objectName)

        String instanceName = null;

        if (getType(objectName) != null) {
		if (getType(objectName).equals(ObjectNames.kServerInstance))
		{
			instanceName = getName(objectName);
		}
		else
		{
			instanceName = objectName.getKeyProperty(ObjectNames.kServerInstanceKeyName);
		}
	}

        return ( instanceName );
    
public static java.lang.StringgetType(javax.management.ObjectName objectName)
A static method that returns type of the MBean as indicated in com.sun.enterprise.admin.common.ObjectNames class. The given ObjectName may not be null. Returns null, if the ObjectName does not contain a property with name "type" in its property name value set.

       String type = objectName.getKeyProperty(ObjectNames.kTypeKeyName);
       //type has to one of the declared ones and hence this should be asserted.
       
       return ( type );
    
public static java.lang.StringgetVirtualServerClassId(javax.management.ObjectName objectName)

        String classId = objectName.getKeyProperty(
                            ObjectNames.kVirtualServerClassIdKeyName);
        return ( classId );
    
public static java.lang.StringgetVirtualServerId(javax.management.ObjectName objectName)

        String virtualServerId = objectName.getKeyProperty(
                                    ObjectNames.kVirtualServerIdKeyName);
        return ( virtualServerId );
    
public static booleanisMonitorMBean(javax.management.ObjectName objectName)
Returns true if this MBean is of type monitor. Useful to decide whether the persistent storage check should be performed.

        boolean isMonitor = false;
        String monitorKeyValue = null;

        monitorKeyValue = objectName.getKeyProperty(
                ObjectNames.kTypeKeyName);
        if (monitorKeyValue != null)
        {
            isMonitor = monitorKeyValue.
                     equals(ObjectNames.kMonitoringType);
        }
        return ( isMonitor );