ABLE, Version 1.1b

com.ibm.able
Class AbleObject

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.ibm.able.AbleObject
Direct Known Subclasses:
AbleBeanAdaptor, AbleBeanWrapper, AbleDefaultAgent, AbleExport, AbleFileWatcher, AbleFilter, AbleImport, AbleNaiveBayes, AbleNetwork, AbleRuleSet, FsRuleSet, SampleSensorEffector, SimpleAbleBean

public class AbleObject
extends java.rmi.server.UnicastRemoteObject
implements AbleBean, java.io.Serializable

This class is the default implementation of the AbleBean interface and is the base class for all ABLE objects; in particular, AbleObjects are JavaBeans which are specifically designed to be part of the ABLE framework.

The Able lifecycle is modeled after the FIPA 97 specification. The mapping from states and transitions to methods is as follows:

 STATE       -->  STATE       method name
 ----------------------------------------------------------------------
 UNKNOWN     -->  UNINITIATED 
 UNINITIATED -->  INITIATED   init() or init(Object)
 INITIATED   -->  ACTIVE      startEnabledEventProcessing()
 ACTIVE      -->  SUSPENDED   suspendEnabledEventProcessing()
 SUSPENDED   -->  ACTIVE      resumeEnabledEventProcessing()
 ACTIVE      -->  UNKNOWN     quitEnabledEventProcessing()

 ACTIVE      -->  WAITING     *EventQueue run() loop toggles state
 WAITING     -->  ACTIVE      *EventQueue run() loop toggles state

 ACTIVE      -->  TRANSIT     move() method -- mobile agent not yet supported
 

*EventQueue run() loop state changes do not cause an AbleProperty.ProcessingState event. All other transitions cause an AbleProperty.ProcessingState event.

Version:
$Revision: 1.24 $, $Date: 2000/09/26 15:42:29 $
See Also:
Serialized Form

Field Summary
protected  boolean changed
          "changed" indicates whether the object has been changed since the last time it was saved (serialized) and hence needs to update/reset itself.
protected  java.beans.PropertyChangeSupport chgSupport
          Property change support.
protected  java.lang.String comment
          "comment" provides a place to associate a comment with this object.
protected  boolean dataFlowEnabled
          "dataFlowEnabled" indicates whether this bean should process data in buffers.
protected  java.util.Vector destBufferConnections
          A list of AbleBufferConnection objects that receive output data from this bean.
protected  AbleEventQueue eventQueue
          The event queue is a small, but highly complex yet efficient, object that provides a single asynchronous thread of control for this Able object.
protected  java.lang.String fileName
          The name of the file to which this bean will be written when it is serialized, or the name of the file from which a serialized version of the bean will be read.
protected  java.lang.Object inputBuffer
          "inputBuffer" is initialized to null, but can be used by other objects to provide input data to this bean's process() synchronous method.
protected  java.util.Vector listeners
          A list of AbleEventListener objects that have registered with this bean.
protected  com.ibm.logging.Logger logger
          If "logger" is not null, ABLE base code will use the specified logger's entry(), exit(), text(), and exception() methods to log trace messages, but only if the logger's "isLogging" public instance variable is set to true.
protected  java.lang.String name
          The name of this bean.
protected  java.lang.Object outputBuffer
          "outputBuffer" is initialized to null, but may be set by this bean's synchronous process() method to provide output data to other ABLE objects.
protected  AbleBeanContainer parent
          The AbleBeanContainer, if any, in which this bean resides.
protected  AblePropertyConnectionManager propertyConnectionMgr
          The property connections manager, an ABLE version of a property change listener, is used for propagating property change events.
protected  java.util.Vector sourceBufferConnections
          A list of AbleBufferConnection objects that provide input data to this bean.
protected  AbleState state
          The state of this bean; valid values are defined in the AbleState class.
protected  java.beans.PropertyChangeSupport stateChgSupport
          State change support.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
AbleObject()
          Construct a base AbleObject.
AbleObject(java.lang.String theName)
          Construct a base AbleObject with the specified name.
AbleObject(java.lang.String theName, java.lang.String theComment)
          Construct a base AbleObject with the specified name and comment.
 
Method Summary
 void addAbleEventListener(AbleEventListener theListener)
          Add an event listener to this bean.
 void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Add a destination buffer connection.
 void addPropertyChangeListener(java.beans.PropertyChangeListener theListener)
          Add a property change listener to this bean.
 void addPropertyConnection(AblePropertyConnection thePropertyConnection)
          Add a property connection.
 void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Add a source buffer connection.
 void addStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
          Add a state change listener to this bean.
static java.lang.String Copyright()
          Determine the copyright of this class.
 void dataChanged(java.lang.Object theArg)
          Signal that this bean's internal state has changed by sending an event to all registered listeners.
 void firePropertyChange(java.lang.String thePropertyName, java.lang.Object theOldValue, java.lang.Object theNewValue)
          Fire a property change event for a changed property.
 void flushAbleEventQueue()
           
 java.util.Vector getAbleEventListeners()
          Retrieve a list of all registered Able event listeners.
 int getAbleEventProcessingEnabled()
          Determine whether asynchronous ABLE event processing is enabled or disabled.
 int getAbleEventQueueSize()
          Determine the number of events on the event queue.
 java.lang.Object getBuffer(java.lang.Object theBuffer, int theIndex)
          Get the value of a single element of the specified buffer.
 java.util.Enumeration getBufferContents(java.lang.Object theBuffer)
          Retrieve the contents of the specified buffer as an enumeration.
 java.lang.String getComment()
          Retrieve the comment associated with this bean.
 java.util.Vector getDestBufferConnections()
          Get the list of all destination (output) buffer connections.
 java.lang.String getFileName()
          Retrieve the persistent store file name.
 java.lang.Object getInputBuffer()
          Retrieve a reference to the input buffer.
 java.lang.Object getInputBuffer(int theIndex)
          Get the value of a single element of the input buffer.
 java.lang.String[] getInputBufferAsStringArray()
          Retrieve the contents of the input buffer as an array of strings.
 java.util.Enumeration getInputBufferContents()
          Retrieve the contents of the input buffer as an enumeration.
 com.ibm.logging.Logger getLogger()
          Retrieve the current logger.
 java.lang.String getName()
          Retrieve the name of this bean.
 java.lang.Object getOutputBuffer()
          Retrieve a reference to the output buffer.
 java.lang.Object getOutputBuffer(int theIndex)
          Get the value of a single element of the output buffer.
 java.lang.String[] getOutputBufferAsStringArray()
          Retrieve the contents of the output buffer as an array of strings.
 java.util.Enumeration getOutputBufferContents()
          Retrieve the contents of the output buffer as an enumeration.
 AbleBeanContainer getParent()
          Retrieve the containing parent of this bean.
 AblePropertyConnectionManager getPropertyConnectionManager()
          Retrieve this bean's property connection manager.
 long getSleepTime()
          Retrieve the current sleep time setting.
 java.util.Vector getSourceBufferConnections()
          Get a list of all source (input) buffer connections.
 int getState()
          Retrieve the current state of this bean.
 void handleAbleEvent(AbleEvent theAbleEvent)
           
 boolean hasInputBuffer()
          Check whether this bean has an input buffer.
 boolean hasOutputBuffer()
          Check whether this bean has an output buffer.
 void init()
          Initialize and configure the bean.
 void init(java.lang.Object theArg)
          Initialize and configure the bean, using the specified Object.
 boolean isAbleEventPostingEnabled()
          Determine whether asynchronous ABLE event posting is enabled or disabled.
 boolean isAbleEventProcessingEnabled()
          Determine whether asynchronous ABLE event processing is enabled or disabled.
 boolean isChanged()
          Check to see if the bean has been changed since the last serialization operation.
 boolean isConnectable()
          Check whether this bean supports buffer connections.
 boolean isDataFlowEnabled()
          Check the data flow processing state of the bean.
 boolean isTimerEventProcessingEnabled()
          Determine whether automatic periodic processing is enabled or disabled.
 void notifyAbleEventListeners(AbleEvent theEvent)
          Notify all registered listeners by sending the specified event.
 void process()
          Perform the main, synchronous, standard processing function performed by this bean.
 void processAbleEvent(AbleEvent theAbleEvent)
          Process an Able event synchronously; that is, on the same thread as the caller.
 void processBufferConnections()
          Process all buffer connections.
 void processNoEventProcessingEnabledSituation()
          Process the situation where neither timer nor Able event processing is enabled in the event queue, but the event queue's asynchronus thread of control has been started.
 void processTimerEvent()
          Process a timer expiration event synchronously; that is, on the same thread as the caller.
 void propertyChange(java.beans.PropertyChangeEvent theEvent)
          Handle property change events from objects with which we have registered as a listener.
 void quitAll()
          Stop the all of the bean's asynchronous threads of control.
 void quitEnabledEventProcessing()
          Stop the bean's asynchronous thread of control.
 void removeAbleEventListener(AbleEventListener theListener)
          Remove an event listener from this bean.
 void removeAllAbleEventListeners()
          Remove all listener connections.
 void removeAllBufferConnections()
          Remove all buffer connections.
 void removeAllPropertyConnections()
          Remove all property connections.
 void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Remove a destination buffer connection.
 void removePropertyChangeListener(java.beans.PropertyChangeListener theListener)
          Remove a property change listener from this bean.
 void removePropertyConnection(AblePropertyConnection thePropertyConnection)
          Remove a property connection.
 void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Remove a source buffer connection.
 void removeStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
          Remove a state change listener from this bean.
 void reset()
          Reset this bean to its "initialized" state.
 void restartEnabledEventProcessing()
          Restart the bean's asynchronous thread of control after the bean has moved from one system to another.
 AbleBean restoreFromFile()
          Read a serialized bean from the file named previously by the setFileName() method, or from "untitled.ser" if no file name has been set.
 AbleBean restoreFromFile(java.lang.String theFileName)
          Read a serialized bean from the specified file.
static AbleBean restoreFromSerializedFile(java.lang.String theFileName)
          Read a serialized bean from the specified file.
static AbleBean restoreFromStream(java.io.ObjectInputStream theObjectInputStream)
          Read a serialized bean from the specified object input stream.
 void resumeAll()
          Resume all of the bean's suspended asynchronous threads of control.
 void resumeEnabledEventProcessing()
          Resume the bean's suspended asynchronous thread of control.
 void saveToFile()
          Write a serialized version of this bean to the file named previously by the setFileName() method, or to "untitled.ser" if no file name has been set.
 void saveToFile(java.lang.String theFileName)
          Write a serialized version of this bean to the specified file.
 void setAbleEventProcessingEnabled(int theEnabledFlag)
          Specify whether asynchronous ABLE event processing is enabled or disabled.
 void setChanged(boolean theChangedFlag)
          Set the changed flag.
 void setComment(java.lang.String theComment)
          Set (or change) the comment associated with this bean.
 void setDataFlowEnabled(boolean theDataFlowEnabledState)
          Set the data flow processing state of the bean.
 void setFileName(java.lang.String theFileName)
          Set (or change) the persistent store file name.
 void setInputBuffer(int theIndex, java.lang.Object theObject)
          Set the value of a single element of the input buffer.
 void setInputBuffer(java.lang.Object theInputBuffer)
          Set the input buffer to the specified object.
 void setLogger(com.ibm.logging.Logger theLogger)
          Set a logger into this bean.
 void setName(java.lang.String theName)
          Set (or change) the name of this bean.
 void setOutputBuffer(int theIndex, java.lang.Object theObject)
          Set the value of a single element of the output buffer.
 void setOutputBuffer(java.lang.Object theOutputBuffer)
          Set the output buffer to the specified object.
 void setParent(AbleBeanContainer theParent)
          Set the containing parent of this bean.
 void setSleepTime(long theSleepTime)
          Set the sleep time for the asynchronous timed processing loop.
 void setState(int theState)
          Set the state of this bean.
 void setTimerEventProcessingEnabled(boolean theEnabledFlag)
          Specify whether automatic periodic processing is enabled or disabled.
 boolean sourceConnectionsOK(java.util.Vector theObjectProcessList)
          Check to see if the incoming connections are OK.
 void startEnabledEventProcessing()
          Start the bean's asynchronous thread of control.
 void suspendAll()
          Temporarily suspend all of the bean's asynchronous threads of control.
 void suspendEnabledEventProcessing()
          Temporarily suspend the bean's asynchronous thread of control.
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
 
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, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of this bean. The value is initialized to the empty String ("") and is never expected to be null.
See Also:
setName(String), getName()

comment

protected java.lang.String comment
"comment" provides a place to associate a comment with this object. The value is initialized to the empty String ("") and is never expected to be null.
See Also:
setComment(String), getComment()

changed

protected boolean changed
"changed" indicates whether the object has been changed since the last time it was saved (serialized) and hence needs to update/reset itself. true indicates that the object has been changed, false indicates that it has not. The field is initialized to false.
See Also:
setChanged(boolean), isChanged()

dataFlowEnabled

protected boolean dataFlowEnabled
"dataFlowEnabled" indicates whether this bean should process data in buffers. true indicates that the object should process data in buffers, false indicates that it should not. The field is initialized to false.
See Also:
setDataFlowEnabled(boolean), isDataFlowEnabled()

fileName

protected java.lang.String fileName
The name of the file to which this bean will be written when it is serialized, or the name of the file from which a serialized version of the bean will be read. The field is initialized to "untitled.ser".
See Also:
setFileName(String), getFileName()

logger

protected com.ibm.logging.Logger logger
If "logger" is not null, ABLE base code will use the specified logger's entry(), exit(), text(), and exception() methods to log trace messages, but only if the logger's "isLogging" public instance variable is set to true. It is up to the creator of the logger to set the destination of the messages and otherwise manipulate the logger. This field is initialized to null. Logging will, of course, impact performance.
See Also:
setLogger(Logger), getLogger()

parent

protected AbleBeanContainer parent
The AbleBeanContainer, if any, in which this bean resides. This field is initialized to null.
See Also:
setParent(AbleBeanContainer), getParent()

state

protected AbleState state
The state of this bean; valid values are defined in the AbleState class. This field is initialized to AbleState.Unknown.
See Also:
setState(int), getState(), AbleState

inputBuffer

protected java.lang.Object inputBuffer
"inputBuffer" is initialized to null, but can be used by other objects to provide input data to this bean's process() synchronous method.

Although any Object type may be used as an input buffer, the base ABLE classes expect the buffer to be one of the following types:

If you wish to use another type in a class you are developing, you may need to override some buffer manipulation methods.

See Also:
setInputBuffer(Object), setInputBuffer(int, Object), getInputBuffer(), getInputBuffer(int)

outputBuffer

protected java.lang.Object outputBuffer
"outputBuffer" is initialized to null, but may be set by this bean's synchronous process() method to provide output data to other ABLE objects.
See Also:
setOutputBuffer(Object), setOutputBuffer(int, Object), getOutputBuffer(), getOutputBuffer(int)

sourceBufferConnections

protected java.util.Vector sourceBufferConnections
A list of AbleBufferConnection objects that provide input data to this bean. The field is initialized to a new, empty Vector, and is never expected to be null.
See Also:
addSourceBufferConnection(AbleBufferConnection), removeSourceBufferConnection(AbleBufferConnection), getSourceBufferConnections(), processBufferConnections(), removeAllBufferConnections()

destBufferConnections

protected java.util.Vector destBufferConnections
A list of AbleBufferConnection objects that receive output data from this bean. The field is initialized to a new, empty Vector, and is never expected to be null.
See Also:
addDestBufferConnection(AbleBufferConnection), removeDestBufferConnection(AbleBufferConnection), getDestBufferConnections(), processBufferConnections(), removeAllBufferConnections()

propertyConnectionMgr

protected AblePropertyConnectionManager propertyConnectionMgr
The property connections manager, an ABLE version of a property change listener, is used for propagating property change events. It is registered as a listener with our own internal PropertyChangeSupport object.
See Also:
chgSupport, addPropertyConnection(AblePropertyConnection), removePropertyConnection(AblePropertyConnection), getPropertyConnectionManager()

chgSupport

protected transient java.beans.PropertyChangeSupport chgSupport
Property change support.
See Also:
addPropertyChangeListener(PropertyChangeListener), removePropertyChangeListener(PropertyChangeListener), propertyChange(PropertyChangeEvent)

eventQueue

protected AbleEventQueue eventQueue
The event queue is a small, but highly complex yet efficient, object that provides a single asynchronous thread of control for this Able object. The event queue can provide periodic processing at set intervals, asynchronous event processing, or both. See the class description for complete details.
See Also:
AbleEventQueue, setTimerEventProcessingEnabled(boolean), setAbleEventProcessingEnabled(int), processTimerEvent(), handleAbleEvent(AbleEvent), startEnabledEventProcessing(), flushAbleEventQueue(), getAbleEventQueueSize()

listeners

protected transient java.util.Vector listeners
A list of AbleEventListener objects that have registered with this bean. The field is initialized to a new, empty Vector, and is never expected to be null.

All listeners in the list are notified whenever dataChanged() is called.

See Also:
dataChanged(Object), addAbleEventListener(AbleEventListener), removeAbleEventListener(AbleEventListener), notifyAbleEventListeners(AbleEvent)

stateChgSupport

protected transient java.beans.PropertyChangeSupport stateChgSupport
State change support.

A bean's state can change rapidly and frequently, resulting in many events flying about; not everyone may be interested in these state changes, so regular property change listeners are not notified of state changes; only those that explicitly register as state change listeners are notified.

See Also:
addStateChangeListener(PropertyChangeListener), removeStateChangeListener(PropertyChangeListener)
Constructor Detail

AbleObject

public AbleObject()
           throws java.rmi.RemoteException
Construct a base AbleObject.

A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.

See Also:
chgSupport, propertyConnectionMgr

AbleObject

public AbleObject(java.lang.String theName)
           throws java.rmi.RemoteException
Construct a base AbleObject with the specified name.

A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.

Parameters:
theName - A String containing the name of this bean.

See Also:
name, chgSupport, propertyConnectionMgr

AbleObject

public AbleObject(java.lang.String theName,
                  java.lang.String theComment)
           throws java.rmi.RemoteException
Construct a base AbleObject with the specified name and comment.

A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.

Parameters:
theName - A String containing the name of this bean.

theComment - A String containing a comment for this bean.

See Also:
name, comment, chgSupport, propertyConnectionMgr
Method Detail

restoreFromSerializedFile

public static AbleBean restoreFromSerializedFile(java.lang.String theFileName)
                                          throws java.rmi.RemoteException,
                                                 java.lang.ClassNotFoundException,
                                                 java.io.IOException
Read a serialized bean from the specified file.

Note that a side-effect of this method is that the instance variable "fileName" of the restored bean is changed to the specified file name using the setFileName() method. This is because the original serialized file may have been copied to the file we are reading, so we need to make sure the file name reflects the actual file.

Parameters:
theFileName - The name of the file containing the serialized AbleBean.

Returns:
The de-serialized bean.
Throws:
java.lang.ClassNotFoundException - if any class file is not found
java.io.IOException - on any IO exception

restoreFromStream

public static AbleBean restoreFromStream(java.io.ObjectInputStream theObjectInputStream)
                                  throws java.rmi.RemoteException,
                                         java.lang.ClassNotFoundException,
                                         java.io.IOException
Read a serialized bean from the specified object input stream.

Note that a side-effect of this method is that the "fileName" instance variable of the restored bean is changed to the empty string (""). *Fix* Why is this ?!? Why not "untitled.ser"?_or_leave_it_alone?

Parameters:
theObjectInputStream - The name of the file containing the serialized AbleBean

Returns:
The de-serialized bean
Throws:
java.lang.ClassNotFoundException - if any class file is not found
java.io.IOException - on any IO exception

setName

public void setName(java.lang.String theName)
             throws java.rmi.RemoteException
Set (or change) the name of this bean.

A PropertyChangeEvent is fired.

Specified by:
setName in interface AbleBean
Parameters:
theName - A String containing the new name of this bean. This name replaces the current name.

See Also:
name

getName

public java.lang.String getName()
                         throws java.rmi.RemoteException
Retrieve the name of this bean.
Specified by:
getName in interface AbleBean
Returns:
A String containing the current name of this AbleBean object or the empty string if no name has been set. The value is never expected to be null.
See Also:
name

setComment

public void setComment(java.lang.String theComment)
                throws java.rmi.RemoteException
Set (or change) the comment associated with this bean.

A PropertyChangeEvent is fired.

Specified by:
setComment in interface AbleBean
Parameters:
theComment - A String containing the new comment for this bean. This comment replaces the current comment.

See Also:
comment

getComment

public java.lang.String getComment()
                            throws java.rmi.RemoteException
Retrieve the comment associated with this bean.
Specified by:
getComment in interface AbleBean
Returns:
A String containing the current comment associated with this bean or the empty string if no comment has been set. The value is never expected to be null.
See Also:
comment

setChanged

public void setChanged(boolean theChangedFlag)
                throws java.rmi.RemoteException
Set the changed flag.

A PropertyChangeEvent is fired.

Specified by:
setChanged in interface AbleBean
Parameters:
theChangedFlag - A boolean value specifying whether this bean is to be marked as modified. If true, the bean will be marked as modified; otherwise, the bean will be marked as unmodified;

See Also:
changed

isChanged

public boolean isChanged()
                  throws java.rmi.RemoteException
Check to see if the bean has been changed since the last serialization operation.
Specified by:
isChanged in interface AbleBean
Returns:
true if the bean has been changed since the last save; false otherwise.
See Also:
changed

dataChanged

public void dataChanged(java.lang.Object theArg)
                 throws java.rmi.RemoteException
Signal that this bean's internal state has changed by sending an event to all registered listeners.
Specified by:
dataChanged in interface AbleBean
Parameters:
theArg - An object to be used as the argument of an AbleEvent.


setDataFlowEnabled

public void setDataFlowEnabled(boolean theDataFlowEnabledState)
                        throws java.rmi.RemoteException
Set the data flow processing state of the bean.

A PropertyChangeEvent is fired.

Specified by:
setDataFlowEnabled in interface AbleBean
Parameters:
theDataFlowEnabledState - A boolean indicating whether this bean should process data in buffers. When set to true, this bean will process data in buffers.

See Also:
dataFlowEnabled

isDataFlowEnabled

public boolean isDataFlowEnabled()
                          throws java.rmi.RemoteException
Check the data flow processing state of the bean.
Specified by:
isDataFlowEnabled in interface AbleBean
Returns:
true if the bean will process data in buffers; false otherwise.
See Also:
dataFlowEnabled

setFileName

public void setFileName(java.lang.String theFileName)
                 throws java.rmi.RemoteException
Set (or change) the persistent store file name.

A PropertyChangeEvent is fired.

Specified by:
setFileName in interface AbleBean
Parameters:
theFileName - A String containing the new name of the file to which this bean can be serialized or from which the bean can be de-serialized. This file name replaces the current file name.

See Also:
fileName

getFileName

public java.lang.String getFileName()
                             throws java.rmi.RemoteException
Retrieve the persistent store file name.
Specified by:
getFileName in interface AbleBean
Returns:
A String containing the current name of the file to which this bean can be serialized or from which the bean can be de-serialized. If never explicitly set, the returned name is untitled.ser.
See Also:
fileName

setLogger

public void setLogger(com.ibm.logging.Logger theLogger)
               throws java.rmi.RemoteException
Set a logger into this bean.

If a logger is available and is active, base ABLE code will use it to log trace messages.

A PropertyChangeEvent is fired.

Specified by:
setLogger in interface AbleBean
Parameters:
theLogger - A logger that can be used to trace base ABLE code. The value can be null.

See Also:
logger

getLogger

public com.ibm.logging.Logger getLogger()
                                 throws java.rmi.RemoteException
Retrieve the current logger.
Specified by:
getLogger in interface AbleBean
Returns:
the current logger, or null if no logger has been set.
See Also:
logger

setParent

public void setParent(AbleBeanContainer theParent)
               throws java.rmi.RemoteException
Set the containing parent of this bean.

A PropertyChangeEvent is fired.

Specified by:
setParent in interface AbleBean
Parameters:
theParent - An ABLE bean container object in which this bean currently resides. Note that a bean may only have one parent at any given time, so this new parent completely replaces the current parent.

See Also:
parent

getParent

public AbleBeanContainer getParent()
                            throws java.rmi.RemoteException
Retrieve the containing parent of this bean.
Specified by:
getParent in interface AbleBean
Returns:
An AbleBeanContainer object in which this bean resides or null if no parent has been set.
See Also:
parent

setState

public void setState(int theState)
              throws java.rmi.RemoteException
Set the state of this bean.

A PropertyChangeEvent is fired.

Specified by:
setState in interface AbleBean
Parameters:
theState - An AbleState. value.

See Also:
state

getState

public int getState()
             throws java.rmi.RemoteException
Retrieve the current state of this bean.
Specified by:
getState in interface AbleBean
Returns:
An AbleState. value.
See Also:
state

setInputBuffer

public void setInputBuffer(java.lang.Object theInputBuffer)
                    throws java.rmi.RemoteException
Set the input buffer to the specified object.

No PropertyChangeEvent is fired.

Specified by:
setInputBuffer in interface AbleBean
Parameters:
theInputBuffer - Any object, such as a String[], Vector, Hashtable, and so on, that can act as a buffer of input data. A reference to the object is saved; the object is not cloned. Note that once the input buffer is set, it must not be tampered with while an AbleBean is reading data from it.

See Also:
inputBuffer

getInputBuffer

public java.lang.Object getInputBuffer()
                                throws java.rmi.RemoteException
Retrieve a reference to the input buffer.
Specified by:
getInputBuffer in interface AbleBean
Returns:
A reference to the object that is the current input buffer, or null if no input buffer has been set.
See Also:
inputBuffer

setInputBuffer

public void setInputBuffer(int theIndex,
                           java.lang.Object theObject)
                    throws java.rmi.RemoteException
Set the value of a single element of the input buffer.
Specified by:
setInputBuffer in interface AbleBean
Parameters:
theIndex - the location within the input buffer that is to be set to the specified value.

theObject - the new value of the element at the specified location.

Throws:
java.rmi.RemoteException - if the input buffer does not support indexing.

getInputBuffer

public java.lang.Object getInputBuffer(int theIndex)
                                throws java.rmi.RemoteException
Get the value of a single element of the input buffer.
Specified by:
getInputBuffer in interface AbleBean
Parameters:
theIndex - the location within the input buffer that is to be retrieved.

Throws:
java.rmi.RemoteException - if the input buffer does not support indexing.

hasInputBuffer

public boolean hasInputBuffer()
                       throws java.rmi.RemoteException
Check whether this bean has an input buffer.
Specified by:
hasInputBuffer in interface AbleBean
Returns:
true if the input buffer has been set; that is, the buffer is not null; otherwise false is returned.

getInputBufferAsStringArray

public java.lang.String[] getInputBufferAsStringArray()
                                               throws java.rmi.RemoteException
Retrieve the contents of the input buffer as an array of strings.
Specified by:
getInputBufferAsStringArray in interface AbleBean
Returns:
An array of string values of the input buffer, or null if no input buffer has been set.
Throws:
java.rmi.RemoteException - If the input buffer cannot be converted to an array of string values.

getInputBufferContents

public java.util.Enumeration getInputBufferContents()
                                             throws java.rmi.RemoteException
Retrieve the contents of the input buffer as an enumeration.
Specified by:
getInputBufferContents in interface AbleBean
Returns:
An array of string values of the input buffer, or null if no input buffer has been set.
Throws:
java.rmi.RemoteException - If the input buffer cannot be returned as an enumeration.

setOutputBuffer

public void setOutputBuffer(java.lang.Object theOutputBuffer)
                     throws java.rmi.RemoteException
Set the output buffer to the specified object.

A PropertyChangeEvent is fired.

Specified by:
setOutputBuffer in interface AbleBean
Parameters:
theOutputBuffer - Any object, such as a String[], Vector, Hashtable, and so on, that can act as a buffer of output data. A reference to the object is saved; the object is not cloned. Note that once the output buffer is set, it must not be tampered with while an AbleBean is writing data to it.

See Also:
outputBuffer

getOutputBuffer

public java.lang.Object getOutputBuffer()
                                 throws java.rmi.RemoteException
Retrieve a reference to the output buffer.
Specified by:
getOutputBuffer in interface AbleBean
Returns:
A reference to the object that is the current output buffer, or null if no output buffer has been set.
See Also:
outputBuffer

setOutputBuffer

public void setOutputBuffer(int theIndex,
                            java.lang.Object theObject)
                     throws java.rmi.RemoteException
Set the value of a single element of the output buffer.
Specified by:
setOutputBuffer in interface AbleBean
Parameters:
theIndex - the location within the output buffer that is to be set to the specified value.

theObject - the new value of the element at the specified location.

Throws:
java.rmi.RemoteException - if the output buffer does not support indexing.

getOutputBuffer

public java.lang.Object getOutputBuffer(int theIndex)
                                 throws java.rmi.RemoteException
Get the value of a single element of the output buffer.
Specified by:
getOutputBuffer in interface AbleBean
Parameters:
theIndex - the location within the output buffer that is to be retrieved.

Throws:
java.rmi.RemoteException - if the output buffer does not support indexing.

hasOutputBuffer

public boolean hasOutputBuffer()
                        throws java.rmi.RemoteException
Check whether this bean has an output buffer.
Specified by:
hasOutputBuffer in interface AbleBean
Returns:
true if the output buffer has been set; that is, the buffer is not null; otherwise false is returned.

getOutputBufferAsStringArray

public java.lang.String[] getOutputBufferAsStringArray()
                                                throws java.rmi.RemoteException
Retrieve the contents of the output buffer as an array of strings.
Specified by:
getOutputBufferAsStringArray in interface AbleBean
Returns:
An array of string values of the output buffer, or null if no output buffer has been set.
Throws:
java.rmi.RemoteException - If the output buffer cannot be converted to an array of string values.

getOutputBufferContents

public java.util.Enumeration getOutputBufferContents()
                                              throws java.rmi.RemoteException
Retrieve the contents of the output buffer as an enumeration.
Specified by:
getOutputBufferContents in interface AbleBean
Returns:
An array of string values of the output buffer, or null if no output buffer has been set.
Throws:
java.rmi.RemoteException - If the output buffer cannot be returned as an enumeration.

addSourceBufferConnection

public void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
                               throws java.rmi.RemoteException
Add a source buffer connection.
Specified by:
addSourceBufferConnection in interface AbleBean
Parameters:
theAbleBufferConnection - An AbleBufferConnection object


removeSourceBufferConnection

public void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
                                  throws java.rmi.RemoteException
Remove a source buffer connection.
Specified by:
removeSourceBufferConnection in interface AbleBean
Parameters:
theAbleBufferConnection - An AbleBufferConnection object.


getSourceBufferConnections

public java.util.Vector getSourceBufferConnections()
                                            throws java.rmi.RemoteException
Get a list of all source (input) buffer connections.
Specified by:
getSourceBufferConnections in interface AbleBean
Returns:
A copy of the Vector containing all source buffer connections.

addDestBufferConnection

public void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
                             throws java.rmi.RemoteException
Add a destination buffer connection.
Specified by:
addDestBufferConnection in interface AbleBean
Parameters:
theAbleBufferConnection - An AbleBufferConnection object.


removeDestBufferConnection

public void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
                                throws java.rmi.RemoteException
Remove a destination buffer connection.
Specified by:
removeDestBufferConnection in interface AbleBean
Parameters:
theAbleBufferConnection - An AbleBufferConnection object.


getDestBufferConnections

public java.util.Vector getDestBufferConnections()
                                          throws java.rmi.RemoteException
Get the list of all destination (output) buffer connections.
Specified by:
getDestBufferConnections in interface AbleBean
Returns:
A copy of the Vector containing all destination buffer connections.

isConnectable

public boolean isConnectable()
                      throws java.rmi.RemoteException
Check whether this bean supports buffer connections.

This base implementation always returns true, as all of the base classes support buffers & data flow processing. If you are implementing a bean or agent that does not support data flow processing, or only supports it conditionally, you may want to override this method.

Specified by:
isConnectable in interface AbleBean
Returns:
true if this bean supports buffer connections; false otherwise.

processBufferConnections

public void processBufferConnections()
                              throws java.rmi.RemoteException
Process all buffer connections.

This method moves data from connected source objects to members in this bean (the inputBuffer)

Specified by:
processBufferConnections in interface AbleBean

removeAllBufferConnections

public void removeAllBufferConnections()
                                throws java.rmi.RemoteException
Remove all buffer connections.
Specified by:
removeAllBufferConnections in interface AbleBean

addPropertyConnection

public void addPropertyConnection(AblePropertyConnection thePropertyConnection)
                           throws java.rmi.RemoteException
Add a property connection.
Specified by:
addPropertyConnection in interface AbleBean

removePropertyConnection

public void removePropertyConnection(AblePropertyConnection thePropertyConnection)
                              throws java.rmi.RemoteException
Remove a property connection.
Specified by:
removePropertyConnection in interface AbleBean

removeAllPropertyConnections

public void removeAllPropertyConnections()
                                  throws java.rmi.RemoteException
Remove all property connections.

getPropertyConnectionManager

public AblePropertyConnectionManager getPropertyConnectionManager()
                                                           throws java.rmi.RemoteException
Retrieve this bean's property connection manager.
Specified by:
getPropertyConnectionManager in interface AbleBean
Returns:
The ABLE property connection manager for this bean.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener theListener)
                               throws java.rmi.RemoteException
Add a property change listener to this bean.
Specified by:
addPropertyChangeListener in interface AbleBean
Parameters:
theListener - An object interested in this bean.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener theListener)
                                  throws java.rmi.RemoteException
Remove a property change listener from this bean.
Specified by:
removePropertyChangeListener in interface AbleBean
Parameters:
theListener - The object no longer interested in this bean.


firePropertyChange

public void firePropertyChange(java.lang.String thePropertyName,
                               java.lang.Object theOldValue,
                               java.lang.Object theNewValue)
                        throws java.rmi.RemoteException
Fire a property change event for a changed property.
Parameters:
thePropertyName - The property being changed.
theOldValue - The previous value for the object.
theNewValue - The new value for the object.

See Also:
AbleProperty

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent theEvent)
                    throws java.rmi.RemoteException
Handle property change events from objects with which we have registered as a listener.

This base method has no default implementation.

Note that this method is included because of the AbleBean interface, and not because of a PropertyChangeListener interface! The PropertyChangeListener.propertyChange() method does not support the Remote interface or the throwing of RemoteExceptions. Therefore, AbleBean and AbleObject have their own version of the propertyChange() method, but the objects are not real PropertyChangeListeners.

Also note that the source instance variable in the PropertyChangeEvent is transient, so that if events are sent via RMI, the generating source reference is lost.

Specified by:
propertyChange in interface AbleBean
Parameters:
theEvent - A property change event in which we may be interested.


init

public void init()
          throws java.rmi.RemoteException
Initialize and configure the bean. The bean's state changes from AbleState.Uninitiated to AbleState.Initiated.
Specified by:
init in interface AbleBean
See Also:
startEnabledEventProcessing()

init

public void init(java.lang.Object theArg)
          throws java.rmi.RemoteException
Initialize and configure the bean, using the specified Object. The bean's state changes from AbleState.Uninitiated to AbleState.Initiated.

In this implementation, the argument parameter is ignored!

Specified by:
init in interface AbleBean
Parameters:
theArg - An Object used to initialize the bean.


reset

public void reset()
           throws java.rmi.RemoteException
Reset this bean to its "initialized" state.

This base method has no default implementation.

Specified by:
reset in interface AbleBean

process

public void process()
             throws java.rmi.RemoteException
Perform the main, synchronous, standard processing function performed by this bean. Typically, this function involves taking data from the input buffer, processing the data, creating an output buffer, and placing the processed data into it.

This base method has no default implementation.

Specified by:
process in interface AbleBean
See Also:
inputBuffer, outputBuffer

setSleepTime

public void setSleepTime(long theSleepTime)
Set the sleep time for the asynchronous timed processing loop.

A PropertyChangeEvent is fired.

Specified by:
setSleepTime in interface AbleBean
Parameters:
theSleepTime - The number of milliseconds for which the process is to sleep before it awakes and calls processTimerEvent().

See Also:
processTimerEvent()

getSleepTime

public long getSleepTime()
Retrieve the current sleep time setting.
Specified by:
getSleepTime in interface AbleBean
Returns:
the current sleep time, in milliseconds.

setTimerEventProcessingEnabled

public void setTimerEventProcessingEnabled(boolean theEnabledFlag)
                                    throws java.rmi.RemoteException
Specify whether automatic periodic processing is enabled or disabled. When enabled and the asynchronous thread of control is started, the bean will awaken at periodic intervals as specified in the "sleep time" variable, and call the processTimerEvent() method.

This method can be used before the asynchronous thread of control is started in order to set the bean's initial behavior; the method can also be used while the thread is running to start and stop the behavior.

A PropertyChangeEvent is fired.

Specified by:
setTimerEventProcessingEnabled in interface AbleBean
Parameters:
theEnabledFlag - Specify true if the bean is to awaken every N milliseconds and call processTimerEvent(); specify false if no automatic periodic processing is to take place while the asynchronous thread of control is running.

See Also:
setSleepTime(long), processTimerEvent(), startEnabledEventProcessing()

isTimerEventProcessingEnabled

public boolean isTimerEventProcessingEnabled()
                                      throws java.rmi.RemoteException
Determine whether automatic periodic processing is enabled or disabled.
Specified by:
isTimerEventProcessingEnabled in interface AbleBean
Returns:
true if the bean will awaken every N milliseconds and call processTimerEvent(); false otherwise.

setAbleEventProcessingEnabled

public void setAbleEventProcessingEnabled(int theEnabledFlag)
                                   throws java.rmi.RemoteException,
                                          java.lang.IllegalArgumentException
Specify whether asynchronous ABLE event processing is enabled or disabled. When enabled and the asynchronous thread of control is started, the bean will awaken whenever an asynchronous event is placed on the bean's internal event queue and call the processAbleEvent() method.

This method can be used before the asynchronous thread of control is started in order to set the bean's initial behavior; the method can also be used while the thread is running to start and stop the behavior.

A PropertyChangeEvent is fired.

Specified by:
setAbleEventProcessingEnabled in interface AbleBean
Parameters:
theEnabledFlag - Specify one of the following values:
Able.ProcessingEnabled_PostingEnabled
Able events are taken off of the event queue and processed; Other objects may add additional events to the event queue. the queue grows and shrinks as events come in and are processed.
Able.ProcessingEnabled_PostingDisabled
Able events are taken off of the event queue and processed; Other objects may not add new events to the event queue. the queue shrinks until it is empty.
Able.ProcessingDisabled_PostingEnabled
Able events on the event queue remain there, unprocessed; Other objects may add additional events to the event queue; the queue grows.
Able.ProcessingDisabled_PostingDisabled
Able events on the event queue remain there, unprocessed; Other objects may not add new events to the event queue. the queue neither shrinks nor grows.

Throws:
java.lang.IllegalArgumentException - if the parameter is not a valid value.
See Also:
processAbleEvent(AbleEvent), startEnabledEventProcessing()

getAbleEventProcessingEnabled

public int getAbleEventProcessingEnabled()
                                  throws java.rmi.RemoteException
Determine whether asynchronous ABLE event processing is enabled or disabled.
Specified by:
getAbleEventProcessingEnabled in interface AbleBean
Returns:
one of the following values:
Able.ProcessingEnabled_PostingEnabled
Able events are taken off of the event queue and processed; Other objects may add additional events to the event queue. the queue grows and shrinks as events come in and are processed.
Able.ProcessingEnabled_PostingDisabled
Able events are taken off of the event queue and processed; Other objects may not add new events to the event queue. the queue shrinks until it is empty.
Able.ProcessingDisabled_PostingEnabled
Able events on the event queue remain there, unprocessed; Other objects may add additional events to the event queue; the queue grows.
Able.ProcessingDisabled_PostingDisabled
Able events on the event queue remain there, unprocessed; Other objects may not add new events to the event queue. the queue neither shrinks nor grows.

isAbleEventPostingEnabled

public boolean isAbleEventPostingEnabled()
Determine whether asynchronous ABLE event posting is enabled or disabled.
Returns:
true if Able events are permitted to be placed on the event queue; false otherwise.

isAbleEventProcessingEnabled

public boolean isAbleEventProcessingEnabled()
Determine whether asynchronous ABLE event processing is enabled or disabled.
Returns:
true if Able events are permitted to be taken off of the event queue and processed; false otherwise.

flushAbleEventQueue

public void flushAbleEventQueue()
                         throws java.rmi.RemoteException
Specified by:
flushAbleEventQueue in interface AbleBean

getAbleEventQueueSize

public int getAbleEventQueueSize()
                          throws java.rmi.RemoteException
Determine the number of events on the event queue.

Note that unless both event Posting and event Processing are disabled, the number may be invalid as soon as it is returned.

Specified by:
getAbleEventQueueSize in interface AbleBean
Returns:
The number of events on the queue.

startEnabledEventProcessing

public void startEnabledEventProcessing()
                                 throws java.rmi.RemoteException
Start the bean's asynchronous thread of control. The bean's state changes from AbleState.Initiated to AbleState.Active when the thread begins running.

In this thread, the bean can perform one, both, or none of these actions, depending on what is enabled (see the related method links):

Specified by:
startEnabledEventProcessing in interface AbleBean
See Also:
setTimerEventProcessingEnabled(boolean), setAbleEventProcessingEnabled(int), quitEnabledEventProcessing()

quitEnabledEventProcessing

public void quitEnabledEventProcessing()
                                throws java.rmi.RemoteException
Stop the bean's asynchronous thread of control. The bean's state changes to AbleState.Unknown when the thread stops.

Timer event processing and ABLE event processing cease, but if event Posting is still enabled, events may still be placed on the internal event queue by other processes.

Specified by:
quitEnabledEventProcessing in interface AbleBean
See Also:
startEnabledEventProcessing(), setAbleEventProcessingEnabled(int)

suspendEnabledEventProcessing

public void suspendEnabledEventProcessing()
                                   throws java.rmi.RemoteException
Temporarily suspend the bean's asynchronous thread of control. The bean's state changes to AbleState.Suspended.

Timer event processing and ABLE event processing cease, but if event Posting is still enabled, events may still be placed on the internal event queue by other processes.

Specified by:
suspendEnabledEventProcessing in interface AbleBean
See Also:
resumeEnabledEventProcessing(), setAbleEventProcessingEnabled(int)

resumeEnabledEventProcessing

public void resumeEnabledEventProcessing()
                                  throws java.rmi.RemoteException
Resume the bean's suspended asynchronous thread of control. The bean's state changes from AbleState.Suspended to AbleState.Active.

Timer event processing and ABLE event processing resume if these actions are enabled.

Specified by:
resumeEnabledEventProcessing in interface AbleBean
See Also:
suspendEnabledEventProcessing(), setAbleEventProcessingEnabled(int), setTimerEventProcessingEnabled(boolean)

restartEnabledEventProcessing

public void restartEnabledEventProcessing()
                                   throws java.rmi.RemoteException
Restart the bean's asynchronous thread of control after the bean has moved from one system to another. The bean's state changes from AbleState.Transient to AbleState.Active.

Timer event processing and ABLE event processing resume if these actions are enabled.

Specified by:
restartEnabledEventProcessing in interface AbleBean
See Also:
setAbleEventProcessingEnabled(int), setTimerEventProcessingEnabled(boolean)

quitAll

public void quitAll()
             throws java.rmi.RemoteException
Stop the all of the bean's asynchronous threads of control.

If the bean is a simple AbleBean, this method just calls its quitEnabledEventProcessing() method; if the bean is an AbleBeanContainer, the bean additionally calls the same method on each contained bean.

Specified by:
quitAll in interface AbleBean
See Also:
quitEnabledEventProcessing()

suspendAll

public void suspendAll()
                throws java.rmi.RemoteException
Temporarily suspend all of the bean's asynchronous threads of control.

If the bean is a simple AbleBean, this method just calls its suspendEnabledEventProcessing() method; if the bean is an AbleBeanContainer, the bean additionally calls the same method on each contained bean.

Specified by:
suspendAll in interface AbleBean
See Also:
suspendEnabledEventProcessing()

resumeAll

public void resumeAll()
               throws java.rmi.RemoteException
Resume all of the bean's suspended asynchronous threads of control.

If the bean is a simple AbleBean, this method just calls its resumeEnabledEventProcessing() method; if the bean is an AbleBeanContainer, the bean additionally calls the same method on each contained bean.

Specified by:
resumeAll in interface AbleBean
See Also:
resumeEnabledEventProcessing()

addAbleEventListener

public void addAbleEventListener(AbleEventListener theListener)
                          throws java.rmi.RemoteException
Add an event listener to this bean.
Specified by:
addAbleEventListener in interface AbleBean
Parameters:
theListener - An object interested in this bean.


removeAbleEventListener

public void removeAbleEventListener(AbleEventListener theListener)
                             throws java.rmi.RemoteException
Remove an event listener from this bean.
Specified by:
removeAbleEventListener in interface AbleBean
Parameters:
theListener - The object no longer interested in this bean.


removeAllAbleEventListeners

public void removeAllAbleEventListeners()
                                 throws java.rmi.RemoteException
Remove all listener connections.

notifyAbleEventListeners

public void notifyAbleEventListeners(AbleEvent theEvent)
                              throws java.rmi.RemoteException
Notify all registered listeners by sending the specified event.
Specified by:
notifyAbleEventListeners in interface AbleBean
Parameters:
theEvent - The AbleEvent to be broadcast to all listeners.


getAbleEventListeners

public java.util.Vector getAbleEventListeners()
                                       throws java.rmi.RemoteException
Retrieve a list of all registered Able event listeners.
Specified by:
getAbleEventListeners in interface AbleBean
Returns:
A cloned vector of registered AbleEventListener objects.

addStateChangeListener

public void addStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
                            throws java.rmi.RemoteException
Add a state change listener to this bean.
Parameters:
theStateChangeListener - An object interested in the state changes of this bean.


removeStateChangeListener

public void removeStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
                               throws java.rmi.RemoteException
Remove a state change listener from this bean.
Parameters:
theStateChangeListener - The object no longer interested in the state changes of this bean.


saveToFile

public void saveToFile()
                throws java.rmi.RemoteException,
                       java.io.IOException
Write a serialized version of this bean to the file named previously by the setFileName() method, or to "untitled.ser" if no file name has been set.
Specified by:
saveToFile in interface AbleBean
Throws:
java.io.IOException - on any IO exception
See Also:
fileName, setFileName(String), getFileName()

saveToFile

public void saveToFile(java.lang.String theFileName)
                throws java.rmi.RemoteException,
                       java.io.IOException
Write a serialized version of this bean to the specified file.

Note that a side-effect of this method is that the instance variable "fileName" is changed to the specified file name using the setFileName() method; setFileName() is used so that a property change event will fire.

Specified by:
saveToFile in interface AbleBean
Parameters:
theFileName - The name of the file to write.

Throws:
java.io.IOException - on any IO exception

restoreFromFile

public AbleBean restoreFromFile()
                         throws java.rmi.RemoteException,
                                java.lang.ClassNotFoundException,
                                java.io.IOException
Read a serialized bean from the file named previously by the setFileName() method, or from "untitled.ser" if no file name has been set.
Specified by:
restoreFromFile in interface AbleBean
Returns:
The de-serialized bean
Throws:
java.lang.ClassNotFoundException - if any class file is not found
java.io.IOException - on any IO exception
See Also:
fileName, setFileName(String), getFileName(), saveToFile()

restoreFromFile

public AbleBean restoreFromFile(java.lang.String theFileName)
                         throws java.rmi.RemoteException,
                                java.lang.ClassNotFoundException,
                                java.io.IOException
Read a serialized bean from the specified file.

Note that a side-effect of this method is that the instance variable "fileName" of the restored bean is changed to the specified file name using the setFileName() method. This is because the original serialized file may have been copied to the file we are reading, so we need to make sure the file name reflects the actual file.

Specified by:
restoreFromFile in interface AbleBean
Parameters:
theFileName - The name of the file containing the serialized AbleBean.

Returns:
The de-serialized bean.
Throws:
java.lang.ClassNotFoundException - if any class file is not found
java.io.IOException - on any IO exception

handleAbleEvent

public void handleAbleEvent(AbleEvent theAbleEvent)
                     throws java.rmi.RemoteException

processAbleEvent

public void processAbleEvent(AbleEvent theAbleEvent)
                      throws java.rmi.RemoteException
Process an Able event synchronously; that is, on the same thread as the caller.

This method is called by our AbleEventQueue when the queue gets around to processing an asynchronous event. Note that this method also can be called directly from the handleAbleEvent() method described in the AbleEventListener interface when that method is given a synchronous event to handle.

Our AbleEventQueue "gets around to processing" an event when the following conditions are all true:

In this implementation, "process an Able event" means to obtain from the event itself the name of a method in THIS class and then call that method, passing in any optional arguments, which are also obtained directly from the event. If the invoked method returns an Object, the object is simply ignored, as there is no way to return it to the caller.

Note that the exceptions IllegalAccess, InvocationTarget, NoSuchMethod, and Security are all caught here, so that this method simply returns to the caller with no error indication. If logging is in effect, the exceptions are logged.

Parameters:
theAbleEvent - The event to process.

See Also:
setAbleEventProcessingEnabled(int), startEnabledEventProcessing(), handleAbleEvent(AbleEvent)

processTimerEvent

public void processTimerEvent()
                       throws java.rmi.RemoteException
Process a timer expiration event synchronously; that is, on the same thread as the caller.

This method is called by our AbleEventQueue whenever the following conditions are all true:

This base method has no default implementation.

See Also:
setSleepTime(long), setTimerEventProcessingEnabled(boolean), startEnabledEventProcessing()

processNoEventProcessingEnabledSituation

public void processNoEventProcessingEnabledSituation()
                                              throws java.rmi.RemoteException
Process the situation where neither timer nor Able event processing is enabled in the event queue, but the event queue's asynchronus thread of control has been started.

This method is called by an AbleEventQueue when the queue is neither enabled for timer processing nor Able event processing. When neither type of processing is enabled, the queue is in a tight processing loop, consuming CPU cycles. This method is called so that the event queue's container can do something about the situation or perform some other type of asynchronous processing.

In this implementation, the condition is logged and the event queue's Able event processing is turned on; that, at least, will put the queue's asynchronous thread into a long wait state.


sourceConnectionsOK

public boolean sourceConnectionsOK(java.util.Vector theObjectProcessList)
Check to see if the incoming connections are OK. This method is used to build the "processList" based on the connections between nodes in the graph.
Parameters:
theObjectProcessList - A Vector containing AbleBean objects already on the process list.

Returns:
true if sourceConnections are OK, false if not.

getBuffer

public java.lang.Object getBuffer(java.lang.Object theBuffer,
                                  int theIndex)
                           throws java.rmi.RemoteException
Get the value of a single element of the specified buffer.
Parameters:
theBuffer - the buffer from from which an element is to be retrieved.

theIndex - the location within the specified buffer that is to be retrieved.

Throws:
java.rmi.RemoteException - if the buffer does not support indexing.

getBufferContents

public java.util.Enumeration getBufferContents(java.lang.Object theBuffer)
                                        throws java.rmi.RemoteException
Retrieve the contents of the specified buffer as an enumeration.
Returns:
An array of string values of the specified buffer, or null if no buffer has been set.
Throws:
java.rmi.RemoteException - If the buffer cannot be returned as an enumeration.

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Returns:
A String containing the current contents of the object.
Overrides:
toString in class java.rmi.server.RemoteObject

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'