Package org.apache.sshd.scp.server
Class ScpCommandFactory
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.server.command.AbstractDelegatingCommandFactory
-
- org.apache.sshd.scp.server.ScpCommandFactory
-
- All Implemented Interfaces:
Cloneable,org.apache.sshd.common.util.threads.ExecutorServiceProvider,org.apache.sshd.common.util.threads.ManagedExecutorServiceSupplier,ScpFileOpenerHolder,CommandFactory,ShellFactory,ShellFactorySelector
public class ScpCommandFactory extends AbstractDelegatingCommandFactory implements org.apache.sshd.common.util.threads.ManagedExecutorServiceSupplier, ScpFileOpenerHolder, Cloneable, ShellFactory, ShellFactorySelector
ThisCommandFactorycan be used as a standalone command factory or can be used to augment anotherCommandFactoryand providesSCPsupport.- Author:
- Apache MINA SSHD Project
- See Also:
ScpCommand,ScpShell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScpCommandFactory.BuilderA usefulObjectBuilderforScpCommandFactory
-
Field Summary
Fields Modifier and Type Field Description static StringSCP_FACTORY_NAME
-
Constructor Summary
Constructors Constructor Description ScpCommandFactory()
-
Method Summary
-
Methods inherited from class org.apache.sshd.server.command.AbstractDelegatingCommandFactory
createCommand, createUnsupportedCommand, getDelegateCommandFactory, setDelegateCommandFactory, toString
-
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, warn
-
-
-
-
Field Detail
-
SCP_FACTORY_NAME
public static final String SCP_FACTORY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getScpFileOpener
public ScpFileOpener getScpFileOpener()
- Specified by:
getScpFileOpenerin interfaceScpFileOpenerHolder- Returns:
- The last
ScpFileOpenerset via call toScpFileOpenerHolder.setScpFileOpener(ScpFileOpener)
-
setScpFileOpener
public void setScpFileOpener(ScpFileOpener fileOpener)
- Specified by:
setScpFileOpenerin interfaceScpFileOpenerHolder- Parameters:
fileOpener- The defaultScpFileOpenerto use - ifnullthen a default opener is used
-
getExecutorServiceProvider
public Supplier<? extends org.apache.sshd.common.util.threads.CloseableExecutorService> getExecutorServiceProvider()
- Specified by:
getExecutorServiceProviderin interfaceorg.apache.sshd.common.util.threads.ExecutorServiceProvider
-
setExecutorServiceProvider
public void setExecutorServiceProvider(Supplier<? extends org.apache.sshd.common.util.threads.CloseableExecutorService> provider)
- Specified by:
setExecutorServiceProviderin interfaceorg.apache.sshd.common.util.threads.ManagedExecutorServiceSupplier
-
getSendBufferSize
public int getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int sendSize)
- Parameters:
sendSize- Size (in bytes) of buffer to use when sending files- See Also:
ScpHelper.MIN_SEND_BUFFER_SIZE
-
getReceiveBufferSize
public int getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveSize)
- Parameters:
receiveSize- Size (in bytes) of buffer to use when receiving files- See Also:
ScpHelper.MIN_RECEIVE_BUFFER_SIZE
-
addEventListener
public boolean addEventListener(ScpTransferEventListener listener)
- Parameters:
listener- TheScpTransferEventListenerto add- Returns:
trueif this is a new listener instance,falseif the listener is already registered- Throws:
IllegalArgumentException- ifnulllistener
-
removeEventListener
public boolean removeEventListener(ScpTransferEventListener listener)
- Parameters:
listener- TheScpTransferEventListenerto remove- Returns:
trueif the listener was registered and removed,falseif the listener was not registered to begin with- Throws:
IllegalArgumentException- ifnulllistener
-
isSupportedCommand
public boolean isSupportedCommand(ChannelSession channel, String command)
- Specified by:
isSupportedCommandin classAbstractDelegatingCommandFactory
-
executeSupportedCommand
protected Command executeSupportedCommand(ChannelSession channel, String command)
- Specified by:
executeSupportedCommandin classAbstractDelegatingCommandFactory
-
getDelegateShellFactory
public ShellFactory getDelegateShellFactory()
- Returns:
- The delegate
ShellFactoryto use ifselectShellFactory(ChannelSession)decides not to use itself as theShellFactory- default=InteractiveProcessShellFactory. - See Also:
setDelegateShellFactory(ShellFactory)
-
setDelegateShellFactory
public void setDelegateShellFactory(ShellFactory delegateShellFactory)
- Parameters:
delegateShellFactory- TheShellFactoryto use ifselectShellFactory(ChannelSession)decides not to use itself as theShellFactory. Ifnullthen it will always decide to use itself regardless of theChannelSession- See Also:
selectShellFactory(ChannelSession)
-
selectShellFactory
public ShellFactory selectShellFactory(ChannelSession channelSession) throws IOException
- Specified by:
selectShellFactoryin interfaceShellFactorySelector- Throws:
IOException
-
createShell
public Command createShell(ChannelSession channel) throws IOException
- Specified by:
createShellin interfaceShellFactory- Throws:
IOException
-
resolveExecutorService
protected org.apache.sshd.common.util.threads.CloseableExecutorService resolveExecutorService(String command)
-
clone
public ScpCommandFactory clone()
-
-