public class DefaultFileReplicator extends AbstractVfsComponent implements FileReplicator, TemporaryFileStore
Constructor and Description |
---|
DefaultFileReplicator() |
DefaultFileReplicator(java.io.File tempDir)
constructor to set the location of the temporary directory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFile(java.lang.Object file) |
java.io.File |
allocateFile(java.lang.String baseName)
Allocates a new temporary file.
|
void |
close()
Closes the replicator, deleting all temporary files.
|
protected java.io.File |
createAndAddFile(java.io.File parent,
java.lang.String basename) |
protected java.io.File |
createFile(java.io.File parent,
java.lang.String name)
create the temporary file
|
protected java.lang.String |
createFilename(java.lang.String baseName)
create the temporary file name
|
protected void |
deleteFile(java.io.File file)
physically deletes the file from the filesystem
|
protected long |
getFilecount() |
void |
init()
Initialises this component.
|
protected java.lang.Object |
removeFile()
removes a file from the copies list.
|
protected void |
removeFile(java.lang.Object file)
removes a instance from the list of copies
|
java.io.File |
replicateFile(FileObject srcFile,
FileSelector selector)
Creates a local copy of the file, and all its descendents.
|
getContext, getLogger, setContext, setLogger
public DefaultFileReplicator(java.io.File tempDir)
tempDir
- The temporary directory.public DefaultFileReplicator()
public void init() throws FileSystemException
init
in interface VfsComponent
init
in class AbstractVfsComponent
FileSystemException
- if an error occurs.public void close()
close
in interface VfsComponent
close
in class AbstractVfsComponent
protected void deleteFile(java.io.File file)
file
- The File to delete.protected java.lang.Object removeFile()
protected void removeFile(java.lang.Object file)
file
- The File to remove.public java.io.File allocateFile(java.lang.String baseName) throws FileSystemException
allocateFile
in interface TemporaryFileStore
baseName
- the base file name.FileSystemException
- if an error occurs.protected java.io.File createAndAddFile(java.io.File parent, java.lang.String basename) throws FileSystemException
FileSystemException
protected void addFile(java.lang.Object file)
protected long getFilecount()
protected java.lang.String createFilename(java.lang.String baseName)
baseName
- The base to prepend to the file name being created.protected java.io.File createFile(java.io.File parent, java.lang.String name) throws FileSystemException
parent
- The file to use as the parent of the file being created.name
- The name of the file to create.FileSystemException
- if an error occurs creating the file.public java.io.File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException
replicateFile
in interface FileReplicator
srcFile
- The file to copy.selector
- The FileSelector.FileSystemException
- if an error occurs copying the file.