|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.ibm.able.AbleObject
com.ibm.able.examples.ablebean.AbleFileWatcher
This class is an example of a simple AbleBean created by extending AbleObject. It monitors specific files for any changes and also answers queries regarding file attributes.
| Field Summary | |
|---|---|
static int |
ACTION_ALERT
Display a dialog when any condition is true. |
static int |
ACTION_EVENT
Send an event to a registered agent or bean when any condition is true. |
static int |
ACTION_EXECUTE
Start a process when any condition is true. |
static int |
ACTION_NONE
Take no action regardless of file condition. |
static int |
FILE_DELETED
This condition indicates the file is to be watched for deletion. |
static int |
FILE_MODIFIED
This condition indicates the file is to be watched for changes. |
static int |
FILE_THRESHOLD
This condition indicates the file is to be watched for a size threshold. |
protected static long |
serialVersionUID
Serialized version identifier in form YYYYMMDDVerRelModxx |
| Fields inherited from class com.ibm.able.AbleObject |
|---|
changed, chgSupport, comment, dataFlowEnabled, defaultName, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
| Constructor Summary | |
|---|---|
AbleFileWatcher()
Construct an AbleFileWatcher with a name of FileWatcher. |
|
AbleFileWatcher(java.lang.String theBeanName)
Construct an AbleFileWatcher with the provided bean name. |
|
AbleFileWatcher(java.lang.String theBeanName,
java.lang.String theFileName)
Construct an AbleFileWatcher with the provided bean name and on the specified file. |
|
| Method Summary | |
|---|---|
boolean |
changed()
Check to see if the file being watched changed. |
boolean |
checkCondition()
Check to see if the condition monitored is true. |
boolean |
exists()
Check to see if the file being watched actually exists. |
int |
getAction()
Set the type of action to take when the condition watched is true. |
java.lang.String |
getCommand()
Get the command executed when the condition is true and the action selected is ACTION_EXECUTE. |
int |
getCondition()
Get the file change condition. |
java.awt.Dialog |
getDialog()
Get the Dialog to display when the condition is true and the action selected is ACTION_ALERT. |
java.lang.String |
getDisplayString()
Return a string for display in a list box. |
long |
getFileSize()
|
long |
getThreshold()
Get the file size threshold. |
java.lang.String |
getWatchFileName()
Set the file name and get a reference to the file. |
boolean |
isDirectory()
Check to see if the file being watched is a directory. |
long |
lastModified()
Return the timestamp of the last file modification. |
long |
length()
Return the length of the file watched. |
void |
process()
Check the file being watched for the condition of interest. |
void |
processTimerEvent()
The timer has expired, so check the file being watched for the condition of interest. |
void |
reset()
Reset the bean to a known initialized state. |
void |
setAction(int theAction)
Set the type of action to take when the condition watched is true. |
void |
setCommand(java.lang.String theCommand)
Set the command to execute when the condition is true and the action selected is ACTION_EXECUTE. |
void |
setCondition(int theCondition)
Set the file watch condition. |
void |
setDialog(java.awt.Dialog theDialog)
Set the Dialog to display when the condition is true and the action selected is ACTION_ALERT. |
void |
setThreshold(long theThreshold)
Set the file size threshold condition. |
void |
setWatchFileName(java.lang.String theName)
Set the file name and get a reference to the file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final long serialVersionUID
public static final int FILE_MODIFIED
public static final int FILE_DELETED
public static final int FILE_THRESHOLD
public static final int ACTION_NONE
public static final int ACTION_ALERT
public static final int ACTION_EXECUTE
public static final int ACTION_EVENT
| Constructor Detail |
public AbleFileWatcher()
throws AbleException
public AbleFileWatcher(java.lang.String theBeanName)
throws AbleException
theBeanName - A String containing the name of the object.
public AbleFileWatcher(java.lang.String theBeanName,
java.lang.String theFileName)
throws AbleException
theBeanName - A String containing the name of the object.theFileName - A String containing the name of the file to watch.| Method Detail |
public void setAction(int theAction)
throws AbleException
theAction - An integer representing the action to take.
AbleExceptiongetAction()public int getAction()
ACTION_NONE,
ACTION_ALERT,
ACTION_EXECUTE,
ACTION_EVENT
public void setCommand(java.lang.String theCommand)
throws AbleException
theCommand - A String containing the command to execute.
AbleExceptionpublic java.lang.String getCommand()
public void setCondition(int theCondition)
throws AbleException
theCondition - An int representing the watch condition.
AbleExceptiongetCondition()public int getCondition()
FILE_DELETED,
FILE_MODIFIED,
FILE_THRESHOLD
public void setDialog(java.awt.Dialog theDialog)
throws AbleException
theDialog - A Dialog to display.
AbleExceptionpublic java.awt.Dialog getDialog()
public void setWatchFileName(java.lang.String theName)
throws AbleException
theName - A String containing the path and name of the file to watch.
AbleExceptionpublic java.lang.String getWatchFileName()
public long getFileSize()
public void setThreshold(long theThreshold)
throws AbleException
theThreshold - A long containing the file size threshold.
AbleExceptionpublic long getThreshold()
public void reset()
throws AbleException
reset in interface AbleBeanreset in class AbleObjectAbleException - If an error occurs.AbleBean.reset()
public void process()
throws AbleException
process in interface AbleBeanprocess in class AbleObjectAn - exception is thrown if an action fails.
AbleExceptionAbleObject.inputBuffer,
AbleObject.outputBuffer,
AbleBean.process()
public void processTimerEvent()
throws AbleException
processTimerEvent in interface AbleEventQueueProcessorprocessTimerEvent in class AbleObjectAn - exception is thrown if an action fails.
AbleException - If an error occurs.public boolean checkCondition()
public java.lang.String getDisplayString()
public boolean changed()
public boolean exists()
public boolean isDirectory()
public long lastModified()
public long length()
|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||