org.mbari.siam.operations.utils
Class NodeUtility

java.lang.Object
  extended by org.mbari.siam.operations.utils.NodeUtility
Direct Known Subclasses:
BINBackups, ExitApplication, FilterClearer, FilterGetter, FilterSetter, FOCECO2SubsysUtil, KillBIN, Leases, ListNodeSwitches, LogMessage, MonitorStreams, NodeInfoGetter, NodeLinkCallback, NodePropertyGetter, NodePropertySetter, NodeStatus, NormalMode, PacketRetriever, PortLister, PortUtility, PublishToRBNB, ReadLog4jConfig, RenewWDT, SafeMode, ShowRegistry, SubnodeDeleter, SubnodeLister, SubNodes, SwitchBIN400V, WakeupNode

public abstract class NodeUtility
extends java.lang.Object

NodeUtility forms the base class of an "application framework", intended for SIAM RMI client applications. An application can be built by extending NodeUtility and then implementing NodeUtility's virtual methods. Note also that an application which is not a subclass of NodeUtility can use the useful getNodeURL() method, which is public static.

Author:
Tom O'Reilly

Nested Class Summary
 class NodeUtility.InvalidOption
          InvalidOption exception indicates an invalid option was encountered.
 
Field Summary
protected static org.apache.log4j.Logger _log4j
           
protected  Node _node
           
protected  java.lang.String _nodeHost
           
protected  java.lang.String _nodeURL
          URL of node server.
 
Constructor Summary
NodeUtility()
           
 
Method Summary
static java.lang.String getHostName(java.lang.String nodeURL)
          Return the 'hostname' portion of the node's URL.
static java.lang.String getNodeURL(java.lang.String input)
          Return SIAM node URL corresponding to input.
abstract  void printUsage()
          Print application-specific usage message to stdout.
 void processArguments(java.lang.String[] args)
          Process command line options.
 void processArguments(java.lang.String[] args, int requiredArgs)
          Process command line options and specify the minimum number of arguments required.
 void processCustomOption(java.lang.String[] args, int index)
          Process application-specific option.
abstract  void processNode(Node node)
          Do application-specific processing of node.
 int run()
          Get node proxy and do application-defined processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j

_nodeURL

protected java.lang.String _nodeURL
URL of node server.


_nodeHost

protected java.lang.String _nodeHost

_node

protected Node _node
Constructor Detail

NodeUtility

public NodeUtility()
Method Detail

processArguments

public void processArguments(java.lang.String[] args)
Process command line options. The first command line argument is always the node server's URL or hostname.


processArguments

public void processArguments(java.lang.String[] args,
                             int requiredArgs)
Process command line options and specify the minimum number of arguments required. The first command line argument is always the node server's URL or hostname.


getNodeURL

public static final java.lang.String getNodeURL(java.lang.String input)
Return SIAM node URL corresponding to input. Input may already be in URL format, in which case the input is simply returned. Input may also be abbreviated as just a hostname, in which case it is converted a SIAM node RMI URL and returned.


getHostName

public static java.lang.String getHostName(java.lang.String nodeURL)
Return the 'hostname' portion of the node's URL. Note that this is a TOTAL hack, since Java's URL class does not support "rmi" as a valid protocol!!!


run

public int run()
Get node proxy and do application-defined processing.


processCustomOption

public void processCustomOption(java.lang.String[] args,
                                int index)
                         throws NodeUtility.InvalidOption
Process application-specific option.

Throws:
NodeUtility.InvalidOption

processNode

public abstract void processNode(Node node)
                          throws java.lang.Exception
Do application-specific processing of node.

Throws:
java.lang.Exception

printUsage

public abstract void printUsage()
Print application-specific usage message to stdout.



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.