com.lightdev.lib.filesystem
Class FileSystemEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.lightdev.lib.filesystem.FileSystemEvent
All Implemented Interfaces:
Serializable

public class FileSystemEvent
extends EventObject

A class that models events in the Light Development File System

Version:
2, 11.9.2008
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software
See Also:
Serialized Form

Field Summary
static int ACTION_COPY
          action type constant
static int ACTION_CREATE
          action type constant
static int ACTION_DELETE
          action type constant
static int ACTION_EXPORT
          action type constant
static int ACTION_IMPORT
          action type constant
static int ACTION_RENAME
          action type constant
static int PROCESS_END
          event type constant
static int PROCESS_START
          event type constant
static int PROGRESS
          event type constant
 
Constructor Summary
FileSystemEvent(Object source, int action, int type, FileRef[] files)
          create a new instance of class FileSystemEvent
FileSystemEvent(Object source, int action, int type, FileRef[] files, Object value)
          create a new instance of class FileSystemEvent
 
Method Summary
 int getAction()
          get the action that initiated this event
 String getActionName(int action)
          Get action name for a given action id
 FileRef[] getFiles()
          get the files that were changed
 int getType()
          get the type of event
 Object getValue()
          get the new value the FileRef with new file name in case of rename a progress value as a long in case of progress (not the total processed, only the progress value of this particular event)
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROGRESS

public static final int PROGRESS
event type constant

See Also:
Constant Field Values

PROCESS_START

public static final int PROCESS_START
event type constant

See Also:
Constant Field Values

PROCESS_END

public static final int PROCESS_END
event type constant

See Also:
Constant Field Values

ACTION_COPY

public static final int ACTION_COPY
action type constant

See Also:
Constant Field Values

ACTION_RENAME

public static final int ACTION_RENAME
action type constant

See Also:
Constant Field Values

ACTION_CREATE

public static final int ACTION_CREATE
action type constant

See Also:
Constant Field Values

ACTION_DELETE

public static final int ACTION_DELETE
action type constant

See Also:
Constant Field Values

ACTION_IMPORT

public static final int ACTION_IMPORT
action type constant

See Also:
Constant Field Values

ACTION_EXPORT

public static final int ACTION_EXPORT
action type constant

See Also:
Constant Field Values
Constructor Detail

FileSystemEvent

public FileSystemEvent(Object source,
                       int action,
                       int type,
                       FileRef[] files)
create a new instance of class FileSystemEvent

Parameters:
source - the file system file have changed in
action - the action that initiated this event, e.g. FileSystemEvent.ACTION_COPY
type - the type of event, one of FILE_DELETED, FILE_CREATED and FILE_RENAMED
files - the files affected by the change

FileSystemEvent

public FileSystemEvent(Object source,
                       int action,
                       int type,
                       FileRef[] files,
                       Object value)
create a new instance of class FileSystemEvent

Parameters:
source - the file system file have changed in
action - the action that initiated this event, e.g. FileSystemEvent.ACTION_COPY
type - the type of event, one of FILE_DELETED, FILE_CREATED and FILE_RENAMED
files - the files affected by the change
value - a value to transport wihtin this class
Method Detail

getType

public int getType()
get the type of event

Returns:
the event type, one of FILE_DELETED, FILE_CREATED and FILE_RENAMED

getAction

public int getAction()
get the action that initiated this event

Returns:
the action, e.g. FileSystemEvent.ACTION_COPY

getFiles

public FileRef[] getFiles()
get the files that were changed

Returns:
an array of changed files

getValue

public Object getValue()
get the new value the FileRef with new file name in case of rename a progress value as a long in case of progress (not the total processed, only the progress value of this particular event)

Returns:
the new value

getActionName

public String getActionName(int action)
Get action name for a given action id

Parameters:
action - id of action to get name for
Returns:
action name for goven action id