fr.gedeon.telnetservice
Class TelnetService

java.lang.Object
  extended by fr.gedeon.telnetservice.TelnetService
All Implemented Interfaces:
SessionListener, Runnable

public final class TelnetService
extends Object
implements Runnable, SessionListener

The service's main daemon component is the Telnet Service. It is configured by the integrating environment at setup/ initialization phase. Refer to the Introduction to Telnet Service for an overview of this service.

Author:
wgedeon

Field Summary
protected  TreeMap<Integer,TelnetServiceExtension> actionListenerFactories
          The provider telnet user action listener factories, those will be picked by event distribution priority
protected  fr.gedeon.telnetservice.OutputFormatMainHandlerImpl outputFormat
           
protected  TreeMap<Integer,TelnetServiceExtension> promptDecoratorFactories
           
protected  LinkedList<TelnetServiceExtension> registeredExtensions
           
protected  ServerSocket serverSocket
          The server socket that is waiting for incoming connections
protected  Thread thread
          The current thread, also the running flag: the runnable runs while it is not null
 
Constructor Summary
TelnetService()
          Default constructor, does nothing
 
Method Summary
 void connectionEstablished(SessionState sessionState)
          Notification that the session has just been established
 void connectionLost(SessionState sessionState)
          Notification that the session has just been lost
 int getBindPort()
          Retreive the current bind port
 Iterator<Session> getSessionsIterator()
           
 boolean isRunning()
           
 void registerExtension(TelnetServiceExtension serviceExtension)
           
 void run()
          Main service loop, while running accept connections and start Sessions
 void setBindPort(int bindPort)
          Set the bind port.
 void start()
          Start the service.
 void stop()
          Stop the service asap.
 void unregisterAllExtensions()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thread

protected Thread thread
The current thread, also the running flag: the runnable runs while it is not null


serverSocket

protected ServerSocket serverSocket
The server socket that is waiting for incoming connections


registeredExtensions

protected LinkedList<TelnetServiceExtension> registeredExtensions

actionListenerFactories

protected TreeMap<Integer,TelnetServiceExtension> actionListenerFactories
The provider telnet user action listener factories, those will be picked by event distribution priority


promptDecoratorFactories

protected TreeMap<Integer,TelnetServiceExtension> promptDecoratorFactories

outputFormat

protected fr.gedeon.telnetservice.OutputFormatMainHandlerImpl outputFormat
Constructor Detail

TelnetService

public TelnetService()
Default constructor, does nothing

Method Detail

unregisterAllExtensions

public void unregisterAllExtensions()

registerExtension

public void registerExtension(TelnetServiceExtension serviceExtension)

getSessionsIterator

public Iterator<Session> getSessionsIterator()

getBindPort

public int getBindPort()
Retreive the current bind port

Returns:
the current bind port value

setBindPort

public void setBindPort(int bindPort)
Set the bind port. This method must be called before the service is started.

Parameters:
bindPort - the desired bind port

isRunning

public boolean isRunning()

start

public void start()
           throws TelnetServiceStartException
Start the service.

Throws:
TelnetServiceStartException

stop

public void stop()
Stop the service asap.


run

public void run()
Main service loop, while running accept connections and start Sessions

Specified by:
run in interface Runnable

connectionEstablished

public void connectionEstablished(SessionState sessionState)
Description copied from interface: SessionListener
Notification that the session has just been established

Specified by:
connectionEstablished in interface SessionListener
Parameters:
sessionState - the current session state

connectionLost

public void connectionLost(SessionState sessionState)
Description copied from interface: SessionListener
Notification that the session has just been lost

Specified by:
connectionLost in interface SessionListener
Parameters:
sessionState - the current session state


Copyright © 2008. All Rights Reserved.