edu.harvard.cfa.vo.tapclient.tool
Class Client

java.lang.Object
  extended by edu.harvard.cfa.vo.tapclient.tool.Client
Direct Known Subclasses:
AsyncClient, AvailabilityClient, CapabilitiesClient, ErrorClient, JobsClient, ResultsClient, SyncClient, TablesClient, TapCli

public abstract class Client
extends java.lang.Object

A Client command line interface.


Constructor Summary
protected Client(java.lang.String commandLineSyntax, java.lang.String[] required)
          Construct an Client with the default Options.
 
Method Summary
 void checkRequired()
           
static org.apache.commons.cli.Options createOptions()
          Returns the options for an availability client.
 java.lang.String getBaseName()
          Returns the application base name.
 org.apache.commons.cli.CommandLine getCommandLine()
          Returns the parsed command line.
 java.lang.String getCommandLineSyntax()
          Returns the application command line syntax.
 java.util.Comparator getOptionComparator()
           
 org.apache.commons.cli.Options getOptions()
          Returns the options supported on the command line.
protected  java.io.PrintStream getOutput()
          Returns the PrintStream to use for output.
 java.lang.String getVersion()
          Returns the application version.
 boolean isVerbose()
          Returns true if the verbose flag has been set.
 void parse(java.lang.String[] args)
          Parser the command line arguments
protected  void printHelp()
          Writes the usage information to the output stream
protected  void printVersion()
          Writes the version information to the output stream
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

protected Client(java.lang.String commandLineSyntax,
                 java.lang.String[] required)
Construct an Client with the default Options.

See Also:
createOptions()
Method Detail

parse

public void parse(java.lang.String[] args)
           throws org.apache.commons.cli.ParseException
Parser the command line arguments

Parameters:
args - the command line arguments
Throws:
org.apache.commons.cli.ParseException - if an error occurs while parsing the command line arguments
See Also:
getOptions()

checkRequired

public void checkRequired()
                   throws org.apache.commons.cli.ParseException
Throws:
org.apache.commons.cli.ParseException

run

public void run()
         throws java.io.FileNotFoundException,
                org.apache.commons.cli.ParseException,
                HttpException,
                ResponseFormatException,
                java.io.IOException
Throws:
java.io.FileNotFoundException
org.apache.commons.cli.ParseException
HttpException
ResponseFormatException
java.io.IOException

printHelp

protected void printHelp()
                  throws java.io.FileNotFoundException
Writes the usage information to the output stream

Throws:
java.io.FileNotFoundException - if an error occurs opening the output file.
See Also:
getOutput()

printVersion

protected void printVersion()
                     throws java.io.FileNotFoundException
Writes the version information to the output stream

Throws:
java.io.FileNotFoundException - if an error occurs opening the output file.
See Also:
getOutput()

getOptions

public org.apache.commons.cli.Options getOptions()
Returns the options supported on the command line.

Returns:
the options supported on the command line.
See Also:
getCommandLine()

getOptionComparator

public java.util.Comparator getOptionComparator()

getCommandLine

public org.apache.commons.cli.CommandLine getCommandLine()
Returns the parsed command line.

Returns:
parsed command line or null if parse(String[]) has not been called.
See Also:
parse(String[])

getBaseName

public java.lang.String getBaseName()
Returns the application base name.

Returns:
the base name of this application

getVersion

public java.lang.String getVersion()
Returns the application version.

Returns:
the version of this application

getCommandLineSyntax

public java.lang.String getCommandLineSyntax()
Returns the application command line syntax.

Returns:
the command line syntax of this application

isVerbose

public boolean isVerbose()
Returns true if the verbose flag has been set.

Returns:
true is the verbose flag is set.
See Also:
getCommandLine(), getOptions()

getOutput

protected java.io.PrintStream getOutput()
                                 throws java.io.FileNotFoundException
Returns the PrintStream to use for output.

Returns:
the PrintStream to use for output.
Throws:
java.io.FileNotFoundException - if there is an error opening the file specified by output option.

createOptions

public static org.apache.commons.cli.Options createOptions()
Returns the options for an availability client.

Returns:
the command line options for an availability client.