This page last changed on Apr 25, 2005 by vmassol.

Definition

Deployables are archives (WAR, EAR, etc) that can be deployed in the container

Explanation

A Deployable class is a wrapper class around a physical archive. Deployable are constructed using a DeployableFactory provided by your container. The reason for this factory is to support container extensions to archives (for example, Tomcat supports context.xml files located in your WAR's META-INF directory, JBoss allows for a jboss-web.xml located in your WAR, etc). You can of course directly instantiate a Deployable implementation (WAR, EAR, ec) but then you won't benefit from container extension support.

The DeployableFactory interface offers different methods for creating Deployable (e.g. DeployableFactory.createEAR(String), DeployableFactory.createWAR(String), etc).

Once you have a Deployable instance wrapping your archive, you'll need to deploy it. This can be done either using Static Deployment or using Hot Deployment.

Example using the Java API

Deploying a WAR in Tomcat 5.x:
Container container = new Tomcat5xContainer();
container.setHomeDir("c:/apps/tomcat-5.0.29");

DeployableFactory factory = container.getDeployableFactory();
WAR war = factory.createWAR("path/to/my.war");

[...]

Example using the Ant API

Statically deploying a WAR in Tomcat 5.x:
<cargo-tomcat5x homeDir="c:/apps/tomcat-5.0.29" action="start">
  <configuration>
    <war warfile="path/to/my.war"/>
  </configuration>
</cargo-tomcat5x>

Note: In the future there will be an Ant task to support Hot Deployment.

Document generated by Confluence on Apr 30, 2005 12:52