net.ponder2.comms
Class TransmitterImpl

java.lang.Object
  extended by net.ponder2.comms.TransmitterImpl
All Implemented Interfaces:
Transmitter

public abstract class TransmitterImpl
extends java.lang.Object
implements Transmitter

Describes the methods that all Ponder2 comms protocols for inter-SMC communication must supply

Version:
$Id:$
Author:
Kevin Twidle

Constructor Summary
TransmitterImpl()
           
 
Method Summary
 Transmitter connect(java.net.URI address)
          creates and connects a Transmitter to a remote location.
abstract  P2Object execute(java.net.URI address, OID target, P2Object source, java.lang.String op, P2Object[] args)
          executes commands at a remote managed object
protected  java.lang.String execute(java.net.URI address, java.lang.String xmlString)
          Executes a command remotely
protected  com.twicom.qdparser.TaggedElement execute(java.net.URI address, com.twicom.qdparser.TaggedElement xml)
          Executes a command remotely
protected  P2Object executeString(java.net.URI address, OID target, P2Object source, java.lang.String op, P2Object[] args)
          executes commands at a remote managed object.
protected  P2Object executeXml(java.net.URI address, OID target, P2Object source, java.lang.String op, P2Object[] args)
          executes commands at a remote managed object.
abstract  P2Object getObject(java.net.URI address, java.lang.String path)
          gets a managed object from a remote SMC
protected  P2Object getObjectString(java.net.URI address, java.lang.String path)
          gets a managed object from a remote SMC using XML as a string for the communications
protected  P2Object getObjectXml(java.net.URI address, java.lang.String path)
          gets a managed object from a remote SMC using XML for the communications
 boolean ping(java.net.URI address)
          Checks to see if the remote service is up and running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransmitterImpl

public TransmitterImpl()
Method Detail

connect

public Transmitter connect(java.net.URI address)
                    throws Ponder2RemoteException
creates and connects a Transmitter to a remote location. This is called once every time a new remote address is brought into play. If the location is important to the Transmitter i.e. a permanent channel is opened then a new instance of transmitter should be created. If the remote location does not matter then only one instance of the Transmitter need be created and this method can return itself.

Specified by:
connect in interface Transmitter
Parameters:
address - the location that this protocol is to be connected to
Returns:
a new communications protocol connected to the appropriate place or null if it fails
Throws:
Ponder2RemoteException

ping

public boolean ping(java.net.URI address)
Checks to see if the remote service is up and running. Returns true or false.

Specified by:
ping in interface Transmitter
Parameters:
address - the address of the remote service
Returns:
true if the service is running

getObject

public abstract P2Object getObject(java.net.URI address,
                                   java.lang.String path)
                            throws Ponder2Exception
gets a managed object from a remote SMC

Specified by:
getObject in interface Transmitter
Parameters:
address - the address of the remote SMC
path - the full path name of the remote managed object
Returns:
the requested Ponder2 object
Throws:
Ponder2Exception

getObjectXml

protected final P2Object getObjectXml(java.net.URI address,
                                      java.lang.String path)
                               throws Ponder2Exception
gets a managed object from a remote SMC using XML for the communications

Parameters:
address - the address of the remote SMC
path - the full path name of the remote managed object
Returns:
the requested Ponder2 object
Throws:
Ponder2Exception

getObjectString

protected final P2Object getObjectString(java.net.URI address,
                                         java.lang.String path)
                                  throws Ponder2Exception
gets a managed object from a remote SMC using XML as a string for the communications

Parameters:
address - the address of the remote SMC
path - the full path name of the remote managed object
Returns:
the requested Ponder2 object
Throws:
Ponder2Exception

execute

public abstract P2Object execute(java.net.URI address,
                                 OID target,
                                 P2Object source,
                                 java.lang.String op,
                                 P2Object[] args)
                          throws Ponder2Exception
executes commands at a remote managed object

Specified by:
execute in interface Transmitter
Parameters:
address - the address of the remote SMC
target - the remote object's OID
source - the originator of the operation
op - the operation to be performed
args - the arguments for the operation
Returns:
the result of the operation
Throws:
Ponder2Exception

executeXml

protected final P2Object executeXml(java.net.URI address,
                                    OID target,
                                    P2Object source,
                                    java.lang.String op,
                                    P2Object[] args)
                             throws Ponder2Exception
executes commands at a remote managed object. All the information is rolled into an XML structure which is passed to the remote site

Parameters:
address - the address of the remote SMC
target - the remote object's OID
source - the originator of the operation
op - the operation to be performed
args - the arguments for the operation
Returns:
the result of the operation
Throws:
Ponder2Exception

executeString

protected final P2Object executeString(java.net.URI address,
                                       OID target,
                                       P2Object source,
                                       java.lang.String op,
                                       P2Object[] args)
                                throws Ponder2Exception
executes commands at a remote managed object. All the information is rolled into an XML structure which is passed to the remote site as a string

Parameters:
address - the address of the remote SMC
target - the remote object's OID
source - the originator of the operation
op - the operation to be performed
args - the arguments for the operation
Returns:
the result of the operation
Throws:
Ponder2Exception

execute

protected com.twicom.qdparser.TaggedElement execute(java.net.URI address,
                                                    com.twicom.qdparser.TaggedElement xml)
                                             throws Ponder2Exception
Executes a command remotely

Parameters:
address - the address of the remote SMC
xml - all the required arguments rolled into an XML structure
Returns:
the object returned after executing the xmlString
Throws:
Ponder2Exception

execute

protected java.lang.String execute(java.net.URI address,
                                   java.lang.String xmlString)
                            throws Ponder2Exception
Executes a command remotely

Parameters:
address - the address of the remote SMC
xmlString - all the required arguments rolled into an XML structure expressed as a string
Returns:
the object returned after executing the xmlString
Throws:
Ponder2Exception


Copyright © 2008 Imperial College. All Rights Reserved.