uk.ac.lancs.relate.gateways.services.architecture.communication.sockets
Class SocketServiceRequester

java.lang.Object
  extended by uk.ac.lancs.relate.gateways.services.architecture.ServiceRequester
      extended by uk.ac.lancs.relate.gateways.services.architecture.communication.sockets.SocketServiceRequester
All Implemented Interfaces:
java.io.Serializable, ProvidersAndRequestersCommonInterface
Direct Known Subclasses:
DirectPrintingServiceRequester

public abstract class SocketServiceRequester
extends ServiceRequester

This abstract class is used for Requesters willing to use sockets for communication with Providers. Note: a Requester is not required to use any particular communication API, this class is models one type of communication but it is the programmer's responsibility to pick up the right communication model for his service. As long as the concrete service requester extends the ServiceRequester class the RelateGateways system will handle and export it correctly.

Author:
Dominique Guinard
Personal Homepage
See Also:
Serialized Form

Constructor Summary
SocketServiceRequester(Service service)
          Creates a new instance of SocketServiceRequester
 
Method Summary
protected  java.net.Socket getSocket()
          Gets the socket to which the requester is currently bound.
protected  void sendServiceRequestTO(ServiceRequest request)
          This method is meant to be used by the concrete ServiceRequester to send a ServiceRequest to a provider listening on a socket.
 void shutdown()
          Ends the connection to the distant service provider.
 void startup()
          Start the connection to the distant service provider.
 
Methods inherited from class uk.ac.lancs.relate.gateways.services.architecture.ServiceRequester
askForConfirmation, askToSelectFile, confirmShutdown, confirmStartup, displayErrorMessage, displayMessage, displayNonBlockingMessage, getService, isStarted, request, setService, setStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketServiceRequester

public SocketServiceRequester(Service service)
Creates a new instance of SocketServiceRequester

Method Detail

startup

public void startup()
Start the connection to the distant service provider.


shutdown

public void shutdown()
Ends the connection to the distant service provider.


sendServiceRequestTO

protected void sendServiceRequestTO(ServiceRequest request)
                             throws java.io.IOException
This method is meant to be used by the concrete ServiceRequester to send a ServiceRequest to a provider listening on a socket.

Throws:
java.io.IOException

getSocket

protected java.net.Socket getSocket()
Gets the socket to which the requester is currently bound.