public class DefaultFileReplicator extends AbstractVfsComponent implements FileReplicator, TemporaryFileStore
Constructor and Description |
---|
DefaultFileReplicator() |
DefaultFileReplicator(File tempDir)
Constructor to set the location of the temporary directory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFile(Object file) |
File |
allocateFile(String baseName)
Allocates a new temporary file.
|
void |
close()
Closes the replicator, deleting all temporary files.
|
protected File |
createAndAddFile(File parent,
String basename) |
protected File |
createFile(File parent,
String name)
Create the temporary file.
|
protected String |
createFilename(String baseName)
Create the temporary file name.
|
protected void |
deleteFile(File file)
Physically deletes the file from the file system.
|
protected long |
getFilecount() |
void |
init()
Initializes this component.
|
protected Object |
removeFile()
Removes a file from the copies list.
|
protected void |
removeFile(Object file)
Removes a instance from the list of copies.
|
File |
replicateFile(FileObject srcFile,
FileSelector selector)
Creates a local copy of the file, and all its descendants.
|
getContext, getLogger, setContext, setLogger
public DefaultFileReplicator()
public DefaultFileReplicator(File tempDir)
tempDir
- The temporary directory.protected void addFile(Object file)
public File allocateFile(String baseName) throws FileSystemException
allocateFile
in interface TemporaryFileStore
baseName
- the base file name.FileSystemException
- if an error occurs.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface VfsComponent
close
in class AbstractVfsComponent
protected File createAndAddFile(File parent, String basename) throws FileSystemException
FileSystemException
protected File createFile(File parent, 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.protected String createFilename(String baseName)
baseName
- The base to prepend to the file name being created.protected void deleteFile(File file)
file
- The File to delete.protected long getFilecount()
public void init() throws FileSystemException
init
in interface VfsComponent
init
in class AbstractVfsComponent
FileSystemException
- if an error occurs.protected Object removeFile()
Notice: The system awaits that the returning object can be cast to a File
.
protected void removeFile(Object file)
file
- The File to remove.public 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.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.