RbUtils 0.13

org.ktc.rbutils.rb
Interface Utility

All Known Subinterfaces:
CheckerUtility, GeneratorUtility
All Known Implementing Classes:
AbstractUtility, RbCheckerUtility, RbContentListerUtility, RbGeneratorUtility

public interface Utility

Base interface for RbUtils command line utilities.

Since:
RbUtils 0.9.3.3
Version:
$Revision: 1.1 $
Author:
moishi

Method Summary
 String getExtension()
          Parses the arguments of this utility in order to get the extension of properties files to be used by this utility.
 List getFilesToBeProcessed()
          Returns a list of properties files to be processed (-f option).
 Collection getLoggers()
          Parses the arguments of this utility in order to get the loggers to be used by this utility.
 File getRootDir()
          Parses the arguments of this utility in order to get the root directory to be used by this utility.
 void parse(Exception exception, PrintWriter pw)
          Parses an Exception and provides a user readable messages which is printed in the PrintWriter.
 void parseParameters()
          Parses the internalArgs field according to the options field.
 void usage()
          Prints the usage information of this utility in the Standard Output.
 void usage(PrintWriter pw)
          Prints the usage information of this utility.
 

Method Detail

parseParameters

void parseParameters()
                     throws ParseException
Parses the internalArgs field according to the options field.

Throws:
ParseException - if an error occurs during parsing.

getRootDir

File getRootDir()
                throws RbUtilsException,
                       FileNotFoundException
Parses the arguments of this utility in order to get the root directory to be used by this utility.
This method must store the returned value in an instance field in order the getFilesToBeProcessed() works.

The parseParameters() method MUST have been previously called.

Returns:
the root directory.
Throws:
RbUtilsException - if more than one -r option is specified.
FileNotFoundException - if the -r option specifies a directory that does not exist in the file system.
NotDirectoryException - if the -r value specifies a file in the file system instead of a directory.

getFilesToBeProcessed

List getFilesToBeProcessed()
                           throws FileNotFoundException
Returns a list of properties files to be processed (-f option).

NOTE: The parseParameters() and getRootDir() methods must have been called before the call of this method.

Returns:
the files to be processed.
Throws:
FileNotFoundException - if a provided file does not exist in the file system.
NotFileException - if the -r value specifies a directory in the file system instead of a file.

getLoggers

Collection getLoggers()
                      throws UnSpecifiedFileException,
                             IOException
Parses the arguments of this utility in order to get the loggers to be used by this utility.

Returns:
the Collection of loggers. This will be empty if no loggers are specified.
Throws:
UnSpecifiedFileException - if a Logger to be created requires a logging file and loggingFile is null
IOException - if an error occurs on file logger initialization.

getExtension

String getExtension()
                    throws RbUtilsException
Parses the arguments of this utility in order to get the extension of properties files to be used by this utility.

The parseParameters() method MUST have been previously called.

Returns:
the extension.
Throws:
RbUtilsException - if more than one -e option is specified.

usage

void usage()
Prints the usage information of this utility in the Standard Output.


usage

void usage(PrintWriter pw)
Prints the usage information of this utility. The Writer will be flushed at the end of this method but won't be closed.

Parameters:
pw - the Writer where the information will be print.

parse

void parse(Exception exception,
           PrintWriter pw)
Parses an Exception and provides a user readable messages which is printed in the PrintWriter. The usage of the provided utility is also printed.

The Writer is not closed by this method.

Parameters:
exception - the Exception to be parsed.
pw - the Writer where the message is printed.

Back to the RbUtils Home Page

Copyright © 2005-2009 RbUtils Project. All Rights Reserved.