Class DirectoryWatcher<T>
- java.lang.Object
-
- org.opennms.netmgt.provision.persist.DirectoryWatcher<T>
-
- Type Parameters:
T- the object representation of the file
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
public class DirectoryWatcher<T> extends Object implements Runnable, Closeable
The Class DirectoryWatcher.- Author:
- Alejandro Galue
-
-
Constructor Summary
Constructors Constructor Description DirectoryWatcher(File directory, FileReloadCallback<T> loader)Instantiates a new directory watcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Set<String>getBaseNamesWithExtension(String extension)Gets the base names with extension.TgetContents(String fileName)Gets the contents.Set<String>getFileNames()Gets the file names.voidjoin()Join.voidrun()voidstart()Start.voidstop()Stop.
-
-
-
Constructor Detail
-
DirectoryWatcher
public DirectoryWatcher(File directory, FileReloadCallback<T> loader) throws InterruptedException
Instantiates a new directory watcher.- Parameters:
directory- the directoryloader- the loader- Throws:
InterruptedException- the interrupted exception
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
join
public void join() throws InterruptedExceptionJoin.- Throws:
InterruptedException- the interrupted exception
-
start
public void start() throws InterruptedExceptionStart.- Throws:
InterruptedException- the interrupted exception
-
stop
public void stop() throws InterruptedExceptionStop.- Throws:
InterruptedException- the interrupted exception
-
getBaseNamesWithExtension
public Set<String> getBaseNamesWithExtension(String extension)
Gets the base names with extension.- Parameters:
extension- the extension- Returns:
- the base names with extension
-
getContents
public T getContents(String fileName) throws FileNotFoundException
Gets the contents.- Parameters:
fileName- the file name- Returns:
- the contents
- Throws:
FileNotFoundException- the file not found exception
-
-