org.marketcetera.orderloader
Class Main

java.lang.Object
  extended by org.marketcetera.orderloader.Main

public class Main
extends Object

The entry point for running the order loader as an application

Since:
1.0.0
Version:
$Id: Main.java 16154 2012-07-14 16:34:05Z colin $
Author:
anshul@marketcetera.com

Constructor Summary
Main()
           
 
Method Summary
protected  OrderProcessor createProcessor(ClientParameters inParameters)
          Creates a processor given the parameters.
protected  void displaySummary(OrderLoader inLoader)
          Displays the summary of results after the order loader is done processing.
protected  void doProcessing()
          Reads the orders from the supplied and sends them to the server.
protected  void exit(int inCode)
          Exits the current process with the supplied exit code.
protected  String getExceptionMsg(Exception inException)
          Gets the exception message from the supplied exception.
static void main(String[] inArgs)
          Runs the order loader given the array of command line arguments.
protected  void printError(Exception inException)
          Prints the supplied exception's message to the output.
protected  void printMessage(String inMessage)
          Prints the message to the output.
protected  boolean processArguments(String[] inArgs)
          Processes the supplied command line options and configures the order loader to run per the options.
protected  void setMsgStream(PrintStream inMsgStream)
          Sets the stream on which all the messages should be printed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String[] inArgs)
Runs the order loader given the array of command line arguments.

Parameters:
inArgs - the arguments to the order loader.

setMsgStream

protected void setMsgStream(PrintStream inMsgStream)
Sets the stream on which all the messages should be printed.

Parameters:
inMsgStream - the message stream on which all the messages should be printed.

processArguments

protected boolean processArguments(String[] inArgs)
Processes the supplied command line options and configures the order loader to run per the options.

Parameters:
inArgs - the command line arguments.
Returns:
true if the argument processing succeeded, false if it did not. Do note the return value only matters for unit testing. When used by the user, if there's an error, this method will never return, it will exit the process.

exit

protected void exit(int inCode)
Exits the current process with the supplied exit code.

Parameters:
inCode - the exit code for the process.

doProcessing

protected void doProcessing()
                     throws Exception
Reads the orders from the supplied and sends them to the server.

Throws:
Exception - if there were errors.

createProcessor

protected OrderProcessor createProcessor(ClientParameters inParameters)
                                  throws Exception
Creates a processor given the parameters.

This method is an implementation artifact to aid unit testing.

Parameters:
inParameters - the parameters to connect to the server.
Returns:
the order processor that will send orders to the server.
Throws:
Exception - if there were errors creating the order processor.

displaySummary

protected void displaySummary(OrderLoader inLoader)
Displays the summary of results after the order loader is done processing.

Parameters:
inLoader - the order loader instance.

printMessage

protected void printMessage(String inMessage)
Prints the message to the output.

Parameters:
inMessage - the message to print.

printError

protected void printError(Exception inException)
Prints the supplied exception's message to the output.

Parameters:
inException - the exception whose messages should be printed on the output.

getExceptionMsg

protected String getExceptionMsg(Exception inException)
Gets the exception message from the supplied exception.

Parameters:
inException - the exception
Returns:
the message from the exception.


Copyright © 2012. All Rights Reserved.