The PReP class reads arguments from the commandline which are either tags and
values or input files and an output file and stores them into a TagList, compiles
it and outputs the result in the PrintWriter. It contains the main method.
To create a subclass, it is important to know, if you need a database connection. You
may specify it in the setDBConnection() where you also can specify how many connections
you want. For this is the commandline version, you may want only one connection, because
you can only use one. This is actually more important for the servlet version.
Constructor:
public PReP(String[] strArgs)
Checks whether there are some arguments. If there are none, a help text will
be printed. It creates a PRePHandler and uses it as an interface to the methods
The constructor processes the arguments.
Methods:
protected PRePHandler provideHandler()
Returns a new PRePHandler with a security int of 0
protected void fillSpecialArgs(Arguments arguments)
Puts special arguments to a list (for example "DB")
protected void setDBConnection()
This may be overwritten in a subclass. The PRePHandler will take the default
values for the database.
public void handleNormalArg(Argument argument, Arguments arguments)
This method handles all normal tags in the argument array (-tagname tagvalue)
public void handleSpecialArg(Argument argument, Arguments arguments)
This argument must be a filename because it is not a minus argument (like -tagname)
nor a name value pair. So it just calls the handleFileArg(arguments, argument) method.
public boolean handleArgInList(int iKey, Arguments args)
Gets the argument with the specified key out of the list and handles special. It returns
a boolean, if the argument was handled or not.
protected void handleFileArg(Arguments arguments, Argument argument)
It checks whether the output file was already handled. If not, the last argument (which
has to be the output file) is handled first. Then the putFile(prepMain, file) method of
the PRePHandler is called.
protected void handleOutputFileArg(Arguments arguments)
This handles the last argument which has to be the output file. The printWriter will
be set.
protected void handleDBTag(Arguments args)
As soon as the DB tag appears, the database setting will be set with the setDatabaseConnection(JDBCDriver,
URL, DBUSER, DBPWD) method of PRePHandler.
protected void printHelp()
Prints a help text. This method will be called if no arguments where defined.
public static void main(String argv[])
Constructor of PReP.