Tomcat deployer ported to VDF
starksm64 Oct 14, 2006 10:03 PMAn initial port of the tomcat deployer to the VDF has been checked in, and javaee14 style wars are deploying/working (for example, jmx-console.war). The classes that have been replaced are:
org.jboss.web.AbstractWebContainer replaced by org.jboss.web.deployers.AbstractWarDeployer
org.jboss.web.tomcat.tc6.Tomcat6 replaced by org.jboss.web.tomcat.tc6.deployers.TomcatDeployer
org.jboss.web.AbstractWebDeployer replaced by
org.jboss.web.deployers.AbstractWarDeployment
org.jboss.web.tomcat.tc6.TomcatDeployer replaced by
org.jboss.web.tomcat.tc6.deployers.TomcatDeployment
In addition, there are metadata deployers that remove the need for these classes to parse any web.xml/jboss-web.xml. org.jboss.deployment.WebAppParsingDeployer translates a web.xml descriptor into a org.jboss.metadata.WebMetaData instance. org.jboss.deployment.JBossWebAppParsingDeployer translates a jboss-web.xml descriptor into the existing org.jboss.metadata.WebMetaData instance. Short term TODOs for metadata processing include:
* Restore integration with the ejb3 annotation processing layer. The org.jboss.web.tomcat.tc6.TomcatInjectionContainer usage is currently commented out as this really should be external to the tomcat deployer. However, to get back to functioning servlet2.5 deployments it needs to be hooked up.
* Update the TomcatInjectionContainer to use the org.jboss.metadata.* classes. The org.jboss.web.metamodel.descriptor.* and org.jboss.metamodel.descriptor.* classes have been merged into the existing org.jboss.metadata.* classes.
Longer term TODOs to properly aspectize the tomcat layer include:
* integrate the annotations into the object model. Adrian is working a common framework for this.
* expand the web.xml parsing to include everything tomcat needs to run off of this rather than reparsing the web.xml.
* create deployers to translate the tomcat server.xml/context.xml.
* Update the TomcatDeployer/TomcatDeployment to run off of this rather than the current jmx stuff.
The deployers are packed up in the server/xxx/deployers/jbossweb-tomcat6.deployer directory:
jbossweb-tomcat6.deployer/ + META-INF/jboss-structure.xml - input into the structural deployment phase to identify the deployment structure context and classpath. + META-INF/war-deployers-beans.xml - an mc bean deployment descriptor that declares the war deployers and injects them into the MainDeployer. This replaces the old jboss-service.xml. + META-INF/webserver-xmbean.xml - currently unused jmx mbean info for the old Tomcat6 mbean. + conf/ + context.xml + server.xml + annotations-api-temp.jar + el-api.jar + jasper-jdt.jar + jbossweb-extras.jar + jbossweb.jar + jboss-web-metamodel.jar - obsolete + jsf-libs/ + jsp-api.jar + jstl.jar + servlet-api.jar + tomcat6-service.jar
An overview of the deployment process.
The relative order of the deployer defines the point at which it runs in the deployment process. The lower the order, the earlier the deployer runs. The relative ordering of the war-deployers-beans.xml deployers is:
org.jboss.deployment.WebAppParsingDeployer (1)
org.jboss.deployment.JBossWebAppParsingDeployer (2)
org.jboss.web.tomcat.tc6.deployers.TomcatDeployer (3)
The WebAppParsingDeployer runs first to parse the WEB-INF/web.xml into a org.jboss.metadata.WebMetaData object graph. It extends the org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer to define the deploymentType to WebMetaData, and implements getObjectModelFactory to return a org.jboss.metadata.web.WebMetaDataObjectFactory instance and, deploy(DeploymentUnit unit) to invoke createMetaData(unit, webXmlPath, null) to trigger the parsing of the web.xml descriptor. The result will be stored in the unit transient managed object attachments under the key "org.jboss.metadata.WebMetaData" with an expected type of WebMetaData.
The JBossWebAppParsingDeployer runs next to parse the WEB-INF/jboss-web.xml into the existing WebMetaData object graph produced by the WebAppParsingDeployer. It extends the org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer to define the deploymentType to WebMetaData, and implements getObjectModelFactory to return a org.jboss.metadata.web.JBossWebMetaDataObjectFactory instance and, deploy(DeploymentUnit unit) to invoke createMetaData(unit, webXmlPath, null) to trigger the parsing of the jboss-web.xml descriptor. The result will be stored in the unit transient managed object attachments under the key "org.jboss.metadata.WebMetaData" with an expected type of WebMetaData.
The TomcatDeployer runs last to translate the WebMetaData instance attached by the WebAppParsingDeployer/JBossWebAppParsingDeployer deployers into a org.jboss.system.metadata.ServiceMetaData instance representing the service mbean of the web application. The web application bean is represented by the org.jboss.web.tomcat.tc6.deployers.TomcatDeployment service bean. This implementation is a bridge between the legacy jmx service oriented deployer and the pure microcontainer bean based deployer. Longer term I expect the TomcatDeployer to be an extension of org.jboss.deployers.plugins.deployers.helpers.AbstractComponentDeployer<WebMetaData, SomeWebComponentMetaData> that translates the web-app WebMetaData into SomeWebComponentMetaData for the servlets, jsp pages, etc., and a new AbstractSimpleRealDeployer will create kernel bean metadata to deploy these components directly to the microcontainer.
See the http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5DeploymentFramework for an overview of the VDF and existing classes/deployers.