|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.UCL.xmiddle.framework.controller.Network
Network.java Network is the basic networking module at the controller core of the xmiddle platform. It provides methods to connect and disconnect to/from the network, send and receive data, negotiate the initiation of protocol sessions and more. Network is also expected to receive protocol requests (e.g. reconciliation requests) from other hosts and service them. Created: Fri Jul 20 13:23:14 2001
Field Summary | |
protected java.util.Hashtable |
activeSessions
Contains the active ProtocolChooser sessions, as
registered with the registerSession() call |
protected Manager |
caller
Holds a reference to the Manager of the platform. |
static boolean |
CONNECTED
represents the "connected to the network" state |
static boolean |
DISCONNECTED
Represents the "network disconnected" state |
protected LocalHost |
localhost
A reference to the LocalHost object. |
protected Locator |
locator
A reference to the locator object, as set by setLocator() |
protected boolean |
status
The status of the network. |
Constructor Summary | |
Network()
|
Method Summary | |
abstract boolean |
connect()
Connects to the network (and can receive & send data) |
abstract Listener |
createListener(Host host,
java.lang.Object sessionID)
Creates and negotiates a Listener object to
receive information from the given Host. |
abstract Sender |
createSender(Host host,
java.lang.Object sessionID)
Creates and negotiates a Sender object to
send information from the given Host. |
abstract void |
disconnect()
Explicitly disconnects from the network |
abstract void |
exit()
Signifies that the platform is about to stop operating. |
boolean |
getStatus()
Returns the connection status of the platform |
abstract void |
registerSession(ProtocolChooser session)
Registers a new ProtocolChooser session. |
abstract void |
removeSession(java.lang.Object sessionID)
Removes a formelly active session from the list of registered sessions. |
abstract void |
run()
What to do when the Network Thread is started. |
abstract boolean |
send(Data data)
Sends the given packet. |
void |
setLocator(Locator locator)
Gives a reference to the local Locator
object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Hashtable activeSessions
ProtocolChooser
sessions, as
registered with the registerSession()
call
protected boolean status
protected Manager caller
protected Locator locator
setLocator()
protected LocalHost localhost
LocalHost
object. This can be
used to queue protocol requests.
public static boolean DISCONNECTED
public static boolean CONNECTED
Constructor Detail |
public Network()
Method Detail |
public abstract boolean connect()
public abstract void disconnect()
public boolean getStatus()
CONNECTED
or DISCONNECTED
public abstract void exit()
public abstract boolean send(Data data)
data
- The Data
packet to send. Note that
Data
also contains the target Host
public abstract void registerSession(ProtocolChooser session) throws ExistingSessionIDException
session
- The ProtocolChooser
managing this session
ExistingSessionIDException
- if a session with the same session
ID is already registered.public abstract void removeSession(java.lang.Object sessionID) throws InvalidSessionIDException
sessionID
- The session's unique ID
InvalidSessionIDException
- if no session with the given ID is registeredpublic abstract Listener createListener(Host host, java.lang.Object sessionID)
Listener
object to
receive information from the given Host. The Object is
generated for a particular protocol session.
host
- The host with which the Listener needs to be
negotiatedsessionID
- The session ID identifying the session for
which this Listener is generated
Listener
valuepublic abstract Sender createSender(Host host, java.lang.Object sessionID)
Sender
object to
send information from the given Host. The Object is
generated for a particular protocol session.
host
- The host with which the Sender needs to be
negotiatedsessionID
- The session ID identifying the session for
which this Sender is generated
Sender
valuepublic void setLocator(Locator locator)
Locator
object. This can be used by Network
to retreive
information on hosts in reach.
locator
- The local Locator
referencepublic abstract void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |