Author: remm Date: Tue Jan 10 07:51:42 2006 New Revision: 367660 URL: http://svn.apache.org/viewcvs?rev=367660&view=rev Log: - Add JMX configuration capabilities for the ContextConfig classname.
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java?rev=367660&r1=367659&r2=367660&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java Tue Jan 10 07:51:42 2006 @@ -33,6 +33,7 @@ import java.util.Stack; import java.util.TreeMap; +import javax.management.AttributeNotFoundException; import javax.management.ListenerNotFoundException; import javax.management.MBeanNotificationInfo; import javax.management.MBeanRegistrationException; @@ -5057,11 +5058,31 @@ .registerComponent(host, parentName, null); mserver.invoke(parentName, "init", new Object[] {}, new String[] {} ); } - ContextConfig config = new ContextConfig(); + + // Add the main configuration listener + LifecycleListener config = null; + try { + Object configClassname = null; + try { + configClassname = mserver.getAttribute(parentName, "configClass"); + } catch (AttributeNotFoundException e) { + // Ignore, it's normal a host may not have this optional attribute + } + if (configClassname != null) { + Class clazz = Class.forName(String.valueOf(configClassname)); + config = (LifecycleListener) clazz.newInstance(); + } else { + config = new ContextConfig(); + } + } catch (Exception e) { + log.warn("Error creating ContextConfig for " + parentName, e); + throw e; + } this.addLifecycleListener(config); - if(log.isDebugEnabled()) - log.debug( "AddChild " + parentName + " " + this); + if (log.isDebugEnabled()) { + log.debug("AddChild " + parentName + " " + this); + } try { mserver.invoke(parentName, "addChild", new Object[] { this }, new String[] {"org.apache.catalina.Container"}); Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml?rev=367660&r1=367659&r2=367660&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Tue Jan 10 07:51:42 2006 @@ -248,6 +248,24 @@ type="org.apache.catalina.Valve"/> </operation> + <operation name="addLifecycleListener" + description="Add a lifecycle listener to this Context" + impact="ACTION" + returnType="void"> + <parameter name="listener" + description="New lifecycle listener to be added" + type="org.apache.catalina.LifecycleListener"/> + </operation> + + <operation name="removeLifecycleListener" + description="Remove a lifecycle listener from this Context" + impact="ACTION" + returnType="void"> + <parameter name="listener" + description="New lifecycle listener to be removed" + type="org.apache.catalina.LifecycleListener"/> + </operation> + <operation name="reload" description="Reload the webapplication" impact="ACTION" @@ -384,6 +402,10 @@ description="The auto deploy flag for this Host" type="boolean"/> + <attribute name="configClass" + description="The configuration class for contexts" + type="java.lang.String"/> + <attribute name="deployOnStartup" description="The deploy on startup flag for this Host" type="boolean"/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]