Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nectar.reda.client.base
Class ClientComThread  view ClientComThread download ClientComThread.java

java.lang.Object
  extended byjava.lang.Thread
      extended bynectar.reda.io.ControllerThread
          extended bynectar.reda.client.base.ClientComThread
All Implemented Interfaces:
java.lang.Runnable

public class ClientComThread
extends nectar.reda.io.ControllerThread

Client Communication Thread -- handles all the data communication with the server.


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean authenticated
           
private  nectar.reda.io.RedaClientConnection client
           
static java.lang.String CONNECTION_PROGRESS_PERCENT
          Property Change Event description, indicating the percentage progress of the connection establishement.
static java.lang.String CONNECTION_PROGRESS_STRING
          Property Change Event description, indicating the currently running operation in the connection establishement process.
static java.lang.String CONNECTION_STATUS
          Property Change Event description, indicating whether the connection is established or not.
private  ConnectionStats connStats
           
private  java.io.ObjectInputStream in
           
private  java.lang.String login
           
private  ClientJFrame mainWindow
           
private  java.lang.Long myProject
           
private  java.lang.Long myUserId
           
private  java.io.ObjectOutputStream out
           
private  java.lang.String password
           
protected  int progressPercent
           
protected  java.lang.String progressString
           
private  ActionPump pump
           
protected  java.beans.PropertyChangeSupport statusChangeListeners
           
private  ConnectionStatusJDialog statusDialog
           
 
Fields inherited from class nectar.reda.io.ControllerThread
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientComThread(ClientJFrame mainWindow, ActionPump pump)
          Creates a new instance of ClientComThread
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
           
 boolean authenticate(java.io.ObjectInputStream in, java.io.ObjectOutputStream out)
           
 void disconnect()
          Attempts to disconnect from the server.
 ConnectionStats getConnectionStats()
           
 java.lang.Long getMyProject()
           
 java.lang.Long getMyUserId()
           
 boolean isAuthenticated()
          Check whether authentication has been successful on the current connection.
 boolean isConnected()
          check whether the connection is established.
 void reloadConfig(Configuration config)
          Reloads configuration variables from the Configuration object.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void runThread()
          The main running loop for the communication, called when the Thread is started.
 void sendAction(nectar.reda.client.action.ClientAction action)
          Sends a ClientAction to the Server -- Note that you should use the ActionPump mechanism to send commands and receive responses.
private  void setMyProject(java.lang.Long project)
           
private  void setMyUserId(java.lang.Long id)
           
 void setStatus(java.lang.String status, int progress)
           
 void setStatusDialog(ConnectionStatusJDialog dialog)
           
 
Methods inherited from class nectar.reda.io.ControllerThread
addChildThread, keepRunning, killChildThreads, killThread, removeChildThread, run, startThread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

client

private nectar.reda.io.RedaClientConnection client

login

private java.lang.String login

password

private java.lang.String password

myUserId

private java.lang.Long myUserId

myProject

private java.lang.Long myProject

authenticated

private boolean authenticated

mainWindow

private ClientJFrame mainWindow

connStats

private ConnectionStats connStats

pump

private ActionPump pump

in

private java.io.ObjectInputStream in

out

private java.io.ObjectOutputStream out

statusDialog

private ConnectionStatusJDialog statusDialog

statusChangeListeners

protected java.beans.PropertyChangeSupport statusChangeListeners

CONNECTION_PROGRESS_PERCENT

public static final java.lang.String CONNECTION_PROGRESS_PERCENT
Property Change Event description, indicating the percentage progress of the connection establishement.

See Also:
Constant Field Values

CONNECTION_PROGRESS_STRING

public static final java.lang.String CONNECTION_PROGRESS_STRING
Property Change Event description, indicating the currently running operation in the connection establishement process.

See Also:
Constant Field Values

CONNECTION_STATUS

public static final java.lang.String CONNECTION_STATUS
Property Change Event description, indicating whether the connection is established or not.

See Also:
Constant Field Values

progressString

protected java.lang.String progressString

progressPercent

protected int progressPercent
Constructor Detail

ClientComThread

public ClientComThread(ClientJFrame mainWindow,
                       ActionPump pump)
Creates a new instance of ClientComThread

Method Detail

reloadConfig

public void reloadConfig(Configuration config)
                  throws java.io.IOException
Reloads configuration variables from the Configuration object. This operation can *ONLY* be performed when the communication is inactive -- when the client is disconnected.


disconnect

public void disconnect()
                throws java.io.IOException
Attempts to disconnect from the server.


setStatus

public void setStatus(java.lang.String status,
                      int progress)

runThread

public void runThread()
The main running loop for the communication, called when the Thread is started.


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

isConnected

public boolean isConnected()
check whether the connection is established.


isAuthenticated

public boolean isAuthenticated()
Check whether authentication has been successful on the current connection.


sendAction

public void sendAction(nectar.reda.client.action.ClientAction action)
                throws nectar.reda.client.action.ClientActionException
Sends a ClientAction to the Server -- Note that you should use the ActionPump mechanism to send commands and receive responses.


getConnectionStats

public ConnectionStats getConnectionStats()

setStatusDialog

public void setStatusDialog(ConnectionStatusJDialog dialog)

authenticate

public boolean authenticate(java.io.ObjectInputStream in,
                            java.io.ObjectOutputStream out)
                     throws java.lang.Exception

setMyUserId

private void setMyUserId(java.lang.Long id)

getMyUserId

public java.lang.Long getMyUserId()

setMyProject

private void setMyProject(java.lang.Long project)

getMyProject

public java.lang.Long getMyProject()