nl.toolforge.karma.core.cmd.impl
Class AbstractBuildCommand

java.lang.Object
  extended bynl.toolforge.karma.core.cmd.DefaultCommand
      extended bynl.toolforge.karma.core.cmd.impl.AbstractBuildCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
BuildModule, CleanAll, CleanModule, DocModule, GenerateTestReport, PackageModule, TestModule

public abstract class AbstractBuildCommand
extends DefaultCommand

Superclass for all commands dealing with building modules. This class provides all basic property mappers and methods that are required to use the build-module.xml properly.

Version:
$Id: AbstractBuildCommand.java,v 1.38 2004/11/10 23:53:08 asmedes Exp $
Author:
D.A. Smedes, W.H. Schraal

Field Summary
protected  Module module
           
 
Constructor Summary
AbstractBuildCommand(CommandDescriptor descriptor)
          Creates a command by initializing the command through its CommandDescriptor.
 
Method Summary
 void cleanUp()
          Called by CommandContext after executing a command.
 void execute()
          Executes the command.
 void executeDelete(java.io.File dir)
           
 void executeDelete(java.io.File dir, java.lang.String includes)
          Performs a <delete>-task on this commands' Ant project.
 void executeMkdir(java.io.File dir)
          Performs an <mkdir>-task on this commands' Ant project.
protected  org.apache.tools.ant.Project getAntProject(java.lang.String buildFile)
          Gets an Ant project initializing the project with buildFile which should be located on the classpath in the ant subdirectory.
protected  BuildEnvironment getBuildEnvironment()
          Retrieve the build environment, which is initialized with the current manifest and module.
protected  java.io.File getCompileDirectory()
          Returns the compile directory for a module, relative to the manifests' build directory.
protected  Manifest getCurrentManifest()
          Helper method to retrieve the current manifest.
protected  Module getCurrentModule()
          Helper method to get to the current module.
protected  org.apache.tools.ant.Project getProjectInstance()
          Gets an Ant Project for a module.
 
Methods inherited from class nl.toolforge.karma.core.cmd.DefaultCommand
deregisterCommandResponseListener, getAlias, getCommandLine, getContext, getDescription, getFrontendMessages, getHelp, getName, getResponseListener, getWorkingContext, registerCommandResponseListener, setCommandLine, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.toolforge.karma.core.cmd.Command
getCommandResponse
 

Field Detail

module

protected Module module
Constructor Detail

AbstractBuildCommand

public AbstractBuildCommand(CommandDescriptor descriptor)
Creates a command by initializing the command through its CommandDescriptor.

Parameters:
descriptor - The command descriptor instance containing the basic information for this command
Method Detail

execute

public void execute()
             throws CommandException
Description copied from interface: Command
Executes the command.

Throws:
CommandException - When execution failed. This exception catches all underlying exceptions and rethrows them as a CommandException, except for RuntimeExceptions.

getCurrentManifest

protected final Manifest getCurrentManifest()
Helper method to retrieve the current manifest.

Returns:
The current manifest.

getCurrentModule

protected Module getCurrentModule()
Helper method to get to the current module.

Returns:

getBuildEnvironment

protected BuildEnvironment getBuildEnvironment()
Retrieve the build environment, which is initialized with the current manifest and module.


getCompileDirectory

protected final java.io.File getCompileDirectory()
                                          throws ModuleTypeException
Returns the compile directory for a module, relative to the manifests' build directory.

Returns:
Throws:
ModuleTypeException

getAntProject

protected org.apache.tools.ant.Project getAntProject(java.lang.String buildFile)
                                              throws CommandException
Gets an Ant project initializing the project with buildFile which should be located on the classpath in the ant subdirectory.

Parameters:
buildFile - The build file that should be loaded.
Returns:
An Ant project initialized with buildFile.
Throws:
CommandException

getProjectInstance

protected org.apache.tools.ant.Project getProjectInstance()
                                                   throws CommandException
Gets an Ant Project for a module.

Returns:
Throws:
CommandException

executeMkdir

public void executeMkdir(java.io.File dir)
                  throws CommandException
Performs an <mkdir>-task on this commands' Ant project.

Throws:
CommandException

executeDelete

public void executeDelete(java.io.File dir,
                          java.lang.String includes)
                   throws CommandException
Performs a <delete>-task on this commands' Ant project.

Throws:
CommandException

executeDelete

public void executeDelete(java.io.File dir)
                   throws CommandException
Throws:
CommandException

cleanUp

public final void cleanUp()
Called by CommandContext after executing a command.

Specified by:
cleanUp in interface Command
Overrides:
cleanUp in class DefaultCommand


Copyright © 2002-2004 Toolforge. All Rights Reserved.