org.mbari.siam.core
Class NodeService

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.mbari.siam.core.NodeService
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, java.util.EventListener, PowerListener, Node, RemoteService
Direct Known Subclasses:
FOCENodeService, MOOSNodeService

public class NodeService
extends java.rmi.server.UnicastRemoteObject
implements Node, PowerListener

NodeService implements the Node interface, and manages multiple Devices (including Instruments).

Author:
Tom O'Reilly
See Also:
Serialized Form

Field Summary
protected  DevicePacketAggregator _aggregator
           
protected  AuxComms _auxComms
           
protected  java.text.SimpleDateFormat _dateFormat
           
protected  long _leaseDuration
           
protected  long _leaseRenewalInterval
           
protected  NetworkManager _networkManager
           
protected  NodeManager _nodeManager
           
protected  NodeProperties _nodeProperties
           
protected  java.net.InetAddress _parentAddr
           
protected  java.lang.String _parentHost
          Name of "parent node" - note that primary surface node's parent is the portal.
protected  PortManager _portManager
           
protected  java.util.Vector _ports
           
protected  java.util.Properties _scratchProperties
           
protected  java.net.InetAddress _surfaceAddr
           
protected  org.mbari.siam.core.NodeService.Turbinator _turbinator
           
protected  PacketFilter[] _typeFilters
           
 java.lang.String _wdtStatus
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.mbari.siam.distributed.Node
SERVER_NAME
 
Constructor Summary
NodeService(PortManager portManager, java.lang.String parentHost)
          Create the NodeService.
 
Method Summary
 void addEventCallback(NodeEventCallback callback)
          Add a RMI node event callback object.
 byte[] addSchedule(byte[] port, byte[] scheduleName, byte[] schedule, boolean overwrite)
          Add Schedule
 void annotate(byte[] annotation)
          Append annotation to node data stream.
 void cpuLease(int requestorID, long when, long howLong)
          Request that the CPU come on at a certain time in the future and/or remain on for a certain duration.
 void enterSafeMode()
          Put node and its devices into "safe" mode.
 void enterSafeMode(long timeoutSec)
           
 int establishLease(long leaseMillisec, byte[] clientNote)
          Request a lease of the primary comms medium.
 int establishLease(long leaseMillisec, byte[] clientNote, boolean usePrimary)
          Request a lease of either the primary or auxillary comms medium
 void exitApplication()
          Shutdown all services and exits the SIAM application.
 void exitApplication(boolean doSafemode, boolean doHalt, boolean enableBackups, boolean doNotify, boolean recursive, int quitDelaySec, int haltDelaySec, java.lang.String msg)
          Shutdown all services and exits the SIAM application.
 void failureDetected(PowerEvent e)
          Action performed when power failure is detected Satisfies PowerListener interface
 Device getDevice(byte[] portName)
          Return Device associated with specified comm port.
 Device getDevice(long deviceID)
          Get specified device service proxy.
 DevicePacketSet getDevicePackets(long deviceID, long startTime, long endTime)
          Get DevicePacket objects, from specified sensor, within specified time window.
 DevicePacketSet getDevicePackets(long deviceID, long startTime, long endTime, int typeMask)
          Get DevicePacket objects, from specified sensor, within specified time window.
 DevicePacketSet getDevicePackets(long sensorId, long startTime, long endTime, int numBytes, int timeout)
          Get DevicePacket objects, from specified sensor, within specified time window.
 DevicePacketSet getDevicePackets(long sensorId, long startTime, long endTime, int numBytes, int typeMask, int timeout)
          Get DevicePacket objects, from specified sensor, within specified time window.
 Device[] getDevices()
          Get all device service proxies.
protected  DeviceService getDeviceService(byte[] portName)
          Return DeviceService associated with specified comm port.
 java.lang.String getDiagnosticsStatusSummary()
          Get the Status Summary from the Diagnostics
 long getId()
          Unique identifier for Node instance
 LeaseDescription[] getLeases(boolean usePrimary)
          Get list of all active leases managed by the node
 Location getLocation()
          Return Location of Node.
 byte[] getMetadata()
          Get Node metadata.
 byte[] getName()
          Returns name of Node's class.
 NetworkManager getNetworkManager()
          Return the NetworkManager
 NodeInfo getNodeInfo()
          Get basic information about node and its subnodes
 PortConfiguration[] getPortConfiguration()
          Get configuration of Node ports.
 byte[] getPortDiagnostics(boolean logPacket)
          Get diagnostics message from device's port and optionally log it.
 Port[] getPorts()
          Get array of Node's Port objects.
 PowerSwitch[] getPowerSwitches()
          Get array of Node's power switches.
 java.util.Vector getProperties()
          Get Vector of node properties; each Vector element consists of byte array with form "key=value".
 RemoteSerialPort getRemoteSerialPort(byte[] portName)
          Return remote serial port to client.
 RemoteSerialPort getRemoteSerialPort(byte[] portName, int timeout)
          Return remote serial port with a timeout milliseconds
 byte[] getSchedule()
          Get Printable Schedule
 byte[] getSchedule(byte[] port, long lookAheadSeconds)
          Get Printable Schedule from one service
 byte[] getSchedule(long lookAheadSeconds)
          Get Printable Schedule
protected  ScheduleOwner getScheduleOwner(byte[] port)
          This returns a ScheduleOwner for the schedule methods.
 byte[] getStatus(boolean logPackets)
          Return byte string with node health/status information.
 Subnode[] getSubnodeObjects()
          Get list of immediate subnodes.
 java.net.InetAddress[] getSubnodes()
          Get list of immediate subnodes.
 java.lang.String getWdtStatus()
           
 java.net.InetAddress host()
          Return InetAddress of node service host.
 void initialize()
          Initialize the Node.
 byte[] instrumentRegistryStatus()
          Get InstrumentRegistry status
 Instrument lookupService(java.lang.String registryName)
          Find an Instrument in the InstrumentRegistry by registryName
 void notifyParent(java.lang.String message)
          Notify parent; send message to parent node log
 void notifyParentLinkConnected()
          Tell the parent that the comms link is up
 void notifyParentLinkDisconnecting(long nextConnectTime)
          Tell the parent that the comms link is being torn down
protected  boolean parentIsPrimary()
          Return true if parent is the surface node
 void ping()
          Just return - indicates service is alive
protected  void pingWDT(NodeSessionInfo sessionInfo)
           
 void powerDownPort(byte[] commPortName)
          Power down a port
 int powerOff()
          Turn device power off to all devices.
 void powerUpPort(byte[] commPortName, int currentLimit)
          power up a port and enable the comms if a service is not already using it
 void quitApplication(int delaySec)
          Exits the SIAM application after specified delay.
 void readLog4jConfig()
          Reload log4j configuration.
 byte[] removeSchedule(byte[] port, byte[] scheduleName)
          Remove Schedule
 void removeSubnode(java.net.InetAddress address)
          Remove specified subnode from list.
 void renewLease(int leaseID, long leaseMillisec)
          Renew a lease with the Node's primary comms medium
 void renewLease(int leaseID, long leaseMillisec, boolean usePrimary)
          Renew a lease with the Node's primary or secondary comms medium
 void resetPortDiagnostics()
          Reset port diagnostics.
 void restartService(byte[] portName)
          Restart service (if any) associated with specified port, initialize service and device.
 void resumeNormalMode()
          Return from "safe" mode; resume normal operations.
 byte[] resumeSchedule(byte[] port, byte[] scheduleName)
          Resume Schedule Entry
 void resumeService(byte[] portName)
          Resume service (if any) associated with specified port.
 byte[] runCommand(byte[] cmd, int timeoutSec)
          Tell node to execute a Linux or shell command.
 void runDiagnostics(java.lang.String note)
          Run diagnostic procedure; called through Parent interface.
 void scanPort(byte[] commPortName)
          Scan specified port, load service.
 void scanPort(byte[] commPortName, byte[] serviceSource)
          Scan specified port, load service.
 void scanPorts()
          Scan all ports, load services.
 void setBackups(int enableBatteries, int enableCapacitors)
          Set battery backups and holdup capacitors in local power system.
 void setProperties(byte[] propertyStrings)
          Set value of specified node service properties.
 void shoreLinkDownCallback(java.lang.String interfaceName, java.lang.String serialName, java.net.InetAddress localAddress, java.net.InetAddress remoteAddress)
          Called when IP link to shore is disconnected
 void shoreLinkUpCallback(java.lang.String interfaceName, java.lang.String serialName, java.net.InetAddress localAddress, java.net.InetAddress remoteAddress)
          Called when IP link to shore is connected
 void shutdown(PowerEvent e)
          Action performed when system is shutting down Satisfies PowerListener interface
 byte[] shutdownDeviceService(byte[] portName)
          Shutdown and remove service from specified port - return human-readable message.
 byte[] shutdownDeviceService(byte[] portName, boolean enterSafeMode)
          Shutdown and remove service from specified port - return human-readable message; optionally put device into 'safe mode' before shutting down service.
 void shutdownServices(java.lang.String[] exclusions)
          Shutdown all services except those of classes indicated Exclusions is a array of Strings representing fully qualified class names or interfaces
 void startComms()
          Start task that periodically schedules comms power
 NodeSessionInfo startSession(boolean renewWDT, byte[] initScript, int scriptTimeoutSec)
          Prepare for telemetry retrieval session.
 boolean summarizing(long deviceID)
          Return true if specified device can supply Summary packets.
 byte[] suspendSchedule(byte[] port, byte[] scheduleName)
          Suspend Schedule Entry
 void suspendService(byte[] portName)
          Suspend service (if any) associated with specified port.
 byte[] syncSchedule(byte[] port, byte[] scheduleName, long delayMillis)
          Synchronize (default) Schedule
 void terminateLease(int leaseID)
          Terminate the session with the primary communications link.
 void terminateLease(int leaseID, boolean usePrimary)
          Terminate the session with the either the primary or auxillary communications link.
 void terminateLease(int leaseID, long nextConnectTime)
          Terminate the session with the communications link.
 int terminateLeases(byte[] noteMatch)
          Terminate all comms leases with notations that match the specified note.
 int test()
          Run Node's self-test routine.
 void writePostExitScript(boolean doHalt, boolean doNotify, java.lang.String msg, int haltDelaySec)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_portManager

protected PortManager _portManager

_parentHost

protected java.lang.String _parentHost
Name of "parent node" - note that primary surface node's parent is the portal.


_parentAddr

protected java.net.InetAddress _parentAddr

_surfaceAddr

protected java.net.InetAddress _surfaceAddr

_nodeProperties

protected NodeProperties _nodeProperties

_scratchProperties

protected java.util.Properties _scratchProperties

_leaseDuration

protected long _leaseDuration

_leaseRenewalInterval

protected long _leaseRenewalInterval

_auxComms

protected AuxComms _auxComms

_dateFormat

protected java.text.SimpleDateFormat _dateFormat

_wdtStatus

public java.lang.String _wdtStatus

_ports

protected java.util.Vector _ports

_networkManager

protected NetworkManager _networkManager

_nodeManager

protected NodeManager _nodeManager

_typeFilters

protected PacketFilter[] _typeFilters

_aggregator

protected DevicePacketAggregator _aggregator

_turbinator

protected org.mbari.siam.core.NodeService.Turbinator _turbinator
Constructor Detail

NodeService

public NodeService(PortManager portManager,
                   java.lang.String parentHost)
            throws java.rmi.RemoteException,
                   MissingPropertyException,
                   InvalidPropertyException,
                   java.io.IOException
Create the NodeService.

Throws:
java.rmi.RemoteException
MissingPropertyException
InvalidPropertyException
java.io.IOException
Method Detail

startComms

public void startComms()
Start task that periodically schedules comms power


host

public java.net.InetAddress host()
                          throws java.net.UnknownHostException
Return InetAddress of node service host.

Specified by:
host in interface Node
Throws:
java.net.UnknownHostException

getName

public final byte[] getName()
Returns name of Node's class.

Specified by:
getName in interface Node

getId

public long getId()
Unique identifier for Node instance

Specified by:
getId in interface Node

initialize

public void initialize()
                throws InitializeException
Initialize the Node.

Specified by:
initialize in interface Node
Throws:
InitializeException

getDevice

public Device getDevice(byte[] portName)
                 throws PortNotFound,
                        DeviceNotFound,
                        java.rmi.RemoteException
Return Device associated with specified comm port.

Specified by:
getDevice in interface Node
Throws:
PortNotFound
DeviceNotFound
java.rmi.RemoteException

getDeviceService

protected DeviceService getDeviceService(byte[] portName)
                                  throws PortNotFound,
                                         DeviceNotFound,
                                         java.rmi.RemoteException
Return DeviceService associated with specified comm port. This method should have protected access to ensure that only local (same JVM) objects can access it.

Throws:
PortNotFound
DeviceNotFound
java.rmi.RemoteException

shutdownDeviceService

public byte[] shutdownDeviceService(byte[] portName)
                             throws PortNotFound,
                                    DeviceNotFound
Shutdown and remove service from specified port - return human-readable message.

Specified by:
shutdownDeviceService in interface Node
Throws:
PortNotFound
DeviceNotFound

shutdownDeviceService

public byte[] shutdownDeviceService(byte[] portName,
                                    boolean enterSafeMode)
                             throws PortNotFound,
                                    DeviceNotFound
Shutdown and remove service from specified port - return human-readable message; optionally put device into 'safe mode' before shutting down service.

Throws:
PortNotFound
DeviceNotFound

getPorts

public Port[] getPorts()
Get array of Node's Port objects.

Specified by:
getPorts in interface Node

runDiagnostics

public void runDiagnostics(java.lang.String note)
                    throws java.lang.Exception
Run diagnostic procedure; called through Parent interface.

Throws:
java.lang.Exception

getDiagnosticsStatusSummary

public java.lang.String getDiagnosticsStatusSummary()
Get the Status Summary from the Diagnostics


getPowerSwitches

public PowerSwitch[] getPowerSwitches()
Get array of Node's power switches.

Specified by:
getPowerSwitches in interface Node

scanPort

public void scanPort(byte[] commPortName)
              throws DeviceNotFound,
                     PortOccupiedException,
                     PortNotFound,
                     java.io.IOException,
                     DuplicateIdException
Scan specified port, load service.

Specified by:
scanPort in interface Node
Throws:
DeviceNotFound
PortOccupiedException
PortNotFound
java.io.IOException
DuplicateIdException

scanPort

public void scanPort(byte[] commPortName,
                     byte[] serviceSource)
              throws DeviceNotFound,
                     PortOccupiedException,
                     PortNotFound,
                     java.io.IOException,
                     DuplicateIdException
Scan specified port, load service.

Specified by:
scanPort in interface Node
Throws:
DeviceNotFound
PortOccupiedException
PortNotFound
java.io.IOException
DuplicateIdException

scanPorts

public void scanPorts()
Scan all ports, load services.

Specified by:
scanPorts in interface Node

powerOff

public int powerOff()
Turn device power off to all devices.

Specified by:
powerOff in interface Node

test

public int test()
Run Node's self-test routine.

Specified by:
test in interface Node

getLocation

public Location getLocation()
                     throws UnknownLocationException
Return Location of Node.

Specified by:
getLocation in interface Node
Throws:
UnknownLocationException

getNetworkManager

public NetworkManager getNetworkManager()
Return the NetworkManager


getMetadata

public byte[] getMetadata()
Get Node metadata.

Specified by:
getMetadata in interface Node

getPortConfiguration

public PortConfiguration[] getPortConfiguration()
Get configuration of Node ports.

Specified by:
getPortConfiguration in interface Node

getDevice

public Device getDevice(long deviceID)
                 throws DeviceNotFound,
                        java.rmi.RemoteException
Get specified device service proxy.

Specified by:
getDevice in interface Node
Throws:
DeviceNotFound
java.rmi.RemoteException

getDevices

public Device[] getDevices()
                    throws java.rmi.RemoteException
Get all device service proxies.

Specified by:
getDevices in interface Node
Throws:
java.rmi.RemoteException

getNodeInfo

public NodeInfo getNodeInfo()
                     throws java.lang.Exception,
                            java.rmi.RemoteException
Get basic information about node and its subnodes

Specified by:
getNodeInfo in interface Node
Throws:
java.lang.Exception
java.rmi.RemoteException

ping

public void ping()
          throws java.rmi.RemoteException
Just return - indicates service is alive

Specified by:
ping in interface RemoteService
Throws:
java.rmi.RemoteException

enterSafeMode

public void enterSafeMode()
                   throws java.rmi.RemoteException,
                          java.lang.Exception
Put node and its devices into "safe" mode.

Specified by:
enterSafeMode in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

enterSafeMode

public void enterSafeMode(long timeoutSec)
                   throws java.rmi.RemoteException,
                          java.lang.Exception
Specified by:
enterSafeMode in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

resumeNormalMode

public void resumeNormalMode()
                      throws java.rmi.RemoteException,
                             java.lang.Exception
Return from "safe" mode; resume normal operations.

Specified by:
resumeNormalMode in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

getDevicePackets

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

Specified by:
getDevicePackets in interface Node
Throws:
java.rmi.RemoteException
DeviceNotFound
NoDataException

getDevicePackets

public DevicePacketSet getDevicePackets(long deviceID,
                                        long startTime,
                                        long endTime,
                                        int typeMask)
                                 throws java.rmi.RemoteException,
                                        DeviceNotFound,
                                        NoDataException
Get DevicePacket objects, from specified sensor, within specified time window.

Specified by:
getDevicePackets in interface Node
Throws:
java.rmi.RemoteException
DeviceNotFound
NoDataException

getDevicePackets

public DevicePacketSet getDevicePackets(long sensorId,
                                        long startTime,
                                        long endTime,
                                        int numBytes,
                                        int timeout)
                                 throws java.rmi.RemoteException,
                                        TimeoutException,
                                        java.lang.IllegalArgumentException,
                                        DeviceNotFound,
                                        NoDataException
Get DevicePacket objects, from specified sensor, within specified time window. Aggregate numBytes bytes. Timeout after timeout milliseconds.

Specified by:
getDevicePackets in interface Node
Throws:
java.rmi.RemoteException
TimeoutException
java.lang.IllegalArgumentException
DeviceNotFound
NoDataException

getDevicePackets

public DevicePacketSet getDevicePackets(long sensorId,
                                        long startTime,
                                        long endTime,
                                        int numBytes,
                                        int typeMask,
                                        int timeout)
                                 throws java.rmi.RemoteException,
                                        TimeoutException,
                                        java.lang.IllegalArgumentException,
                                        DeviceNotFound,
                                        NoDataException
Get DevicePacket objects, from specified sensor, within specified time window. Filter packets on typeMask. Aggregate numBytes bytes. Timeout after timeout milliseconds.

Specified by:
getDevicePackets in interface Node
Throws:
java.rmi.RemoteException
TimeoutException
java.lang.IllegalArgumentException
DeviceNotFound
NoDataException

suspendService

public void suspendService(byte[] portName)
                    throws java.rmi.RemoteException,
                           PortNotFound,
                           DeviceNotFound
Suspend service (if any) associated with specified port.

Specified by:
suspendService in interface Node
Throws:
java.rmi.RemoteException
PortNotFound
DeviceNotFound

resumeService

public void resumeService(byte[] portName)
                   throws java.rmi.RemoteException,
                          PortNotFound,
                          DeviceNotFound
Resume service (if any) associated with specified port.

Specified by:
resumeService in interface Node
Throws:
java.rmi.RemoteException
PortNotFound
DeviceNotFound

restartService

public void restartService(byte[] portName)
                    throws java.rmi.RemoteException,
                           PortNotFound,
                           DeviceNotFound,
                           InitializeException,
                           java.lang.Exception
Restart service (if any) associated with specified port, initialize service and device.

Specified by:
restartService in interface Node
Throws:
java.rmi.RemoteException
PortNotFound
DeviceNotFound
InitializeException
java.lang.Exception

getRemoteSerialPort

public RemoteSerialPort getRemoteSerialPort(byte[] portName)
                                     throws java.rmi.RemoteException,
                                            java.net.UnknownHostException,
                                            PortNotFound,
                                            PortOccupiedException,
                                            java.io.IOException
Return remote serial port to client.

Specified by:
getRemoteSerialPort in interface Node
Throws:
java.rmi.RemoteException
java.net.UnknownHostException
PortNotFound
PortOccupiedException
java.io.IOException

getRemoteSerialPort

public RemoteSerialPort getRemoteSerialPort(byte[] portName,
                                            int timeout)
                                     throws java.rmi.RemoteException,
                                            java.net.UnknownHostException,
                                            PortNotFound,
                                            PortOccupiedException,
                                            RangeException,
                                            java.io.IOException
Return remote serial port with a timeout milliseconds

Specified by:
getRemoteSerialPort in interface Node
Throws:
java.rmi.RemoteException
java.net.UnknownHostException
PortNotFound
PortOccupiedException
RangeException
java.io.IOException

getScheduleOwner

protected ScheduleOwner getScheduleOwner(byte[] port)
                                  throws java.lang.Exception
This returns a ScheduleOwner for the schedule methods. It should retain protected access since the object backing the ScheduleOwner is not a remote stub

Throws:
java.lang.Exception

getSchedule

public byte[] getSchedule()
                   throws java.rmi.RemoteException
Get Printable Schedule

Specified by:
getSchedule in interface Node
Throws:
java.rmi.RemoteException

getSchedule

public byte[] getSchedule(long lookAheadSeconds)
                   throws java.rmi.RemoteException
Get Printable Schedule

Specified by:
getSchedule in interface Node
Throws:
java.rmi.RemoteException

getSchedule

public byte[] getSchedule(byte[] port,
                          long lookAheadSeconds)
                   throws java.rmi.RemoteException
Get Printable Schedule from one service

Specified by:
getSchedule in interface Node
Throws:
java.rmi.RemoteException

addSchedule

public byte[] addSchedule(byte[] port,
                          byte[] scheduleName,
                          byte[] schedule,
                          boolean overwrite)
                   throws java.rmi.RemoteException
Add Schedule

Specified by:
addSchedule in interface Node
Throws:
java.rmi.RemoteException

removeSchedule

public byte[] removeSchedule(byte[] port,
                             byte[] scheduleName)
                      throws java.rmi.RemoteException
Remove Schedule

Specified by:
removeSchedule in interface Node
Throws:
java.rmi.RemoteException

suspendSchedule

public byte[] suspendSchedule(byte[] port,
                              byte[] scheduleName)
                       throws java.rmi.RemoteException
Suspend Schedule Entry

Specified by:
suspendSchedule in interface Node
Throws:
java.rmi.RemoteException

resumeSchedule

public byte[] resumeSchedule(byte[] port,
                             byte[] scheduleName)
                      throws java.rmi.RemoteException
Resume Schedule Entry

Specified by:
resumeSchedule in interface Node
Throws:
java.rmi.RemoteException

syncSchedule

public byte[] syncSchedule(byte[] port,
                           byte[] scheduleName,
                           long delayMillis)
                    throws java.rmi.RemoteException
Synchronize (default) Schedule

Specified by:
syncSchedule in interface Node
Throws:
java.rmi.RemoteException

parentIsPrimary

protected boolean parentIsPrimary()
Return true if parent is the surface node


establishLease

public int establishLease(long leaseMillisec,
                          byte[] clientNote)
                   throws java.rmi.RemoteException,
                          LeaseRefused
Request a lease of the primary comms medium.

Specified by:
establishLease in interface Node
Parameters:
leaseMillisec - lease period in milliseconds
clientNote - note attached by client
Returns:
leaseID for use with renewLease(), terminateLease(). Will always be >= 1.
Throws:
java.rmi.RemoteException
LeaseRefused

establishLease

public int establishLease(long leaseMillisec,
                          byte[] clientNote,
                          boolean usePrimary)
                   throws java.rmi.RemoteException,
                          LeaseRefused
Request a lease of either the primary or auxillary comms medium

Specified by:
establishLease in interface Node
Parameters:
leaseMillisec - lease period in milliseconds
Returns:
leaseID for use with renewLease(), terminateLease()
Throws:
java.rmi.RemoteException
LeaseRefused

renewLease

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

Specified by:
renewLease in interface Node
Parameters:
leaseID - lease ID returned by establishLease()
leaseMillisec - lease period in milliseconds
Throws:
java.rmi.RemoteException
LeaseRefused

renewLease

public void renewLease(int leaseID,
                       long leaseMillisec,
                       boolean usePrimary)
                throws java.rmi.RemoteException,
                       LeaseRefused
Renew a lease with the Node's primary or secondary comms medium

Specified by:
renewLease in interface Node
Parameters:
leaseID - lease ID returned by establishLease()
leaseMillisec - lease period in milliseconds
Throws:
java.rmi.RemoteException
LeaseRefused

terminateLease

public void terminateLease(int leaseID,
                           long nextConnectTime)
                    throws java.rmi.RemoteException,
                           LeaseRefused
Terminate the session with the communications link.

Parameters:
leaseID - lease ID returned by establishLease()
nextConnectTime - Estimated time of next connection
Throws:
java.rmi.RemoteException
LeaseRefused

terminateLease

public void terminateLease(int leaseID)
                    throws java.rmi.RemoteException,
                           LeaseRefused
Terminate the session with the primary communications link.

Specified by:
terminateLease in interface Node
Parameters:
leaseID - lease ID returned by establishLease()
Throws:
java.rmi.RemoteException
LeaseRefused

terminateLease

public void terminateLease(int leaseID,
                           boolean usePrimary)
                    throws java.rmi.RemoteException,
                           LeaseRefused
Terminate the session with the either the primary or auxillary communications link.

Specified by:
terminateLease in interface Node
Parameters:
leaseID - lease ID returned by establishLease()
Throws:
java.rmi.RemoteException
LeaseRefused

terminateLeases

public int terminateLeases(byte[] noteMatch)
                    throws java.rmi.RemoteException,
                           LeaseRefused
Terminate all comms leases with notations that match the specified note. If noteMatch is null, then terminate all leases. Returns the number of leases that were terminated.

Specified by:
terminateLeases in interface Node
Throws:
java.rmi.RemoteException
LeaseRefused

notifyParentLinkConnected

public void notifyParentLinkConnected()
Tell the parent that the comms link is up


notifyParentLinkDisconnecting

public void notifyParentLinkDisconnecting(long nextConnectTime)
Tell the parent that the comms link is being torn down

Parameters:
nextConnectTime - Time we expect to next establish the link (ms since epoch)

cpuLease

public void cpuLease(int requestorID,
                     long when,
                     long howLong)
              throws java.rmi.RemoteException
Request that the CPU come on at a certain time in the future and/or remain on for a certain duration.

Specified by:
cpuLease in interface Node
Parameters:
requestorID - Unique ID (externally assigned) to identify who is requesting the CPU to remain on. Allows for multiple requestors each requesting that the CPU be on.
when - Milliseconds until the requestor needs the CPU on. Use 0 (zero) to request that the CPU remain on starting now.
howLong - Number of milliseconds that the CPU should remain on. Use 0 (zero) to cancel an earlier request.
Throws:
java.rmi.RemoteException

addEventCallback

public void addEventCallback(NodeEventCallback callback)
                      throws java.rmi.RemoteException
Add a RMI node event callback object.

Specified by:
addEventCallback in interface Node
Throws:
java.rmi.RemoteException

getStatus

public byte[] getStatus(boolean logPackets)
Return byte string with node health/status information.

Specified by:
getStatus in interface Node

resetPortDiagnostics

public void resetPortDiagnostics()
                          throws java.rmi.RemoteException
Reset port diagnostics.

Throws:
java.rmi.RemoteException

getPortDiagnostics

public byte[] getPortDiagnostics(boolean logPacket)
                          throws java.rmi.RemoteException
Get diagnostics message from device's port and optionally log it.

Throws:
java.rmi.RemoteException

shutdownServices

public void shutdownServices(java.lang.String[] exclusions)
                      throws java.rmi.RemoteException
Shutdown all services except those of classes indicated Exclusions is a array of Strings representing fully qualified class names or interfaces

Throws:
java.rmi.RemoteException

quitApplication

public void quitApplication(int delaySec)
                     throws java.rmi.RemoteException
Exits the SIAM application after specified delay.

Throws:
java.rmi.RemoteException

notifyParent

public void notifyParent(java.lang.String message)
Notify parent; send message to parent node log


setBackups

public void setBackups(int enableBatteries,
                       int enableCapacitors)
Set battery backups and holdup capacitors in local power system. Finds local serialADC (P2/PowerCan) service and issues binBackup command


writePostExitScript

public void writePostExitScript(boolean doHalt,
                                boolean doNotify,
                                java.lang.String msg,
                                int haltDelaySec)

exitApplication

public void exitApplication(boolean doSafemode,
                            boolean doHalt,
                            boolean enableBackups,
                            boolean doNotify,
                            boolean recursive,
                            int quitDelaySec,
                            int haltDelaySec,
                            java.lang.String msg)
                     throws java.rmi.RemoteException,
                            java.lang.Exception
Shutdown all services and exits the SIAM application. Catch exceptions at each step and log them, but always try to proceed.

Specified by:
exitApplication in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

exitApplication

public void exitApplication()
                     throws java.rmi.RemoteException
Shutdown all services and exits the SIAM application.

Specified by:
exitApplication in interface Node
Throws:
java.rmi.RemoteException

powerUpPort

public void powerUpPort(byte[] commPortName,
                        int currentLimit)
                 throws PortOccupiedException,
                        PortNotFound,
                        RangeException,
                        NotSupportedException
power up a port and enable the comms if a service is not already using it

Specified by:
powerUpPort in interface Node
Throws:
PortOccupiedException
PortNotFound
RangeException
NotSupportedException

powerDownPort

public void powerDownPort(byte[] commPortName)
                   throws PortOccupiedException,
                          PortNotFound
Power down a port

Specified by:
powerDownPort in interface Node
Throws:
PortOccupiedException
PortNotFound

getSubnodes

public java.net.InetAddress[] getSubnodes()
Get list of immediate subnodes.

Specified by:
getSubnodes in interface Node

getSubnodeObjects

public Subnode[] getSubnodeObjects()
Get list of immediate subnodes.

Specified by:
getSubnodeObjects in interface Node

getWdtStatus

public java.lang.String getWdtStatus()

pingWDT

protected void pingWDT(NodeSessionInfo sessionInfo)

startSession

public NodeSessionInfo startSession(boolean renewWDT,
                                    byte[] initScript,
                                    int scriptTimeoutSec)
                             throws java.lang.Exception
Prepare for telemetry retrieval session. This method will throw exception if getId(), getPorts() or getSubnodeObjects() fails.

Specified by:
startSession in interface Node
Throws:
java.lang.Exception

removeSubnode

public void removeSubnode(java.net.InetAddress address)
                   throws java.rmi.RemoteException,
                          java.lang.Exception
Remove specified subnode from list.

Specified by:
removeSubnode in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

getLeases

public LeaseDescription[] getLeases(boolean usePrimary)
Get list of all active leases managed by the node

Specified by:
getLeases in interface Node

getProperties

public java.util.Vector getProperties()
Get Vector of node properties; each Vector element consists of byte array with form "key=value".

Specified by:
getProperties in interface Node

runCommand

public byte[] runCommand(byte[] cmd,
                         int timeoutSec)
                  throws java.rmi.RemoteException,
                         java.io.IOException,
                         TimeoutException
Tell node to execute a Linux or shell command. This method doesn't return unil the command has completed, or until timeoutSec expires. Added 13jan2006, rah

Specified by:
runCommand in interface Node
Throws:
java.rmi.RemoteException
java.io.IOException
TimeoutException

annotate

public void annotate(byte[] annotation)
              throws java.rmi.RemoteException
Append annotation to node data stream.

Specified by:
annotate in interface Node
Throws:
java.rmi.RemoteException

summarizing

public boolean summarizing(long deviceID)
                    throws DeviceNotFound,
                           java.rmi.RemoteException
Return true if specified device can supply Summary packets.

Specified by:
summarizing in interface Node
Throws:
DeviceNotFound
java.rmi.RemoteException

shutdown

public void shutdown(PowerEvent e)
Action performed when system is shutting down Satisfies PowerListener interface

Specified by:
shutdown in interface PowerListener

failureDetected

public void failureDetected(PowerEvent e)
Action performed when power failure is detected Satisfies PowerListener interface

Specified by:
failureDetected in interface PowerListener

setProperties

public final void setProperties(byte[] propertyStrings)
                         throws java.rmi.RemoteException,
                                InvalidPropertyException
Set value of specified node service properties. Input consists of one or more 'key=value' pairs. Each key=value pair is separated from the next pair by newline ('\n').

Specified by:
setProperties in interface Node
Throws:
java.rmi.RemoteException
InvalidPropertyException

shoreLinkUpCallback

public void shoreLinkUpCallback(java.lang.String interfaceName,
                                java.lang.String serialName,
                                java.net.InetAddress localAddress,
                                java.net.InetAddress remoteAddress)
                         throws java.rmi.RemoteException,
                                java.lang.Exception
Called when IP link to shore is connected

Specified by:
shoreLinkUpCallback in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

shoreLinkDownCallback

public void shoreLinkDownCallback(java.lang.String interfaceName,
                                  java.lang.String serialName,
                                  java.net.InetAddress localAddress,
                                  java.net.InetAddress remoteAddress)
                           throws java.rmi.RemoteException,
                                  java.lang.Exception
Called when IP link to shore is disconnected

Specified by:
shoreLinkDownCallback in interface Node
Throws:
java.rmi.RemoteException
java.lang.Exception

lookupService

public Instrument lookupService(java.lang.String registryName)
                         throws java.rmi.RemoteException
Find an Instrument in the InstrumentRegistry by registryName

Specified by:
lookupService in interface Node
Throws:
java.rmi.RemoteException

instrumentRegistryStatus

public byte[] instrumentRegistryStatus()
                                throws java.rmi.RemoteException
Get InstrumentRegistry status

Specified by:
instrumentRegistryStatus in interface Node
Throws:
java.rmi.RemoteException

readLog4jConfig

public void readLog4jConfig()
                     throws java.rmi.RemoteException
Reload log4j configuration. Enables logging configuration to be changed at run time.

Specified by:
readLog4jConfig in interface Node
Throws:
java.rmi.RemoteException


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.