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

ConnectorMBean

public class ConnectorMBean extends ClassNameMBean

A ModelMBean implementation for the org.apache.coyote.tomcat4.CoyoteConnector component.

author
Amy Roh
version
$Revision: 1.3 $ $Date: 2007/05/05 05:32:09 $

Fields Summary
Constructors Summary
public ConnectorMBean()
Construct a ModelMBean with default ModelMBeanInfo information.

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


        super();

    
Methods Summary
public java.lang.ObjectgetAttribute(java.lang.String name)
Obtain and return the value of a specific attribute of this MBean.

param
name Name of the requested attribute
exception
AttributeNotFoundException if this attribute is not supported by this MBean
exception
MBeanException if the initializer of an object throws an exception
exception
ReflectionException if a Java reflection exception occurs when invoking the getter

		
 	Object attribute = null;
        // Validate the input parameters
        if (name == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute name is null"),
                 "Attribute name is null");
		 
        CoyoteConnector connector = null;
	try {
	    connector = (CoyoteConnector) getManagedResource();
	} catch (InstanceNotFoundException e) {
	    throw new MBeanException(e);
	} catch (InvalidTargetObjectTypeException e) {
	   throw new MBeanException(e);
        } 	    
	
	if (("algorithm").equals(name) || ("keystoreType").equals(name) ||
            ("maxThreads").equals(name) || ("maxSpareThreads").equals(name) ||
            ("minSpareThreads").equals(name)) {
                
            if (("keystoreType").equals(name)) {
                name = "keyType";
            }
                
            ProtocolHandler protocolHandler = connector.getProtocolHandler();
	    /* check the Protocol first, since JkCoyote has an independent
             * configure method.
             */
            try {
                if( protocolHandler != null ) {
                    attribute = IntrospectionUtils.getAttribute(protocolHandler, name);
                }
            } catch (Exception e) {
                throw new MBeanException(e);
            }
            //if( attribute == null ) {
            //    attribute = connector.getProperty(name);
            //}
	} else {
	    attribute = super.getAttribute(name);
	}
	
        return attribute;

    
public voidsetAttribute(javax.management.Attribute attribute)
Set the value of a specific attribute of this MBean.

param
attribute The identification of the attribute to be set and the new value
exception
AttributeNotFoundException if this attribute is not supported by this MBean
exception
MBeanException if the initializer of an object throws an exception
exception
ReflectionException if a Java reflection exception occurs when invoking the getter


        // Validate the input parameters
        if (attribute == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute is null"),
                 "Attribute is null");
        String name = attribute.getName();
        Object value = attribute.getValue();
        if (name == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute name is null"),
                 "Attribute name is null"); 
		 
        CoyoteConnector connector = null;
	try {
	    connector = (CoyoteConnector) getManagedResource();
	} catch (InstanceNotFoundException e) {
	    throw new MBeanException(e);
	} catch (InvalidTargetObjectTypeException e) {
	   throw new MBeanException(e);
        } 	    
	
        if (("algorithm").equals(name) || ("keystoreType").equals(name) ||
            ("maxThreads").equals(name) || ("maxSpareThreads").equals(name) ||
            ("minSpareThreads").equals(name)) {
                
            if (("keystoreType").equals(name)) {
                name = "keyType";
            }
            
            ProtocolHandler protocolHandler = connector.getProtocolHandler();
	    /* check the Protocol first, since JkCoyote has an independent
             * configure method.
             */
            try {
                if( protocolHandler != null ) {
                    IntrospectionUtils.setAttribute(protocolHandler, name, value);
                }   
            } catch (Exception e) {
                throw new MBeanException(e);
            }
  
	} else {
	    super.setAttribute(attribute);
	}