net.ponder2
Class ExternalManagedObject

java.lang.Object
  extended by net.ponder2.ExternalManagedObject
All Implemented Interfaces:
ManagedObject

public class ExternalManagedObject
extends java.lang.Object
implements ManagedObject

A managed object that represents a remote managed object. It acts as a proxy, rerouting any requests that it receives to the remote object. An external managed object is not imported and used in the normal way, it is automatically instantiated and filled in by the clause when it recognises a remote address.

Version:
$Id:$
Author:
Kevin Twidle

Constructor Summary
ExternalManagedObject(P2Object myP2Object)
          Creates a new external Managed Object that acts as a proxy for the real remote object.
 
Method Summary
static Transmitter getRemote(java.net.URI location)
          gets the protocol code for the given URI.
static boolean hasProtocol(java.lang.String name)
          sees if a protocol has already been loaded
static void loadProtocol(java.lang.String protocol, java.lang.String address, java.net.URI remote)
          Loads a new communications protocol for interworking with other Ponder2 SMCs
protected  P2Object obj_operation(P2Object source, java.lang.String op, P2Object... args)
          All operations are sent to the external Managed Object.
static void registerProtocol(java.lang.String name, Transmitter protocol, java.net.URI address)
          Registers an external protocol so that it can be used as a transport mechanism.
 void setExternalOID(OID externalOID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalManagedObject

public ExternalManagedObject(P2Object myP2Object)
Creates a new external Managed Object that acts as a proxy for the real remote object. The remote protocol is checked to see that it exists and the driver is kept handy for speedy communications. NB This message is used internally by Ponder2.

Method Detail

registerProtocol

public static void registerProtocol(java.lang.String name,
                                    Transmitter protocol,
                                    java.net.URI address)
Registers an external protocol so that it can be used as a transport mechanism. This is called from the install method of the protocol being installed

Parameters:
name - the name of the protocol
protocol - instance of the protocol interface allowing messages to be sent
address - the address of a remote SMC

hasProtocol

public static boolean hasProtocol(java.lang.String name)
sees if a protocol has already been loaded

Parameters:
name - the name of the protocol to be checked
Returns:
true if the protocol has been loaded

getRemote

public static Transmitter getRemote(java.net.URI location)
                             throws Ponder2RemoteException
gets the protocol code for the given URI. if the protocol is not already loaded then it is located and loaded on the fly.

Parameters:
location - the remote address as a URI
Returns:
the comms class for the given protocol
Throws:
Ponder2RemoteException

loadProtocol

public static void loadProtocol(java.lang.String protocol,
                                java.lang.String address,
                                java.net.URI remote)
                         throws Ponder2RemoteException
Loads a new communications protocol for interworking with other Ponder2 SMCs

Parameters:
protocol - protocol name
address - address for others to reach us
remote - remote address that kicked off this request
Throws:
Ponder2RemoteException

setExternalOID

public void setExternalOID(OID externalOID)

obj_operation

protected P2Object obj_operation(P2Object source,
                                 java.lang.String op,
                                 P2Object... args)
                          throws Ponder2Exception
All operations are sent to the external Managed Object. Answers with the answer from the external Managed Object.

Parameters:
op - the operation to be performed
args - an array of the arguments for the operation
Returns:
the result of the operation
Throws:
Ponder2Exception


Copyright © 2008 Imperial College. All Rights Reserved.