net.fenyo.gnetwatch.actions
Class Action

java.lang.Object
  extended by net.fenyo.gnetwatch.GUI.VisualElement
      extended by net.fenyo.gnetwatch.actions.Action
Direct Known Subclasses:
ActionFlood, ActionGenericProcess, ActionGenericSrc, ActionHTTP, ActionNmap, ActionPing, ActionSNMP

public class Action
extends VisualElement

Action is the base class for any action: ActionFlood, ActionPing, ActionSNMP, etc. An action applies an operation to a target and adds events to this target depending on the result of the operation.

Version:
$Id: Action.java,v 1.24 2008/04/15 23:58:18 fenyo Exp $
Author:
Alexandre Fenyo

Nested Class Summary
static class Action.InterruptCause
           
 
Field Summary
private  Background background
           
private static Log log
           
private  Target target
           
 
Constructor Summary
protected Action()
          Default constructor.
protected Action(Target target, Background background)
          Constructor.
 
Method Summary
 boolean canManageThisChild(VisualElement visual_element)
          Checks that another visual element type can be under this one.
protected  void disposed()
          Called when this element is being removed.
 Background getBackground()
           
 long getMaxDelay()
          Returns the timeout associated with this action.
 java.lang.String getQueueName()
          Returns the preferred queue.
 Target getTarget()
          Returns the associated target.
protected  void initialize(GUI gui)
          Called to inform about the current GUI.
 void interrupt(Action.InterruptCause cause)
          Asks this action to stop rapidely.
 void invoke()
          Asks this action to do its job.
 void setBackground(Background background)
          Sets the background manager.
 void setTarget(Target target)
          Sets the target.
 
Methods inherited from class net.fenyo.gnetwatch.GUI.VisualElement
addParent, contains, duplicateTreeItemOnce, expandTreeItems, getAllParents, getChildren, getDescription, getGUI, getId, getItem, getParents, getProgress, getSubElements, getSubElements, getTreeItems, getType, informSelected, isDisposed, isThisOurTreeItem, removeVisualElements, selected, setChildren, setDescription, setGUI, setId, setImage, setImageExec, setImageFolder, setImageHost, setImageHost6, setImageHost6SNMP, setImageHostSNMP, setImageInterface, setImageMultiRow, setImageNetwork, setImageOscillo, setImageQueue, setImageWatch, setItem, setParent, setParent, setProgress, setType, unselected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static Log log

target

private Target target

background

private Background background
Constructor Detail

Action

protected Action(Target target,
                 Background background)
Constructor.

Parameters:
target - target this action works on.
background - queue manager by which this action will add events.

Action

protected Action()
Default constructor.

Parameters:
none. -
Method Detail

setTarget

public void setTarget(Target target)
Sets the target.

Parameters:
target - target.

setBackground

public void setBackground(Background background)
Sets the background manager.

Parameters:
background - background manager.

getBackground

public Background getBackground()

initialize

protected void initialize(GUI gui)
Called to inform about the current GUI.

Overrides:
initialize in class VisualElement
Parameters:
gui - current GUI instance.

getTarget

public Target getTarget()
Returns the associated target.

Parameters:
none. -
Returns:
Target associated target.

getQueueName

public java.lang.String getQueueName()
Returns the preferred queue.

Parameters:
none. -
Returns:
String preferred queue.

getMaxDelay

public long getMaxDelay()
Returns the timeout associated with this action.

Parameters:
none. -
Returns:
long timeout.

interrupt

public void interrupt(Action.InterruptCause cause)
               throws java.io.IOException
Asks this action to stop rapidely.

Parameters:
cause - cause.
Throws:
java.io.IOException - IO exception.

invoke

public void invoke()
            throws java.io.IOException,
                   java.lang.InterruptedException
Asks this action to do its job.

Parameters:
none. -
Throws:
java.io.IOException - IO exception.
java.lang.InterruptedException - exception.

canManageThisChild

public boolean canManageThisChild(VisualElement visual_element)
Checks that another visual element type can be under this one.

Overrides:
canManageThisChild in class VisualElement
Parameters:
visual_element - element to check against.
Returns:
boolean true if this element can be under this action.

disposed

protected void disposed()
Called when this element is being removed.

Overrides:
disposed in class VisualElement
Parameters:
none. -