FileDocCategorySizeDatePackage
DomainStatusHelper.javaAPI DocGlassfish v2 API4828Fri May 04 22:24:08 BST 2007com.sun.enterprise.admin.mbeans

DomainStatusHelper

public class DomainStatusHelper extends Object
Helper class for setting server status in DomianStatusMBean
author
Sreenivas Munnangi

Fields Summary
private static final Logger
sLogger
private static final com.sun.enterprise.util.i18n.StringManager
localStrings
private static final Class[]
DOMAIN_STATUS_INTERFACES
Constructors Summary
public DomainStatusHelper()



    // default constructor
      
    
public DomainStatusHelper(String serverName)

    
Methods Summary
protected DomainStatusMBeangetDomainStatus()

	MBeanServer mbs = MBeanServerFactory.getMBeanServer();
	ObjectName  on  = null;
	try {
		on  = getDomainStatusObjectName();
	} catch (MalformedObjectNameException mone) {
		sLogger.log(Level.WARNING, 
			"DomainStatusHelper getDomainStatus ObjectName exception", mone);
	}
	DomainStatusMBean domainStatus = null;
	try {
		domainStatus = 
			(DomainStatusMBean)MBeanServerInvocationHandler.newProxyInstance(
				mbs, on, DomainStatusMBean.class, false );
	} catch (Exception e) {
		sLogger.log(Level.WARNING, 
			"DomainStatusHelper getDomainStatus io exception", e);
	}
	return(domainStatus);
    
public static javax.management.ObjectNamegetDomainStatusObjectName()


	ObjectName on = new ObjectName(
		ApplicationServer.getServerContext().getDefaultDomainName() + ":" +
		DomainStatusMBean.DOMAIN_STATUS_PROPS);
	return on;
    
public static javax.management.ObjectNamegetServersConfigObjectName()


	ObjectName on = new ObjectName(
		ApplicationServer.getServerContext().getDefaultDomainName() + ":" +
		"type=servers,category=config");
	return on;
    
public intgetstate(java.lang.String serverName)

	sLogger.log(Level.FINE, "DomainStatusHelper getstate for " + serverName);
	return (getDomainStatus().getstate(serverName));
    
public voidsetstate(java.lang.String serverName, int state)

	sLogger.log(Level.FINE, "DomainStatusHelper setstate for " + serverName);
	try {
		getDomainStatus().setstate(serverName, Integer.valueOf(state));
	} catch (Exception e) {
		sLogger.log(Level.WARNING, 
			"DomainStatusHelper setstate exception for server " +
			serverName, e);
	}