|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.AbleObject
The AbleObject class is the default implementation of the AbleBean interface and is the base class for all ABLE objects. 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:
Initial AbleState | Resulting AbleState | Produced by Method |
UNKNOWN | UNINITIATED | constructor |
UNINITIATED | INITIATED | init() or init(Object) -- asynchronous events not enabled |
UNINITIATED | WAITING | init() or init(Object) -- if asynchronous events enabled |
INITIATED | WAITING | startEnabledEventProcessing() |
WAITING or ACTIVE | SUSPENDED | suspendEnabledEventProcessing() |
SUSPENDED | WAITING | resumeEnabledEventProcessing() |
WAITING or ACTIVE | UNKNOWN | quitEnabledEventProcessing() |
ACTIVE | WAITING | *EventQueue run() loop toggles state |
WAITING | ACTIVE | *EventQueue run() loop toggles state |
WAITING or ACTIVE | TRANSIT | move() method -- mobile agent not yet supported |
stateChgSupport
.
Notification of other transitions are sent to listeners registered with chgSupport
.
Field Summary | |
---|---|
protected boolean |
changed
The "changed" field 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
The "comment" provides a place to associate a description of this object. |
protected boolean |
dataFlowEnabled
The "dataFlowEnabled" field indicates whether this bean should process data in buffers. |
static java.lang.String |
defaultName
The name assigned to a new AbleObject when the empty constructor is used. |
protected java.util.Vector |
destBufferConnections
A list of AbleBufferConnection objects that receive output data from this bean. |
protected AbleEventQueue |
eventQueue
The event queue provides a single asynchronous thread of control for this Able object. |
protected java.lang.String |
fileName
The name of the file where 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
The "inputBuffer" field is initialized to null, but can be used by other objects to provide input data to a bean's process() synchronous method. |
protected java.util.Vector |
listeners
A list of AbleEventListener objects that have registered with this bean. |
protected AbleLogger |
logger
The logger is a default static logger to record locale-specific messages for users and operators. |
protected java.lang.String |
name
The name of this bean. |
protected java.lang.Object |
outputBuffer
The "outputBuffer" field 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 parent, if any, in which this bean resides. |
protected AblePropertyConnectionManager |
propertyConnectionMgr
The property connections manager, a serializable version of a property change listener, is used to propagate 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 as defined in AbleState . |
protected java.beans.PropertyChangeSupport |
stateChgSupport
State change support. |
protected AbleLogger |
trace
The trace field is a default static logger for programmer-use trace messages. |
Constructor Summary | |
---|---|
AbleObject()
Construct a base AbleObject with a default name. |
|
AbleObject(java.lang.String theName)
Construct a base AbleObject with a specified name. |
|
AbleObject(java.lang.String theName,
java.lang.String theComment)
Construct a base AbleObject with a specified name and comment. |
Method Summary | |
---|---|
void |
addAbleEventListener(AbleEventListener theListener)
Adds an event listener to this bean. |
void |
addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
Adds a destination buffer connection. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener theListener)
Add a property change listener to this bean. |
void |
addPropertyConnection(AblePropertyConnection thePropertyConnection)
Adds a property connection. |
void |
addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
Adds 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)
A convenience method to construct and send an asynchronous AbleEvent.DATACHANGED
event to notify any registered listeners that this bean's internal state has
changed. |
void |
firePropertyChange(java.lang.String thePropertyName,
java.lang.Object theOldValue,
java.lang.Object theNewValue)
Fire a PropertyChangeEvent for a changed property. |
void |
flushAbleEventQueue()
Removes all events from the event queue. |
java.util.Vector |
getAbleEventListeners()
Returns a list of all registered listeners. |
int |
getAbleEventProcessingEnabled()
Returns the state of asynchronous ABLE event processing. |
int |
getAbleEventQueueSize()
Returns the number of events on the event queue. |
java.lang.String |
getComment()
Returns the comment associated with this bean. |
java.util.Vector |
getDestBufferConnections()
Returns the list of all destination (output) buffer connections. |
java.lang.String |
getFileName()
Returns the persistent store file name. |
java.lang.Object |
getInputBuffer()
Returns a reference to the input buffer. |
java.lang.Object |
getInputBuffer(int theIndex)
Returns the value of a single element of the input buffer. |
java.lang.String[] |
getInputBufferAsStringArray()
Returns the contents of the input buffer as an array of strings. |
java.util.Enumeration |
getInputBufferContents()
Returns the contents of the input buffer as an enumeration. |
AbleLogger |
getLogger()
Returns the current message logger. |
java.lang.String |
getName()
Returns the name of this bean. |
java.lang.Object |
getOutputBuffer()
Returns a reference to the output buffer. |
java.lang.Object |
getOutputBuffer(int theIndex)
Returns the value of a single element of the output buffer. |
java.lang.String[] |
getOutputBufferAsStringArray()
Returns the contents of the output buffer as an array of Strings. |
java.util.Enumeration |
getOutputBufferContents()
Returns the contents of the output buffer as an enumeration. |
AbleBeanContainer |
getParent()
Returns the containing parent of this bean. |
AblePropertyConnectionManager |
getPropertyConnectionManager()
Returns this bean's property connection manager. |
long |
getSleepTime()
Returns the current sleep time setting. |
java.util.Vector |
getSourceBufferConnections()
Returns a list of all source (input) buffer connections. |
int |
getState()
Returns the current state of this bean. |
AbleLogger |
getTraceLogger()
Returns the current trace logger. |
void |
handleAbleEvent(AbleEvent theAbleEvent)
Handles an Able event. |
boolean |
hasInputBuffer()
Indicates if this bean has an input buffer. |
boolean |
hasOutputBuffer()
Indicates if 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()
Indicates whether asynchronous ABLE event posting is enabled or disabled. |
boolean |
isAbleEventProcessingEnabled()
Indicates whether asynchronous ABLE event processing is enabled or disabled. |
boolean |
isChanged()
Indicates if the bean has been changed since the last serialization operation. |
boolean |
isConnectable()
Indicates if this bean supports buffer connections. |
boolean |
isDataFlowEnabled()
Indicates if the bean will process data in buffers. |
boolean |
isTimerEventProcessingEnabled()
Indicates if automatic periodic processing is enabled or disabled. |
void |
notifyAbleEventListeners(AbleEvent theEvent)
Notify all registered listeners by sending the specified event via their implemented AbleEventListener.handleAbleEvent(AbleEvent) method. |
void |
process()
Performs the main, synchronous, standard processing function performed by this bean. |
java.lang.Object |
process(java.lang.Object theArg)
Perform the main, standard processing function performed by this bean, using the argument Object (usually passed via an AbleEvent). |
void |
processAbleEvent(AbleEvent theAbleEvent)
Processes an Able event synchronously; that is, on the same thread as the caller. |
void |
processBufferConnections()
Processes 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 |
quitAll()
Stop all of the bean's asynchronous threads of control. |
void |
quitEnabledEventProcessing()
Stop the bean's asynchronous thread of control. |
void |
removeAbleEventListener(AbleEventListener theListener)
Removes an event listener from this bean. |
void |
removeAllAbleEventListeners()
Remove all listener connections from this bean. |
void |
removeAllBufferConnections()
Remove all buffer connections whether source or destination. |
void |
removeAllConnections()
Removes all Property, Buffer, and Event connections. |
void |
removeAllPropertyConnections()
Removes 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)
Removes a property connection. |
void |
removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
Removes 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 the default name provided by the implementor. |
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(java.lang.String) method, or to the
default name provided by the implementor. |
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 describing this bean. |
void |
setDataFlowEnabled(boolean theDataFlowEnabledState)
Sets the data flow processing state of the bean. |
void |
setFileName(java.lang.String theFileName)
Sets or changes the persistent store file name. |
void |
setInputBuffer(int theIndex,
java.lang.Object theObject)
Sets the value of a single element of the input buffer. |
void |
setInputBuffer(java.lang.Object theInputBuffer)
Sets the input buffer to the specified object. |
void |
setLogger(AbleLogger theLogger)
Sets the logger to be used for message output. |
void |
setName(java.lang.String theName)
Set or change the name of this bean. |
void |
setOutputBuffer(int theIndex,
java.lang.Object theObject)
Sets the value of a single element of the output buffer. |
void |
setOutputBuffer(java.lang.Object theOutputBuffer)
Sets the output buffer to the specified object. |
void |
setParent(AbleBeanContainer theParent)
Sets the containing parent of this bean. |
void |
setSleepTime(long theSleepTime)
Sets the sleep time interval 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. |
void |
setTraceLogger(AbleLogger theLogger)
Sets a logger to be used for tracing program-level output. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String defaultName
protected java.lang.String name
setName(String)
,
getName()
protected java.lang.String comment
setComment(String)
,
getComment()
protected boolean changed
setChanged(boolean)
,
isChanged()
protected boolean dataFlowEnabled
setDataFlowEnabled(boolean)
,
isDataFlowEnabled()
protected java.lang.String fileName
setFileName(String)
,
getFileName()
protected AbleLogger trace
Able.TraceLog
.
To minimize performance impacts of tracing, any calls to the the
trace field should be bound by if (trace.isLogging())
.
Tracing may be performed for an individual bean, which is
controlled by the methods Able.startBeanTraceLogging(AbleBean)
and
Able.stopBeanTraceLogging(AbleBean)
.AbleTraceLogger
,
setTraceLogger(com.ibm.able.AbleLogger)
,
getTraceLogger()
protected AbleLogger logger
Able.MessageLog
.AbleTraceLogger
,
setLogger(AbleLogger)
,
getLogger()
protected AbleBeanContainer parent
setParent(AbleBeanContainer)
,
getParent()
protected AbleState state
AbleState
.
This field is initialized to AbleState.Unknown
.setState(int)
,
getState()
protected java.lang.Object inputBuffer
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.
setInputBuffer(Object)
,
setInputBuffer(int, Object)
,
getInputBuffer()
,
getInputBuffer(int)
protected java.lang.Object outputBuffer
setOutputBuffer(Object)
,
setOutputBuffer(int, Object)
,
getOutputBuffer()
,
getOutputBuffer(int)
protected java.util.Vector sourceBufferConnections
addSourceBufferConnection(AbleBufferConnection)
,
removeSourceBufferConnection(AbleBufferConnection)
,
getSourceBufferConnections()
,
processBufferConnections()
,
removeAllBufferConnections()
protected java.util.Vector destBufferConnections
addDestBufferConnection(AbleBufferConnection)
,
removeDestBufferConnection(AbleBufferConnection)
,
getDestBufferConnections()
,
processBufferConnections()
,
removeAllBufferConnections()
protected AblePropertyConnectionManager propertyConnectionMgr
chgSupport
object.addPropertyConnection(AblePropertyConnection)
,
removePropertyConnection(AblePropertyConnection)
,
getPropertyConnectionManager()
protected AbleEventQueue eventQueue
AbleEventQueue
protected transient java.util.Vector listeners
addAbleEventListener(AbleEventListener)
,
removeAbleEventListener(AbleEventListener)
,
notifyAbleEventListeners(AbleEvent)
protected transient java.beans.PropertyChangeSupport chgSupport
addPropertyChangeListener(PropertyChangeListener)
,
removePropertyChangeListener(PropertyChangeListener)
,
firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
protected transient java.beans.PropertyChangeSupport stateChgSupport
A bean's state can change rapidly and frequently, particularly when
processing asynchronously.
This results in many state changes between AbleState.Active
and AbleState.Waiting
which may not be of general interest.
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.
addStateChangeListener(PropertyChangeListener)
,
removeStateChangeListener(PropertyChangeListener)
Constructor Detail |
public AbleObject()
A default AblePropertyConnectionManager
object is added to the
internal PropertyChangeSupport object. The state is changed to
AbleState.Uninitiated
.
public AbleObject(java.lang.String theName)
A default AblePropertyConnectionManager
object is added to the
internal PropertyChangeSupport object. The state is changed to
AbleState.Uninitiated
.
theName
- The name
of this bean.public AbleObject(java.lang.String theName, java.lang.String theComment)
AblePropertyConnectionManager
object is added to the
internal PropertyChangeSupport object. The state is changed to
AbleState.Uninitiated
.theName
- The name
of this bean.theComment
- A descriptive comment
for this bean.Method Detail |
public static AbleBean restoreFromSerializedFile(java.lang.String theFileName) throws java.lang.ClassNotFoundException, java.io.IOException
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.
As the original serialized file may have been copied to
the file being read, this ensures the fileName reflects the actual file.
theFileName
- The path and file containing the serialized AbleBean.java.lang.ClassNotFoundException
- If any class file is not found during reserialization.java.io.IOException
- If an IO exception occurs while reading the file.public static AbleBean restoreFromStream(java.io.ObjectInputStream theObjectInputStream) throws java.lang.ClassNotFoundException, java.io.IOException
Note that the
fileName
instance variable is changed to the empty string ("").
theObjectInputStream
- The name of the file containing the serialized AbleBeanjava.lang.ClassNotFoundException
- If any class file is not found during reserialization.java.io.IOException
- If an IO exception occurs while reading the file.public void setName(java.lang.String theName)
name
of this bean. As this value
is used as a key when beans are included in containers or as
listeners, once a bean is initialized, it is
recommended that the name not be changed.
An AbleProperty.Name
PropertyChangeEvent is fired.
setName
in interface AbleBean
theName
- The new name of this bean, replacing any current name.public java.lang.String getName()
AbleBean
getName
in interface AbleBean
com.ibm.able.AbleBean
public void setComment(java.lang.String theComment)
comment
describing this bean.
An AbleProperty.Comment
PropertyChangeEvent is fired.
setComment
in interface AbleBean
theComment
- The new comment for this bean, replacing any current comment.comment
public java.lang.String getComment()
AbleBean
getComment
in interface AbleBean
com.ibm.able.AbleBean
public void setChanged(boolean theChangedFlag)
An AbleProperty.Changed
PropertyChangeEvent is fired.
setChanged
in interface AbleBean
theChangedFlag
- The value indicating 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. Saving or serializing the bean should reset
the change flag to unmodified.changed
public boolean isChanged()
AbleBean
isChanged
in interface AbleBean
com.ibm.able.AbleBean
true
if the bean has been changed since the
last save; false
otherwise.public void dataChanged(java.lang.Object theArg) throws AbleException
AbleEvent.DATACHANGED
event to notify any registered listeners that this bean's internal state has
changed.dataChanged
in interface AbleEventListenerManager
theArg
- An object to be used as the argument of an AbleEvent.AbleException
- If an error occurs.handleAbleEvent(AbleEvent)
,
AbleEvent.AbleEvent(Object,Object)
public void setDataFlowEnabled(boolean theDataFlowEnabledState)
An AbleProperty.DataFlowEnabled
PropertyChangeEvent is fired.
setDataFlowEnabled
in interface AbleDataBufferManager
theDataFlowEnabledState
- Indicates if this bean will process
data in buffers. When set to true, this bean
will be included in its parent's process list.public boolean isDataFlowEnabled()
AbleDataBufferManager
isDataFlowEnabled
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
public void setFileName(java.lang.String theFileName)
AbleProperty.FileName
PropertyChangeEvent is fired.setFileName
in interface AbleSerializable
theFileName
- 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.public java.lang.String getFileName()
AbleSerializable
getFileName
in interface AbleSerializable
com.ibm.able.AbleSerializable
public void setTraceLogger(AbleLogger theLogger)
AbleProperty.Logger
is fired.
If a logger is available and is active, base ABLE code will use it to log trace messages.
setTraceLogger
in interface AbleBean
theLogger
- A logger that can be used to trace base ABLE code. The
value cannot be null.public AbleLogger getTraceLogger()
AbleBean
getTraceLogger
in interface AbleBean
com.ibm.able.AbleBean
public void setLogger(AbleLogger theLogger)
AbleProperty.Logger
is fired.
If a logger is available and is active, it will be used to log translated messages.
setLogger
in interface AbleBean
theLogger
- A logger that can be used to record translated messages. The
value cannot be null.public AbleLogger getLogger()
AbleBean
getLogger
in interface AbleBean
com.ibm.able.AbleBean
public void setParent(AbleBeanContainer theParent)
AbleProperty.Parent
is fired.setParent
in interface AbleBean
theAbleBeanContainer
- 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.public AbleBeanContainer getParent()
AbleBean
getParent
in interface AbleBean
com.ibm.able.AbleBean
public void setState(int theState)
AbleProperty.State
PropertyChangeEvent is fired
through the stateChgSupport
object.setState
in interface AbleBean
theState
- An AbleState.public int getState()
AbleBean
getState
in interface AbleBean
com.ibm.able.AbleBean
AbleState
value.public void setInputBuffer(java.lang.Object theInputBuffer) throws AbleException
setInputBuffer
in interface AbleDataBufferManager
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.
AbleException
- If an error occurs.public java.lang.Object getInputBuffer()
AbleDataBufferManager
getInputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If an error occurs.public void setInputBuffer(int theIndex, java.lang.Object theObject) throws AbleException
AbleDataBufferManager
setInputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
theIndex
- The location in the input buffer to be set
to the specified value.
theObject
- The new value of the element at the specified
location.
AbleException
- If the input buffer does not support indexing.public java.lang.Object getInputBuffer(int theIndex) throws AbleException
AbleDataBufferManager
getInputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
theIndex
- The location to retrieve from the input buffer.
AbleException
- If the input buffer does not support indexing.public boolean hasInputBuffer()
AbleDataBufferManager
hasInputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
public java.lang.String[] getInputBufferAsStringArray() throws AbleException
AbleDataBufferManager
getInputBufferAsStringArray
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If the input buffer cannot be converted to an array of
string values.public java.util.Enumeration getInputBufferContents() throws AbleException
AbleDataBufferManager
getInputBufferContents
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If the input buffer cannot be returned as an
enumeration.public void setOutputBuffer(java.lang.Object theOutputBuffer) throws AbleException
An AbleProperty.OutputBuffer
PropertyChangeEvent is fired.
setOutputBuffer
in interface AbleDataBufferManager
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.
AbleException
- If an error occurs.public java.lang.Object getOutputBuffer()
AbleDataBufferManager
getOutputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If an error occurs.public void setOutputBuffer(int theIndex, java.lang.Object theObject) throws AbleException
AbleDataBufferManager
setOutputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
theIndex
- The location in the output buffer to be set
to the specified value.
theObject
- The new value of the element at the specified
location.
AbleException
- If the output buffer does not support indexing.public java.lang.Object getOutputBuffer(int theIndex) throws AbleException
AbleDataBufferManager
getOutputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
theIndex
- The location in the output buffer to be retrieved.
AbleException
- If the output buffer does not support indexing.public boolean hasOutputBuffer()
AbleDataBufferManager
hasOutputBuffer
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
public java.lang.String[] getOutputBufferAsStringArray() throws AbleException
AbleDataBufferManager
getOutputBufferAsStringArray
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If the output buffer cannot be converted to an array
of String values.public java.util.Enumeration getOutputBufferContents() throws AbleException
AbleDataBufferManager
getOutputBufferContents
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
AbleException
- If the output buffer cannot be returned as an
enumeration.public void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
An AbleProperty.SourceBufferConnections
PropertyChangeEvent is fired.
addSourceBufferConnection
in interface AbleDataBufferManager
theAbleBufferConnection
- An AbleBufferConnection object including a bean whose output buffer
populates this bean's input buffer.public void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
An AbleProperty.SourceBufferConnections
PropertyChangeEvent is fired.
removeSourceBufferConnection
in interface AbleDataBufferManager
theAbleBufferConnection
- The AbleBufferConnection object to be removed.public java.util.Vector getSourceBufferConnections()
AbleDataBufferManager
getSourceBufferConnections
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
public void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
An AbleProperty.DestBufferConnections
PropertyChangeEvent is fired.
addDestBufferConnection
in interface AbleDataBufferManager
theAbleBufferConnection
- An AbleBufferConnection object including a bean whose input
buffer is to be populated from this bean's output buffer.public void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
An AbleProperty.DestBufferConnections
PropertyChangeEvent is fired.
removeDestBufferConnection
in interface AbleDataBufferManager
theAbleBufferConnection
- The AbleBufferConnection object to be removed.public java.util.Vector getDestBufferConnections()
AbleDataBufferManager
getDestBufferConnections
in interface AbleDataBufferManager
com.ibm.able.AbleDataBufferManager
public boolean isConnectable()
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.
isConnectable
in interface AbleDataBufferManager
public void processBufferConnections() throws AbleException
processBufferConnections
in interface AbleDataBufferManager
AbleException
- If an error occurs.public void removeAllConnections() throws AbleException
removeAllConnections
in interface AbleBean
AbleException
- If an error occurs.removeAllAbleEventListeners()
,
removeAllBufferConnections()
,
removeAllPropertyConnections()
public void removeAllBufferConnections()
Both an AbleProperty.SourceBufferConnections
PropertyChangeEvent
and an AbleProperty.DestBufferConnections
PropertyChangeEvent are fired.
removeAllBufferConnections
in interface AbleDataBufferManager
public void addPropertyConnection(AblePropertyConnection thePropertyConnection)
A AbleProperty.DestBufferConnections
is fired.
addPropertyConnection
in interface AblePropertyChangeManager
com.ibm.able.AblePropertyChangeManager
AbleException
- If an error occurs.public void removePropertyConnection(AblePropertyConnection thePropertyConnection) throws AbleException
removePropertyConnection
in interface AblePropertyChangeManager
AbleException
- If an error occurs.public void removeAllPropertyConnections() throws AbleException
removeAllPropertyConnections
in interface AblePropertyChangeManager
AbleException
- If an error occurs.public AblePropertyConnectionManager getPropertyConnectionManager()
AblePropertyChangeManager
getPropertyConnectionManager
in interface AblePropertyChangeManager
com.ibm.able.AblePropertyChangeManager
public void addPropertyChangeListener(java.beans.PropertyChangeListener theListener)
AblePropertyChangeManager
addPropertyChangeListener
in interface AblePropertyChangeManager
com.ibm.able.AblePropertyChangeManager
theListener
- An object interested in this bean's property changes.public void removePropertyChangeListener(java.beans.PropertyChangeListener theListener)
AblePropertyChangeManager
removePropertyChangeListener
in interface AblePropertyChangeManager
com.ibm.able.AblePropertyChangeManager
theListener
- The object no longer interested in this bean's properties.public void firePropertyChange(java.lang.String thePropertyName, java.lang.Object theOldValue, java.lang.Object theNewValue)
thePropertyName
- The property being changed, typically defined in AbleProperty
.theOldValue
- The previous value for the object.theNewValue
- The new value for the object.public void init() throws AbleException
AbleState.Initiated
or
AbleState.Waiting
.
If either the AbleEventProcessing or
TimerEventProcessing flags are enabled, this method calls
startEnabledEventProcessing()
to start a new thread for asynchronous or timer event processing.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
Beans overriding this method should call
super.init()
after any customization and
before returning so that the thread is started if needed
and the PropertyChangeEvent is fired.
init
in interface AbleBean
AbleException
- If an error occurs.startEnabledEventProcessing()
public void init(java.lang.Object theArg) throws AbleException
init()
.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
init
in interface AbleBean
theArg
- An Object used to initialize the bean, typically by
getting parameters of interest, but ignored in this implementatoin.AbleException
- If an error occurs.public void reset() throws AbleException
This base method has no default implementation. It only provides tracing.
reset
in interface AbleBean
AbleException
- If an error occurs.AbleBean.reset()
public void process() throws AbleException
This base method implementation provides tracing only.
process
in interface AbleBean
inputBuffer
,
outputBuffer
,
AbleBean.process()
public java.lang.Object process(java.lang.Object theArg) throws AbleException
process
in interface AbleBean
theArg
- An Object providing data input to the bean.
Note: Only Object[], String[], Vector, and double[] arguments are handled
AbleException
- In the following situations:
inputBuffer
,
outputBuffer
,
AbleBean.process()
public void setSleepTime(long theSleepTime)
An AbleProperty.SleepTime
PropertyChangeEvent is fired.
setSleepTime
in interface AbleEventQueueManager
theSleepTime
- The number of milliseconds for which the process is to
sleep before it awakes and calls
AbleEventQueueProcessor.processTimerEvent()
.processTimerEvent()
public long getSleepTime()
AbleEventQueueManager
getSleepTime
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
public void setTimerEventProcessingEnabled(boolean theEnabledFlag)
sleepTime
, 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.
An AbleProperty.TimerEventProcessingEnabled
PropertyChangeEvent is fired.
setTimerEventProcessingEnabled
in interface AbleEventQueueManager
theEnabledFlag
- Specify true if the bean is to awaken every N
milliseconds and call
AbleEventQueueProcessor.processTimerEvent()
;
specify false if no automatic periodic processing
is to take place while the asynchronous thread of control is
running.setSleepTime(long)
,
processTimerEvent()
,
startEnabledEventProcessing()
public boolean isTimerEventProcessingEnabled()
AbleEventQueueManager
isTimerEventProcessingEnabled
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
public void setAbleEventProcessingEnabled(int theEnabledFlag) throws java.lang.IllegalArgumentException
processAbleEvent(com.ibm.able.AbleEvent)
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.
An AbleProperty.AbleEventProcessingEnabled
PropertyChangeEvent is fired.
setAbleEventProcessingEnabled
in interface AbleEventQueueManager
theEnabledFlag
- Specify one of the following values:
Able.ProcessingEnabled_PostingEnabled
Able.ProcessingEnabled_PostingDisabled
Able.ProcessingDisabled_PostingEnabled
Able.ProcessingDisabled_PostingDisabled
java.lang.IllegalArgumentException
- If the parameter is not a valid value.processAbleEvent(com.ibm.able.AbleEvent)
,
startEnabledEventProcessing()
public int getAbleEventProcessingEnabled()
AbleEventQueueManager
getAbleEventProcessingEnabled
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
Able.ProcessingEnabled_PostingEnabled
Able.ProcessingEnabled_PostingDisabled
Able.ProcessingDisabled_PostingEnabled
Able.ProcessingDisabled_PostingDisabled
public boolean isAbleEventPostingEnabled()
AbleEventQueueManager
isAbleEventPostingEnabled
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
public boolean isAbleEventProcessingEnabled()
AbleEventQueueManager
isAbleEventProcessingEnabled
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
public void flushAbleEventQueue()
AbleEventQueueManager
Note that unless event Posting is disabled before clearing the event queue, new events may arrive on the queue as soon as it has been cleared!
flushAbleEventQueue
in interface AbleEventQueueManager
public int getAbleEventQueueSize()
AbleEventQueueManager
Note that unless both event Posting and event Processing are disabled, the number may be invalid as soon as it is returned.
getAbleEventQueueSize
in interface AbleEventQueueManager
com.ibm.able.AbleEventQueueManager
public void startEnabledEventProcessing()
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
In this thread, the bean can perform one, both, or none of these actions, depending on what is enabled:
AbleEventQueueProcessor.processTimerEvent()
.
AbleEventQueueProcessor.processAbleEvent(com.ibm.able.AbleEvent)
.
AbleState.Waiting
startEnabledEventProcessing
in interface AbleEventQueueManager
setTimerEventProcessingEnabled(boolean)
,
setAbleEventProcessingEnabled(int)
,
quitEnabledEventProcessing()
public void quitEnabledEventProcessing() throws AbleException
AbleState.Unknown
.
This method must be called synchronously; it cannot be called from the asynchronous thread itself.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
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.
quitEnabledEventProcessing
in interface AbleEventQueueManager
AbleException
- If an error occurs.startEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
,
Able.stopBeanTraceLogging(com.ibm.able.AbleBean)
public void suspendEnabledEventProcessing()
AbleState.Unknown
.
This method must be called synchronously; it cannot be called from the asynchronous thread itself.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
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.
suspendEnabledEventProcessing
in interface AbleEventQueueManager
resumeEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
public void resumeEnabledEventProcessing()
AbleState.Waiting
.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
Timer event processing and ABLE event processing resume if these actions are enabled.
resumeEnabledEventProcessing
in interface AbleEventQueueManager
suspendEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
,
setTimerEventProcessingEnabled(boolean)
public void restartEnabledEventProcessing() throws AbleException
AbleState.Waiting
.
An AbleProperty.ProcessingState
PropertyChangeEvent is fired.
Timer event processing and ABLE event processing resume if these actions are enabled.
restartEnabledEventProcessing
in interface AbleEventQueueManager
AbleException
- If an error occurs.setAbleEventProcessingEnabled(int)
,
setTimerEventProcessingEnabled(boolean)
public void quitAll() throws AbleException
AbleBean
AbleState.Unknown
.
If the bean is a simple AbleBean, this method just calls
AbleEventQueueManager.quitEnabledEventProcessing()
.
A bean implementing AbleBeanContainer
should call quitAll
on each bean it contains and accumulate errors from each contained bean.
quitAll
in interface AbleBean
com.ibm.able.AbleBean
AbleException
- If an error occurs.public void suspendAll() throws AbleException
AbleBean
AbleState.Suspended
.
If the bean is a simple AbleBean, this method just calls its
AbleEventQueueManager.suspendEnabledEventProcessing()
method.
A bean implementing AbleBeanContainer
should call this method
on each bean it contains and accumulate errors from each contained bean.
suspendAll
in interface AbleBean
com.ibm.able.AbleBean
AbleException
- If an error occurs.public void resumeAll() throws AbleException
AbleBean
AbleState.Suspended
to
AbleState.Waiting
.
If the bean is a simple AbleBean, this method just calls its
AbleEventQueueManager.resumeEnabledEventProcessing()
method.
A bean implementing AbleBeanContainer
should call this method
on each bean it contains and accumulate errors from each contained bean.
resumeAll
in interface AbleBean
com.ibm.able.AbleBean
AbleException
- If an error occurs.public void addAbleEventListener(AbleEventListener theListener)
An AbleProperty.Listeners
PropertyChangeEvent is fired.
addAbleEventListener
in interface AbleEventListenerManager
theListener
- An object interested in this bean.public void removeAbleEventListener(AbleEventListener theListener)
An AbleProperty.Listeners
PropertyChangeEvent is fired.
removeAbleEventListener
in interface AbleEventListenerManager
theListener
- The object no longer interested in this bean.public void removeAllAbleEventListeners()
A single AbleProperty.Listeners
PropertyChangeEvent is fired
regardless of the quantity of listeners removed.
public void notifyAbleEventListeners(AbleEvent theEvent) throws AbleException
AbleEventListener.handleAbleEvent(AbleEvent)
method.notifyAbleEventListeners
in interface AbleEventListenerManager
theEvent
- The AbleEvent to be broadcast to all listeners. If the event is
asynchronous, an unsuccessful posting will cause an exception.
If the event is synchronous, unsuccessful processing will cause
an exception.
An
- AbleException with the following data members provided:
public java.util.Vector getAbleEventListeners()
getAbleEventListeners
in interface AbleEventListenerManager
public void addStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
theStateChangeListener
- An object interested in the state changes of this bean.public void removeStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener)
theStateChangeListener
- The object no longer interested in the state changes
of this bean.public void saveToFile() throws java.io.IOException
AbleSerializable
AbleSerializable.setFileName(java.lang.String)
method, or to the
default name provided by the implementor.saveToFile
in interface AbleSerializable
com.ibm.able.AbleSerializable
java.io.IOException
- If any error occurs.public void saveToFile(java.lang.String theFileName) throws java.io.IOException
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.
saveToFile
in interface AbleSerializable
theFileName
- The name of the file to write.
java.io.IOException
- If any error occurs.public AbleBean restoreFromFile() throws java.lang.ClassNotFoundException, java.io.IOException
AbleSerializable
restoreFromFile
in interface AbleSerializable
com.ibm.able.AbleSerializable
java.lang.ClassNotFoundException
- If any error occurs.java.io.IOException
- If any error occurs.public AbleBean restoreFromFile(java.lang.String theFileName) throws java.lang.ClassNotFoundException, java.io.IOException
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.
restoreFromFile
in interface AbleSerializable
theFileName
- The name of the file containing the serialized AbleBean.java.lang.ClassNotFoundException
- if any class file is not foundjava.io.IOException
- on any IO exceptionpublic void handleAbleEvent(AbleEvent theAbleEvent) throws AbleException
AbleEventListener
handleAbleEvent
in interface AbleEventListener
com.ibm.able.AbleEventListener
theAbleEvent
- The event to handle.AbleException
- If an error occurs.public void processAbleEvent(AbleEvent theAbleEvent) throws AbleException
This method is called by the AbleEventQueue when an event is removed from the queue for asynchronous processing. 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.
Events posted to the AbleEventQueue are processed 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 any exceptions are caught and logged. If the event is synchronous, the exception is converted to an AbleException and rethrown; if asynchronous, processing continues so that this method simply returns to the caller with no error indication. "Eating" exceptions from asynchronous events allows agents to continue processing asynchronously.
processAbleEvent
in interface AbleEventQueueProcessor
theAbleEvent
- The event to process.AbleException
- If an error occurs.setAbleEventProcessingEnabled(int)
,
startEnabledEventProcessing()
,
handleAbleEvent(AbleEvent)
public void processTimerEvent() throws AbleException
This method is called by the AbleEventQueue whenever the following conditions are all true:
setSleepTime(long)
has expired.
This base method has no default implementation. It provides only tracing.
processTimerEvent
in interface AbleEventQueueProcessor
AbleException
- If an error occurs.public void processNoEventProcessingEnabledSituation()
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 calls this method so that the event queue's container can log the situation and perhaps perform some other specialized processing. Upon return from this method the queue puts itself into a wait state which can only be interrupted by (1) turning either timer event processing or Able event processing on; (2) by suspending the thread by calling suspendEnabledEventProcessing(); or (3) by stopping the thread by calling quitEnabledEventProcessing().
In this implementation, the condition is simply logged and then the queue puts itself into a wait state.
processNoEventProcessingEnabledSituation
in interface AbleEventQueueProcessor
com.ibm.able.AbleEventQueueProcessor
AbleException
- If an error occurs.public boolean sourceConnectionsOK(java.util.Vector theObjectProcessList)
theObjectProcessList
- A Vector containing AbleBean objects already on the
process list.
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |