iCMS.masterd
Class CmsdClient

java.lang.Object
  extended by luky.serverSimple.Client
      extended by iCMS.masterd.CmsdClient
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
EvaluationClient

public class CmsdClient
extends Client
implements Runnable

The CmsdClient class extends the Client class and is created to make a general listner for servers which communicates with MyEventListners

Version:
2.0.1
Author:
Chris Lukassen
 

Field Summary
protected  boolean isReconnecting
           
protected  boolean isRunning
           
protected  EventListenerList listenerList
           
protected  String name
           
protected  String symbolicName
           
 
Fields inherited from class luky.serverSimple.Client
connected, reader, writer
 
Constructor Summary
CmsdClient(String ip, int port, String name, String symbolicName)
          constructor, takes ip number and portnumber of the server to connect to the name shows up in the debug output
 
Method Summary
 void addMyEventListener(MyEventListener listener)
          This methods allows classes to register for MyEvents
protected  void fireMyEvent(MyEvent evt)
          This method is used to fire MyEvents
 String getIp()
          returns the Ip of this client
 String getLine(String cmd)
          overrides getLine, checks if running or reconnecting
 Vector getList(String cmd)
          overrides getList, checks if running or reconnecting
 String getName()
          get's the symbolic name of this clients endpoint
 int getPort()
          returns the port of this client
 int handleCommError()
          comm error occured re-initialize and report to listners
 boolean isReconnecting()
          isReconnecting
 void reconnect()
          This method starts the client in a seperate thread and tries to open the connection
 void removeMyEventListener(MyEventListener listener)
          This methods allows classes to unregister for MyEvents
 void run()
          main loop of the client, override with more sensible actions
currently listens to input and fires each line as an event
 void start()
          This method starts the client in a seperate thread, the thread will listen to input and not repond to any cmds anymore !
 void stop()
          This method stops the client
 
Methods inherited from class luky.serverSimple.Client
openConnection, sendCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name

symbolicName

protected String symbolicName

isRunning

protected boolean isRunning

isReconnecting

protected boolean isReconnecting

listenerList

protected EventListenerList listenerList
Constructor Detail

CmsdClient

public CmsdClient(String ip,
                  int port,
                  String name,
                  String symbolicName)
constructor, takes ip number and portnumber of the server to connect to the name shows up in the debug output

Method Detail

getName

public String getName()
get's the symbolic name of this clients endpoint


getList

public Vector getList(String cmd)
overrides getList, checks if running or reconnecting

Overrides:
getList in class Client

getLine

public String getLine(String cmd)
overrides getLine, checks if running or reconnecting

Overrides:
getLine in class Client

getIp

public String getIp()
returns the Ip of this client


getPort

public int getPort()
returns the port of this client


addMyEventListener

public void addMyEventListener(MyEventListener listener)
This methods allows classes to register for MyEvents


removeMyEventListener

public void removeMyEventListener(MyEventListener listener)
This methods allows classes to unregister for MyEvents


fireMyEvent

protected void fireMyEvent(MyEvent evt)
This method is used to fire MyEvents


reconnect

public void reconnect()
This method starts the client in a seperate thread and tries to open the connection


start

public void start()
This method starts the client in a seperate thread, the thread will listen to input and not repond to any cmds anymore !


stop

public void stop()
This method stops the client


isReconnecting

public boolean isReconnecting()
isReconnecting


handleCommError

public int handleCommError()
comm error occured re-initialize and report to listners


run

public void run()
main loop of the client, override with more sensible actions
currently listens to input and fires each line as an event

Specified by:
run in interface Runnable