pyrasun.eio.services.telnet
Class TelnetService

java.lang.Object
  extended bypyrasun.eio.services.AbstractEmberService
      extended bypyrasun.eio.services.telnet.TelnetService
All Implemented Interfaces:
EIOAcceptWorkerFactory.EIOAcceptWorkerCallback, EmberService, EndpointEventListener

public class TelnetService
extends AbstractEmberService
implements EndpointEventListener, EIOAcceptWorkerFactory.EIOAcceptWorkerCallback

A service which does very little. It's setup to use the string protocol, and effectively it means you can telnet into the running process and issue comands to it. The only supported default commands are 'dump', which dumps out the running EIO state, and quit and exit, both of which kill your telnet connection.


Field Summary
 
Fields inherited from interface pyrasun.eio.services.EmberService
RUNNING, STOPPED
 
Constructor Summary
TelnetService(EIOGlobalContext context, EIOPoolingStrategy acceptStrategy, EIOPoolingStrategy ioStrategy, java.lang.String host, int port)
           
 
Method Summary
 void endpointClosed(Endpoint endpoint, EIOReasonCode reason, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          A callback indicating that the specified endpoint was closed.
 EmberServiceListener getListener()
           
 java.lang.String getPrompt()
           
 java.lang.String getWelcome()
           
 void newEndpoint(ReadWriteEndpoint endpoint)
           
 void reportReadError(Endpoint endpoint, EIOReasonCode why, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          Reports that a non-fatal error occured while reading from this endpoint.
 void reportWriteError(Endpoint endpoint, EIOReasonCode why, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          Reports that a non-fatal error occured while writing to this endpoint.
 void setListener(EmberServiceListener listener)
           
 void setPrompt(java.lang.String prompt)
           
 void setWelcome(java.lang.String welcome)
           
 void start()
          Start the service.
 void stop()
          Stop the service.
 
Methods inherited from class pyrasun.eio.services.AbstractEmberService
failureOK, getController, getName, getState, isStoppable, setController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TelnetService

public TelnetService(EIOGlobalContext context,
                     EIOPoolingStrategy acceptStrategy,
                     EIOPoolingStrategy ioStrategy,
                     java.lang.String host,
                     int port)
              throws java.io.IOException
Method Detail

setListener

public void setListener(EmberServiceListener listener)

getListener

public EmberServiceListener getListener()

setPrompt

public void setPrompt(java.lang.String prompt)

getPrompt

public java.lang.String getPrompt()

setWelcome

public void setWelcome(java.lang.String welcome)

getWelcome

public java.lang.String getWelcome()

start

public void start()
           throws EmberServiceException
Start the service.

Specified by:
start in interface EmberService
Specified by:
start in class AbstractEmberService
Throws:
ServiceException - if the service fails to start, or is already running
EmberServiceException

stop

public void stop()
          throws EmberServiceException
Stop the service.

Specified by:
stop in interface EmberService
Specified by:
stop in class AbstractEmberService
Throws:
ServiceException - if the service fails to stop, or is already stopped
EmberServiceException

newEndpoint

public void newEndpoint(ReadWriteEndpoint endpoint)
Specified by:
newEndpoint in interface EIOAcceptWorkerFactory.EIOAcceptWorkerCallback

endpointClosed

public void endpointClosed(Endpoint endpoint,
                           EIOReasonCode reason,
                           java.lang.String msg,
                           java.lang.Throwable t,
                           java.lang.Object context)
Description copied from interface: EndpointEventListener
A callback indicating that the specified endpoint was closed.

Specified by:
endpointClosed in interface EndpointEventListener
Parameters:
endpoint - The endpoint that was closed
reason - Indicator as to why the endpoint was closed
msg - Semi-friendly text explaining in more detail why it was closed. May be null!
t - Exception that caused the close. May be null if an exception was not the cause
context - An object that indicates the context in which the close happened. Usually null, but app code may override with its own meaning

reportReadError

public void reportReadError(Endpoint endpoint,
                            EIOReasonCode why,
                            java.lang.String msg,
                            java.lang.Throwable t,
                            java.lang.Object context)
Description copied from interface: EndpointEventListener
Reports that a non-fatal error occured while reading from this endpoint.

Specified by:
reportReadError in interface EndpointEventListener

reportWriteError

public void reportWriteError(Endpoint endpoint,
                             EIOReasonCode why,
                             java.lang.String msg,
                             java.lang.Throwable t,
                             java.lang.Object context)
Description copied from interface: EndpointEventListener
Reports that a non-fatal error occured while writing to this endpoint.

Specified by:
reportWriteError in interface EndpointEventListener


Pyrasun EmberIO