Excalibur Fortress - CLI Applications

Command Line Tools"

Command Line Tools are the class of tools or applications that are run from a command shell. Typical examples are the ANT build tool, Turbine Maven, Apache Forrest, etc. They have a definite begining and a definite end. As a result, we don't have to do any trickery with threads or synchronizing the startup and shutdown of the container.

A typical example of creating a Fortress CLI application will follow the pattern outlined below:

        
public int main(String [] args)
{
    // You would have to implement the referenced method here...
    FortressConfig config = configWithArgs( args );
    ContainerManager cm = new DefaultContainerManager( config.getContext() );
    ContainerUtil.initialize( cm );

    // Get the root container and use it
    MyCLIContainer container = (MyCLIContainer) cm.getContainer();
    container.performAction(args);

    // Clean up after ourselves
    ContainerUtil.dispose( cm );
}
        
      

As you can see, there are three major portions of working with Fortress: startup, useage, and shutdown; The Startup and shutdown portions are not likely to change at all. What will change is how you plan on interacting with your container.

by The Avalon Documentation Team