edu.UCL.xmiddle.framework
Interface Manager

All Known Implementing Classes:
SimpleManager

public interface Manager

Manager.java Manager is the only access point that applications have to the middleware. Thus it provides a consistent API to manage the platform, send data, link information, etc. Created: Fri Jul 20 14:55:36 2001


Field Summary
static boolean CONNECTED
          Signifies that we are currently connected to the network
static boolean DISCONNECTED
          Signifies that we are currently disconnected from the network.
 
Method Summary
 void addHostListener(Host host, HostListener application)
          Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach
 void addHostListener(HostListener application)
          Signifies that the given HostListener object needs to be notified when any Host becomes in reach or out of reach.
 void addHostListenerPrimID(java.lang.Object primID, HostListener application)
          Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach
 void addHostListenerSecID(java.lang.Object secID, HostListener application)
          Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach
 void close(org.w3c.dom.Element element, java.lang.Integer appID)
          Signifies that an element previously opened (open()) is no longer being accessed.
 boolean connect()
          Connects to the network.
 void deleteApplication(java.lang.Integer appID)
          Deletes the given application.
 void disconnect()
          Disconnects from the network.
 void exit()
          Quits the platform
 boolean export(org.w3c.dom.Element element, java.lang.Integer appID)
          Exports an element in an application tree
 boolean export(java.lang.String path, java.lang.Integer appID)
          Exports an Element in an application tree.
 java.util.Enumeration getExports()
          Returns the local exports table
 java.util.Enumeration getHosts()
          Returns a list of hosts which are currently in reach with the localhost.
 java.util.Enumeration getLinkedBy()
          Returns the local linked by table
 java.util.Enumeration getLinkedFrom()
          Returns the local linked from table
 java.lang.Object getPrimaryID()
           
 ApplicationProfile getProfile(java.lang.Integer appID)
          Returns the Application profile of the given application
 java.lang.Object getSecondaryID()
           
 boolean getStatus()
          Gets the status of the middleware (connected or disconnected to/from the network)
 void init()
          Initialises the platform/middleware for the first time
 void link(Host host, java.lang.Integer remoteAppID, java.lang.String remoteElement, java.lang.Integer localAppID, org.w3c.dom.Element localRoot)
          Issues a request to link an element from a remote host.
 org.w3c.dom.Element open(java.lang.String path, java.lang.Integer appID)
          Opens an Element for the application to manipulate
 void print(java.lang.String data)
          Can be used to print debugging strings.
 void println(java.lang.String data)
          Can be used to print debugging strings.
 void queue(java.lang.Object[] request)
          Queue a request (protocol request) to be serviced by the middleware
 java.lang.Integer registerApplication(XApp app)
          Registers an application with the application manager, allowing it to access the services of xmiddle
 void registerProtocol(java.lang.String name, java.lang.String className)
          Registers a new protocol as available to the middleware.
 void removeHostListener(Host host, HostListener application)
          Signifies that the given HostListener object does not wish to be notified any more if the given host is online.
 void removeHostListener(HostListener application)
          Signifies that the given HostListener object does not wish to be notified of any events any more.
 void removeHostListenerPrimID(java.lang.Object primID, HostListener application)
          Signifies that the given HostListener object does not wish to be notified any more if the given host is online.
 void removeHostListenerSecID(java.lang.Object secID, HostListener application)
          Signifies that the given HostListener object does not wish to be notified any more if the given host is online.
 void resume()
          Resumes after a previously executed suspend()
 void send(Data data)
          Sends a data packet to a host.
 void suspend()
          Suspends the platform
 void sync(Host host, java.lang.Integer origAppID, java.lang.String origPath, java.lang.Integer localAppID, java.lang.String localPath)
          Synchronises (reconciles) our data with the given Host's.
 void unexport(org.w3c.dom.Element element, java.lang.Integer appID)
          Stops exporting the given element
 void unexport(java.lang.String path, java.lang.Integer appID)
          Stops exporting the given element
 void unlink(org.w3c.dom.Element element, java.lang.Integer appID)
          Stops linking at the given element
 

Field Detail

CONNECTED

public static final boolean CONNECTED
Signifies that we are currently connected to the network

See Also:
Constant Field Values

DISCONNECTED

public static final boolean DISCONNECTED
Signifies that we are currently disconnected from the network.

See Also:
Constant Field Values
Method Detail

init

public void init()
Initialises the platform/middleware for the first time


suspend

public void suspend()
Suspends the platform


resume

public void resume()
Resumes after a previously executed suspend()


exit

public void exit()
Quits the platform


print

public void print(java.lang.String data)
Can be used to print debugging strings. It is also used by some xmiddle components to print debugging information.

Parameters:
data - The String to print

println

public void println(java.lang.String data)
Can be used to print debugging strings. It is also used by some xmiddle components to print debugging information. It appends the given String with a newline character

Parameters:
data - The String to print

open

public org.w3c.dom.Element open(java.lang.String path,
                                java.lang.Integer appID)
Opens an Element for the application to manipulate

Parameters:
path - an xpath expression describing the element to open.
appID - The application ID to which the element belongs.
Returns:
the Element, or NULL if the element does not exists, the xpath expression was invalid or access was denied.

close

public void close(org.w3c.dom.Element element,
                  java.lang.Integer appID)
Signifies that an element previously opened (open()) is no longer being accessed.

Parameters:
element - the Element not being accessed
appID - The application ID to which this element belongs.

getHosts

public java.util.Enumeration getHosts()
Returns a list of hosts which are currently in reach with the localhost.

Returns:
The list of hosts as an Enumeration value

connect

public boolean connect()
Connects to the network. This signifies that we will be searching for hosts in reach, linking and reconciliation protocols will act etc.

Returns:
true is it succeeds, false otherwise.

disconnect

public void disconnect()
Disconnects from the network. This provides a mechanism for an application to request explicit disconnection from the network.


getStatus

public boolean getStatus()
Gets the status of the middleware (connected or disconnected to/from the network)

Returns:
CONNECTED or DISCONNECTED

export

public boolean export(java.lang.String path,
                      java.lang.Integer appID)
Exports an Element in an application tree.

Parameters:
path - The element encoded as an xpath expression.
appID - The application ID on the tree of which the element resides
Returns:
True if the operation succeeded or false if the element does not exist, access is denied, etc.

export

public boolean export(org.w3c.dom.Element element,
                      java.lang.Integer appID)
Exports an element in an application tree

Parameters:
element - The element
appID - The application ID on the tree of which the element resides
Returns:
True if the operation succeeded or false if the element does not exist, access is denied, etc.

unexport

public void unexport(java.lang.String path,
                     java.lang.Integer appID)
Stops exporting the given element

Parameters:
path - The element, encoded as an xpath expression.
appID - The application ID identifying the application on the tree of which the element resides.

unexport

public void unexport(org.w3c.dom.Element element,
                     java.lang.Integer appID)
Stops exporting the given element

Parameters:
element - The element
appID - The application ID identifying the application on the tree of which the element resides.

send

public void send(Data data)
Sends a data packet to a host.

Parameters:
data - The packet (the Data structure also contains the target host)

queue

public void queue(java.lang.Object[] request)
Queue a request (protocol request) to be serviced by the middleware

Parameters:
request - the request, as an Object[] value

link

public void link(Host host,
                 java.lang.Integer remoteAppID,
                 java.lang.String remoteElement,
                 java.lang.Integer localAppID,
                 org.w3c.dom.Element localRoot)
Issues a request to link an element from a remote host. Please note that at the moment no feedback mechanism is provided.

Parameters:
host - The host which exports the element
remoteAppID - The remote application which exports the element.
remoteElement - The element, encoded as an xpath expression being exported.
localAppID - the ID of the application which requests the linking and on which localRoot resides
localRoot - The local Element under which the remote element will be linked if the operation succeeds

sync

public void sync(Host host,
                 java.lang.Integer origAppID,
                 java.lang.String origPath,
                 java.lang.Integer localAppID,
                 java.lang.String localPath)
Synchronises (reconciles) our data with the given Host's.

Parameters:
host - The host on which the element resides.
localAppID - The application ID on the localhost.
localPath - The path name on the localhost.

unlink

public void unlink(org.w3c.dom.Element element,
                   java.lang.Integer appID)
Stops linking at the given element

Parameters:
appID - the ID of the application to which element belongs.

getExports

public java.util.Enumeration getExports()
Returns the local exports table

Returns:
an Enumeration of the local exports table. The actual objects contained in the Enumeration are left to the implementor

getLinkedBy

public java.util.Enumeration getLinkedBy()
Returns the local linked by table

Returns:
an Enumeration of the local linked by table. The actual objects contained in the Enumeration are left to the implementor

getLinkedFrom

public java.util.Enumeration getLinkedFrom()
Returns the local linked from table

Returns:
an Enumeration of the local linked from table. The actual objects contained in the Enumeration are left to the implementor

registerProtocol

public void registerProtocol(java.lang.String name,
                             java.lang.String className)
Registers a new protocol as available to the middleware.

Parameters:
name - The name of the protocol which must be unique.
className - The absolute classname of the protocol, which can be used by the ProtocolChooser to load the protocol. Protocols are expected to extend edu.UCL.xmiddle.lib.protocols.Protocol

registerApplication

public java.lang.Integer registerApplication(XApp app)
Registers an application with the application manager, allowing it to access the services of xmiddle

Parameters:
app - The application to register
Returns:
The application ID assigned by the application manager.

getProfile

public ApplicationProfile getProfile(java.lang.Integer appID)
Returns the Application profile of the given application

Parameters:
appID - The ID of the application of which the profile is desired
Returns:
The Application profile if the call succeeded, or NULL (application not found, not sufficient rights etc) otherwise.

deleteApplication

public void deleteApplication(java.lang.Integer appID)
Deletes the given application. Repercussions of this are left to the implementor.

Parameters:
appID - the ID of the application we wish to delete

addHostListener

public void addHostListener(HostListener application)
Signifies that the given HostListener object needs to be notified when any Host becomes in reach or out of reach.

Parameters:
application - The object to be notified.

addHostListener

public void addHostListener(Host host,
                            HostListener application)
Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach

Parameters:
host - The host
application - The object to be notified

addHostListenerSecID

public void addHostListenerSecID(java.lang.Object secID,
                                 HostListener application)
Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach

Parameters:
secID - The host, identified (NOT uniquely) by its secondary ID.
application - The object to be notified

addHostListenerPrimID

public void addHostListenerPrimID(java.lang.Object primID,
                                  HostListener application)
Signifies that the given HostListener object needs to be notified when the given Host is in reach or out of reach

Parameters:
primID - The host, identified by its primary ID
application - The object to be notified

removeHostListener

public void removeHostListener(HostListener application)
Signifies that the given HostListener object does not wish to be notified of any events any more.

Parameters:
application - The object not to be notified any more.

removeHostListener

public void removeHostListener(Host host,
                               HostListener application)
Signifies that the given HostListener object does not wish to be notified any more if the given host is online.

Parameters:
host - The host
application - The object not to be notified any more

removeHostListenerSecID

public void removeHostListenerSecID(java.lang.Object secID,
                                    HostListener application)
Signifies that the given HostListener object does not wish to be notified any more if the given host is online.

Parameters:
secID - The host, identified (NOT uniquely) by its secondary ID
application - The object not to be notified any more

removeHostListenerPrimID

public void removeHostListenerPrimID(java.lang.Object primID,
                                     HostListener application)
Signifies that the given HostListener object does not wish to be notified any more if the given host is online.

Parameters:
primID - The host, identified by its primaryID
application - The object not to be notified any more

getPrimaryID

public java.lang.Object getPrimaryID()

getSecondaryID

public java.lang.Object getSecondaryID()