Before you start you might be interested in reading the Project Structure tutorial which shows the directory organization of the Cargo sources. The Building tutorial explains how to build Cargo from sources and the Contributing tutorial explains what rules to follow when contributing code.
Here are some quick steps to follow if you wish to add support for a new container in Cargo:
- Subscribe to the cargo dev mailing list and ask as many question you'd like there!
- Create a JIRA issue on httphttps://jira.codehaus.org (you'll need to register). I'll then add you to the cargo-developers group in JIRA and assign the issue to you-cargo.atlassian.net/browse/CARGO
- Checkout Cargo from SVN Source code trunk
- Understand the Cargo project's directory structure. Container implementations are located in
trunk/core/containers/ContainerName
. - Have a look at existing container implementations (search for example for
Resin3xLocalContainer
orOrion2xLocalContainer
).Create aorg.codehaus.cargo.container.containerName
package if it doesn't already exist. This package must be located in thetrunk/core/api/container
project (Note: we are in the process of moving container implementations to their own project and in the future you'll create that package intrunk/core/containers/containerName
- Some containers are simple to read and understand; for example jo or glassfish
- Some other containers are much more feature-complete (remote deployers, datasources, etc.); for example tomcat or jonas.
- Create your container's Maven module, with its package inside.
- Create the following classes:Add your container to the tests in
trunk/samples/java
. This means editing the*Test.java
classes and adding your container in thesuite()
method- A container implementation class named
_ServerNameNxContainerType_Container
whereServerName
is the name of the container,N
Nx
the version andContainerType
the type of container (LocalInstalledLocal
orRemote
). For example:JBoss3xLocalContainer
. - A One or several configuration implementation class classes named
_ServerNameConfigurationType_Configuration
whereConfigurationType
can beStandaloneLocal
,ExistingLocal
orExistingLocal
Runtime
. For exampleJBossStandaloneLocalConfiguration
.You may need to implement some ancillary classes but those are the main 2 required. Check how the other container are implemented to see how to implement them and what other classes you may need to implement - One or several deployer implementation classes named
_ServerNameDeployerType_Deployer
whereDeployerType
can beInstalledLocal
orRemote
. For example:JBossInstalledLocalDeployer
.- Cargo has an SPI that you should use and that should make it easy for you. Your container class should extend
org.codehaus.cargo.container.spi.Abstract_ContainerType_Container
and your configuration class should extendorg.codehaus.cargo.container.spi.configuration.Abstract_ConfigurationType_Configuration
.
- Cargo has an SPI that you should use and that should make it easy for you. Your container class should extend
- A container implementation class named
- Register your new classes in the generic API in the Factory classes
trunk/core/api/generic
so that users can use your new container by using the generic API. - Finally, implement the
FactoryRegistry
that will register your container to Codehaus Cargo and make sure you've defined a link to your container's factory registry insrc/main/resources/META-INF/services/org.codehaus.cargo.generic.AbstractFactoryRegistry
.
- Finally, implement the
- Run the Cargo build to ensure everything is working. You'll probably find that you haven't followed the Cargo project's coding conventions... Fix those and build again until it passes! Please note that when you run the build it'll automatically run the samples test suites in your container (provided you've added your container to the generic API as described in the previous step and provided you've defined the right capabilities for your container). See the Building page for more details on the build.
- Register on Codehaus' confluenceOnce built, add your new container to the
uberpom
and check that theuberjar
is still looking fine. - Once added to the
uberpom
, add your container's download URL to thesamples
and add profiles for it.- As soon as you add your container to the
samples
, the Maven build will automatically attempt to configure, start, deploy some test applications, test them and stop your container.
- As soon as you add your container to the
- Register on Codehaus Cargo Confluence. Once this is done Iwe'll add you to the
cargo-developers
user group so that you have the right to edit yourself the Cargo web site pages - Document the new container on the Cargo web site
- Create a SVN patch and attach it to the JIRA issue you have created above.
- Create a pull request on Github, referencing your JIRA.
- Once the pull request has been accepted:
- Add the container to the Containers list on the main web site
- Add the container to the Navigation page (left side of the Codehaus Cargo Web site)
- Add the container to the Downloads page
- Add the container to the Continous Integration (via the
.semaphore/semaphore.yml
file) so that its integrity can be checked at each build
Thanks and happy coding!