[jboss-cvs] JBossAS SVN: r69742 - in trunk/tomcat: src/main/org/jboss/web/tomcat/service/deployers and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 8 19:10:45 EST 2008
Author: remy.maucherat at jboss.com
Date: 2008-02-08 19:10:45 -0500 (Fri, 08 Feb 2008)
New Revision: 69742
Added:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatServiceMBean.java
trunk/tomcat/src/resources/jboss-structure-sar.xml
Removed:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapper.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapperMBean.java
Modified:
trunk/tomcat/build.xml
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
trunk/tomcat/src/resources/jboss-structure.xml
trunk/tomcat/src/resources/jboss-web-service.xml
trunk/tomcat/src/resources/war-deployers-beans.xml
Log:
- Expand on Brian's jbossweb.sar and move the JBoss Web binary to it,
along with the actual deployment work.
Modified: trunk/tomcat/build.xml
===================================================================
--- trunk/tomcat/build.xml 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/build.xml 2008-02-09 00:10:45 UTC (rev 69742)
@@ -227,6 +227,8 @@
<mkdir dir="${build.deploy}/jboss-web.deployer/META-INF"/>
<!-- Build the jboss-web.deployer -->
+ <copy file="${build.resources}/web.xml"
+ tofile="${build.deploy}/jboss-web.deployer/web.xml"/>
<copy todir="${build.deploy}/jboss-web.deployer/META-INF">
<fileset dir="${build.resources}">
<include name="jboss-structure.xml" />
@@ -234,13 +236,32 @@
<include name="webserver-xmbean.xml" />
</fileset>
</copy>
+ <jar jarfile="${build.deploy}/jboss-web.deployer/jboss-web-deployer.jar"
+ manifest="${build.etc}/default.mf">
+ <!-- The service classes -->
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/web/tomcat/service/deployers/ClusteringDefaultsDeployer.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/ClusteringDependencyDeployer.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/DeployerConfig.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/TomcatDeployer.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/TomcatDeployer$ENCLoader.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.class"/>
+ <include name="org/jboss/web/tomcat/service/deployers/WarClassLoaderDeployer.class"/>
+ </fileset>
+ </jar>
+
+ <!-- SAR for the webserver runtime -->
+ <mkdir dir="${build.deploy}/jbossweb.sar/META-INF"/>
+ <copy tofile="${build.deploy}/jbossweb.sar/META-INF/jboss-service.xml"
+ file="${build.resources}/jboss-web-service.xml"/>
+ <copy tofile="${build.deploy}/jbossweb.sar/META-INF/jboss-structure.xml"
+ file="${build.resources}/jboss-structure-sar.xml"/>
+
<copy file="${build.resources}/context.xml"
- todir="${build.deploy}/jboss-web.deployer"/>
- <copy file="${build.resources}/web.xml"
- tofile="${build.deploy}/jboss-web.deployer/conf/web.xml"/>
+ todir="${build.deploy}/jbossweb.sar"/>
<copy file="${build.resources}/server.xml"
- tofile="${build.deploy}/jboss-web.deployer/server.xml"/>
- <copy todir="${build.deploy}/jboss-web.deployer">
+ tofile="${build.deploy}/jbossweb.sar/server.xml"/>
+ <copy todir="${build.deploy}/jbossweb.sar">
<fileset dir="${jboss.web.lib}">
<include name="*.jar"/>
<exclude name="el-api.jar"/>
@@ -248,32 +269,35 @@
<exclude name="servlet-api.jar"/>
</fileset>
</copy>
-
- <copy todir="${build.deploy}/jboss-web.deployer"
+ <copy todir="${build.deploy}/jbossweb.sar"
file="${sun.jstl.lib}/jstl.jar" />
-
- <mkdir dir="${build.deploy}/jboss-web.deployer/jsf-libs"/>
-
- <copy todir="${build.deploy}/jboss-web.deployer/jsf-libs">
+ <mkdir dir="${build.deploy}/jbossweb.sar/jsf-libs"/>
+ <copy todir="${build.deploy}/jbossweb.sar/jsf-libs">
<fileset dir="${sun.jsf.lib}">
<include name="*.jar" />
</fileset>
</copy>
-
<!-- jar for jsf integration classes -->
- <jar jarfile="${build.deploy}/jboss-web.deployer/jsf-libs/jboss-faces.jar">
+ <jar jarfile="${build.deploy}/jbossweb.sar/jsf-libs/jboss-faces.jar">
<fileset dir="${build.classes}">
<include name="org/jboss/web/jsf/integration/**"/>
</fileset>
</jar>
- <jar jarfile="${build.deploy}/jboss-web.deployer/jboss-web-service.jar"
+ <jar jarfile="${build.deploy}/jbossweb.sar/jboss-web-service.jar"
manifest="${build.etc}/default.mf">
<!-- The service classes -->
<fileset dir="${build.classes}">
- <exclude name="org/jboss/**/*.properties"/>
- <exclude name="org/jboss/web/tomcat/service/session/AopMarker*"/>
- <exclude name="org/jboss/web/tomcat/service/session/InstanceOfAopMarker*"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/ClusteringDefaultsDeployer.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/ClusteringDependencyDeployer.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/DeployerConfig.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/TomcatDeployer.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/TomcatDeployer$ENCLoader.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.class"/>
+ <exclude name="org/jboss/web/tomcat/service/deployers/WarClassLoaderDeployer.class"/>
+ <exclude name="org/jboss/**/*.properties"/>
+ <exclude name="org/jboss/web/tomcat/service/session/AopMarker*"/>
+ <exclude name="org/jboss/web/tomcat/service/session/InstanceOfAopMarker*"/>
<include name="org/jboss/net/**"/>
<include name="org/jboss/web/tomcat/filters/**"/>
<include name="org/jboss/web/tomcat/servlets/**"/>
@@ -295,13 +319,6 @@
</fileset>
</jar>
- <!-- jboss-web-metamodel.jar -->
- <jar jarfile="${build.deploy}/jboss-web.deployer/jboss-web-metamodel.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/web/metamodel/**"/>
- </fileset>
- </jar>
-
<!-- Cluster caches and aop descriptor used for fine-grained replication -->
<mkdir dir="${build.deploy}/cluster"/>
<copy todir="${build.deploy}/cluster"
@@ -311,11 +328,6 @@
<copy tofile="${build.deploy}/cluster/jbossweb-clusteredsso-beans.xml"
file="${build.resources}/jbossweb-clusteredsso-beans.xml"/>
- <!-- SAR for the webserver runtime -->
- <mkdir dir="${build.deploy}/jbossweb.sar/META-INF"/>
- <copy tofile="${build.deploy}/jbossweb.sar/META-INF/jboss-service.xml"
- file="${build.resources}/jboss-web-service.xml"/>
-
<!-- Update the build marker to allow bypassing -->
<touch file="${build-bypass.marker}"/>
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -21,52 +21,25 @@
*/
package org.jboss.web.tomcat.service.deployers;
-import java.io.File;
import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-import javax.management.Attribute;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.security.jacc.PolicyContext;
-import javax.security.jacc.PolicyContextException;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.CatalinaProperties;
-import org.apache.tomcat.util.modeler.Registry;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.metadata.web.jboss.JBoss50WebMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.jboss.ReplicationConfig;
import org.jboss.metadata.web.spec.Web25MetaData;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.metadata.web.spec.WebMetaData;
+import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.security.ISecurityManagement;
import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
-import org.jboss.system.server.Server;
-import org.jboss.system.server.ServerImplMBean;
import org.jboss.virtual.VirtualFile;
import org.jboss.web.deployers.AbstractWarDeployer;
import org.jboss.web.deployers.AbstractWarDeployment;
-import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
import org.jboss.web.tomcat.service.session.SessionIDGenerator;
-import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
@@ -89,8 +62,11 @@
* @see org.jboss.web.deployers.AbstractWarDeployer
*/
public class TomcatDeployer extends AbstractWarDeployer
- implements NotificationListener, TomcatDeployerMBean
+ implements TomcatDeployerMBean
{
+ // default object name
+ public static final ObjectName TOMCAT_SERVICE_NAME = ObjectNameFactory.create("jboss.web:service=WebServer");
+
// Constants -----------------------------------------------------
public static final String NAME = "TomcatDeployer";
@@ -161,7 +137,9 @@
/** The service used to flush authentication cache on session invalidation. */
private JaasSecurityManagerServiceMBean secMgrService;
/** The AbstractWarDeployment implementation class */
- private Class deploymentClass = TomcatDeployment.class;
+ private Class deploymentClass = null;
+ /** The classloader for the Tomcat SAR */
+ private ClassLoader serviceClassLoader = null;
/** The JBoss Security Manager Wrapper */
private ISecurityManagement securityManagement;
@@ -193,7 +171,16 @@
this.managerClass = managerClass;
}
+ public ClassLoader getServiceClassLoader()
+ {
+ return serviceClassLoader;
+ }
+ public void setServiceClassLoader(ClassLoader serviceClassLoader)
+ {
+ this.serviceClassLoader = serviceClassLoader;
+ }
+
public String getDomain()
{
return this.catalinaDomain;
@@ -403,239 +390,19 @@
sharedMetaData = new JBoss50WebMetaData();
sharedMetaData.merge(null, confWebMD);
- if (isRuntimeLifecycleCoupled())
- startWebServer();
}
- /**
- * Initializes and starts the webserver runtime.
- */
- public void startWebServer() throws Exception
- {
- // Load Catalina properties
- CatalinaProperties.getProperty("");
-
- log.debug("Starting tomcat deployer");
- MBeanServer server = super.getServer();
- System.setProperty("catalina.ext.dirs",
- (System.getProperty("jboss.server.home.dir")
- + File.separator + "lib"));
-
- String objectNameS = catalinaDomain + ":type=server";
- ObjectName objectName = new ObjectName(objectNameS);
-
- // Set the modeler Registry MBeanServer to the that of the tomcat service
- Registry.getRegistry().setMBeanServer(server);
-
- Registry.getRegistry().registerComponent(Class.forName("org.apache.catalina.startup.Catalina").newInstance(),
- objectName, "org.apache.catalina.startup.Catalina");
- /*
- server.createMBean("org.apache.tomcat.util.modeler.BaseModelMBean",
- objectName,
- new Object[]{"org.apache.catalina.startup.Catalina"},
- new String[]{"java.lang.String"});
- */
-
- server.setAttribute(objectName, new Attribute
- ("catalinaHome",
- System.getProperty("jboss.server.home.dir")));
- server.setAttribute(objectName, new Attribute
- ("configFile", serverConfigFile));
- server.setAttribute(objectName, new Attribute
- ("useNaming", new Boolean(false)));
- server.setAttribute(objectName, new Attribute
- ("useShutdownHook", new Boolean(false)));
- server.setAttribute(objectName, new Attribute
- ("await", new Boolean(false)));
- server.setAttribute(objectName, new Attribute
- ("redirectStreams", new Boolean(false)));
-
- server.invoke(objectName, "create", new Object[]{},
- new String[]{});
-
- server.invoke(objectName, "start", new Object[]{},
- new String[]{});
-
- //Set up the authenticators in JNDI such that they can be configured for web apps
- InitialContext ic = new InitialContext();
- try
- {
- ic.bind("TomcatAuthenticators", this.authenticators);
- }
- catch(NamingException ne)
- {
- if(log.isTraceEnabled())
- log.trace("Binding Authenticators to JNDI failed",ne);
- }
- finally
- {
- try{ ic.close();}catch(NamingException nee){}
- }
-
- // Register the web container JACC PolicyContextHandlers
- HttpServletRequestPolicyContextHandler handler = new HttpServletRequestPolicyContextHandler();
- PolicyContext.registerHandler(HttpServletRequestPolicyContextHandler.WEB_REQUEST_KEY,
- handler, true);
-
-// // Parse shared web.xml
-// Unmarshaller unmarshaller = factory.newUnmarshaller();
-// URL webXml = this.getClass().getClassLoader().getResource("web.xml");
-// if (webXml == null)
-// {
-// webXml = this.getClass().getClassLoader().getResource("conf/web.xml");;
-// }
-// if (webXml == null)
-// throw new IllegalStateException("Unable to find shared web.xml or conf/web.xml");
-// SchemaBinding schema = JBossXBBuilder.build(Web25MetaData.class);
-// Web25MetaData confWebMD = (Web25MetaData) unmarshaller.unmarshal(webXml.toString(), schema);
-// sharedMetaData = new JBoss50WebMetaData();
-// sharedMetaData.merge(null, confWebMD);
-
- // If we are hot-deployed *after* the overall server is started
- // we'll never receive Server.START_NOTIFICATION_TYPE, so check
- // with the Server and start the connectors immediately, if this is the case.
- // Otherwise register to receive the server start-up notification.
- Boolean started = (Boolean)server.getAttribute(ServerImplMBean.OBJECT_NAME, "Started");
- if (started.booleanValue() == true)
- {
- log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
- "' already started, starting connectors now");
-
- startConnectors();
- }
- else
- {
- // Register for notification of the overall server startup
- log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
- "' not started, registering for start-up notification");
-
- server.addNotificationListener(ServerImplMBean.OBJECT_NAME, this, null, null);
- }
- }
-
-
public void stop()
throws Exception
{
- if (isRuntimeLifecycleCoupled())
- stopWebServer();
-
super.stop();
}
/**
- * Stops the webserver runtime.
- */
- public void stopWebServer() throws Exception
- {
- MBeanServer server = super.getServer();
- String objectNameS = catalinaDomain + ":type=server";
- ObjectName objectName = new ObjectName(objectNameS);
-
- server.invoke(objectName, "stop", new Object[]{},
- new String[]{});
-
- server.invoke(objectName, "destroy", new Object[]{},
- new String[]{});
-
- server.unregisterMBean(objectName);
-
- MBeanServer server2 = server;
-
- // Unregister any remaining jboss.web or Catalina MBeans
- ObjectName queryObjectName = new ObjectName
- (catalinaDomain + ":*");
- Iterator iterator =
- server2.queryMBeans(queryObjectName, null).iterator();
- while (iterator.hasNext())
- {
- ObjectInstance oi = (ObjectInstance) iterator.next();
- ObjectName toRemove = oi.getObjectName();
- // Exception: Don't unregister the service right now
- if (!"WebServer".equals(toRemove.getKeyProperty("service")))
- {
- if (server2.isRegistered(toRemove))
- {
- server2.unregisterMBean(toRemove);
- }
- }
- }
- queryObjectName = new ObjectName("Catalina:*");
- iterator = server2.queryMBeans(queryObjectName, null).iterator();
- while (iterator.hasNext())
- {
- ObjectInstance oi = (ObjectInstance) iterator.next();
- ObjectName name = oi.getObjectName();
- server2.unregisterMBean(name);
- }
- }
-
- /**
- * Start the tomcat service connectors.
- */
- public void startConnectors() throws Exception
- {
- MBeanServer server = super.getServer();
- ObjectName service = new ObjectName(catalinaDomain + ":type=Service,serviceName=jboss.web");
- Object[] args = {};
- String[] sig = {};
- Connector[] connectors = (Connector[]) server.invoke(service,
- "findConnectors", args, sig);
- for (int n = 0; n < connectors.length; n++)
- {
- Lifecycle lc = (Lifecycle) connectors[n];
- lc.start();
- }
- /* TODO:
- // Notify listeners that connectors have started processing requests
- sendNotification(new Notification(TOMCAT_CONNECTORS_STARTED,
- this, getNextNotificationSequenceNumber()));
- */
- }
-
- /**
- * Stop the tomcat service connectors.
- */
- public void stopConnectors() throws Exception
- {
- MBeanServer server = super.getServer();
- ObjectName service = new ObjectName(catalinaDomain + ":type=Service,serviceName=jboss.web");
- Object[] args = {};
- String[] sig = {};
- Connector[] connectors = (Connector[]) server.invoke(service,
- "findConnectors", args, sig);
- for (int n = 0; n < connectors.length; n++)
- {
- Lifecycle lc = (Lifecycle) connectors[n];
- lc.stop();
- }
- }
-
- /**
- * Used to receive notification of the server start msg so the tomcat
- * connectors can be started after all web apps are deployed.
- */
- public void handleNotification(Notification msg, Object handback)
- {
- String type = msg.getType();
- if (type.equals(Server.START_NOTIFICATION_TYPE))
- {
- log.debug("Saw " + type + " notification, starting connectors");
- try
- {
- startConnectors();
- }
- catch (Exception e)
- {
- log.warn("Failed to startConnectors", e);
- }
- }
- }
-
- /**
* A trival extension of URLClassLoader that uses an empty URL[] as its
* classpath so that all work is delegated to its parent.
*/
+ /*
static class ENCLoader extends URLClassLoader
{
private boolean parentFirst;
@@ -692,7 +459,7 @@
ENCLoader loader = new ENCLoader(list.toArray(new URL[list.size()]), parent, parentFirst);
return loader;
- }
+ }*/
/**
* Create a tomcat war deployment bean for the deployment unit/metaData.
@@ -704,12 +471,13 @@
public AbstractWarDeployment getDeployment(VFSDeploymentUnit unit, JBossWebMetaData metaData)
throws Exception
{
- AbstractWarDeployment deployment = (AbstractWarDeployment) deploymentClass.newInstance();
+ AbstractWarDeployment deployment = (AbstractWarDeployment) (getClass().getClassLoader().loadClass("org.jboss.web.tomcat.service.deployers.TomcatDeployment")).newInstance();
+
DeployerConfig config = new DeployerConfig();
config.setDefaultSecurityDomain(this.defaultSecurityDomain);
config.setSubjectAttributeName(this.subjectAttributeName);
- config.setServiceClassLoader(getClass().getClassLoader());
+ config.setServiceClassLoader((getServiceClassLoader() == null) ? getClass().getClassLoader() : getServiceClassLoader());
config.setManagerClass(this.managerClass);
config.setJava2ClassLoadingCompliance(this.java2ClassLoadingCompliance);
config.setUnpackWars(this.unpackWars);
@@ -736,7 +504,7 @@
List<String> depends = metaData.getDepends();
if (depends == null)
depends = new ArrayList<String>();
- depends.add(TomcatDeployerMBean.OBJECT_NAME.getCanonicalName());
+ depends.add(TOMCAT_SERVICE_NAME.getCanonicalName());
metaData.setDepends(depends);
deployment.setServer(super.getServer());
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -21,9 +21,6 @@
*/
package org.jboss.web.tomcat.service.deployers;
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
import org.jboss.web.AbstractWebContainerMBean;
import org.jboss.web.deployers.AbstractWarDeployerMBean;
@@ -42,9 +39,6 @@
*/
public interface TomcatDeployerMBean extends AbstractWarDeployerMBean
{
- // default object name
- public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.web:service=WebServer");
-
/** JMX notification type to signal after-start connector event */
public final String TOMCAT_CONNECTORS_STARTED = "jboss.tomcat.connectors.started";
@@ -121,22 +115,6 @@
public void setSubjectAttributeName(String name);
/**
- * Start all connectors of the Domain + ":type=Service,serviceName=jboss.web"
- * service.
- *
- * @throws Exception
- */
- public void startConnectors() throws Exception;
-
- /**
- * Stop all connectors of the Domain + ":type=Service,serviceName=jboss.web"
- * service.
- *
- * @throws Exception
- */
- public void stopConnectors() throws Exception;
-
- /**
* Get whether web-apps are able to control the privileged flag
*/
public boolean isAllowSelfPrivilegedWebApps();
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapper.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapper.java 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapper.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -1,246 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.deployers;
-
-import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * Temporary workaround to support controlling the lifecycle of the webserver
- * runtime portion of TomcatDeployer via a JMX service in the deploy directory.
- * We want it in deploy so dependencies on services in deploy can be properly
- * expressed. We want it as a JMX service so the ServiceBindingManager can
- * alter the connector ports.
- * <p>
- * A more long term solution involves:
- * <ol>
- * <li>separating out the JBossWeb runtime aspects from TomcatDeployer and
- * putting them in a separate class</li>
- * <li>developing a ProfileService-based alternative to ServiceBindingManager</li>
- * </ol>
- * </p>
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class TomcatDeployerWrapper
- extends ServiceMBeanSupport
- implements TomcatDeployerWrapperMBean
-{
- private TomcatDeployer tomcatDeployer;
-
-
- // Dependency inject the TomcatDeployer pojo
-
- public TomcatDeployer getTomcatDeployer()
- {
- return tomcatDeployer;
- }
-
- public void setTomcatDeployer(TomcatDeployer tomcatDeployer)
- {
- this.tomcatDeployer = tomcatDeployer;
- }
-
- // In our lifecycle, we invoke the webserver lifecycle-related operations
- // in the TomcatDeployer
-
- @Override
- protected void startService() throws Exception
- {
- if (tomcatDeployer == null)
- throw new IllegalStateException("Must set TomcatDeployer before starting");
- tomcatDeployer.startWebServer();
- }
-
- @Override
- protected void stopService() throws Exception
- {
- if (tomcatDeployer != null)
- tomcatDeployer.stopWebServer();
- }
-
- // Expose the TomcatDeployer MBean interface
-
- public String getConfigFile()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getConfigFile();
- }
-
- public String getContextMBeanCode()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getContextMBeanCode();
- }
-
- public String getDomain()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getDomain();
- }
-
- public String[] getFilteredPackages()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getFilteredPackages();
- }
-
- public String getManagerClass()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getManagerClass();
- }
-
- public String getSessionIdAlphabet()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getSessionIdAlphabet();
- }
-
- public String getSubjectAttributeName()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getSubjectAttributeName();
- }
-
- public boolean getUseJBossWebLoader()
- {
- return tomcatDeployer == null ? false : tomcatDeployer.getUseJBossWebLoader();
- }
-
- public boolean isAllowSelfPrivilegedWebApps()
- {
- return tomcatDeployer == null ? false : tomcatDeployer.isAllowSelfPrivilegedWebApps();
- }
-
- public void setAllowSelfPrivilegedWebApps(boolean flag)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setAllowSelfPrivilegedWebApps(flag);
- }
-
- public void setConfigFile(String configFile)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setConfigFile(configFile);
- }
-
- public void setContextMBeanCode(String className)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setContextMBeanCode(className);
- }
-
- public void setDomain(String domainName)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setDomain(domainName);
- }
-
- public void setFilteredPackages(String[] pkgs)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setFilteredPackages(pkgs);
- }
-
- public void setManagerClass(String managerClass)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setManagerClass(managerClass);
- }
-
- public void setSecurityManagerService(JaasSecurityManagerServiceMBean mgr)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setSecurityManagerService(mgr);
- }
-
- public void setSessionIdAlphabet(String sessionIdAlphabet)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setSessionIdAlphabet(sessionIdAlphabet);
- }
-
- public void setSubjectAttributeName(String name)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setSubjectAttributeName(name);
- }
-
- public void setUseJBossWebLoader(boolean flag)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setUseJBossWebLoader(flag);
- }
-
- public void startConnectors() throws Exception
- {
- if (tomcatDeployer != null)
- tomcatDeployer.startConnectors();
- }
-
- public void stopConnectors() throws Exception
- {
- if (tomcatDeployer != null)
- tomcatDeployer.stopConnectors();
- }
-
- public String getDefaultSecurityDomain()
- {
- return tomcatDeployer == null ? null : tomcatDeployer.getDefaultSecurityDomain();
- }
-
- public boolean getJava2ClassLoadingCompliance()
- {
- return tomcatDeployer == null ? false : tomcatDeployer.getJava2ClassLoadingCompliance();
- }
-
- public boolean getLenientEjbLink()
- {
- return tomcatDeployer == null ? false : tomcatDeployer.getLenientEjbLink();
- }
-
- public boolean getUnpackWars()
- {
- return tomcatDeployer == null ? false : tomcatDeployer.getUnpackWars();
- }
-
- public void setDefaultSecurityDomain(String defaultSecurityDomain)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setDefaultSecurityDomain(defaultSecurityDomain);
- }
-
- public void setJava2ClassLoadingCompliance(boolean flag)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setJava2ClassLoadingCompliance(flag);
- }
-
- public void setLenientEjbLink(boolean flag)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setLenientEjbLink(flag);
- }
-
- public void setUnpackWars(boolean flag)
- {
- if (tomcatDeployer != null)
- tomcatDeployer.setUnpackWars(flag);
- }
-
-}
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapperMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapperMBean.java 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapperMBean.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.deployers;
-
-import org.jboss.system.ServiceMBean;
-
-/**
- * StandardMBean interface for the TomcatDeployerWrapper.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public interface TomcatDeployerWrapperMBean extends TomcatDeployerMBean, ServiceMBean
-{
- public void setTomcatDeployer(TomcatDeployer tomcatDeployer);
-}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -37,6 +37,7 @@
import java.util.List;
import java.util.Set;
import java.util.zip.ZipFile;
+
import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -49,14 +50,13 @@
import org.apache.catalina.Loader;
import org.apache.catalina.core.StandardContext;
import org.apache.tomcat.util.modeler.Registry;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
import org.jboss.metadata.serviceref.ServiceReferenceHandler;
import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.metadata.web.jboss.ClassLoadingMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.naming.NonSerializableFactory;
@@ -72,7 +72,6 @@
import org.jboss.web.tomcat.security.SecurityAssociationValve;
import org.jboss.web.tomcat.security.SecurityContextEstablishmentValve;
import org.jboss.web.tomcat.service.TomcatInjectionContainer;
-import org.jboss.web.tomcat.service.WebAppLoader;
import org.jboss.web.tomcat.service.WebCtxLoader;
import org.jboss.web.tomcat.service.session.AbstractJBossManager;
import org.jboss.web.tomcat.service.session.ClusteringNotSupportedException;
Copied: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java (from rev 69669, trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapper.java)
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -0,0 +1,441 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.deployers;
+
+import java.io.File;
+import java.util.Iterator;
+
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.security.jacc.PolicyContext;
+
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.CatalinaProperties;
+import org.apache.tomcat.util.modeler.Registry;
+import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.system.server.Server;
+import org.jboss.system.server.ServerImplMBean;
+import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
+
+/**
+ * Temporary workaround to support controlling the lifecycle of the webserver
+ * runtime portion of TomcatDeployer via a JMX service in the deploy directory.
+ * We want it in deploy so dependencies on services in deploy can be properly
+ * expressed. We want it as a JMX service so the ServiceBindingManager can
+ * alter the connector ports.
+ * <p>
+ * A more long term solution involves:
+ * <ol>
+ * <li>separating out the JBossWeb runtime aspects from TomcatDeployer and
+ * putting them in a separate class</li>
+ * <li>developing a ProfileService-based alternative to ServiceBindingManager</li>
+ * </ol>
+ * </p>
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class TomcatService
+ extends ServiceMBeanSupport
+ implements NotificationListener, TomcatServiceMBean
+{
+ /** The associated Tomcat deployer **/
+ private TomcatDeployer tomcatDeployer;
+
+
+ // Dependency inject the TomcatDeployer pojo
+
+ public TomcatDeployer getTomcatDeployer()
+ {
+ return tomcatDeployer;
+ }
+
+ public void setTomcatDeployer(TomcatDeployer tomcatDeployer)
+ {
+ this.tomcatDeployer = tomcatDeployer;
+ }
+
+ // In our lifecycle, we invoke the webserver lifecycle-related operations
+ // in the TomcatDeployer
+
+ @Override
+ protected void startService() throws Exception
+ {
+ if (tomcatDeployer == null)
+ throw new IllegalStateException("Must set TomcatDeployer before starting");
+
+ tomcatDeployer.setServiceClassLoader(getClass().getClassLoader());
+
+ // Load Catalina properties
+ CatalinaProperties.getProperty("");
+
+ log.debug("Starting tomcat deployer");
+ MBeanServer server = super.getServer();
+ System.setProperty("catalina.ext.dirs",
+ (System.getProperty("jboss.server.home.dir")
+ + File.separator + "lib"));
+
+ String objectNameS = tomcatDeployer.getDomain() + ":type=server";
+ ObjectName objectName = new ObjectName(objectNameS);
+
+ // Set the modeler Registry MBeanServer to the that of the tomcat service
+ Registry.getRegistry().setMBeanServer(server);
+
+ Registry.getRegistry().registerComponent(Class.forName("org.apache.catalina.startup.Catalina").newInstance(),
+ objectName, "org.apache.catalina.startup.Catalina");
+
+ server.setAttribute(objectName, new Attribute
+ ("catalinaHome",
+ System.getProperty("jboss.server.home.dir")));
+ server.setAttribute(objectName, new Attribute
+ ("configFile", tomcatDeployer.getConfigFile()));
+ server.setAttribute(objectName, new Attribute
+ ("useNaming", new Boolean(false)));
+ server.setAttribute(objectName, new Attribute
+ ("useShutdownHook", new Boolean(false)));
+ server.setAttribute(objectName, new Attribute
+ ("await", new Boolean(false)));
+ server.setAttribute(objectName, new Attribute
+ ("redirectStreams", new Boolean(false)));
+
+ server.invoke(objectName, "create", new Object[]{},
+ new String[]{});
+
+ server.invoke(objectName, "start", new Object[]{},
+ new String[]{});
+
+ //Set up the authenticators in JNDI such that they can be configured for web apps
+ InitialContext ic = new InitialContext();
+ try
+ {
+ ic.bind("TomcatAuthenticators", tomcatDeployer.getAuthenticators());
+ }
+ catch(NamingException ne)
+ {
+ if(log.isTraceEnabled())
+ log.trace("Binding Authenticators to JNDI failed",ne);
+ }
+ finally
+ {
+ try{ ic.close();}catch(NamingException nee){}
+ }
+
+ // Register the web container JACC PolicyContextHandlers
+ HttpServletRequestPolicyContextHandler handler = new HttpServletRequestPolicyContextHandler();
+ PolicyContext.registerHandler(HttpServletRequestPolicyContextHandler.WEB_REQUEST_KEY,
+ handler, true);
+
+ // If we are hot-deployed *after* the overall server is started
+ // we'll never receive Server.START_NOTIFICATION_TYPE, so check
+ // with the Server and start the connectors immediately, if this is the case.
+ // Otherwise register to receive the server start-up notification.
+ Boolean started = (Boolean)server.getAttribute(ServerImplMBean.OBJECT_NAME, "Started");
+ if (started.booleanValue() == true)
+ {
+ log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
+ "' already started, starting connectors now");
+
+ startConnectors();
+ }
+ else
+ {
+ // Register for notification of the overall server startup
+ log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
+ "' not started, registering for start-up notification");
+
+ server.addNotificationListener(ServerImplMBean.OBJECT_NAME, this, null, null);
+ }
+
+ }
+
+ @Override
+ protected void stopService() throws Exception
+ {
+
+ if (tomcatDeployer == null)
+ throw new IllegalStateException("Must set TomcatDeployer before stopping");
+
+ MBeanServer server = super.getServer();
+ String objectNameS = tomcatDeployer.getDomain() + ":type=server";
+ ObjectName objectName = new ObjectName(objectNameS);
+
+ server.invoke(objectName, "stop", new Object[]{},
+ new String[]{});
+
+ server.invoke(objectName, "destroy", new Object[]{},
+ new String[]{});
+
+ server.unregisterMBean(objectName);
+
+ MBeanServer server2 = server;
+
+ // Unregister any remaining jboss.web or Catalina MBeans
+ ObjectName queryObjectName = new ObjectName(tomcatDeployer.getDomain() + ":*");
+ Iterator iterator =
+ server2.queryMBeans(queryObjectName, null).iterator();
+ while (iterator.hasNext())
+ {
+ ObjectInstance oi = (ObjectInstance) iterator.next();
+ ObjectName toRemove = oi.getObjectName();
+ // Exception: Don't unregister the service right now
+ if (!"WebServer".equals(toRemove.getKeyProperty("service")))
+ {
+ if (server2.isRegistered(toRemove))
+ {
+ server2.unregisterMBean(toRemove);
+ }
+ }
+ }
+ queryObjectName = new ObjectName("Catalina:*");
+ iterator = server2.queryMBeans(queryObjectName, null).iterator();
+ while (iterator.hasNext())
+ {
+ ObjectInstance oi = (ObjectInstance) iterator.next();
+ ObjectName name = oi.getObjectName();
+ server2.unregisterMBean(name);
+ }
+
+ }
+
+ // Expose the TomcatDeployer MBean interface
+
+ public String getConfigFile()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getConfigFile();
+ }
+
+ public String getContextMBeanCode()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getContextMBeanCode();
+ }
+
+ public String getDomain()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getDomain();
+ }
+
+ public String[] getFilteredPackages()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getFilteredPackages();
+ }
+
+ public String getManagerClass()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getManagerClass();
+ }
+
+ public String getSessionIdAlphabet()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getSessionIdAlphabet();
+ }
+
+ public String getSubjectAttributeName()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getSubjectAttributeName();
+ }
+
+ public boolean getUseJBossWebLoader()
+ {
+ return tomcatDeployer == null ? false : tomcatDeployer.getUseJBossWebLoader();
+ }
+
+ public boolean isAllowSelfPrivilegedWebApps()
+ {
+ return tomcatDeployer == null ? false : tomcatDeployer.isAllowSelfPrivilegedWebApps();
+ }
+
+ public void setAllowSelfPrivilegedWebApps(boolean flag)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setAllowSelfPrivilegedWebApps(flag);
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setConfigFile(configFile);
+ }
+
+ public void setContextMBeanCode(String className)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setContextMBeanCode(className);
+ }
+
+ public void setDomain(String domainName)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setDomain(domainName);
+ }
+
+ public void setFilteredPackages(String[] pkgs)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setFilteredPackages(pkgs);
+ }
+
+ public void setManagerClass(String managerClass)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setManagerClass(managerClass);
+ }
+
+ public void setSecurityManagerService(JaasSecurityManagerServiceMBean mgr)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setSecurityManagerService(mgr);
+ }
+
+ public void setSessionIdAlphabet(String sessionIdAlphabet)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setSessionIdAlphabet(sessionIdAlphabet);
+ }
+
+ public void setSubjectAttributeName(String name)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setSubjectAttributeName(name);
+ }
+
+ public void setUseJBossWebLoader(boolean flag)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setUseJBossWebLoader(flag);
+ }
+
+ public void startConnectors() throws Exception
+ {
+ if (tomcatDeployer == null)
+ throw new IllegalStateException("Must set TomcatDeployer before starting connectors");
+
+ MBeanServer server = super.getServer();
+ ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web");
+ Object[] args = {};
+ String[] sig = {};
+ Connector[] connectors = (Connector[]) server.invoke(service,
+ "findConnectors", args, sig);
+ for (int n = 0; n < connectors.length; n++)
+ {
+ Lifecycle lc = (Lifecycle) connectors[n];
+ lc.start();
+ }
+ /* TODO:
+ // Notify listeners that connectors have started processing requests
+ sendNotification(new Notification(TOMCAT_CONNECTORS_STARTED,
+ this, getNextNotificationSequenceNumber()));
+ */
+ }
+
+ public void stopConnectors() throws Exception
+ {
+ if (tomcatDeployer == null)
+ throw new IllegalStateException("Must set TomcatDeployer before stopping connectors");
+
+ MBeanServer server = super.getServer();
+ ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web");
+ Object[] args = {};
+ String[] sig = {};
+ Connector[] connectors = (Connector[]) server.invoke(service,
+ "findConnectors", args, sig);
+ for (int n = 0; n < connectors.length; n++)
+ {
+ Lifecycle lc = (Lifecycle) connectors[n];
+ lc.stop();
+ }
+ }
+
+ /**
+ * Used to receive notification of the server start msg so the tomcat
+ * connectors can be started after all web apps are deployed.
+ */
+ public void handleNotification(Notification msg, Object handback)
+ {
+ String type = msg.getType();
+ if (type.equals(Server.START_NOTIFICATION_TYPE))
+ {
+ log.debug("Saw " + type + " notification, starting connectors");
+ try
+ {
+ startConnectors();
+ }
+ catch (Exception e)
+ {
+ log.warn("Failed to startConnectors", e);
+ }
+ }
+ }
+
+ public String getDefaultSecurityDomain()
+ {
+ return tomcatDeployer == null ? null : tomcatDeployer.getDefaultSecurityDomain();
+ }
+
+ public boolean getJava2ClassLoadingCompliance()
+ {
+ return tomcatDeployer == null ? false : tomcatDeployer.getJava2ClassLoadingCompliance();
+ }
+
+ public boolean getLenientEjbLink()
+ {
+ return tomcatDeployer == null ? false : tomcatDeployer.getLenientEjbLink();
+ }
+
+ public boolean getUnpackWars()
+ {
+ return tomcatDeployer == null ? false : tomcatDeployer.getUnpackWars();
+ }
+
+ public void setDefaultSecurityDomain(String defaultSecurityDomain)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setDefaultSecurityDomain(defaultSecurityDomain);
+ }
+
+ public void setJava2ClassLoadingCompliance(boolean flag)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setJava2ClassLoadingCompliance(flag);
+ }
+
+ public void setLenientEjbLink(boolean flag)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setLenientEjbLink(flag);
+ }
+
+ public void setUnpackWars(boolean flag)
+ {
+ if (tomcatDeployer != null)
+ tomcatDeployer.setUnpackWars(flag);
+ }
+
+}
Copied: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatServiceMBean.java (from rev 69669, trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerWrapperMBean.java)
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatServiceMBean.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatServiceMBean.java 2008-02-09 00:10:45 UTC (rev 69742)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.deployers;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * StandardMBean interface for the TomcatDeployerWrapper.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TomcatServiceMBean extends TomcatDeployerMBean, ServiceMBean
+{
+ public void setTomcatDeployer(TomcatDeployer tomcatDeployer);
+}
Added: trunk/tomcat/src/resources/jboss-structure-sar.xml
===================================================================
--- trunk/tomcat/src/resources/jboss-structure-sar.xml (rev 0)
+++ trunk/tomcat/src/resources/jboss-structure-sar.xml 2008-02-09 00:10:45 UTC (rev 69742)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<structure>
+ <context>
+ <path name=""/>
+ <metaDataPath>
+ <path name="META-INF"/>
+ </metaDataPath>
+ <classpath>
+ <path name=""/>
+ <path name="" suffixes=".jar" />
+ <path name="jsf-libs" suffixes=".jar" />
+ </classpath>
+ </context>
+</structure>
Modified: trunk/tomcat/src/resources/jboss-structure.xml
===================================================================
--- trunk/tomcat/src/resources/jboss-structure.xml 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/resources/jboss-structure.xml 2008-02-09 00:10:45 UTC (rev 69742)
@@ -8,7 +8,6 @@
<classpath>
<path name=""/>
<path name="" suffixes=".jar" />
- <path name="jsf-libs" suffixes=".jar" />
</classpath>
</context>
</structure>
Modified: trunk/tomcat/src/resources/jboss-web-service.xml
===================================================================
--- trunk/tomcat/src/resources/jboss-web-service.xml 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/resources/jboss-web-service.xml 2008-02-09 00:10:45 UTC (rev 69742)
@@ -10,7 +10,7 @@
controls the lifecycle of the JBoss Web runtime exposed by the
WarDeployer bean.
-->
- <mbean code="org.jboss.web.tomcat.service.deployers.TomcatDeployerWrapper"
+ <mbean code="org.jboss.web.tomcat.service.deployers.TomcatService"
name="jboss.web:service=WebServer">
<!-- Inject the TomcatDeployer -->
Modified: trunk/tomcat/src/resources/war-deployers-beans.xml
===================================================================
--- trunk/tomcat/src/resources/war-deployers-beans.xml 2008-02-08 23:39:27 UTC (rev 69741)
+++ trunk/tomcat/src/resources/war-deployers-beans.xml 2008-02-09 00:10:45 UTC (rev 69742)
@@ -192,9 +192,6 @@
-->
<property name="managerClass">org.jboss.web.tomcat.service.session.JBossCacheManager</property>
- <!-- The class used as the deployment wrapper -->
- <property name="deploymentClass">org.jboss.web.tomcat.service.deployers.TomcatDeployment</property>
-
<!-- The name of the request property under with the authenticated JAAS
Subject is stored on successful authentication. If null or empty then
the Subject will not be stored.
More information about the jboss-cvs-commits
mailing list