This page last changed on Mar 22, 2006 by vmassol.

Mission

Cargo is a thin wrapper around existing containers (e.g. J2EE containers). It provides different APIs to easily manipulate containers.

Cargo provides the following APIs:

  • A Java API to start/stop/configure Java Containers and deploy modules into them. We also offer Ant tasks, Maven 1, Maven 2, Intellij IDEA and Netbeans plugins.
  • A Java API to parse/create/merge J2EE Modules

Check the utilisation page to understand what you can use Cargo for.

Status

Version status (click in the status column to get release notes):

Version Status Comments
0.1 (/) Released on 11/09/04
0.2 (/) Released on 03/10/04
0.3 (/) Released on 30/10/04
0.4 (/) Released on 26/11/04
0.5 (/) Released on 30/04/05
0.6 (/) Released on 21/07/05
0.7 (/) Released on 30/12/05
0.8 (/) Released on 22/03/06


Documentation for Cargo version in development

The documentation below is for Cargo 0.9 which is the version that we are currently developing (not released yet). The documentation for Cargo 0.8 (latest released version) is available here

Architecture

(view as slideshow)
     
  High level Cargo architecture   Different ways of using Cargo
 


Cargo offers differents ways of using it at different levels:

  • Module Java API: A Java API to parse/create/merge J2EE Modules (WAR, EAR, etc)
  • Container Java API: A Java API to start/stop/configure Java Containers and deploy modules into them.
  • Generic Java API: A Java API that sits on top of the Container API but allows writing generic code that works with any container. It consists mostly in a set of Factory classes to instantiate Container API objects by name.
  • Build plugins
    • Ant tasks: A set of Ant tasks that wrap the Generic Java API
    • Maven 1: A Maven 1 plugin that wraps the Ant tasks
    • Maven 2: A Maven 2 plugin
  • IDE plugins

The main Container API objects are:

  • The Container is the top level interface wrapping a real physical container. Cargo supports local and remote containers. A Container is composed of a Configuration.
  • A Configuration tells Cargo how the container is to be configured (whether it should create a standalone setup, whether it should be based on an existing configuration, etc). A Configuration can be configured to install Deployables before the Container is started.
  • You can use a Deployer to hot-deploy Deployables (i.e. after the Container is started).
  • Deployables are archives to be deployed in the Container. They are WAR, EAR, EJBs, etc.

Feature list

Some top-level features (the full feature list can be found here):

  • ConfigurationA Configuration specifies how the container is configured
  • ContainerA top level interface wrapping a real physical container
  • DebuggingExplain how to perform debugging when something doesn't work in Cargo
  • DeploymentHow to deploy components to a container
  • ExtensionsExtensions are additions to the Cargo core Java API such as build tool plugins, IDE plugins, etc
  • Module APIAPI to manipulate J2EE archives, including vendor-specific deployment descriptors

Container support

List of supported containers and the extensions that are implemented for each container (Java API, Ant tasks and Maven plugins). The specified version is the Cargo version where the feature was first made available. Click on a container's name to see a detailed list of features it supports.

Container Java API(version) Ant tasks(version) Maven 1 plugin(version) Maven 2 plugin(version)
Geronimo 1.x 0.8 0.8 0.8 0.8
JBoss 3.x 0.7 0.7 0.7 0.1
JBoss 4.x 0.7 0.7 0.7 0.1
Jetty 4.x 0.1 ??? ??? 0.8
Jetty 5.x 0.8 ??? ??? 0.8
Jetty 6.x 0.8 ??? ??? 0.8
jo! 1.x 0.5 0.5 0.5 0.1
OC4J 9.x 0.3 0.3 0.5 0.1
Orion 1.x 0.1 0.1 0.5 0.1
Orion 2.x 0.1 0.1 0.5 0.1
Resin 2.x 0.1 0.1 0.5 0.1
Resin 3.x 0.1 0.1 0.5 0.1
Tomcat 3.x 0.1 0.1 0.5 0.1
Tomcat 4.x 0.1 0.1 0.5 0.1
Tomcat 5.x 0.1 0.1 0.5 0.1
WebLogic 8.x 0.3 0.3 0.5 0.1


We also encourage you to report success and failures on different versions of those containers in the Tested on section.

Quick Start

The following examples demonstrate how to configure Resin 3.0.15 to start in target/resin3x and deploy a WAR located in path/to/simple.war. The default port is 8080. Please note that the container.start() and container.stop() methods wait until the container is fully started and fully stopped before continuing. Thus, for any action you are executing after, you are assured the container is completely operational.

Static deployment

Static deployment means that the Deployable is deployed before the container is started. Here's an example using the strongly typed Java API:

Deployable war = new WAR("path/to/simple.war");

LocalConfiguration configuration =
    new Resin3xStandaloneLocalConfiguration(new File("target/myresin3x"));
configuration.addDeployable(war);

InstalledLocalContainer container =
    new Resin3xInstalledLocalContainer(configuration);
container.setHome(new File("c:/apps/resin-3.0.18"));

container.start();
// Here you are assured the container is started.

container.stop();
// Here you are assured the container is stopped.

Here's the same example using the generic untyped API (which we recommend as it leads to more generic code):

Deployable war = new DefaultDeployableFactory().createDeployable(
    "resin3x", "path/to/simple.war", DeployableType.WAR);

ConfigurationFactory configurationFactory =
    new DefaultConfigurationFactory();
LocalConfiguration configuration =
    (LocalConfiguration) configurationFactory.createConfiguration(
        "resin3x", ConfigurationType.STANDALONE);
configuration.addDeployable(war);

InstalledLocalContainer container =
    (InstalledLocalContainer) new DefaultContainerFactory().createContainer(
        "resin3x", ContainerType.INSTALLED, configuration);
container.setHome(new File("c:/apps/resin-3.0.18"));

container.start();
// Here you are assured the container is started.

container.stop();
// Here you are assured the container is stopped.

Hot deployment

Hot deployment means that the Deployable is deployed after the container is started.

InstalledLocalContainer container = new Resin3xInstalledLocalContainer(
    new Resin3xStandaloneLocalConfiguration(
        new File("target/myresin3x")));
container.setHome(new File("c:/apps/resin-3.0.18"));

container.start();

// Here you are assured the container is started.

Deployable war = new WAR("path/to/simple.war");
Deployer deployer = new ResinDeployer(container);
deployer.deploy(war);

// Here you are NOT sure the WAR has finished deploying. To be sure you
// need to use a DeployableMonitor to monitor the deployment. For example
// the following code deploys the WAR and wait until it is available to
// serve requests (the URL should point to a resource inside your WAR):
deployer.deploy(war, new URLDeployableMonitor(
    new URL("http://server:port/some/url")));

container.stop();

// Here you are assured the container is stopped.

architecture.jpg (image/jpeg)
architecture.jpg (image/jpeg)
access-layers.jpg (image/jpeg)
access-layers.jpg (image/jpeg)
access-layers.jpg (image/jpeg)
Document generated by Confluence on Mar 22, 2006 15:28