FileDocCategorySizeDatePackage
HttpListenerMBean.javaAPI DocGlassfish v2 API5193Fri May 04 22:24:10 BST 2007com.sun.enterprise.admin.mbeans

HttpListenerMBean

public class HttpListenerMBean extends com.sun.enterprise.admin.config.BaseConfigMBean implements MBeanRegistration

Fields Summary
private ObjectName
on
static final String
DEFAULT_VIRTUAL_SERVER
Constructors Summary
Methods Summary
private voidchangeHttpListenerRef(java.lang.String oldVs, java.lang.String newVs)

        HttpListenerVirtualServerAssociationMgr mgr = 
            new HttpListenerVirtualServerAssociationMgr(
                super.getConfigContext(), on.getKeyProperty("config"));
        final String id = on.getKeyProperty("id");
        mgr.changeHttpListenerRef(id, oldVs, newVs);
    
private java.lang.StringgetDefaultVirtualServer(javax.management.AttributeList al)

        final Map map = AttributeListUtils.asNameMap(al);
        final Attribute val = (Attribute)map.get(DEFAULT_VIRTUAL_SERVER);
        return (String)val.getValue();
    
private booleanisDefaultVirtualServer(javax.management.Attribute a)

        return a.getName().equals(DEFAULT_VIRTUAL_SERVER);
    
private booleanisDefaultVirtualServerExists(javax.management.AttributeList al)

        return AttributeListUtils.containsNamedAttribute(al, 
                DEFAULT_VIRTUAL_SERVER);
    
public javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName name)

        on = super.preRegister(server, name);
        return on;
    
public voidsetAttribute(javax.management.Attribute attribute)


       
           
    
        String oldVs = null;
        if (isDefaultVirtualServer(attribute))
        {
            oldVs = (String)super.getAttribute(DEFAULT_VIRTUAL_SERVER);
        }

        super.setAttribute(attribute);

        if (isDefaultVirtualServer(attribute))
        {
            try
            {
                changeHttpListenerRef(oldVs, (String)attribute.getValue());
            }
            catch (ConfigException ce)
            {
                throw new MBeanException(ce);
            }
        }
    
public javax.management.AttributeListsetAttributes(javax.management.AttributeList list)

        String oldVs = null;
        if (isDefaultVirtualServerExists(list))
        {
            try
            {
                oldVs = (String)super.getAttribute(DEFAULT_VIRTUAL_SERVER);
            }
            catch (JMException e)
            {
                //Ignoring. This should not occur.
            }
        }
        AttributeList al = super.setAttributes(list);
        if (isDefaultVirtualServerExists(list) && 
            isDefaultVirtualServerExists(al))
        {
            try
            {
                changeHttpListenerRef(oldVs, getDefaultVirtualServer(list));
            }
            catch (ConfigException ce)
            {
                _sLogger.log(Level.WARNING, 
                    "httplistenerMBean.failed_to_add_http_listener_ref",ce);
            }
        }
        return al;