Package org.apache.commons.vfs2.impl
Class PrivilegedFileReplicator
- java.lang.Object
-
- org.apache.commons.vfs2.impl.PrivilegedFileReplicator
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,FileReplicator
,VfsComponent
public class PrivilegedFileReplicator extends java.lang.Object implements FileReplicator, VfsComponent
A file replicator that wraps another file replicator, performing the replication as a privileged action.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
PrivilegedFileReplicator.CloseAction
An action that closes the wrapped replicator.private class
PrivilegedFileReplicator.InitAction
An action that initializes the wrapped replicator.private class
PrivilegedFileReplicator.ReplicateAction
An action that replicates a file using the wrapped replicator.
-
Field Summary
Fields Modifier and Type Field Description private FileReplicator
replicator
private VfsComponent
replicatorComponent
-
Constructor Summary
Constructors Constructor Description PrivilegedFileReplicator(FileReplicator replicator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the replicator.void
init()
Initializes the component.java.io.File
replicateFile(FileObject srcFile, FileSelector selector)
Creates a local copy of the file, and all its descendants.void
setContext(VfsComponentContext context)
Sets the context for the replicator.void
setLogger(org.apache.commons.logging.Log logger)
Sets the Logger to use for the component.
-
-
-
Field Detail
-
replicator
private final FileReplicator replicator
-
replicatorComponent
private final VfsComponent replicatorComponent
-
-
Constructor Detail
-
PrivilegedFileReplicator
public PrivilegedFileReplicator(FileReplicator replicator)
-
-
Method Detail
-
setLogger
public void setLogger(org.apache.commons.logging.Log logger)
Sets the Logger to use for the component.- Specified by:
setLogger
in interfaceVfsComponent
- Parameters:
logger
- The logger.
-
setContext
public void setContext(VfsComponentContext context)
Sets the context for the replicator.- Specified by:
setContext
in interfaceVfsComponent
- Parameters:
context
- The component context.
-
init
public void init() throws FileSystemException
Initializes the component.- Specified by:
init
in interfaceVfsComponent
- Throws:
FileSystemException
- if an error occurs.
-
close
public void close()
Closes the replicator.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceVfsComponent
-
replicateFile
public java.io.File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException
Creates a local copy of the file, and all its descendants.- Specified by:
replicateFile
in interfaceFileReplicator
- Parameters:
srcFile
- The source FileObject.selector
- The file selector.- Returns:
- The replicated file.
- Throws:
FileSystemException
- if an error occurs.
-
-