Package org.apache.sshd.client.scp
Class AbstractScpClient
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.scp.AbstractScpClient
-
- All Implemented Interfaces:
ScpClient
,ClientSessionHolder
,SessionContextHolder
,SessionHolder<ClientSession>
- Direct Known Subclasses:
DefaultScpClient
public abstract class AbstractScpClient extends AbstractLoggingBean implements ScpClient
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractScpClient.ScpOperationExecutor<T>
-
Nested classes/interfaces inherited from interface org.apache.sshd.client.scp.ScpClient
ScpClient.Option
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<ClientChannelEvent>
COMMAND_WAIT_EVENTS
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.client.scp.ScpClient
DEFAULT_EXEC_CHANNEL_EXIT_STATUS_TIMEOUT, DEFAULT_EXEC_CHANNEL_OPEN_TIMEOUT, SCP_EXEC_CHANNEL_EXIT_STATUS_TIMEOUT, SCP_EXEC_CHANNEL_OPEN_TIMEOUT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScpClient()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<ScpClient.Option>
addTargetIsDirectory(java.util.Collection<ScpClient.Option> options)
void
download(java.lang.String[] remote, java.lang.String local, java.util.Collection<ScpClient.Option> options)
void
download(java.lang.String[] remote, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options)
void
download(java.lang.String remote, java.lang.String local, java.util.Collection<ScpClient.Option> options)
protected abstract void
download(java.lang.String remote, java.nio.file.FileSystem fs, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options)
void
download(java.lang.String remote, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options)
protected void
handleCommandExitStatus(java.lang.String cmd, java.lang.Integer exitStatus)
Invoked by the variousupload/download
methods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote serverprotected void
handleCommandExitStatus(java.lang.String cmd, ClientChannel channel)
Invoked by the variousupload/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, java.lang.String cmd)
protected abstract <T> void
runUpload(java.lang.String remote, java.util.Collection<ScpClient.Option> options, java.util.Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor)
void
upload(java.lang.String[] local, java.lang.String remote, java.util.Collection<ScpClient.Option> options)
void
upload(java.nio.file.Path[] local, java.lang.String remote, java.util.Collection<ScpClient.Option> options)
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.client.session.ClientSessionHolder
getClientSession
-
Methods inherited from interface org.apache.sshd.client.scp.ScpClient
download, download, download, download, download, downloadBytes, getSession, upload, upload, upload, upload, upload, upload, upload, upload, upload
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
COMMAND_WAIT_EVENTS
public static final java.util.Set<ClientChannelEvent> COMMAND_WAIT_EVENTS
-
-
Method Detail
-
isOpen
public boolean isOpen()
-
download
public void download(java.lang.String[] remote, java.lang.String local, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
download
public void download(java.lang.String[] remote, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
download
public void download(java.lang.String remote, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
download
public void download(java.lang.String remote, java.lang.String local, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
download
protected abstract void download(java.lang.String remote, java.nio.file.FileSystem fs, java.nio.file.Path local, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
- Throws:
java.io.IOException
-
upload
public void upload(java.lang.String[] local, java.lang.String remote, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
upload
public void upload(java.nio.file.Path[] local, java.lang.String remote, java.util.Collection<ScpClient.Option> options) throws java.io.IOException
-
runUpload
protected abstract <T> void runUpload(java.lang.String remote, java.util.Collection<ScpClient.Option> options, java.util.Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor) throws java.io.IOException
- Throws:
java.io.IOException
-
handleCommandExitStatus
protected void handleCommandExitStatus(java.lang.String cmd, ClientChannel channel) throws java.io.IOException
Invoked by the variousupload/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 withinFactoryManager.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, anScpException
is thrown- Parameters:
cmd
- The attempted remote copy commandchannel
- TheClientChannel
through which the command was sent - Note: then channel may be in the process of being closed- Throws:
java.io.IOException
- If failed the command- See Also:
handleCommandExitStatus(String, Integer)
-
handleCommandExitStatus
protected void handleCommandExitStatus(java.lang.String cmd, java.lang.Integer exitStatus) throws java.io.IOException
Invoked by the variousupload/download
methods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server- Parameters:
cmd
- The attempted remote copy commandexitStatus
- The exit status - ifnull
then no status was reported- Throws:
java.io.IOException
- If failed the command
-
addTargetIsDirectory
protected java.util.Collection<ScpClient.Option> addTargetIsDirectory(java.util.Collection<ScpClient.Option> options)
-
openCommandChannel
protected ChannelExec openCommandChannel(ClientSession session, java.lang.String cmd) throws java.io.IOException
- Throws:
java.io.IOException
-
-