public final class FileDistributionImplementation extends Object implements FileDistribution
FileDistribution implementation.
Instantiated by PicoContainer.
FileChangeWatcher.FileChangedListener| Constructor and Description |
|---|
FileDistributionImplementation(DistributionControl distributionControl,
ProcessControl processControl,
Directory directory,
Pattern distributionFileFilterPattern)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFileChangedListener(FileChangeWatcher.FileChangedListener listener)
Add a listener that will be sent events about files that have changed when
scanDistributionFiles() is called. |
AgentCacheState |
getAgentCacheState()
Accessor for our
AgentCacheState. |
FileFilter |
getDistributionFileFilter()
Return a FileFilter that can be used to test whether the given file is
one that will be distributed.
|
FileDistributionHandler |
getHandler()
Get a
FileDistributionHandler for a new file
distribution. |
void |
scanDistributionFiles()
Scan the given directory for files that have been recently modified.
|
void |
setDirectory(Directory directory)
Update the distribution directory.
|
void |
setFileFilterPattern(Pattern distributionFileFilterPattern)
Update the pattern used to filter out files that shouldn't be distributed.
|
public FileDistributionImplementation(DistributionControl distributionControl, ProcessControl processControl, Directory directory, Pattern distributionFileFilterPattern)
distributionControl - A DistributionControl.processControl - A process control.directory - The base distribution directory.distributionFileFilterPattern - -
The filter. Files with names that match this pattern will be
filtered out.public void setDirectory(Directory directory)
setDirectory in interface FileDistributiondirectory - The base distribution directory.public void setFileFilterPattern(Pattern distributionFileFilterPattern)
setFileFilterPattern in interface FileDistributiondistributionFileFilterPattern - -
The filter. Files with names that match this pattern will be
filtered out.public AgentCacheState getAgentCacheState()
AgentCacheState.getAgentCacheState in interface FileDistributionpublic FileDistributionHandler getHandler()
FileDistributionHandler for a new file
distribution.
The FileDistributionHandler updates our simple model of the remote cache state. Callers should only use one FileDistributionHandler at a time for a given FileDistribution. Using multiple instances concurrently will result in undefined behaviour.
getHandler in interface FileDistributionpublic void scanDistributionFiles()
This method is too coupled to the agent cache. Perhaps this and the file watcher support should be factored out into a separate class.
Currently, the file listeners only get notification for things that match the distribution filter.
scanDistributionFiles in interface FileDistributionpublic void addFileChangedListener(FileChangeWatcher.FileChangedListener listener)
scanDistributionFiles() is called.addFileChangedListener in interface FileChangeWatcherlistener - The listener.public FileFilter getDistributionFileFilter()
getDistributionFileFilter in interface FileDistributionsetFileFilterPattern(Pattern)Copyright © 2000-2014. All Rights Reserved.