|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ciagent.CIAgent | +--pamanager.FileAgent
The FileAgent
class implements an agent that monitors
a file to see if it was modified, deleted, or if its size exceeds a
certain threshold.
Field Summary | |
protected int |
action
|
protected javax.swing.JDialog |
actionDialog
|
protected java.lang.String |
actionString
|
static int |
ALERT
|
protected int |
condition
|
static int |
DELETED
|
static int |
EVENT
|
static int |
EXECUTE
|
protected java.io.File |
file
|
protected java.lang.String |
fileName
|
protected long |
lastChanged
|
static int |
MODIFIED
|
protected java.lang.String |
parms
|
protected int |
threshold
|
static int |
THRESHOLD
|
Fields inherited from class ciagent.CIAgent |
agentPlatform,
children,
DEFAULT_ASYNCTIME,
DEFAULT_SLEEPTIME,
name,
parent,
traceLevel |
Constructor Summary | |
FileAgent()
Creates the agent. |
|
FileAgent(java.lang.String name)
Creates the agent with the specified name. |
Method Summary | |
protected boolean |
changed()
Checks to see if the file has changed. |
int |
executeCmd(java.lang.String cmd)
Executes the command string that was set up as a parameter for the EXECUTE action. |
protected boolean |
exists()
Checks to see if the file exists. |
int |
getAction()
Retrieves action this agent performs. |
java.lang.String |
getActionString()
Retrieves the actionString this agent sends in events. |
int |
getCondition()
Retrieves the condition being monitored. |
java.lang.String |
getFileName()
Retrieves the name of the file being watched. |
java.lang.String |
getParms()
Retrieve the parameters used by the agent when performing an action. |
java.lang.String |
getTaskDescription()
Retrieves a description of the task this agent is performing. |
int |
getThreshold()
Retrieves the threshold value. |
void |
initialize()
Initializes the agent. |
protected long |
lastModified()
Retrieves the time the file was last modified. |
protected long |
length()
Retrieves the size of the file in bytes. |
(package private) void |
performAction()
Peforms the ALERT, EXECUTE, or EVENT action. |
void |
process()
Performs the default processing for this agent by checking the condition and performing the action is the condition is met. |
void |
processCIAgentEvent(CIAgentEvent e)
Does nothing when an event is received. |
void |
processTimerPop()
Performs the default processing for this agent when a timer pop occurs. |
void |
setAction(int action)
Sets the action to be performed by this agent to ALERT, EXECUTE, or EVENT. |
void |
setActionString(java.lang.String actionString)
Sets the action string to be sent by this agent in an EVENT. |
void |
setCondition(int cond)
Sets the condition to be monitored to MODIFIED, DELETED, or THRESHOLD. |
void |
setDialog(javax.swing.JDialog dlg)
Sets the dialog used by the agent when performing the ALERT or EXECUTE actions. |
void |
setFileName(java.lang.String fileName)
Sets the name of the file to be watched. |
void |
setParms(java.lang.String params)
Sets the parameters used when this agent performs an ALERT or EXECUTE action. |
void |
setThreshold(int thresh)
Sets the threshold value. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int MODIFIED
public static final int DELETED
public static final int THRESHOLD
public static final int ALERT
public static final int EXECUTE
public static final int EVENT
protected int condition
protected int action
protected java.lang.String fileName
protected java.io.File file
protected long lastChanged
protected int threshold
protected javax.swing.JDialog actionDialog
protected java.lang.String actionString
protected java.lang.String parms
Constructor Detail |
public FileAgent()
public FileAgent(java.lang.String name)
name
- the String that contains the name of the agentMethod Detail |
public java.lang.String getTaskDescription()
public void setFileName(java.lang.String fileName)
fileName
- the String that contains the name of the filepublic java.lang.String getFileName()
public void setCondition(int cond)
cond
- the integer that represents the condition being checkedpublic int getCondition()
public void setThreshold(int thresh)
thresh
- the threshold valuepublic int getThreshold()
public void setAction(int action)
action
- the integer that represents the actionpublic int getAction()
public void setActionString(java.lang.String actionString)
actionString
- the integer that represents the actionpublic java.lang.String getActionString()
public void setParms(java.lang.String params)
params
- the String that contains the parameters for the actionpublic java.lang.String getParms()
public void setDialog(javax.swing.JDialog dlg)
dlg
- the JDialog that is used with an ALERT or EXECUTE actionpublic void initialize()
public void process()
public void processCIAgentEvent(CIAgentEvent e)
e
- the CIAgentEvent received by this agentpublic void processTimerPop()
void performAction()
public int executeCmd(java.lang.String cmd)
the
- String that contains the command to be executed in the
proper format for the platform on which this agent is runningcmd
- the String objectprotected boolean exists()
true
if the file exists or false
if
the file does not existprotected boolean changed()
true
if the file has changed or false
if the file has not changedprotected long length()
protected long lastModified()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |