Package org.apache.sshd.scp.client
Class AbstractScpClient
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.scp.client.AbstractScpClient
- All Implemented Interfaces:
ClientSessionHolder,SessionContextHolder,SessionHolder<ClientSession>,ScpClient
- Direct Known Subclasses:
DefaultScpClient
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.sshd.scp.client.ScpClient
ScpClient.Option -
Field Summary
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<ScpClient.Option> addTargetIsDirectory(Collection<ScpClient.Option> options) voiddownload(String[] remote, String local, Collection<ScpClient.Option> options) voiddownload(String[] remote, Path local, Collection<ScpClient.Option> options) voiddownload(String remote, String local, Collection<ScpClient.Option> options) protected abstract voiddownload(String remote, FileSystem fs, Path local, Collection<ScpClient.Option> options) voiddownload(String remote, Path local, Collection<ScpClient.Option> options) protected voidhandleCommandExitStatus(String cmd, Integer exitStatus) Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote serverprotected voidhandleCommandExitStatus(String cmd, ClientChannel channel) Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server.booleanisOpen()protected ChannelExecopenCommandChannel(ClientSession session, String cmd) protected abstract <T> voidrunUpload(String remote, Collection<ScpClient.Option> options, Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor) voidupload(String[] local, String remote, Collection<ScpClient.Option> options) voidupload(Path[] local, String remote, Collection<ScpClient.Option> options) Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.client.session.ClientSessionHolder
getClientSessionMethods inherited from interface org.apache.sshd.scp.client.ScpClient
download, download, download, download, download, downloadBytes, getSession, upload, upload, upload, upload, upload, upload, upload, upload, uploadMethods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
Constructor Details
-
AbstractScpClient
protected AbstractScpClient()
-
-
Method Details
-
isOpen
public boolean isOpen() -
download
public void download(String[] remote, String local, Collection<ScpClient.Option> options) throws IOException - Specified by:
downloadin interfaceScpClient- Throws:
IOException
-
download
public void download(String[] remote, Path local, Collection<ScpClient.Option> options) throws IOException - Specified by:
downloadin interfaceScpClient- Throws:
IOException
-
download
public void download(String remote, Path local, Collection<ScpClient.Option> options) throws IOException - Specified by:
downloadin interfaceScpClient- Throws:
IOException
-
download
public void download(String remote, String local, Collection<ScpClient.Option> options) throws IOException - Specified by:
downloadin interfaceScpClient- Throws:
IOException
-
download
protected abstract void download(String remote, FileSystem fs, Path local, Collection<ScpClient.Option> options) throws IOException - Throws:
IOException
-
upload
public void upload(String[] local, String remote, Collection<ScpClient.Option> options) throws IOException - Specified by:
uploadin interfaceScpClient- Throws:
IOException
-
upload
public void upload(Path[] local, String remote, Collection<ScpClient.Option> options) throws IOException - Specified by:
uploadin interfaceScpClient- Throws:
IOException
-
runUpload
protected abstract <T> void runUpload(String remote, Collection<ScpClient.Option> options, Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor) throws IOException - Throws:
IOException
-
handleCommandExitStatus
Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server. If no exit status received withinCoreModuleProperties.CHANNEL_CLOSE_TIMEOUTthe no further action is taken. Otherwise, the exit status is examined to ensure it is either OK or WARNING - if not, anScpExceptionis thrown- Parameters:
cmd- The attempted remote copy commandchannel- TheClientChannelthrough which the command was sent - Note: then channel may be in the process of being closed- Throws:
IOException- If failed the command- See Also:
-
handleCommandExitStatus
Invoked by the variousupload/downloadmethods 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 - ifnullthen no status was reported- Throws:
IOException- If received non-OK exit status
-
addTargetIsDirectory
-
openCommandChannel
- Throws:
IOException
-