org.montsuqi.client
Class Client

java.lang.Object
  extended by org.montsuqi.client.Client
All Implemented Interfaces:
java.lang.Runnable

public class Client
extends java.lang.Object
implements java.lang.Runnable

The main application class for panda client.


Field Summary
(package private)  Logger logger
           
 
Constructor Summary
Client(Configuration conf)
          Constructs a client initialized by the given configuration object.
 
Method Summary
(package private)  void connect()
          Connects to the server using protocol, user, password and application name specified in the configuration of this client.
(package private)  java.net.Socket createSocket()
          Creates a socket for the connection.
(package private)  void exitSystem()
          Terminates the application.
 void finalize()
          Dispose connection if it exists.
static void main(java.lang.String[] args)
           
 void run()
          Kick the application.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

Logger logger
Constructor Detail

Client

public Client(Configuration conf)

Constructs a client initialized by the given configuration object.

Parameters:
conf - configuration.
Method Detail

connect

void connect()
       throws java.io.IOException,
              java.security.GeneralSecurityException

Connects to the server using protocol, user, password and application name specified in the configuration of this client.

Throws:
java.io.IOException - on IO errors.
java.security.GeneralSecurityException - on SSL verification/authentication failure.

createSocket

java.net.Socket createSocket()
                       throws java.io.IOException,
                              java.security.GeneralSecurityException

Creates a socket for the connection.

When the configuration says useSSL, an SSL Socket is returned instead.

Returns:
a socket connected at the TCP layer.
Throws:
java.io.IOException - on IO error.
java.security.GeneralSecurityException - on SSL verification/authentication failure.

run

public void run()

Kick the application.

Specified by:
run in interface java.lang.Runnable

exitSystem

void exitSystem()

Terminates the application.

Sends end packet to the server and exists.


finalize

public void finalize()

Dispose connection if it exists.

Overrides:
finalize in class java.lang.Object

main

public static void main(java.lang.String[] args)