|
|||||||||
| 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
public class 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 static org.apache.log4j.Logger |
logger
|
protected ProtocolReader |
reader
|
protected java.net.Socket |
socket
|
protected ProtocolWriter |
writer
|
| Fields inherited from class edu.sdsc.inca.Component |
|---|
authenticate, cert, certPath, COMPONENT_OPTS, hostname, key, keyPath, logFile, password, port, 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. |
void |
commandPermit(java.lang.String dn,
java.lang.String action)
Send a permit command 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 |
getDn(boolean peer)
Returns the DN associated with this connection. |
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 |
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, getDn, getHostname, getKey, getKeyPath, getLogFile, getPassword, getPort, getTrustedCertificates, getTrustedPath, getUri, openResourceStream, readCredentials, readVersion, setAuthenticate, setCertificatePath, setHostname, setKeyPath, setLogFile, setPassword, setPort, 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.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 commandPermit(java.lang.String dn,
java.lang.String action)
throws java.io.IOException,
ProtocolException
dn - the DN of the entity allowed to perform an actionaction - the action the entity is allowed to perform
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 getDn(boolean peer)
peer - indicates whether the local or peer DN is desired
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 value
public void setServer(java.lang.String server,
int defaultPort)
server - contact spec of the form [protocol://]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 | ||||||||