LexAccess Java
2008 Version

gov.nih.nlm.nls.lexAccess.Api
Class LexAccessCmdApi

java.lang.Object
  extended by gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption
      extended by gov.nih.nlm.nls.lexAccess.Api.LexAccessCmdApi

public class LexAccessCmdApi
extends gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption

This class provides a LexCheck API for setup options by a command.

History:

Version:
V-2008
Author:
NLM NLS Development Team

Field Summary
protected static java.io.BufferedReader inReader_
           
protected static java.io.BufferedWriter outWriter_
           
protected  java.util.Vector<java.lang.String> quitStrList_
           
protected  boolean runFlag_
           
 
Fields inherited from class gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption
systemOption_
 
Constructor Summary
LexAccessCmdApi()
          Creates an LexAccessCmdApi object and initiate related data (default).
LexAccessCmdApi(java.util.Hashtable<java.lang.String,java.lang.String> properties)
          Creates an LexAccessCmdApi object and initiate related data with properties to be overwritten in configuration.
LexAccessCmdApi(java.lang.String optionStr)
          Creates an LexAccessApi object, init related data by a command string.
LexAccessCmdApi(java.lang.String optionStr, java.util.Hashtable<java.lang.String,java.lang.String> properties)
          Creates an LexAccessApi object, init related data by a command string with properties to be overwritten in configuration.
LexAccessCmdApi(java.lang.String optionStr, java.lang.String configFile)
          Creates an LexAccessApi object, init related data by a command string and the path of configuration file.
LexAccessCmdApi(java.lang.String optionStr, java.lang.String configFile, java.util.Hashtable<java.lang.String,java.lang.String> properties)
          Creates an LexAccessApi object, init related data by a command string and the path of configuration file with properties to be overwritten in configuration.
 
Method Summary
 void CleanUp()
          Close LexAccess database connection and persistent tries.
protected  void DefineFlag()
          Define the LexAccess system option by defining a string.
protected  void ExecuteCommand(gov.nih.nlm.nls.lvg.CmdLineSyntax.OptionItem optionItem, gov.nih.nlm.nls.lvg.CmdLineSyntax.Option systemOption)
          Execute lexAccess command for a specified option item in a given system option.
 Configuration GetConfiguration()
          A method to get the configuration object
 java.sql.Connection GetConnection()
          Get the Db connection
protected  void GetPrompt()
          Get the Lvg interface prompt and print it out to system output.
 boolean IsLegalOption()
          Check if the input command is legal.
static void PrintLexAccessHelp()
          Print out the LexAccess help menu.
 boolean Process()
          Performs retrieving data by processing the input line (term).
 java.lang.String ProcessToString()
          Performs retrieving data by processing the input line (term).
 void SetOption(java.lang.String optionStr)
          Set the LexAccess command for retrieving data.
 void SetPromptStr(java.lang.String promptStr)
          Set the prompt string.
 void SetQuitStrList(java.util.Vector<java.lang.String> quitStrList)
          Set a list for quiting the program while using LexAccess prompt interface.
 
Methods inherited from class gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption
CheckOption, CheckSyntax, ExecuteCommands, GetOption, ToBoolean, ToFloatArray, ToIntArray, ToStringArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

quitStrList_

protected java.util.Vector<java.lang.String> quitStrList_

inReader_

protected static java.io.BufferedReader inReader_

outWriter_

protected static java.io.BufferedWriter outWriter_

runFlag_

protected boolean runFlag_
Constructor Detail

LexAccessCmdApi

public LexAccessCmdApi()
Creates an LexAccessCmdApi object and initiate related data (default). This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object


LexAccessCmdApi

public LexAccessCmdApi(java.lang.String optionStr)
Creates an LexAccessApi object, init related data by a command string. This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object

Parameters:
optionStr - the initial lvg option string

LexAccessCmdApi

public LexAccessCmdApi(java.lang.String optionStr,
                       java.lang.String configFile)
Creates an LexAccessApi object, init related data by a command string and the path of configuration file. This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object

Parameters:
optionStr - the initial lvg option string
configFile - the absolute path of the configuration file

LexAccessCmdApi

public LexAccessCmdApi(java.util.Hashtable<java.lang.String,java.lang.String> properties)
Creates an LexAccessCmdApi object and initiate related data with properties to be overwritten in configuration. This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object

Parameters:
properties - properties to be overwrite in configuration

LexAccessCmdApi

public LexAccessCmdApi(java.lang.String optionStr,
                       java.util.Hashtable<java.lang.String,java.lang.String> properties)
Creates an LexAccessApi object, init related data by a command string with properties to be overwritten in configuration. This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object

Parameters:
optionStr - the initial lvg option string
properties - properties to be overwrite in configuration

LexAccessCmdApi

public LexAccessCmdApi(java.lang.String optionStr,
                       java.lang.String configFile,
                       java.util.Hashtable<java.lang.String,java.lang.String> properties)
Creates an LexAccessApi object, init related data by a command string and the path of configuration file with properties to be overwritten in configuration. This constructor is consider as a preprocess method.

CleanUp( ) method must be called to close Db connection after using this object

Parameters:
optionStr - the initial lvg option string
configFile - the absolute path of the configuration file
properties - properties to be overwrite in configuration
Method Detail

SetPromptStr

public void SetPromptStr(java.lang.String promptStr)
Set the prompt string. This method allows users to set their customerized prompt string for using LexAccess prompt interface.

Parameters:
promptStr - the customerized prompt string

SetQuitStrList

public void SetQuitStrList(java.util.Vector<java.lang.String> quitStrList)
Set a list for quiting the program while using LexAccess prompt interface.

Parameters:
quitStrList - Vector quiting options

IsLegalOption

public boolean IsLegalOption()
Check if the input command is legal.

Returns:
true or false if the input command is legal or illegal

SetOption

public void SetOption(java.lang.String optionStr)
Set the LexAccess command for retrieving data.

Parameters:
optionStr - LexAccess command for flows

GetConfiguration

public Configuration GetConfiguration()
A method to get the configuration object

Returns:
Configuration

GetConnection

public java.sql.Connection GetConnection()
Get the Db connection

Returns:
Connection lexAccess database connection

CleanUp

public void CleanUp()
Close LexAccess database connection and persistent tries. This methods must be called before exiting LexAccessCmdApi. It is a method from post process.


ProcessToString

public java.lang.String ProcessToString()
                                 throws java.sql.SQLException,
                                        java.io.IOException
Performs retrieving data by processing the input line (term). This method provides LexAccess command line interface prompt, read input term from system input or from a file. The result of this method include output format.

Returns:
the result in string
Throws:
java.sql.SQLException
java.io.IOException

Process

public boolean Process()
                throws java.sql.SQLException,
                       java.io.IOException
Performs retrieving data by processing the input line (term). This method provides LexAccess command line interface prompt, read input term from system input or from a file. The result of this method include output format.

Returns:
true or false if the input line is not or is to quit the program
Throws:
java.sql.SQLException
java.io.IOException

PrintLexAccessHelp

public static void PrintLexAccessHelp()
Print out the LexAccess help menu.


ExecuteCommand

protected void ExecuteCommand(gov.nih.nlm.nls.lvg.CmdLineSyntax.OptionItem optionItem,
                              gov.nih.nlm.nls.lvg.CmdLineSyntax.Option systemOption)
Execute lexAccess command for a specified option item in a given system option.

Specified by:
ExecuteCommand in class gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption
Parameters:
optionItem - the option to be executed
systemOption - the system option that the option item will be run on

DefineFlag

protected void DefineFlag()
Define the LexAccess system option by defining a string.

Specified by:
DefineFlag in class gov.nih.nlm.nls.lvg.CmdLineSyntax.SystemOption

GetPrompt

protected void GetPrompt()
                  throws java.io.IOException
Get the Lvg interface prompt and print it out to system output.

Throws:
java.io.IOException

LexAccess Java
2008 Version

Submit a bug or feature

Copyright © 2008 National Library of Medicine