|
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 | +--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. |
Fields inherited from class com.ibm.able.AbleObject |
changed,
chgSupport,
comment,
dataFlowEnabled,
destBufferConnections,
eventQueue,
fileName,
inputBuffer,
listeners,
logger,
name,
outputBuffer,
parent,
propertyConnectionMgr,
sourceBufferConnections,
state,
stateChgSupport |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
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. |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
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. |
java.lang.String |
getFileName()
Set the file name and get a reference to the file. |
long |
getThreshold()
Get the file size threshold. |
void |
init()
Initialize the bean to a known state supporting only timer events. |
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 |
setFileName(java.lang.String theName)
Set the file name and get a reference to the file. |
void |
setThreshold(long theThreshold)
Set the file size threshold condition. |
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 |
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 java.rmi.RemoteException
public AbleFileWatcher(java.lang.String theBeanName) throws java.rmi.RemoteException
theBeanName
- A String containing the name of the object.public AbleFileWatcher(java.lang.String theBeanName, java.lang.String theFileName) throws java.rmi.RemoteException
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 java.rmi.RemoteException
theAction
- An integer representing the action to take.getAction()
public int getAction()
ACTION_NONE
,
ACTION_ALERT
,
ACTION_EXECUTE
,
ACTION_EVENT
public void setCommand(java.lang.String theCommand) throws java.rmi.RemoteException
theCommand
- A String containing the command to execute.public java.lang.String getCommand()
public void setCondition(int theCondition) throws java.rmi.RemoteException
theCondition
- An int representing the watch condition.getCondition()
public int getCondition()
FILE_DELETED
,
FILE_MODIFIED
,
FILE_THRESHOLD
public void setDialog(java.awt.Dialog theDialog) throws java.rmi.RemoteException
theDialog
- A Dialog to display.public java.awt.Dialog getDialog()
public void setFileName(java.lang.String theName) throws java.rmi.RemoteException
theName
- A String containing the path and name of the file to watch.public java.lang.String getFileName()
public void setThreshold(long theThreshold) throws java.rmi.RemoteException
theThreshold
- A long containing the file size threshold.public long getThreshold()
public void init() throws java.rmi.RemoteException
public void reset() throws java.rmi.RemoteException
public void process() throws java.rmi.RemoteException
public void processTimerEvent() throws java.rmi.RemoteException
public boolean checkCondition()
public java.lang.String getDisplayString()
public boolean changed()
public boolean exists()
public boolean isDirectory()
public long lastModified()
public long length()
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 |