org.mbari.siam.operations.utils
Class NodeProxy

java.lang.Object
  extended by org.mbari.siam.operations.utils.NodeProxy

public class NodeProxy
extends java.lang.Object

Uses Socket I/O instead of RMI to talk to Node. Requires NodeServer on Node side to act as its peer.

Author:
Bob Herlien

Constructor Summary
NodeProxy()
           
 
Method Summary
protected  void checkReturn(java.lang.Object obj, java.lang.Class cl)
           
 boolean connectNode(java.net.InetAddress inAddr)
          Connect to the Node Server.
 void disconnectNode()
          Disconnect from the Node Server
 int establishLease(long leaseMillisec)
          Request a lease of the Node's comms medium
protected  java.lang.Object getAndCheckRemoteObject(java.lang.String cmd, java.lang.Class cl)
           
 DevicePacketSet getDevicePackets(long sensorID, long startTime, long endTime)
          Get DevicePacket objects, from specified sensor, within specified time window.
 long getId()
          Unique identifier for Node instance
 byte[] getName()
          Name of Node service class.
 Port[] getPorts()
          Get array of Node's Port objects.
protected  long getRemoteLong(java.lang.String cmd)
          Internal function to send string and return Long
protected  java.lang.Object getRemoteObject(java.lang.String cmd)
          Internal function to send string and return Object
 java.net.InetAddress host()
          Return InetAddress of device service host.
 boolean nodeConnected()
          Returns true if portal currently has "live" connection to remote node.
 void renewLease(int leaseID, long leaseMillisec)
          Renew a lease with the Node's comms medium
 void terminateLease(int leaseID)
          Terminate the session with the communications link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeProxy

public NodeProxy()
Method Detail

connectNode

public boolean connectNode(java.net.InetAddress inAddr)
Connect to the Node Server. Return true on success, false on error.


disconnectNode

public void disconnectNode()
Disconnect from the Node Server


nodeConnected

public boolean nodeConnected()
Returns true if portal currently has "live" connection to remote node.


host

public java.net.InetAddress host()
                          throws java.io.IOException
Return InetAddress of device service host.

Throws:
java.io.IOException

getRemoteObject

protected java.lang.Object getRemoteObject(java.lang.String cmd)
                                    throws java.io.IOException
Internal function to send string and return Object

Throws:
java.io.IOException

checkReturn

protected void checkReturn(java.lang.Object obj,
                           java.lang.Class cl)
                    throws java.rmi.UnexpectedException
Throws:
java.rmi.UnexpectedException

getAndCheckRemoteObject

protected java.lang.Object getAndCheckRemoteObject(java.lang.String cmd,
                                                   java.lang.Class cl)
                                            throws java.io.IOException,
                                                   java.rmi.UnexpectedException
Throws:
java.io.IOException
java.rmi.UnexpectedException

getRemoteLong

protected long getRemoteLong(java.lang.String cmd)
                      throws java.io.IOException,
                             java.rmi.UnexpectedException
Internal function to send string and return Long

Throws:
java.io.IOException
java.rmi.UnexpectedException

getName

public byte[] getName()
               throws java.io.IOException,
                      java.rmi.UnexpectedException
Name of Node service class.

Throws:
java.io.IOException
java.rmi.UnexpectedException

getId

public long getId()
           throws java.io.IOException,
                  java.rmi.UnexpectedException
Unique identifier for Node instance

Throws:
java.io.IOException
java.rmi.UnexpectedException

getPorts

public Port[] getPorts()
                throws java.io.IOException,
                       java.rmi.UnexpectedException
Get array of Node's Port objects.

Throws:
java.io.IOException
java.rmi.UnexpectedException

getDevicePackets

public DevicePacketSet getDevicePackets(long sensorID,
                                        long startTime,
                                        long endTime)
                                 throws java.io.IOException,
                                        java.rmi.UnexpectedException,
                                        DeviceNotFound,
                                        NoDataException
Get DevicePacket objects, from specified sensor, within specified time window.

Throws:
java.io.IOException
java.rmi.UnexpectedException
DeviceNotFound
NoDataException

establishLease

public int establishLease(long leaseMillisec)
                   throws java.io.IOException,
                          java.rmi.UnexpectedException,
                          LeaseRefused
Request a lease of the Node's comms medium

Parameters:
leaseMillisec - lease period in milliseconds
Returns:
leaseID for use with renewLease(), terminateLease(). Will always be >= 1.
Throws:
java.io.IOException
java.rmi.UnexpectedException
LeaseRefused

renewLease

public void renewLease(int leaseID,
                       long leaseMillisec)
                throws java.io.IOException,
                       java.rmi.UnexpectedException,
                       LeaseRefused
Renew a lease with the Node's comms medium

Parameters:
leaseID - lease ID returned by establishLease()
leaseMillisec - lease period in milliseconds
Throws:
java.io.IOException
java.rmi.UnexpectedException
LeaseRefused

terminateLease

public void terminateLease(int leaseID)
                    throws java.io.IOException,
                           java.rmi.UnexpectedException
Terminate the session with the communications link.

Parameters:
leaseID - lease ID returned by establishLease()
Throws:
java.io.IOException
java.rmi.UnexpectedException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.