Class FileEventImpl
- java.lang.Object
-
- de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
-
- de.aristaflow.adept2.core.eventmanager.fileevents.FileEventImpl
-
- Direct Known Subclasses:
LockFileEventImpl
public class FileEventImpl extends AbstractEvent implements FileEvent
An event for files, that is, an event is produced and sent as soon as a file (or a directory) is created or stored in a specific folder.
This event source terminates as soon as an event has been handled. However, since it polls, one has to ensure that a handled file is deleted or moved to another folder. Otherwise the source will create another event for the file.
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicFileAttributes
attributes
The file attributes of the path.protected Path
path
The path for which the event has been created.-
Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
creationTime, eventType, id, ID_COUNT, managerURI, sourceID, sourceType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicFileAttributes
getFileAttributes()
Gets the basic file attributes of the path of this event.Path
getPath()
Gets the path that caused this event.static UDTValue
getUdtValue(Path filePath, String udtName)
Gets the UDT value with the designated type name for the designated file.-
Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
getCreationTime, getEventManager, getEventType, getID, getSourceID, getSourceType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.events.Event
getCreationTime, getEventManager, getEventType, getID, getSourceID, getSourceType
-
-
-
-
Field Detail
-
path
protected final Path path
The path for which the event has been created.
-
attributes
protected final BasicFileAttributes attributes
The file attributes of the path.
-
-
Constructor Detail
-
FileEventImpl
public FileEventImpl(URI[] managerURI, String eventType, String sourceType, String sourceID, Path path) throws IOException
Creates a new event for the designated path.- Parameters:
managerURI
- The URIs of the service (event manager) creating the event.eventType
- The type of the event.sourceType
- The type of the source of this event.sourceID
- The ID of the source of this event.path
- The path for which the event has been created.- Throws:
IOException
- If retrieving the basic file attributes of the designated path fails, anIOException
will be thrown.
-
-
Method Detail
-
getPath
public Path getPath()
Description copied from interface:FileEvent
Gets the path that caused this event.
-
getFileAttributes
public BasicFileAttributes getFileAttributes()
Description copied from interface:FileEvent
Gets the basic file attributes of the path of this event.- Specified by:
getFileAttributes
in interfaceFileEvent
- Returns:
- The basic file attributes of the path of this event.
-
getUdtValue
public static UDTValue getUdtValue(Path filePath, String udtName) throws IOException, MalformedURLException
Gets the UDT value with the designated type name for the designated file.- Parameters:
filePath
- The path specifying the file to retrieve.udtName
- The type name of the UDT.- Returns:
- The UDT value of the designated type name for the designated file. The caller is responsible for closing.
- Throws:
IOException
- If there are problems creating theFileUDT
orUDTValue
from the path or an URI, anIOException
will be thrown.MalformedURLException
- If the URI of the path cannot be converted to URL, aMalformedURLException
will be thrown.
-
-