Package org.apache.sshd.server.scp
Class ScpCommandFactory
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.server.command.AbstractDelegatingCommandFactory
-
- org.apache.sshd.server.scp.ScpCommandFactory
-
- All Implemented Interfaces:
Cloneable
,ScpFileOpenerHolder
,ExecutorServiceProvider
,ManagedExecutorServiceSupplier
,CommandFactory
public class ScpCommandFactory extends AbstractDelegatingCommandFactory implements ManagedExecutorServiceSupplier, ScpFileOpenerHolder, Cloneable
ThisCommandFactory
can be used as a standalone command factory or can be used to augment anotherCommandFactory
and providesSCP
support.- Author:
- Apache MINA SSHD Project
- See Also:
ScpCommand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScpCommandFactory.Builder
A usefulObjectBuilder
forScpCommandFactory
-
Field Summary
Fields Modifier and Type Field Description static String
SCP_FACTORY_NAME
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description ScpCommandFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addEventListener(ScpTransferEventListener listener)
ScpCommandFactory
clone()
protected Command
executeSupportedCommand(String command)
Supplier<? extends CloseableExecutorService>
getExecutorServiceProvider()
int
getReceiveBufferSize()
ScpFileOpener
getScpFileOpener()
int
getSendBufferSize()
boolean
isSupportedCommand(String command)
boolean
removeEventListener(ScpTransferEventListener listener)
protected CloseableExecutorService
resolveExecutorService(String command)
void
setExecutorServiceProvider(Supplier<? extends CloseableExecutorService> provider)
void
setReceiveBufferSize(int receiveSize)
void
setScpFileOpener(ScpFileOpener fileOpener)
void
setSendBufferSize(int sendSize)
-
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
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.util.threads.ExecutorServiceProvider
resolveExecutorService
-
-
-
-
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:
getScpFileOpener
in interfaceScpFileOpenerHolder
- Returns:
- The last
ScpFileOpener
set via call toScpFileOpenerHolder.setScpFileOpener(ScpFileOpener)
-
setScpFileOpener
public void setScpFileOpener(ScpFileOpener fileOpener)
- Specified by:
setScpFileOpener
in interfaceScpFileOpenerHolder
- Parameters:
fileOpener
- The defaultScpFileOpener
to use - ifnull
then a default opener is used
-
getExecutorServiceProvider
public Supplier<? extends CloseableExecutorService> getExecutorServiceProvider()
- Specified by:
getExecutorServiceProvider
in interfaceExecutorServiceProvider
- Returns:
- A
Supplier
ofCloseableExecutorService
to be used when asynchronous execution required. Ifnull
then a single-threaded ad-hoc service is used.
-
setExecutorServiceProvider
public void setExecutorServiceProvider(Supplier<? extends CloseableExecutorService> provider)
- Specified by:
setExecutorServiceProvider
in interfaceManagedExecutorServiceSupplier
- Parameters:
provider
- TheSupplier
ofCloseableExecutorService
-s to be used when asynchronous execution is required. Ifnull
then a single-threaded ad-hoc service is used.
-
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
- TheScpTransferEventListener
to add- Returns:
true
if this is a new listener instance,false
if the listener is already registered- Throws:
IllegalArgumentException
- ifnull
listener
-
removeEventListener
public boolean removeEventListener(ScpTransferEventListener listener)
- Parameters:
listener
- TheScpTransferEventListener
to remove- Returns:
true
if the listener was registered and removed,false
if the listener was not registered to begin with- Throws:
IllegalArgumentException
- ifnull
listener
-
isSupportedCommand
public boolean isSupportedCommand(String command)
- Specified by:
isSupportedCommand
in classAbstractDelegatingCommandFactory
- Parameters:
command
- The command about to be executed- Returns:
true
if this command is supported by the command factory,false
if it will be passed on to thedelegate
factory
-
executeSupportedCommand
protected Command executeSupportedCommand(String command)
- Specified by:
executeSupportedCommand
in classAbstractDelegatingCommandFactory
-
resolveExecutorService
protected CloseableExecutorService resolveExecutorService(String command)
-
clone
public ScpCommandFactory clone()
-
-