edu.UCL.xmiddle.framework.lib.protocols
Class ProtocolChooser

java.lang.Object
  |
  +--edu.UCL.xmiddle.framework.lib.protocols.ProtocolChooser
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
SimpleProtocolChooser

public abstract class ProtocolChooser
extends java.lang.Object
implements java.lang.Runnable

ProtocolChooser.java ProtocolChooser is responsible to negotiate with other hosts and start protocols, such as linking, reconciliation etc. Created: Fri Jul 20 16:14:29 2001


Field Summary
static boolean ACTIVE
          Denotes an active protocol session (protocol is running)
protected static AppManager appManager
          A reference to the ApplicationManager
protected  java.lang.Object[] args
          The arguments/parameters of this sessions
protected  java.lang.Boolean has_sender
           
static boolean INACTIVE
          Denotes a passive protocol session (protocol is not running)
protected  Listener listener
          Used to receive information from the remote Host(s)
protected static LocalHost localhost
          A reference to the localhost (used to access the linktable)
protected static Locator locator
          Describe variable locator here.
protected static Network network
          A static reference to the xmiddle networking layer
protected  Protocol protocol
          Stores the protocol chosen
protected static ProtocolRegistry protocolRegistry
          A reference to the protocol registry, from where the protocol chooser can pick protocols
protected  Sender sender
          Used to send information to the remote Host(s)
protected  java.lang.Object sessionID
          The unique ID for this session
protected  boolean status
          The protocol's status (ACTIVE or INACTIVE)
 
Constructor Summary
ProtocolChooser()
           
 
Method Summary
abstract  void abort()
          Aborts the execution of the protocol (in case for example of a network disconnection).
 Protocol getProtocol()
          Returns the protocol chosen by the ProtocolChooser
 java.lang.Object getSessionID()
          Returns the session ID assigned for this session.
 boolean getStatus()
          Returns the status of the session.
abstract  void run()
          Starts the protocol chooser.
static void setAppManager(AppManager appmgr)
          Gives a static reference to the Application Manager.
 void setListener(Listener listener)
          Gives a reference to the Listener used to receive information from the remote host(s) involved.
static void setLocalHost(LocalHost loc)
          Gives a static reference to the LocalHost.
static void setLocator(Locator loc)
          Gives a static reference to the Locator.
static void setNetwork(Network net)
          Gives a static reference to the networking layer.
static void setRegistry(ProtocolRegistry reg)
          Gives a static reference to the ProtocolRegistry.
 void setSender(Sender sender)
          Gives a reference to the Sender used to send information to the remote host(s) involved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

args

protected java.lang.Object[] args
The arguments/parameters of this sessions


localhost

protected static LocalHost localhost
A reference to the localhost (used to access the linktable)


sessionID

protected java.lang.Object sessionID
The unique ID for this session


protocol

protected Protocol protocol
Stores the protocol chosen


sender

protected Sender sender
Used to send information to the remote Host(s)


listener

protected Listener listener
Used to receive information from the remote Host(s)


network

protected static Network network
A static reference to the xmiddle networking layer


locator

protected static Locator locator
Describe variable locator here.


status

protected boolean status
The protocol's status (ACTIVE or INACTIVE)


appManager

protected static AppManager appManager
A reference to the ApplicationManager


protocolRegistry

protected static ProtocolRegistry protocolRegistry
A reference to the protocol registry, from where the protocol chooser can pick protocols


ACTIVE

public static boolean ACTIVE
Denotes an active protocol session (protocol is running)


INACTIVE

public static boolean INACTIVE
Denotes a passive protocol session (protocol is not running)


has_sender

protected java.lang.Boolean has_sender
Constructor Detail

ProtocolChooser

public ProtocolChooser()
Method Detail

run

public abstract void run()
Starts the protocol chooser.

Specified by:
run in interface java.lang.Runnable

setListener

public void setListener(Listener listener)
Gives a reference to the Listener used to receive information from the remote host(s) involved. The Listener is created by the networking layer

Parameters:
listener - a Listener value

setSender

public void setSender(Sender sender)
Gives a reference to the Sender used to send information to the remote host(s) involved. The Sender is created by the networking layer

Parameters:
sender - a Sender value

getProtocol

public Protocol getProtocol()
Returns the protocol chosen by the ProtocolChooser

Returns:
The Protocol chosen by the ProtocolChooser, or null if the choice hasn't been made yet

getSessionID

public java.lang.Object getSessionID()
Returns the session ID assigned for this session.

Returns:
an Object value

getStatus

public boolean getStatus()
Returns the status of the session.

Returns:
ACTIVE if the protocol is executing, or PASSIVE if the protocol isn't executing

setNetwork

public static void setNetwork(Network net)
Gives a static reference to the networking layer. Used to negotiate Listeners and Senders.

Parameters:
net - a Network value

setLocator

public static void setLocator(Locator loc)
Gives a static reference to the Locator. Used to get information on hosts

Parameters:
loc - a Locator value

setRegistry

public static void setRegistry(ProtocolRegistry reg)
Gives a static reference to the ProtocolRegistry. Used to get protocols

Parameters:
reg - a ProtocolRegistry value

setAppManager

public static void setAppManager(AppManager appmgr)
Gives a static reference to the Application Manager. Used to get the Application Profiles needed

Parameters:
appmgr - an AppManager value

setLocalHost

public static void setLocalHost(LocalHost loc)
Gives a static reference to the LocalHost. Used to access the LinkTable

Parameters:
loc - a LocalHost value

abort

public abstract void abort()
Aborts the execution of the protocol (in case for example of a network disconnection). This basically calls Protocol.abort() and cleans up.