proper.app
Class Application

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.core.ArgumentObject
          extended by proper.app.Application
All Implemented Interfaces:
CommandLineInterface, ProperInterface, XMLAccessInterface
Direct Known Subclasses:
ArffComparer, ArffFilter, Classifier, DatabaseApplication, Experimenter, JobAdder, Jobs, Server, Standalone, Tester

public abstract class Application
extends ArgumentObject
implements CommandLineInterface, XMLAccessInterface

This class functions as a Ancestor for all classes that are called from commandline with parameters.
For a complete list of commandline parameters just run it with the option "-help".

Version:
$Revision: 1.3 $
Author:
FracPete

Field Summary
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
Application()
          initializes the object
 
Method Summary
 void checkCommandLine()
          checks whether all necessary parameters are provided
static Application createInstance(java.lang.String classname)
          creates a new instance from the given classname
 void fromXML(Element node)
          reads all the data stored in the children of the given node (= container).
 void parameterError()
          prints the usage if not all necessary parameters were provided
 void printDescription()
          prints a short description of this class
 void printUsage()
          prints the usage of the application, with all necessary parameters
 boolean run()
          runs the application with previously set arguments
 boolean run(java.lang.String[] args)
          processes the commandline parameters and runs the application
 void setArgs(CommandLine cl)
          sets the arguments from the given CommandLine object
 void setArgs(java.lang.String[] args)
          sets the arguments to use with the run() method
 java.lang.String toString()
          outputs the current parameters
 Element toXML()
          returns the content in an XML structure, where the actual data is stored in the children of the returned Element, i.e.
 
Methods inherited from class proper.core.ArgumentObject
fixAdditionalArg
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Application

public Application()
initializes the object

Method Detail

createInstance

public static Application createInstance(java.lang.String classname)
creates a new instance from the given classname


checkCommandLine

public void checkCommandLine()
checks whether all necessary parameters are provided

Specified by:
checkCommandLine in interface CommandLineInterface

parameterError

public void parameterError()
prints the usage if not all necessary parameters were provided

Specified by:
parameterError in interface CommandLineInterface

printDescription

public void printDescription()
prints a short description of this class

Specified by:
printDescription in interface CommandLineInterface

printUsage

public void printUsage()
prints the usage of the application, with all necessary parameters

Specified by:
printUsage in interface CommandLineInterface

setArgs

public void setArgs(java.lang.String[] args)
sets the arguments to use with the run() method

Parameters:
args - the arguments to use
See Also:
run()

setArgs

public void setArgs(CommandLine cl)
sets the arguments from the given CommandLine object

Specified by:
setArgs in interface CommandLineInterface
Parameters:
cl - the commandline object containing the parameters

run

public boolean run()
            throws java.lang.Exception
runs the application with previously set arguments

Throws:
java.lang.Exception
See Also:
setArgs(String[])

run

public boolean run(java.lang.String[] args)
            throws java.lang.Exception
processes the commandline parameters and runs the application

Specified by:
run in interface CommandLineInterface
Returns:
returns TRUE if successful run
Throws:
java.lang.Exception

toString

public java.lang.String toString()
outputs the current parameters

Overrides:
toString in class ProperObject

toXML

public Element toXML()
returns the content in an XML structure, where the actual data is stored in the children of the returned Element, i.e. the returned node acts only as a container. The contents of the container are the command line parameters currently used and the outer tag is the Java-tag used in ANT.

Specified by:
toXML in interface XMLAccessInterface
Returns:
the Element containing the data in its children
See Also:
CommandLine.toXML()

fromXML

public void fromXML(Element node)
reads all the data stored in the children of the given node (= container). The content of the container must be nodes like used in the CommandLine.fromXML() method

Specified by:
fromXML in interface XMLAccessInterface
Parameters:
node - the Element node containing the data in its children
See Also:
CommandLine.fromXML(Element)