Add Cargo config file

Description

From mailing-list:

"Hi,

I think it could be interesting for Cargo to have a configuration file. We could have a Factory that reads such a config file and generates a Container object that is setup accordingly. The same can be done for saving an existing configuration.

A typical cargo.xml config file would be:

<cargo>
<containers>
<container id="xxx" key="resin3x"
homeDir="c:/apps/resin-3.0.9</homeDir>"
output="${basedir}/target/resin-cargo.log"
append="false"
log="{basedir}/target/resin-log.log">
<zipUrlInstaller
installUrl="http://www.caucho.com/download/resin-3.0.9.zip"
installDir="${basedir}/target/install"/>
</zipUrlInstaller>
<configuration hint="standalone"
dir="${basedir}/target/resin">
<property name="cargo.servlet.port" value="8280"/>
<property name="cargo.logging" value="high"/>
</configuration>
</container>
</containers>
</cargo>

Note 1:
-------
From Java:
Container[] containers = new CargoFactory().loadCargoConfigurations(File)
Container container = new CargoFactory().loadCargoConfiguration(String id,
File)
new CargoFactory().saveCargoConfiguration(Container, File)

This CargoFactory would sit in the Generic Java API module (see http://cargo.codehaus.org/download/attachments/8416/access-layers.jpg). Note that currently this module is still in the cargo/core/container/ subproject but we would possibly want to separate it one day.

Note 2:
-------
The current <cargo-*> Ant tasks or the future <container> task would accept either a nested configuration or a configurationFile attribute:

<cargo-resin3x... key="resin3x"
homeDir="c:/apps/resin-3.0.9</homeDir>"
output="${basedir}/target/resin-cargo.log"
append="false"
log="{basedir}/target/resin-log.log">
<zipUrlInstaller
installUrl="http://www.caucho.com/download/resin-3.0.9.zip"
installDir="${basedir}/target/install"/>
</zipUrlInstaller>
<configuration hint="standalone"
dir="${basedir}/target/resin">
<property name="cargo.servlet.port" value="8280"/>
<property name="cargo.logging" value="high"/>
</configuration>
</cargo-resin3x>

Or

<cargo-resin3x... configurationFile=".../cargo.xml"/>

Advantages
----------

  • Ability to read and persist configurations. This would be useful for example for the Netbeans plugin where Milos needed a way to do this.

  • Independent way of specifying a Cargo configuration (this can work in the same manner for the Java, Ant or Maven integration). This also leads to more coding sharing between the different integration modules.

  • Scales better than having to specify flat properties. For example the Maven plugin is currently configured in the following manner:

cargo.containers = myResin
cargo.zipUrlInstaller.myResin.installUrl = ...
cargo.zipUrlInstaller.myResin.installDir = ${maven.build.dir}/installs cargo.container.myResin.containerKey = resin3x cargo.container.myResin.homeDir = c:/apps/resin-3.0.9 cargo.container.myResin.config.hint = standalone cargo.container.myResin.config.dir = ${maven.build.dir}/resin cargo.container.myResin.config.standalone.servlet.port = 8280 cargo.container.myResin.config.standalone.logging = high

WDYT?

Thanks
-Vincent
"

Assignee

Vincent Massol

Reporter

Vincent Massol

Components

Affects versions

Priority

Major
Configure