FileDocCategorySizeDatePackage
ConfigMBeanNamingInfo.javaAPI DocGlassfish v2 API6874Fri May 04 22:34:08 BST 2007com.sun.enterprise.admin.server.core.mbean.config.naming

ConfigMBeanNamingInfo

public class ConfigMBeanNamingInfo extends Object
Provides naming support for ConfigMbeans

Fields Summary
private com.sun.enterprise.admin.AdminContext
m_AdminContext
String[]
m_ids
MBeanNamingDescriptor
m_descr
private static com.sun.enterprise.util.i18n.StringManager
localStrings
Constructors Summary
public ConfigMBeanNamingInfo(String type, String[] params)


          
    
       this(type, params, true);
    
public ConfigMBeanNamingInfo(String type, String[] params, boolean bTestParamSize)

        m_descr = ConfigMBeansNaming.findNamingDescriptorByType(type);
        if(m_descr==null) {
			String msg = localStrings.getString( "admin.server.core.mbean.config.naming.mbeannamingdescriptor_not_found_for_type", type );
            throw new MBeanConfigException( msg );
		}

        if(bTestParamSize)
        {
            int parmSize = (params==null)?0:params.length;
            if(m_descr.getParmListSize()!=parmSize) {
				String msg = localStrings.getString( "admin.server.core.mbean.config.naming.wrong_parameters_array_size", type );
                throw new MBeanConfigException( msg );
			}
        }
        m_ids   = params;
    
public ConfigMBeanNamingInfo(String dottedName)

        m_descr = ConfigMBeansNaming.findNamingDescriptor(dottedName);
        if(m_descr==null) {
			String msg = localStrings.getString( "admin.server.core.mbean.config.naming.mbeannamingdescriptor_not_found_for_dotted_name", dottedName );
            throw new MBeanConfigException( msg );
		}
        m_ids   = m_descr.extractParmList(dottedName);
    
public ConfigMBeanNamingInfo(ObjectName objectName)

        m_descr = ConfigMBeansNaming.findNamingDescriptor(objectName);
        if(m_descr==null) {
			String msg = localStrings.getString( "admin.server.core.mbean.config.naming.mbeannamingdescriptor_not_found_for_object_name", objectName );
            throw new MBeanConfigException( msg );
		}
        m_ids   = m_descr.extractParmList(objectName);
    
Methods Summary
public com.sun.enterprise.admin.server.core.mbean.config.ConfigMBeanBaseconstructConfigMBean()

        String className = MBeansDescriptions.CONFIG_MBEANS_BASE_CLASS_PREFIX + m_descr.getMBeanClassName();
        Class cl;
        ConfigMBeanBase configMBean;
        try
        {
            cl = Class.forName(className);
            //create configMBean by defaul constructor;
            configMBean  = (ConfigMBeanBase)cl.newInstance();
        }
        catch (Exception e)
        {
			String msg = localStrings.getString( "admin.server.core.mbean.config.naming.mbeannamingdescriptor_couldnot_create_mbean_class", className );
            throw new MBeanConfigException( msg );
        }
        configMBean.setAdminContext(m_AdminContext);
        configMBean.initialize(this);
        return configMBean;
    
public java.lang.String[]getLocationParams()

        return m_ids;
    
public intgetMode()

        return m_descr.getMode();
    
public javax.management.ObjectNamegetObjectName()

        return m_descr.createObjectName(m_ids);
    
public java.lang.StringgetServerInstanceName()

        if(m_ids==null || m_ids.length==0)
        {
            String msg = localStrings.getString( "admin.server.core.mbean.config.naming.wrong_parameters_array_size", m_descr.getType() );
            throw new MBeanConfigException( msg );
        }
        return m_ids[0];
    
public java.lang.StringgetXPath()

        return m_descr.createXPath(m_ids);
    
public booleanisModeConfig()

        int mode = m_descr.getMode();
        return ((mode&MBeansDescriptions.MODE_CONFIG)!=0);
    
public booleanisModeMonitorable()

        int mode = m_descr.getMode();
        return ((mode&MBeansDescriptions.MODE_MONITOR)!=0);
    
public voidsetAdminContext(com.sun.enterprise.admin.AdminContext adminContext)

        m_AdminContext = adminContext;