FileDocCategorySizeDatePackage
OldConfigProxies.javaAPI DocGlassfish v2 API13318Fri May 04 22:23:48 BST 2007com.sun.enterprise.management.support.oldconfig

OldConfigProxies

public class OldConfigProxies extends Object
Provides support for getting proxies to "old" (8.0) config MBeans.

Fields Summary
final MBeanServer
mServer
private static final com.sun.enterprise.util.i18n.StringManager
_strMgr
private final String
OLD_DOMAIN
private final String
CONFIGS_IN_OLD_DOMAIN
private static OldConfigProxies
INSTANCE
Constructors Summary
private OldConfigProxies(MBeanServer server)

	
		
	    
	
		mServer	= server;
	
Methods Summary
public javax.management.ObjectNamecreateOldManagementRules(java.lang.String configName)

	    final String    props = getManagementRulesProps( configName );
	    
	    ObjectName  objectName  =
	        queryOldConfigObjectName( props );
	        
	    if ( objectName == null )
	    {
	        // null seems to be OK
	        getOldConfig( configName ).createManagementRules( null );
	        
	        objectName  = queryOldConfigObjectName( props );
	    }
	    return objectName;
	
public static synchronized com.sun.enterprise.management.support.oldconfig.OldConfigProxiesgetInstance(javax.management.MBeanServer server)

	
		   
	    
	
		if ( INSTANCE == null )
		{
			INSTANCE	= new OldConfigProxies( server );
		}
		else
		{
			assert( INSTANCE.getMBeanServer() == server );
		}
		return( INSTANCE );
	
private javax.management.MBeanServergetMBeanServer()

		return( mServer );
	
private static java.lang.StringgetManagementRulesProps(java.lang.String configName)

	    return "type=management-rules,config=" + configName;
	
public OldAdminServiceMBeangetOldAdminServiceMBean(java.lang.String configName)

		return( newProxy(
				"type=admin-service,config=" + configName, OldAdminServiceMBean.class ) );
	
public OldApplicationsConfigMBeangetOldApplicationsConfigMBean()

		return( newProxy( 
				"type=applications", OldApplicationsConfigMBean.class ) );
	
public OldAvailabilityServiceMBeangetOldAvailabilityServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=availability,config=" + configName, OldAvailabilityServiceMBean.class ) );
	
public OldClusterMBeangetOldClusterMBean(java.lang.String clusterName)

		return( newProxy(
				"type=cluster,name=" + clusterName, OldClusterMBean.class ) );
	
public OldClusterRefMBeangetOldClusterRefMBean(java.lang.String name, java.lang.String props)

            return( ( OldClusterRefMBean)newProxy(
                   props + ",type=cluster-ref,ref=" + name, OldClusterRefMBean.class));
	
public OldClustersMBeangetOldClustersMBean()

		return( newProxy( "type=clusters", OldClustersMBean.class ) );
	
public OldConfiggetOldConfig(java.lang.String name)

		return( newProxy( "type=config,name=" + name, OldConfig.class ) );
	
public OldConfigsMBeangetOldConfigsMBean()

		return( newProxy( "type=configs", OldConfigsMBean.class ) );
	
public OldConnectorConnectionPoolMBeangetOldConnectorConnectionPool(java.lang.String name)

		return( 
		    newProxy( "type=connector-connection-pool,name=" + name, OldConnectorConnectionPoolMBean.class ) );
	
public OldDASConfigMBeangetOldDASConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=das-config,config=" + configName, OldDASConfigMBean.class ) );
	
public OldDomainMBeangetOldDomainMBean()

		return( newProxy( "type=domain", OldDomainMBean.class ) );
	
public OldEJBContainerConfigMBeangetOldEJBContainerConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=ejb-container,config=" + configName, OldEJBContainerConfigMBean.class ) );
	
public OldHTTPServiceMBeangetOldHTTPServiceMBean(java.lang.String configName)

		return( newProxy(
				"type=http-service,config=" + configName, OldHTTPServiceMBean.class ) );
	
public OldIIOPServiceMBeangetOldIIOPServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=iiop-service,config=" + configName, OldIIOPServiceMBean.class ) );
	
public OldJMSServiceMBeangetOldJMSServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=jms-service,config=" + configName, OldJMSServiceMBean.class ) );
	
public OldJavaConfigMBeangetOldJavaConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=java-config,config=" + configName, OldJavaConfigMBean.class ) );
	
public OldLbConfiggetOldLbConfig(java.lang.String name)

            return( (OldLbConfig)newProxy( 
                "type=lb-config,name="+name, OldLbConfig.class ) );
	
public OldLbConfigsgetOldLbConfigs()

		return( newProxy( "type=lb-configs", OldLbConfigs.class ) );
	
public OldLoadBalancersgetOldLoadBalancers()

		return( newProxy( "type=load-balancers", OldLoadBalancers.class ) );
	
public OldLogServiceMBeangetOldLogServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=log-service,config=" + configName, OldLogServiceMBean.class ) );
	
public OldManagementRulesgetOldManagementRules(java.lang.String configName)

		return( 
		    newProxy( getManagementRulesProps( configName ), OldManagementRules.class ) );
	
public OldMessageSecurityConfigMBeangetOldMessageSecurityConfigMBean(java.lang.String name)

		return( newProxy( 
                    "type=message-security-config,name=" + name, 
                        OldMessageSecurityConfigMBean.class ) );
	
public OldModuleLogLevelsMBeangetOldModuleLogLevelsMBean(java.lang.String configName)

		return( newProxy( 
				"type=module-log-levels,config=" + configName, OldModuleLogLevelsMBean.class ) );
	
public OldModuleMonitoringLevelsMBeangetOldModuleMonitoringLevelsMBean(java.lang.String configName)

		return( newProxy( 
				"type=module-monitoring-levels,config=" + configName, OldModuleMonitoringLevelsMBean.class ) );
	
public OldMonitoringServiceMBeangetOldMonitoringServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=monitoring-service,config=" + configName, OldMonitoringServiceMBean.class ) );
	
public OldPropertiesgetOldProperties(javax.management.ObjectName objectName)

		return( newProxy( objectName, OldProperties.class ) );
	
public OldResourcesMBeangetOldResourcesMBean()

		return( newProxy( "type=resources", OldResourcesMBean.class ) );
	
public OldSecurityMapgetOldSecurityMap(java.lang.String connectorConnectionPoolName, java.lang.String name)

	    final ObjectName securityMapObjectName =
	        getOldSecurityMapObjectName( connectorConnectionPoolName, name );
	    
		return newProxy( securityMapObjectName, OldSecurityMap.class );
	
public javax.management.ObjectNamegetOldSecurityMapObjectName(java.lang.String connectorConnectionPoolName, java.lang.String name)

	    return getOldConnectorConnectionPool( connectorConnectionPoolName ).getSecurityMapByName( name );
	
public OldSecurityServiceMBeangetOldSecurityServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=security-service,config=" + configName, OldSecurityServiceMBean.class ) );
	
public OldServerMBeangetOldServerMBean(java.lang.String serverName)

		return( newProxy(
				"type=server,name=" + serverName, OldServerMBean.class ) );
	
public OldServerRefMBeangetOldServerRefMBean(java.lang.String name, java.lang.String props)

            return( ( OldServerRefMBean)newProxy(
                   props + ",type=server-ref,ref=" + name, OldServerRefMBean.class));
        
public OldServersMBeangetOldServersMBean()

		return( newProxy( "type=servers", OldServersMBean.class ) );
	
public OldSessionConfigMBeangetOldSessionConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=session,config=" + configName, OldSessionConfigMBean.class ) );
	
public OldSessionManagerMBeangetOldSessionManagerMBean(java.lang.String configName)

		return( newProxy( 
				"type=session-manager,config=" + configName, OldSessionManagerMBean.class ) );
	
public OldSystemServicesMBeangetOldSystemServicesMBean()

		return( newProxy( ObjectNames.kDefaultIASDomainName + ":type=system-services,server=server", 
                        OldSystemServicesMBean.class ) );
	
public OldThreadPoolsConfigMBeangetOldThreadPoolsConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=thread-pools,config=" + configName, OldThreadPoolsConfigMBean.class ) );
	
public OldTransactionServiceMBeangetOldTransactionServiceMBean(java.lang.String configName)

		return( newProxy( 
				"type=transaction-service,config=" + configName, OldTransactionServiceMBean.class ) );
	
public OldVirtualServerMBeangetOldVirtualServerMBean(java.lang.String configName, java.lang.String virtualServer)

		return( newProxy(
				"type=virtual-server,config=" + configName +
				",id=" + virtualServer, OldVirtualServerMBean.class ) );
	
public OldWebContainerConfigMBeangetOldWebContainerConfigMBean(java.lang.String configName)

		return( newProxy( 
				"type=web-container,config=" + configName, OldWebContainerConfigMBean.class ) );
	
public OldWebServiceEndpointConfigMBeangetOldWebServiceEndpointConfigMBean(java.lang.String name)

            return( ( OldWebServiceEndpointConfigMBean)newProxy(
               "type=web-service-endpoint,name=" + name,
               OldWebServiceEndpointConfigMBean.class));
	
public TnewProxy(javax.management.ObjectName target, java.lang.Class interfaceClass)

param
target the target MBean ObjectName
param
interfaceClass the interface class to use

		return interfaceClass.cast( MBeanServerInvocationHandler.newProxyInstance(
					mServer, target, interfaceClass, false ) );
	
public TnewProxy(java.lang.String props, java.lang.Class interfaceClass)

param
props properties for use in an ObjectName query
param
interfaceClass the interface class to use

		final ObjectName	objectName	= queryOldConfigObjectName( props );
		
		return newProxy( objectName, interfaceClass );
	
private javax.management.ObjectNamequeryOldConfigObjectName(java.lang.String props)

		final ObjectName pattern	=
			Util.newObjectNamePattern( OLD_DOMAIN,
				Util.concatenateProps( props, "category=config" ) );
		
		final Set<ObjectName>	candidates	= JMXUtil.queryNames( mServer, pattern, null );
		
		ObjectName	oldConfigObjectName	= null;
		
		if ( candidates.size() == 1 )
		{
			oldConfigObjectName	= GSetUtil.getSingleton( candidates );
		}
		else if ( candidates.size() == 0 )
		{
			oldConfigObjectName	= null;
		}
		else
		{
                        final String msg = _strMgr.getString("FoundMoreThanOneMatch", props);
			throw new IllegalArgumentException( msg );
		}
		
		return( oldConfigObjectName );