pyrasun.eio.services.object
Class ObjectClientService

java.lang.Object
  extended bypyrasun.eio.services.AbstractEmberService
      extended bypyrasun.eio.services.object.ObjectClientService
All Implemented Interfaces:
EmberService, EndpointEventListener

public class ObjectClientService
extends AbstractEmberService
implements EndpointEventListener


Field Summary
 
Fields inherited from interface pyrasun.eio.services.EmberService
RUNNING, STOPPED
 
Constructor Summary
ObjectClientService(EIOGlobalContext context, EIOPoolingStrategy strategy)
           
 
Method Summary
 ObjectServerClient createClient(java.lang.String host, int port, java.lang.String ID, ObjectServerClientListener listener)
           
 ReadWriteEndpoint createEndpoint(EndpointCoordinator coord, java.nio.channels.SocketChannel channel)
           
 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.
 ObjectServerListener getListener()
           
 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(ObjectServerListener listener)
           
 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

ObjectClientService

public ObjectClientService(EIOGlobalContext context,
                           EIOPoolingStrategy strategy)
                    throws java.io.IOException
Method Detail

setListener

public void setListener(ObjectServerListener listener)

getListener

public ObjectServerListener getListener()

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

createClient

public ObjectServerClient createClient(java.lang.String host,
                                       int port,
                                       java.lang.String ID,
                                       ObjectServerClientListener listener)
                                throws java.io.IOException
Throws:
java.io.IOException

createEndpoint

public ReadWriteEndpoint createEndpoint(EndpointCoordinator coord,
                                        java.nio.channels.SocketChannel channel)

newEndpoint

public void newEndpoint(ReadWriteEndpoint endpoint)

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