net.larsan.urd.util.fileset
Class FileSetEvent

java.lang.Object
  |
  +--net.larsan.urd.util.fileset.FileSetEvent

public class FileSetEvent
extends java.lang.Object

A file set event is thrown by file sets implementing the WatchableFileSet when the set changes. Changes occurs to single or multiple resources, in the former case the following events exist: RESOURCE_CHANGED, RESOURCE_REMOVED and RESOURCE_ADDED, and in the latter STRUCTURAL_CHANGE. These identifier are final static integers in this class and can be retrieved from the event with the getType method.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Field Summary
static int RESOURCE_ADDED
          Identifier for added resource events.
static int RESOURCE_CHANGED
          Identifier for changed resource event.
static int RESOURCE_REMOVED
          Identifier for removed resource events.
static int STRUCTURAL_CHANGE
          Identifier for structural resource events.
 
Constructor Summary
FileSetEvent(int type, FileSet source)
          Construct a new event using a type identifier, a source and a resource.
FileSetEvent(int type, FileSet source, Resource resource)
          Construct a new event using a type identifier, a source and a resource.
 
Method Summary
 Resource getResource()
          Get ther resource this event concerns.
 FileSet getSource()
          Get the file set this event originated from.
 int getType()
          Get the event type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_CHANGED

public static final int RESOURCE_CHANGED
Identifier for changed resource event. This event type should be thrown if a resource have been updated since it war last used.

See Also:
Constant Field Values

RESOURCE_REMOVED

public static final int RESOURCE_REMOVED
Identifier for removed resource events. This event type should be thrown if a resource have been removed or disabled.

See Also:
Constant Field Values

RESOURCE_ADDED

public static final int RESOURCE_ADDED
Identifier for added resource events. This event type should be thrown if a resource have been added to the file set.

See Also:
Constant Field Values

STRUCTURAL_CHANGE

public static final int STRUCTURAL_CHANGE
Identifier for structural resource events. This event type should be thrown if a file set have been structurally changed or multiple resources have been added/removed/changed.

See Also:
Constant Field Values
Constructor Detail

FileSetEvent

public FileSetEvent(int type,
                    FileSet source,
                    Resource resource)
Construct a new event using a type identifier, a source and a resource. The source must not be null and the type must be one of the public static identifiers of this class.

Parameters:
type - Type of event, from static identifiers in this class
source - Originating file set, must not be null
resource - Resource triggering the event, or null if not known

FileSetEvent

public FileSetEvent(int type,
                    FileSet source)
Construct a new event using a type identifier, a source and a resource. The source must not be null and the type must be one of the public static identifiers of this class.

Parameters:
type - Type of event, from static identifiers in this class
source - Originating file set, must not be null
Method Detail

getType

public int getType()
Get the event type. This type identifier corresponds to a static identifier in this class and can be either RESOURCE_CHANGED, RESOURCE_ADDED, RESOURCE_REMOVED or STRUCTURAL_CHANGE.

Returns:
A integer type identifier

getSource

public FileSet getSource()
Get the file set this event originated from. This will never return null.

Returns:
The originating FileSet

getResource

public Resource getResource()
Get ther resource this event concerns. This might return null if it is not set.

Returns:
The resource that triggered this event, or null if not set