public abstract class AbstractScpClient extends AbstractLoggingBean implements ScpClient
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractScpClient.ScpOperationExecutor<T> |
ScpClient.Option
log
Modifier | Constructor and Description |
---|---|
protected |
AbstractScpClient() |
Modifier and Type | Method and Description |
---|---|
protected Collection<ScpClient.Option> |
addTargetIsDirectory(Collection<ScpClient.Option> options) |
void |
download(String[] remote,
Path local,
Collection<ScpClient.Option> options) |
void |
download(String[] remote,
String local,
Collection<ScpClient.Option> options) |
protected abstract void |
download(String remote,
FileSystem fs,
Path local,
Collection<ScpClient.Option> options) |
void |
download(String remote,
Path local,
Collection<ScpClient.Option> options) |
void |
download(String remote,
String local,
Collection<ScpClient.Option> options) |
protected void |
handleCommandExitStatus(String cmd,
ClientChannel channel)
Invoked by the various
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server. |
protected void |
handleCommandExitStatus(String cmd,
Integer exitStatus)
Invoked by the various
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server |
boolean |
isOpen() |
protected ChannelExec |
openCommandChannel(ClientSession session,
String cmd) |
protected abstract <T> void |
runUpload(String remote,
Collection<ScpClient.Option> options,
Collection<T> local,
AbstractScpClient.ScpOperationExecutor<T> executor) |
void |
upload(Path[] local,
String remote,
Collection<ScpClient.Option> options) |
void |
upload(String[] local,
String remote,
Collection<ScpClient.Option> options) |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendCommandOption, createReceiveCommand, createSendCommand, download, download, download, download, download, downloadBytes, getSession, upload, upload, upload, upload, upload, upload, upload, upload, upload
getSessionContext
getClientSession
public boolean isOpen()
public void download(String[] remote, String local, Collection<ScpClient.Option> options) throws IOException
download
in interface ScpClient
IOException
public void download(String[] remote, Path local, Collection<ScpClient.Option> options) throws IOException
download
in interface ScpClient
IOException
public void download(String remote, Path local, Collection<ScpClient.Option> options) throws IOException
download
in interface ScpClient
IOException
public void download(String remote, String local, Collection<ScpClient.Option> options) throws IOException
download
in interface ScpClient
IOException
protected abstract void download(String remote, FileSystem fs, Path local, Collection<ScpClient.Option> options) throws IOException
IOException
public void upload(String[] local, String remote, Collection<ScpClient.Option> options) throws IOException
upload
in interface ScpClient
IOException
public void upload(Path[] local, String remote, Collection<ScpClient.Option> options) throws IOException
upload
in interface ScpClient
IOException
protected abstract <T> void runUpload(String remote, Collection<ScpClient.Option> options, Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor) throws IOException
IOException
protected void handleCommandExitStatus(String cmd, ClientChannel channel) throws IOException
upload/download
methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server. If no exit status received within
CoreModuleProperties.CHANNEL_CLOSE_TIMEOUT
the no further action is taken. Otherwise, the exit status is
examined to ensure it is either OK or WARNING - if not, an ScpException
is throwncmd
- The attempted remote copy commandchannel
- The ClientChannel
through which the command was sent - Note: then channel may
be in the process of being closedIOException
- If failed the commandhandleCommandExitStatus(String, Integer)
protected void handleCommandExitStatus(String cmd, Integer exitStatus) throws IOException
upload/download
methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote servercmd
- The attempted remote copy commandexitStatus
- The exit status - if null
then no status was reportedIOException
- If received non-OK exit statusprotected Collection<ScpClient.Option> addTargetIsDirectory(Collection<ScpClient.Option> options)
protected ChannelExec openCommandChannel(ClientSession session, String cmd) throws IOException
IOException
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.