Class FileEventImpl

  • All Implemented Interfaces:
    Event, FileEvent
    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 Detail

      • path

        protected final Path path
        The path for which the event has been created.
    • 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, an IOException will be thrown.
    • Method Detail

      • getPath

        public Path getPath()
        Description copied from interface: FileEvent
        Gets the path that caused this event.
        Specified by:
        getPath in interface FileEvent
        Returns:
        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 interface FileEvent
        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 the FileUDT or UDTValue from the path or an URI, an IOException will be thrown.
        MalformedURLException - If the URI of the path cannot be converted to URL, a MalformedURLException will be thrown.