FileDocCategorySizeDatePackage
StandardHostMBean.javaAPI DocApache Tomcat 6.0.144501Fri Jul 20 04:20:32 BST 2007org.apache.catalina.mbeans

StandardHostMBean

public class StandardHostMBean extends org.apache.tomcat.util.modeler.BaseModelMBean

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

author
Amy Roh
version
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

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);