net.chaosserver.bilbo.task.convert
Class ConvertTask

java.lang.Object
  |
  +--net.chaosserver.bilbo.task.BaseTask
        |
        +--net.chaosserver.bilbo.task.RecursiveTask
              |
              +--net.chaosserver.bilbo.task.RootFirstRecursiveTask
                    |
                    +--net.chaosserver.bilbo.task.convert.ConvertTask
All Implemented Interfaces:
Task

public class ConvertTask
extends RootFirstRecursiveTask

Tasked used to convert between two different mappings.

Since:
Bilbo 2.0

Field Summary
protected  int errorLevel
          Holds the error level.
protected  String fromStyle
          Holds the mapping style files start in.
protected  String toStyle
          Holds the mapping style files end in.
 
Fields inherited from class net.chaosserver.bilbo.task.BaseTask
settings
 
Constructor Summary
ConvertTask()
           
 
Method Summary
 void execute(File currentDirectory)
          Swaps the files in the directory.
protected  int getErrorLevel()
          Getter for the errorLevel property.
protected  String getFromStyle()
          Getter for the fromStyle property.
protected  String getToStyle()
          Getter for the toStyle property.
protected  void parseFlags(String flags)
          Parses the task specific flags.
 void parseTaskArguments(String argumentString)
          Parses the input argument string.
protected  void setErrorLevel(int errorLevel)
          Setter for the errorLevel property.
protected  void setFromStyle(String fromStyle)
          Setter for the fromStyle property.
protected  void setToStyle(String toStyle)
          Setter for the toStyle property.
 
Methods inherited from class net.chaosserver.bilbo.task.RootFirstRecursiveTask
executeRecursive
 
Methods inherited from class net.chaosserver.bilbo.task.RecursiveTask
executeSpecific, isRootDirectory
 
Methods inherited from class net.chaosserver.bilbo.task.BaseTask
execute, getHelpResource, getSettings, printHelp, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fromStyle

protected String fromStyle
Holds the mapping style files start in.


toStyle

protected String toStyle
Holds the mapping style files end in.


errorLevel

protected int errorLevel
Holds the error level.

Constructor Detail

ConvertTask

public ConvertTask()
Method Detail

setFromStyle

protected void setFromStyle(String fromStyle)
Setter for the fromStyle property.

Parameters:
fromStyle - the fromStyle property

getFromStyle

protected String getFromStyle()
Getter for the fromStyle property.

Returns:
the fromStyle property

setToStyle

protected void setToStyle(String toStyle)
Setter for the toStyle property.

Parameters:
toStyle - the toStyle property

getToStyle

protected String getToStyle()
Getter for the toStyle property.

Returns:
the toStyle property

setErrorLevel

protected void setErrorLevel(int errorLevel)
Setter for the errorLevel property.

Parameters:
errorLevel - the errorLevel property

getErrorLevel

protected int getErrorLevel()
Getter for the errorLevel property.

Returns:
the errorLevel property

parseTaskArguments

public void parseTaskArguments(String argumentString)
                        throws BadTaskCommandArgumentsException
Parses the input argument string. Style should look like [-e#] fromStyle toStyle

Specified by:
parseTaskArguments in interface Task
Overrides:
parseTaskArguments in class BaseTask
Parameters:
argumentString - the string to parse
Throws:
BadTaskCommandArgumentsException - indicates a bad argument string was given

parseFlags

protected void parseFlags(String flags)
Parses the task specific flags.

Parameters:
flags - the task specific flags

execute

public void execute(File currentDirectory)
             throws ConvertException
Swaps the files in the directory.
  1. File the file name in the directory by fromStyle
  2. Rename the file in the directory to the toStyle

Specified by:
execute in class RecursiveTask
Parameters:
currentDirectory - the directory to execute against
Throws:
ConvertException - if something goes wrong


Copyright © 20030415