This content has been marked as final.
Show 3 replies
-
1. Re: syntax for specifying dependencies?
adrian.brock Feb 21, 2008 11:14 AM (in response to jhalliday)Ask in the Tomcat forum, there's no such feature AFAIK.
You should be able to depend upon the mbean that represents the war though (which will
be less fine-grained than what you want).
http://wiki.jboss.org/wiki/Wiki.jsp?page=MyDependencyDoesntWork -
2. Re: syntax for specifying dependencies?
jhalliday Feb 21, 2008 11:23 AM (in response to jhalliday)Thanks Adrian. As it happens the .war is fairly small and won't take long to deploy, so depending on it probably is not too much of a kludge.
-
3. Re: syntax for specifying dependencies?
alesj Feb 21, 2008 2:53 PM (in response to jhalliday)Check org.jboss.web.deployers.AbstractWarDeployer for the mbean Adrian mentioned.
protected void deployWebModule(VFSDeploymentUnit unit, JBossWebMetaData metaData, AbstractWarDeployment deployment) throws Exception { log.debug("deployWebModule: " + unit.getName()); try { ServiceMetaData webModule = new ServiceMetaData(); String name = getObjectName(metaData); ObjectName objectName = new ObjectName(name); webModule.setObjectName(objectName); webModule.setCode(WebModule.class.getName()); // WebModule(DeploymentUnit, AbstractWarDeployer, AbstractWarDeployment) ServiceConstructorMetaData constructor = new ServiceConstructorMetaData(); constructor.setSignature(new String[] { VFSDeploymentUnit.class.getName(), AbstractWarDeployer.class.getName(), AbstractWarDeployment.class.getName()}); constructor.setParameters(new Object[] {unit, this, deployment}); webModule.setConstructor(constructor); // Dependencies...Still have old jmx names here Collection<String> depends = metaData.getDepends(); List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>(); if (depends != null && depends.isEmpty() == false) { if (log.isTraceEnabled()) log.trace(name + " has dependencies: " + depends); for(String iDependOn : depends) { ServiceDependencyMetaData sdmd = new ServiceDependencyMetaData(); sdmd.setIDependOn(iDependOn); dependencies.add(sdmd); } } webModule.setDependencies(dependencies); // Here's where a bit of magic happens. By attaching the ServiceMetaData // to the deployment, we now make the deployment "relevant" to // deployers that use ServiceMetaData as an input (e.g. the // org.jboss.system.deployers.ServiceDeployer). Those deployers // can now take over deploying the web module. // TODO could create multiple components for the deployment // The ServiceConstructorMetaData is not serializable due to its args unit.addAttachment(ServiceMetaData.class, webModule); } catch (Exception e) { throw DeploymentException.rethrowAsDeploymentException("Error creating rar deployment " + unit.getName(), e); } } /** * Get the object name of the ServiceMetaData instance associated with * the WebMetaData. This uses the pattern: * "jboss.web.deployment:war="+metaData.getContextRoot() * * @param metaData - the web app metaData * @return "jboss.web.deployment:war="+metaData.getContextRoot(); */ protected String getObjectName(JBossWebMetaData metaData) { String ctxPath = metaData.getContextRoot(); // The ctx path value cannot be empty in the object name if( ctxPath == null || ctxPath.length() == 0 ) ctxPath = "/"; String objectName = "jboss.web.deployment:war="+ctxPath; return objectName; }