|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--com.ibm.able.AbleObject
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 --> UNINITIATEDUNINITIATED --> 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
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 |
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 com.ibm.logging.Logger logger
setLogger(Logger)
,
getLogger()
protected AbleBeanContainer parent
setParent(AbleBeanContainer)
,
getParent()
protected AbleState state
setState(int)
,
getState()
,
AbleState
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
,
addPropertyConnection(AblePropertyConnection)
,
removePropertyConnection(AblePropertyConnection)
,
getPropertyConnectionManager()
protected transient java.beans.PropertyChangeSupport chgSupport
addPropertyChangeListener(PropertyChangeListener)
,
removePropertyChangeListener(PropertyChangeListener)
,
propertyChange(PropertyChangeEvent)
protected AbleEventQueue eventQueue
AbleEventQueue
,
setTimerEventProcessingEnabled(boolean)
,
setAbleEventProcessingEnabled(int)
,
processTimerEvent()
,
handleAbleEvent(AbleEvent)
,
startEnabledEventProcessing()
,
flushAbleEventQueue()
,
getAbleEventQueueSize()
protected transient java.util.Vector listeners
All listeners in the list are notified whenever dataChanged() is called.
dataChanged(Object)
,
addAbleEventListener(AbleEventListener)
,
removeAbleEventListener(AbleEventListener)
,
notifyAbleEventListeners(AbleEvent)
protected transient java.beans.PropertyChangeSupport stateChgSupport
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.
addStateChangeListener(PropertyChangeListener)
,
removeStateChangeListener(PropertyChangeListener)
Constructor Detail |
public AbleObject() throws java.rmi.RemoteException
A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.
chgSupport
,
propertyConnectionMgr
public AbleObject(java.lang.String theName) throws java.rmi.RemoteException
A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.
theName
- A String containing the name of this bean.
name
,
chgSupport
,
propertyConnectionMgr
public AbleObject(java.lang.String theName, java.lang.String theComment) throws java.rmi.RemoteException
A default AblePropertyConnectionMgr object is added to the internal PropertyChangeSupport object. The state is changed to AbleState.Uninitiated.
theName
- A String containing the name of this bean.
theComment
- A String containing a comment for this bean.
name
,
comment
,
chgSupport
,
propertyConnectionMgr
Method Detail |
public static AbleBean restoreFromSerializedFile(java.lang.String theFileName) throws java.rmi.RemoteException, 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.
theFileName
- The name of the file containing the serialized AbleBean.
public static AbleBean restoreFromStream(java.io.ObjectInputStream theObjectInputStream) throws java.rmi.RemoteException, java.lang.ClassNotFoundException, java.io.IOException
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?
theObjectInputStream
- The name of the file containing the serialized AbleBean
public void setName(java.lang.String theName) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
theName
- A String containing the new name of this bean. This
name replaces the current name.
name
public java.lang.String getName() throws java.rmi.RemoteException
name
public void setComment(java.lang.String theComment) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
theComment
- A String containing the new comment for this bean.
This comment replaces the current comment.
comment
public java.lang.String getComment() throws java.rmi.RemoteException
comment
public void setChanged(boolean theChangedFlag) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
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;
changed
public boolean isChanged() throws java.rmi.RemoteException
changed
public void dataChanged(java.lang.Object theArg) throws java.rmi.RemoteException
theArg
- An object to be used as the argument of an AbleEvent.
public void setDataFlowEnabled(boolean theDataFlowEnabledState) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
theDataFlowEnabledState
- A boolean indicating whether this bean should process
data in buffers. When set to true, this bean
will process data in buffers.
dataFlowEnabled
public boolean isDataFlowEnabled() throws java.rmi.RemoteException
dataFlowEnabled
public void setFileName(java.lang.String theFileName) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
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.
fileName
public java.lang.String getFileName() throws java.rmi.RemoteException
fileName
public void setLogger(com.ibm.logging.Logger theLogger) throws java.rmi.RemoteException
If a logger is available and is active, base ABLE code will use it to log trace messages.
A PropertyChangeEvent is fired.
theLogger
- A logger that can be used to trace base ABLE code. The
value can be null.
logger
public com.ibm.logging.Logger getLogger() throws java.rmi.RemoteException
logger
public void setParent(AbleBeanContainer theParent) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
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.
parent
public AbleBeanContainer getParent() throws java.rmi.RemoteException
parent
public void setState(int theState) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
theState
- An AbleState.state
public int getState() throws java.rmi.RemoteException
state
public void setInputBuffer(java.lang.Object theInputBuffer) throws java.rmi.RemoteException
No PropertyChangeEvent is fired.
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.
inputBuffer
public java.lang.Object getInputBuffer() throws java.rmi.RemoteException
inputBuffer
public void setInputBuffer(int theIndex, java.lang.Object theObject) throws java.rmi.RemoteException
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.
public java.lang.Object getInputBuffer(int theIndex) throws java.rmi.RemoteException
theIndex
- the location within the input buffer that is to be
retrieved.
public boolean hasInputBuffer() throws java.rmi.RemoteException
public java.lang.String[] getInputBufferAsStringArray() throws java.rmi.RemoteException
public java.util.Enumeration getInputBufferContents() throws java.rmi.RemoteException
public void setOutputBuffer(java.lang.Object theOutputBuffer) throws java.rmi.RemoteException
A PropertyChangeEvent is fired.
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.
outputBuffer
public java.lang.Object getOutputBuffer() throws java.rmi.RemoteException
outputBuffer
public void setOutputBuffer(int theIndex, java.lang.Object theObject) throws java.rmi.RemoteException
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.
public java.lang.Object getOutputBuffer(int theIndex) throws java.rmi.RemoteException
theIndex
- the location within the output buffer that is to be
retrieved.
public boolean hasOutputBuffer() throws java.rmi.RemoteException
public java.lang.String[] getOutputBufferAsStringArray() throws java.rmi.RemoteException
public java.util.Enumeration getOutputBufferContents() throws java.rmi.RemoteException
public void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection) throws java.rmi.RemoteException
theAbleBufferConnection
- An AbleBufferConnection object
public void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection) throws java.rmi.RemoteException
theAbleBufferConnection
- An AbleBufferConnection object.
public java.util.Vector getSourceBufferConnections() throws java.rmi.RemoteException
public void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection) throws java.rmi.RemoteException
theAbleBufferConnection
- An AbleBufferConnection object.
public void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection) throws java.rmi.RemoteException
theAbleBufferConnection
- An AbleBufferConnection object.
public java.util.Vector getDestBufferConnections() throws java.rmi.RemoteException
public boolean isConnectable() throws java.rmi.RemoteException
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.
public void processBufferConnections() throws java.rmi.RemoteException
This method moves data from connected source objects to members in this bean (the inputBuffer)
public void removeAllBufferConnections() throws java.rmi.RemoteException
public void addPropertyConnection(AblePropertyConnection thePropertyConnection) throws java.rmi.RemoteException
public void removePropertyConnection(AblePropertyConnection thePropertyConnection) throws java.rmi.RemoteException
public void removeAllPropertyConnections() throws java.rmi.RemoteException
public AblePropertyConnectionManager getPropertyConnectionManager() throws java.rmi.RemoteException
public void addPropertyChangeListener(java.beans.PropertyChangeListener theListener) throws java.rmi.RemoteException
theListener
- An object interested in this bean.
public void removePropertyChangeListener(java.beans.PropertyChangeListener theListener) throws java.rmi.RemoteException
theListener
- The object no longer interested in this bean.
public void firePropertyChange(java.lang.String thePropertyName, java.lang.Object theOldValue, java.lang.Object theNewValue) throws java.rmi.RemoteException
thePropertyName
- The property being changed.theOldValue
- The previous value for the object.theNewValue
- The new value for the object.
AbleProperty
public void propertyChange(java.beans.PropertyChangeEvent theEvent) throws java.rmi.RemoteException
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.
theEvent
- A property change event in which we may be interested.
public void init() throws java.rmi.RemoteException
startEnabledEventProcessing()
public void init(java.lang.Object theArg) throws java.rmi.RemoteException
In this implementation, the argument parameter is ignored!
theArg
- An Object used to initialize the bean.
public void reset() throws java.rmi.RemoteException
This base method has no default implementation.
public void process() throws java.rmi.RemoteException
This base method has no default implementation.
inputBuffer
,
outputBuffer
public void setSleepTime(long theSleepTime)
A PropertyChangeEvent is fired.
theSleepTime
- The number of milliseconds for which the process is to
sleep before it awakes and calls processTimerEvent().
processTimerEvent()
public long getSleepTime()
public void setTimerEventProcessingEnabled(boolean theEnabledFlag) throws java.rmi.RemoteException
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.
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.
setSleepTime(long)
,
processTimerEvent()
,
startEnabledEventProcessing()
public boolean isTimerEventProcessingEnabled() throws java.rmi.RemoteException
public void setAbleEventProcessingEnabled(int theEnabledFlag) throws java.rmi.RemoteException, java.lang.IllegalArgumentException
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.
theEnabledFlag
- Specify one of the following values:
processAbleEvent(AbleEvent)
,
startEnabledEventProcessing()
public int getAbleEventProcessingEnabled() throws java.rmi.RemoteException
public boolean isAbleEventPostingEnabled()
public boolean isAbleEventProcessingEnabled()
public void flushAbleEventQueue() throws java.rmi.RemoteException
public int getAbleEventQueueSize() throws java.rmi.RemoteException
Note that unless both event Posting and event Processing are disabled, the number may be invalid as soon as it is returned.
public void startEnabledEventProcessing() throws java.rmi.RemoteException
In this thread, the bean can perform one, both, or none of these actions, depending on what is enabled (see the related method links):
setTimerEventProcessingEnabled(boolean)
,
setAbleEventProcessingEnabled(int)
,
quitEnabledEventProcessing()
public void quitEnabledEventProcessing() throws java.rmi.RemoteException
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.
startEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
public void suspendEnabledEventProcessing() throws java.rmi.RemoteException
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.
resumeEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
public void resumeEnabledEventProcessing() throws java.rmi.RemoteException
Timer event processing and ABLE event processing resume if these actions are enabled.
suspendEnabledEventProcessing()
,
setAbleEventProcessingEnabled(int)
,
setTimerEventProcessingEnabled(boolean)
public void restartEnabledEventProcessing() throws java.rmi.RemoteException
Timer event processing and ABLE event processing resume if these actions are enabled.
setAbleEventProcessingEnabled(int)
,
setTimerEventProcessingEnabled(boolean)
public void quitAll() throws java.rmi.RemoteException
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.
quitEnabledEventProcessing()
public void suspendAll() throws java.rmi.RemoteException
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.
suspendEnabledEventProcessing()
public void resumeAll() throws java.rmi.RemoteException
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.
resumeEnabledEventProcessing()
public void addAbleEventListener(AbleEventListener theListener) throws java.rmi.RemoteException
theListener
- An object interested in this bean.
public void removeAbleEventListener(AbleEventListener theListener) throws java.rmi.RemoteException
theListener
- The object no longer interested in this bean.
public void removeAllAbleEventListeners() throws java.rmi.RemoteException
public void notifyAbleEventListeners(AbleEvent theEvent) throws java.rmi.RemoteException
theEvent
- The AbleEvent to be broadcast to all listeners.
public java.util.Vector getAbleEventListeners() throws java.rmi.RemoteException
public void addStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener) throws java.rmi.RemoteException
theStateChangeListener
- An object interested in the state changes of this bean.
public void removeStateChangeListener(java.beans.PropertyChangeListener theStateChangeListener) throws java.rmi.RemoteException
theStateChangeListener
- The object no longer interested in the state changes
of this bean.
public void saveToFile() throws java.rmi.RemoteException, java.io.IOException
fileName
,
setFileName(String)
,
getFileName()
public void saveToFile(java.lang.String theFileName) throws java.rmi.RemoteException, 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.
theFileName
- The name of the file to write.
public AbleBean restoreFromFile() throws java.rmi.RemoteException, java.lang.ClassNotFoundException, java.io.IOException
fileName
,
setFileName(String)
,
getFileName()
,
saveToFile()
public AbleBean restoreFromFile(java.lang.String theFileName) throws java.rmi.RemoteException, 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.
theFileName
- The name of the file containing the serialized AbleBean.
public void handleAbleEvent(AbleEvent theAbleEvent) throws java.rmi.RemoteException
public void processAbleEvent(AbleEvent theAbleEvent) throws java.rmi.RemoteException
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.
theAbleEvent
- The event to process.
setAbleEventProcessingEnabled(int)
,
startEnabledEventProcessing()
,
handleAbleEvent(AbleEvent)
public void processTimerEvent() throws java.rmi.RemoteException
This method is called by our AbleEventQueue whenever the following conditions are all true:
This base method has no default implementation.
setSleepTime(long)
,
setTimerEventProcessingEnabled(boolean)
,
startEnabledEventProcessing()
public void processNoEventProcessingEnabledSituation() throws java.rmi.RemoteException
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.
public boolean sourceConnectionsOK(java.util.Vector theObjectProcessList)
theObjectProcessList
- A Vector containing AbleBean objects already on the
process list.
public java.lang.Object getBuffer(java.lang.Object theBuffer, int theIndex) throws java.rmi.RemoteException
theBuffer
- the buffer from from which an element is to be
retrieved.
theIndex
- the location within the specified buffer that is to be
retrieved.
public java.util.Enumeration getBufferContents(java.lang.Object theBuffer) throws java.rmi.RemoteException
public java.lang.String toString()
public static java.lang.String Copyright()
|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |