Class DBPorter

java.lang.Object
  extended byDBPorter

public class DBPorter
extends Object

This class provides methods for retrieving and submitting data to and from the database-backed account server. This class can export data out of the database into the LocalAcctMgr-format accounts file, and it can import data into the database given the LocalAcctMgr-format accounts file. TODO: DO THIS FOR EVERY DRINK CLASS: ALL ERRORS SHOULD GO TO SYSTEM.ERR. TODO: Command line option to purge/not purge the database.

Version:
$Revision: #4 $
Author:
Kevin Thompson [antiduh@csh.rit.edu]

Nested Class Summary
static class DBPorter.SysoutLogger
          TODO: Make this its own class.
 
Field Summary
static int ACT_EXPORT
          Indicates that the command line parser has found the action to be exporting.
static int ACT_IMPORT
          Indicates that the command line parser has found the action to be importing.
static int ACT_NOTYET
          Indicates that the command line parser has not yet found the action.
 
Constructor Summary
DBPorter()
           
 
Method Summary
static void main(String[] args)
          Reads in the command line arguments, processes them, creates the appopriate backend, and then starts the port process.
static void showWarning()
          Prints a warning and waits for a reply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACT_NOTYET

public static final int ACT_NOTYET
Indicates that the command line parser has not yet found the action.

See Also:
Constant Field Values

ACT_EXPORT

public static final int ACT_EXPORT
Indicates that the command line parser has found the action to be exporting.

See Also:
Constant Field Values

ACT_IMPORT

public static final int ACT_IMPORT
Indicates that the command line parser has found the action to be importing.

See Also:
Constant Field Values
Constructor Detail

DBPorter

public DBPorter()
Method Detail

main

public static void main(String[] args)
Reads in the command line arguments, processes them, creates the appopriate backend, and then starts the port process.
Command line argument options:
-host [host] The host address of the database to connect to.
-db [database] The name of the database to get the data from.
-user [user] The username for the database login.
-pass [pass] The password of the database login.
-export [file] Exports data out of the database and into the file.
-import [file] Imports data into the database from the file.
All command line arguments are required. -export and -import are mutually exclusive. If '-' is supplied for the accounts file, then the standard input or output will be used.

Parameters:
args - The command-line arguements.

showWarning

public static void showWarning()
Prints a warning and waits for a reply.