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 FileDistribution
directory
- The base distribution directory.public void setFileFilterPattern(Pattern distributionFileFilterPattern)
setFileFilterPattern
in interface FileDistribution
distributionFileFilterPattern
- -
The filter. Files with names that match this pattern will be
filtered out.public AgentCacheState getAgentCacheState()
AgentCacheState
.getAgentCacheState
in interface FileDistribution
public 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 FileDistribution
public 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 FileDistribution
public void addFileChangedListener(FileChangeWatcher.FileChangedListener listener)
scanDistributionFiles()
is called.addFileChangedListener
in interface FileChangeWatcher
listener
- The listener.public FileFilter getDistributionFileFilter()
getDistributionFileFilter
in interface FileDistribution
setFileFilterPattern(Pattern)
Copyright © 2000-2014. All Rights Reserved.