org.apache.ddlutils.task
Class Command

java.lang.Object
  extended by org.apache.ddlutils.task.Command
Direct Known Subclasses:
DatabaseCommand, WriteDtdToFileCommand, WriteSchemaToFileCommand

public abstract class Command
extends Object

Base class for commands that work with a model.

Version:
$Revision: 289996 $

Field Summary
protected  org.apache.commons.logging.Log _log
          The log.
 
Constructor Summary
Command()
           
 
Method Summary
abstract  void execute(DatabaseTaskBase task, Database model)
          Executes this command.
protected  void handleException(Exception ex, String msg)
          Handles the given exception according to the fail-on-error setting by either re-throwing it (wrapped in a build exception) or only logging it.
 boolean isFailOnError()
          Determines whether the command execution will be stopped upon an error.
abstract  boolean isRequiringModel()
          Specifies whether this command requires a model, i.e.
 void setFailOnError(boolean failOnError)
          Specifies whether the execution shall stop if an error has occurred during the task runs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected final org.apache.commons.logging.Log _log
The log.

Constructor Detail

Command

public Command()
Method Detail

isFailOnError

public boolean isFailOnError()
Determines whether the command execution will be stopped upon an error. Default value is true.

Returns:
true if the execution stops in case of an error

setFailOnError

public void setFailOnError(boolean failOnError)
Specifies whether the execution shall stop if an error has occurred during the task runs.

Parameters:
failOnError - true if the execution shall stop in case of an error

handleException

protected void handleException(Exception ex,
                               String msg)
                        throws org.apache.tools.ant.BuildException
Handles the given exception according to the fail-on-error setting by either re-throwing it (wrapped in a build exception) or only logging it.

Parameters:
ex - The exception
msg - The message to use unless this the exception is rethrown and it is already a build exception
Throws:
org.apache.tools.ant.BuildException

isRequiringModel

public abstract boolean isRequiringModel()
Specifies whether this command requires a model, i.e. whether the second argument in execute(DatabaseTaskBase, Database) cannot be null.

Returns:
true if this command requires a model

execute

public abstract void execute(DatabaseTaskBase task,
                             Database model)
                      throws org.apache.tools.ant.BuildException
Executes this command.

Parameters:
task - The executing task
model - The database model
Throws:
org.apache.tools.ant.BuildException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.