001package org.intellimate.izou.system.file;
002
003import org.apache.logging.log4j.LogManager;
004import org.apache.logging.log4j.Logger;
005
006import java.nio.file.Path;
007
008/**
009 * Information for files registered in the FileManager, it is what is processed when a file-event has been raised in the
010 * file manager
011 */
012public class FileInfo {
013    private Path path;
014    private String fileType;
015    private ReloadableFile reloadableFile;
016    private final Logger fileLogger = LogManager.getLogger(this.getClass());
017
018    /**
019     * Creates a new FileInfo object
020     *
021     * @param path path of DIRECTORY (not file itself!!!!) where file to be watched is located
022     * @param fileType the type of file the file is, can be name or extension or both
023     *                 (Ex: "test", "txt", "test.txt" all work)
024     * @param reloadableFile interface that includes update method
025     */
026    public FileInfo(Path path, String fileType, ReloadableFile reloadableFile) {
027        this.path = path;
028        this.fileType = fileType;
029        this.reloadableFile = reloadableFile;
030    }
031
032    /**
033     * gets directory path of fileInfo
034     *
035     * @return the directory path of fileInfo
036     */
037    public Path getPath() {
038        return path;
039    }
040
041    /**
042     * gets file type or name of file
043     *
044     * @return the file type or name of file
045     */
046    public String getFileType() {
047        return fileType;
048    }
049
050    /**
051     * gets the reloadable files to which the registered file belongs
052     *
053     * @return the reloadable files to which the registered file belongs
054     */
055    public ReloadableFile getReloadableFile() {
056        return reloadableFile;
057    }
058
059    /**
060     * Gets id of file-info
061     *
062     * @return the id of the file-info
063     */
064    public String getID() {
065        return reloadableFile.getID();
066    }
067}