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, org.apache.sshd.server.command.CommandFactory, org.apache.sshd.server.shell.ShellFactory, org.apache.sshd.server.shell.ShellFactorySelector

public class ScpCommandFactory extends org.apache.sshd.server.command.AbstractDelegatingCommandFactory implements org.apache.sshd.common.util.threads.ManagedExecutorServiceSupplier, ScpFileOpenerHolder, Cloneable, org.apache.sshd.server.shell.ShellFactory, org.apache.sshd.server.shell.ShellFactorySelector
This CommandFactory can be used as a standalone command factory or can be used to augment another CommandFactory and provides SCP support.
Author:
Apache MINA SSHD Project
See Also:
  • Field Details

  • Constructor Details

    • ScpCommandFactory

      public ScpCommandFactory()
  • Method Details

    • getScpFileOpener

      public ScpFileOpener getScpFileOpener()
      Specified by:
      getScpFileOpener in interface ScpFileOpenerHolder
      Returns:
      The last ScpFileOpener set via call to ScpFileOpenerHolder.setScpFileOpener(ScpFileOpener)
    • setScpFileOpener

      public void setScpFileOpener(ScpFileOpener fileOpener)
      Specified by:
      setScpFileOpener in interface ScpFileOpenerHolder
      Parameters:
      fileOpener - The default ScpFileOpener to use - if null then a default opener is used
    • getExecutorServiceProvider

      public Supplier<? extends org.apache.sshd.common.util.threads.CloseableExecutorService> getExecutorServiceProvider()
      Specified by:
      getExecutorServiceProvider in interface org.apache.sshd.common.util.threads.ExecutorServiceProvider
    • setExecutorServiceProvider

      public void setExecutorServiceProvider(Supplier<? extends org.apache.sshd.common.util.threads.CloseableExecutorService> provider)
      Specified by:
      setExecutorServiceProvider in interface org.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:
    • getReceiveBufferSize

      public int getReceiveBufferSize()
    • setReceiveBufferSize

      public void setReceiveBufferSize(int receiveSize)
      Parameters:
      receiveSize - Size (in bytes) of buffer to use when receiving files
      See Also:
    • addEventListener

      public boolean addEventListener(ScpTransferEventListener listener)
      Parameters:
      listener - The ScpTransferEventListener to add
      Returns:
      true if this is a new listener instance, false if the listener is already registered
      Throws:
      IllegalArgumentException - if null listener
    • removeEventListener

      public boolean removeEventListener(ScpTransferEventListener listener)
      Parameters:
      listener - The ScpTransferEventListener to remove
      Returns:
      true if the listener was registered and removed, false if the listener was not registered to begin with
      Throws:
      IllegalArgumentException - if null listener
    • isSupportedCommand

      public boolean isSupportedCommand(org.apache.sshd.server.channel.ChannelSession channel, String command)
      Specified by:
      isSupportedCommand in class org.apache.sshd.server.command.AbstractDelegatingCommandFactory
    • executeSupportedCommand

      protected org.apache.sshd.server.command.Command executeSupportedCommand(org.apache.sshd.server.channel.ChannelSession channel, String command)
      Specified by:
      executeSupportedCommand in class org.apache.sshd.server.command.AbstractDelegatingCommandFactory
    • getDelegateShellFactory

      public org.apache.sshd.server.shell.ShellFactory getDelegateShellFactory()
      Returns:
      The delegate ShellFactory to use if selectShellFactory(ChannelSession) decides not to use itself as the ShellFactory - default=InteractiveProcessShellFactory.
      See Also:
    • setDelegateShellFactory

      public void setDelegateShellFactory(org.apache.sshd.server.shell.ShellFactory delegateShellFactory)
      Parameters:
      delegateShellFactory - The ShellFactory to use if selectShellFactory(ChannelSession) decides not to use itself as the ShellFactory. If null then it will always decide to use itself regardless of the ChannelSession
      See Also:
    • selectShellFactory

      public org.apache.sshd.server.shell.ShellFactory selectShellFactory(org.apache.sshd.server.channel.ChannelSession channelSession) throws IOException
      Specified by:
      selectShellFactory in interface org.apache.sshd.server.shell.ShellFactorySelector
      Throws:
      IOException
    • createShell

      public org.apache.sshd.server.command.Command createShell(org.apache.sshd.server.channel.ChannelSession channel) throws IOException
      Specified by:
      createShell in interface org.apache.sshd.server.shell.ShellFactory
      Throws:
      IOException
    • resolveExecutorService

      protected org.apache.sshd.common.util.threads.CloseableExecutorService resolveExecutorService(String command)
    • clone

      public ScpCommandFactory clone()
      Overrides:
      clone in class Object