public interface ScpFileOpener
Modifier and Type | Method and Description |
---|---|
ScpSourceStreamResolver |
createScpSourceStreamResolver(Path path) |
ScpTargetStreamResolver |
createScpTargetStreamResolver(Path path) |
default BasicFileAttributes |
getLocalBasicFileAttributes(Path path,
LinkOption... options) |
default Set<PosixFilePermission> |
getLocalFilePermissions(Path path,
LinkOption... options) |
default DirectoryStream<Path> |
getLocalFolderChildren(Path path)
Invoked when required to send all children of a local directory
|
default Iterable<String> |
getMatchingFilesToSend(String basedir,
String pattern)
Invoked when required to send a pattern of files
|
InputStream |
openRead(Session session,
Path file,
OpenOption... options)
Create an input stream to read from a file
|
OutputStream |
openWrite(Session session,
Path file,
OpenOption... options)
Create an output stream to write to a file
|
default Path |
resolveIncomingFilePath(Path localPath,
String name,
boolean preserve,
Set<PosixFilePermission> permissions,
ScpTimestamp time)
Invoked when receiving a new file to via a directory command
|
default Path |
resolveIncomingReceiveLocation(Path path,
boolean recursive,
boolean shouldBeDir,
boolean preserve)
Invoked when a request to receive something is processed
|
default Path |
resolveLocalPath(FileSystem fileSystem,
String commandPath) |
default Path |
resolveOutgoingFilePath(Path localPath,
LinkOption... options)
Called when there is a candidate file/folder for sending
|
default boolean |
sendAsDirectory(Path path,
LinkOption... options)
Invoked on a local path in order to decide whether it should be sent
as a file or as a directory
|
default boolean |
sendAsRegularFile(Path path,
LinkOption... options)
Invoked on a local path in order to decide whether it should be sent
as a file or as a directory
|
static void |
updateFileProperties(Path file,
Set<PosixFilePermission> perms,
ScpTimestamp time) |
default Path resolveIncomingFilePath(Path localPath, String name, boolean preserve, Set<PosixFilePermission> permissions, ScpTimestamp time) throws IOException
localPath
- The target local pathname
- The target file namepreserve
- Whether requested to preserve the permissions and timestamppermissions
- The requested file permissionstime
- The requested ScpTimestamp
- may be null
if nothing to updateIOException
- If failed to resolve the file pathupdateFileProperties
default Iterable<String> getMatchingFilesToSend(String basedir, String pattern)
basedir
- The base directory - may be null
/empty to indicate CWDpattern
- The required patterndefault boolean sendAsRegularFile(Path path, LinkOption... options) throws IOException
path
- The local Path
options
- The LinkOption
-sfalse
then the sendAsDirectory(Path, LinkOption...)
is consulted.IOException
- If failed to decidedefault boolean sendAsDirectory(Path path, LinkOption... options) throws IOException
path
- The local Path
options
- The LinkOption
-strue
then getLocalFolderChildren(Path)
is consultedIOException
- If failed to decidedefault DirectoryStream<Path> getLocalFolderChildren(Path path) throws IOException
path
- The local folder Path
{DirectoryStream
of children to send - Note: for each child
the decision whether to send it as a file or a directory will be reached by consulting
the respective sendAsRegularFile
and
sendAsDirectory
methodsIOException
- If failed to provide the children streamsendAsDirectory
default BasicFileAttributes getLocalBasicFileAttributes(Path path, LinkOption... options) throws IOException
IOException
default Set<PosixFilePermission> getLocalFilePermissions(Path path, LinkOption... options) throws IOException
IOException
default Path resolveLocalPath(FileSystem fileSystem, String commandPath) throws IOException, InvalidPathException
fileSystem
- The local FileSystem
on which local file should residecommandPath
- The command path using the local file separatorPath
IOException
- If failed to resolve the pathInvalidPathException
- If invalid local path valuedefault Path resolveIncomingReceiveLocation(Path path, boolean recursive, boolean shouldBeDir, boolean preserve) throws IOException
path
- The local target Path
of the requestrecursive
- Whether the request is recursiveshouldBeDir
- Whether target path is expected to be a directorypreserve
- Whether target path is expected to preserve attributes (permissions, times)IOException
- If failed to resolve target locationdefault Path resolveOutgoingFilePath(Path localPath, LinkOption... options) throws IOException
localPath
- The original file/folder Path
for sendingoptions
- The LinkOption
-s to use for validationIOException
- If failed to resolveInputStream openRead(Session session, Path file, OpenOption... options) throws IOException
session
- The Session
requesting the accessfile
- The requested local file Path
options
- The OpenOption
s - may be null
/emptyInputStream
never null
IOException
- If failed to open the fileScpSourceStreamResolver createScpSourceStreamResolver(Path path) throws IOException
IOException
OutputStream openWrite(Session session, Path file, OpenOption... options) throws IOException
session
- The Session
requesting the accessfile
- The requested local file Path
options
- The OpenOption
s - may be null
/emptyOutputStream
never null
IOException
- If failed to open the fileScpTargetStreamResolver createScpTargetStreamResolver(Path path) throws IOException
IOException
static void updateFileProperties(Path file, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException
IOException
Copyright © 2008–2019 The Apache Software Foundation. All rights reserved.