FileDocCategorySizeDatePackage
StandardHostMBean.javaAPI DocGlassfish v2 API5746Fri May 04 22:32:10 BST 2007org.apache.catalina.mbeans

StandardHostMBean

public class StandardHostMBean extends com.sun.org.apache.commons.modeler.BaseModelMBean

A ModelMBean implementation for the org.apache.catalina.core.StandardHost component.

author
Amy Roh
version
$Revision: 1.4 $ $Date: 2007/05/05 05:32:10 $

Fields Summary
private static MBeanServer
mserver
The MBeanServer for this application.
Constructors Summary
public StandardHostMBean()
Construct a ModelMBean with default ModelMBeanInfo information.

exception
MBeanException if the initializer of an object throws an exception
exception
RuntimeOperationsException if an IllegalArgumentException occurs


    // ----------------------------------------------------------- Constructors


                                   
     
           

        super();

    
Methods Summary
public voidaddAlias(java.lang.String alias)
Add an alias name that should be mapped to this Host

param
alias The alias to be added
exception
Exception if an MBean cannot be created or registered


        StandardHost host = (StandardHost) this.resource;
        host.addAlias(alias);

    
public java.lang.String[]findAliases()
Return the set of alias names for this Host

exception
Exception if an MBean cannot be created or registered


        StandardHost host = (StandardHost) this.resource;
        return host.findAliases();

    
public java.lang.String[]getValves()
Return the MBean Names of the Valves assoicated with this Host

exception
Exception if an MBean cannot be created or registered


        Registry registry = MBeanUtils.createRegistry();
        StandardHost host = (StandardHost) this.resource;
        String mname = MBeanUtils.createManagedName(host);
        ManagedBean managed = registry.findManagedBean(mname);
        String domain = null;
        if (managed != null) {
            domain = managed.getDomain();
        }
        if (domain == null)
            domain = mserver.getDefaultDomain();
        Valve [] valves = host.getValves();
        String [] mbeanNames = new String[valves.length];
        for (int i = 0; i < valves.length; i++) {
            mbeanNames[i] =
                MBeanUtils.createObjectName(domain, valves[i]).toString();
        }

        return mbeanNames;

    
public voidremoveAlias(java.lang.String alias)
Return the specified alias name from the aliases for this Host

param
alias Alias name to be removed
exception
Exception if an MBean cannot be created or registered


        StandardHost host = (StandardHost) this.resource;
        host.removeAlias(alias);