Package org.cip4.jdflib.util.hotfolder
Class HotFolder
- java.lang.Object
-
- org.cip4.jdflib.util.hotfolder.HotFolder
-
- Direct Known Subclasses:
ColdFolder
public class HotFolder extends java.lang.Objecta very simple hotfolder watcher subdirectories are ignored
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<org.cip4.jdflib.util.hotfolder.ExtensionListener>hflintstabilizeTimethe time in milliseconds to wait for stabilization
-
Constructor Summary
Constructors Constructor Description HotFolder(java.io.File _dir)Deprecated.- use the 3 parameter versionHotFolder(java.io.File _dir, java.lang.String ext, HotFolderListener _hfl)constructor for a simple hotfolder watcher that is automagically started in its own thread
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(HotFolderListener _hfl, java.lang.String ext)booleanequals(java.lang.Object obj)static intgetDefaultStabilizeTime()java.io.FilegetDir()org.cip4.jdflib.util.hotfolder.ExtensionListenergetListener(int i)intgetMaxCheck()intgetMaxConcurrent()intgetStabilizeTime()inthashCode()voidrestart()restart the threadstatic voidsetDefaultStabilizeTime(int defaultStabilizeTime)voidsetMaxCheck(int maxCheck)voidsetMaxConcurrent(int maxConcurrent)voidsetStabilizeTime(int stabilizeTime)voidstop()stop this thread;java.lang.StringtoString()
-
-
-
Constructor Detail
-
HotFolder
@Deprecated public HotFolder(java.io.File _dir)
Deprecated.- use the 3 parameter versionconstructor for a simple hotfolder watcher that is automagically started in its own thread- Parameters:
_dir- the Directory to watch
-
HotFolder
public HotFolder(java.io.File _dir, java.lang.String ext, HotFolderListener _hfl)constructor for a simple hotfolder watcher that is automagically started in its own thread- Parameters:
_dir- the Directory to watchext- the extension filter - case is ignored and lists of extensions may be specified as a comma separated list e.g. ".txt,.xml"_hfl- the listener callback
-
-
Method Detail
-
getMaxCheck
public int getMaxCheck()
-
setMaxCheck
public void setMaxCheck(int maxCheck)
-
setMaxConcurrent
public void setMaxConcurrent(int maxConcurrent)
- Parameters:
maxConcurrent- the maxConcurrent to set note will only add
-
getListener
public org.cip4.jdflib.util.hotfolder.ExtensionListener getListener(int i)
- Parameters:
i-- Returns:
-
getMaxConcurrent
public int getMaxConcurrent()
- Returns:
-
getDir
public java.io.File getDir()
- Returns:
- the hot folder directory
-
addListener
public void addListener(HotFolderListener _hfl, java.lang.String ext)
- Parameters:
_hfl-ext-
-
restart
public void restart()
restart the thread
-
stop
public void stop()
stop this thread;
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
getDefaultStabilizeTime
public static int getDefaultStabilizeTime()
- Returns:
- the defaultStabilizeTime
-
setDefaultStabilizeTime
public static void setDefaultStabilizeTime(int defaultStabilizeTime)
- Parameters:
defaultStabilizeTime- the defaultStabilizeTime to set
-
getStabilizeTime
public int getStabilizeTime()
- Returns:
- the stabilizeTime
-
setStabilizeTime
public void setStabilizeTime(int stabilizeTime)
- Parameters:
stabilizeTime- the stabilizeTime to set in milliseconds - we always ensure at least 2000 because some OS have 1000 file modified garnularity
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
-