public abstract class AbstractScpClient extends AbstractLoggingBean implements ScpClient
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractScpClient.ScpOperationExecutor<T> |
ScpClient.Option
Modifier and Type | Field and Description |
---|---|
static Set<ClientChannelEvent> |
COMMAND_WAIT_EVENTS |
log
DEFAULT_EXEC_CHANNEL_EXIT_STATUS_TIMEOUT, DEFAULT_EXEC_CHANNEL_OPEN_TIMEOUT, SCP_EXEC_CHANNEL_EXIT_STATUS_TIMEOUT, SCP_EXEC_CHANNEL_OPEN_TIMEOUT
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) |
ClientSession |
getSession() |
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) |
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createReceiveCommand, createSendCommand, download, download, download, download, download, downloadBytes, upload, upload, upload, upload, upload, upload, upload, upload, upload
getClientSession
public static final Set<ClientChannelEvent> COMMAND_WAIT_EVENTS
public boolean isOpen()
public final ClientSession getSession()
getSession
in interface SessionHolder<ClientSession>
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 FactoryManager.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 failed the commandprotected Collection<ScpClient.Option> addTargetIsDirectory(Collection<ScpClient.Option> options)
protected ChannelExec openCommandChannel(ClientSession session, String cmd) throws IOException
IOException
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.