| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.sdsc.inca.Component
edu.sdsc.inca.Client
This class implements the functionality common to all Inca client classes. Along with defining an API that understands the Server protocol, it defines a main method that allows access to a Server via a telnet-style interface.
| Field Summary | |
| static java.lang.String | CLIENT_OPTS | 
| protected  java.lang.String | host | 
| protected static org.apache.log4j.Logger | logger | 
| protected  int | port | 
| protected  ProtocolReader | reader | 
| protected  java.net.Socket | socket | 
| protected  ProtocolWriter | writer | 
| Fields inherited from class edu.sdsc.inca.Component | 
| authenticate, cert, certPath, COMPONENT_OPTS, key, keyPath, logFile, password, trusted, trustedPath | 
| Constructor Summary | |
| Client() | |
| Method Summary | |
|  void | close()Close the client socket to the server. | 
|  java.lang.String | commandGetLog()Retrieve the text in the server's log file, if any. | 
|  void | commandLogConfig(java.lang.String data)Send a log config message to the server. | 
|  java.lang.String | commandPing(java.lang.String data)Send a ping to the server and return the response data. | 
|  void | connect()Establish a connection to the server. | 
| protected  java.lang.String | dialog(java.lang.String command,
       java.lang.String data)Sends a statement to the server and returns the data from a successful response. | 
|  java.lang.String | getHost()Returns the host where the server is running. | 
|  int | getPort()Returns the port where the server is listening. | 
|  java.lang.String | getUri()Return the uri for the server. | 
|  boolean | isConnected()Query whether the client is presently connected. | 
| static void | main(java.lang.String[] args)A simple main method for exercising the Client. | 
|  Statement | read()Read the next statement from the server. | 
|  void | setConfiguration(java.util.Properties config)A convenience function for setting multiple configuration properties at once. | 
|  void | setHost(java.lang.String host)Sets the host where the server is running. | 
|  void | setPort(int port)Sets the port where the server is listening. | 
|  void | setServer(java.lang.String server,
          int defaultPort)Sets the host and port of the server to contact. | 
| static void | telnetDialog(Client c,
             java.lang.String prompt)Allows the user to use a client via a telnet-style interface. | 
|  void | write(Statement statement)Write a statement to the server. | 
| Methods inherited from class edu.sdsc.inca.Component | 
| addTrustedCert, configComponent, createSocket, getAuthenticate, getCertificate, getCertificatePath, getKey, getKeyPath, getLogFile, getPassword, getTrustedCertificates, getTrustedPath, openResourceStream, readCredentials, readVersion, setAuthenticate, setCertificatePath, setKeyPath, setLogFile, setPassword, setTrustedPath | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final java.lang.String CLIENT_OPTS
protected static org.apache.log4j.Logger logger
protected java.lang.String host
protected int port
protected java.net.Socket socket
protected ProtocolReader reader
protected ProtocolWriter writer
| Constructor Detail | 
public Client()
| Method Detail | 
public void close()
public java.lang.String commandGetLog()
                               throws java.io.IOException,
                                      ProtocolException
java.io.IOException - on read/write error
ProtocolException - on an invalid message
public void commandLogConfig(java.lang.String data)
                      throws java.io.IOException,
                             ProtocolException
data - a log4j setting of the form property=value
java.io.IOException - on read/write error
ProtocolException - on an invalid message
public java.lang.String commandPing(java.lang.String data)
                             throws java.io.IOException,
                                    ProtocolException
data - the ping message data
java.io.IOException - on read/write error
ProtocolException - on an invalid message
public void connect()
             throws ConfigurationException,
                    java.io.IOException
ConfigurationException - if the configuration settings are invalid
java.io.IOException - if the attempt to contact the server failspublic java.lang.String getHost()
public int getPort()
public java.lang.String getUri()
public boolean isConnected()
public Statement read()
               throws java.io.IOException,
                      ProtocolException
java.io.IOException - on read error
ProtocolException - on an invalid message
public void setConfiguration(java.util.Properties config)
                      throws ConfigurationException
setConfiguration in class Componentconfig - contains client configuration values
ConfigurationException - on a faulty configuration property valuepublic void setHost(java.lang.String host)
host - the server host.public void setPort(int port)
port - the server port.
public void setServer(java.lang.String server,
                      int defaultPort)
server - contact spec of the form [protcol://]host[:port]defaultPort - port to contact if server contains none
public void write(Statement statement)
           throws java.io.IOException
statement - the statement to write
java.io.IOException - on write failure
protected java.lang.String dialog(java.lang.String command,
                                  java.lang.String data)
                           throws java.io.IOException,
                                  ProtocolException
command - the command to senddata - the data to accompany the command
java.io.IOException - on read failure
ProtocolException - if a failure message is received
public static void telnetDialog(Client c,
                                java.lang.String prompt)
c - the client to useprompt - the user promptpublic static void main(java.lang.String[] args)
usage:java inca.Client
-a|--auth boolean Authenticated (secure) connection? -c|--cert path Path to the authentication certificate -f|--file path Inca installation configuration file path -h|--help null Print help/usage -i|--init path Path to properties file -k|--key path Path to the authentication key -P|--password str Specify how to obtain encryption password -S|--server str Server specification; host:port -t|--trusted path Path to authentication trusted certificate dir -V|--version null Display program version
args - command line arguments, as above.| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||