de.uni_paderborn.fujaba.basic
Class CommandLineParser

java.lang.Object
  extended byde.uni_paderborn.fujaba.basic.CommandLineParser

public class CommandLineParser
extends java.lang.Object

The class CommandLineParser checks the provided parameter for wildcards and substitutes them with complete filepaths. It handles wildcards with following filetypes as '*.java' and filenames with wildcards in the file extension like 'a.*'. !!! This case will be interpretet as 'a*.*' for now.!!! It contains two inner classes that define FilenameFilters. !!! Maybe this parsing is not necessary under other command line interpreters than LINUX/UNIX !!!

Version:
$Revision: 1.19 $
Author:
$Author: schneider $

Field Summary
static int COMMAND_LINE
          Constant indicating that the provided line is command line
static int EMPTY_COMMANDLINE
          Constant indicating that the provided String is empty (no job to do)
static int NO_COMMAND
          Constant indicating that the expression contains no command
static int NO_ERROR
          Constant indicating no error occured during parsing
static int PATH_LIST
          Constant indicating that the provided line is a list of pathes seperated by path.seperator
static int PATH_NOT_EXISTS
          Constant indicating that a provided pathname is not valid
static int WRONG_EXPRESSION
          Constant indicating a wrong wildcard expression was found (like Elevator*)
 
Constructor Summary
CommandLineParser(java.lang.String line)
          Constructor for CommandLineParser.
CommandLineParser(java.lang.String line, java.lang.String selection, int type)
          Constructor for class CommandLineParser
 
Method Summary
 java.lang.String getCommandLine()
          Returns the last parsed commandLine.
 int getErrorState()
          Returns the last error
 java.io.File[] getFileArray()
          Returns an array of File objects with all matching files
 java.util.Vector getFileVector()
          Returns a vector of File objects with all matching files
 void parseLine(java.lang.String line)
          The provided String will be examined for wildcards.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_LINE

public static int COMMAND_LINE
Constant indicating that the provided line is command line


PATH_LIST

public static int PATH_LIST
Constant indicating that the provided line is a list of pathes seperated by path.seperator


NO_ERROR

public static final int NO_ERROR
Constant indicating no error occured during parsing

See Also:
Constant Field Values

WRONG_EXPRESSION

public static final int WRONG_EXPRESSION
Constant indicating a wrong wildcard expression was found (like Elevator*)

See Also:
Constant Field Values

NO_COMMAND

public static final int NO_COMMAND
Constant indicating that the expression contains no command

See Also:
Constant Field Values

EMPTY_COMMANDLINE

public static final int EMPTY_COMMANDLINE
Constant indicating that the provided String is empty (no job to do)

See Also:
Constant Field Values

PATH_NOT_EXISTS

public static final int PATH_NOT_EXISTS
Constant indicating that a provided pathname is not valid

See Also:
Constant Field Values
Constructor Detail

CommandLineParser

public CommandLineParser(java.lang.String line)
Constructor for CommandLineParser. Calls parseLine with the provided String.

Parameters:
line - The String to be parsed for wildcards.
Throws:
IllegalArgumentException, - if a invalid wildcard expression is found in the provided String

CommandLineParser

public CommandLineParser(java.lang.String line,
                         java.lang.String selection,
                         int type)
Constructor for class CommandLineParser

Parameters:
line - No description provided
selection - No description provided
type - No description provided
Method Detail

getCommandLine

public java.lang.String getCommandLine()
Returns the last parsed commandLine.

Returns:
The commandLine value

getFileVector

public java.util.Vector getFileVector()
Returns a vector of File objects with all matching files

Returns:
The fileVector value

getFileArray

public java.io.File[] getFileArray()
Returns an array of File objects with all matching files

Returns:
The fileArray value

getErrorState

public int getErrorState()
Returns the last error

Returns:
The errorState value

parseLine

public void parseLine(java.lang.String line)
The provided String will be examined for wildcards. All wildcards found will be substituted with the complete path/filenames for the matching files. If no path is specified, parseLine uses UMLProject.getRootDir(). All other parts of the provided String will be copied.

Parameters:
line - The String to be parsed for wildcards.
Throws:
IllegalArgumentException, - if a invalid wildcard expression is found in the provided String