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:
java.lang.Cloneable,ScpFileOpenerHolder,ExecutorServiceProvider,ManagedExecutorServiceSupplier,CommandFactory
public class ScpCommandFactory extends AbstractDelegatingCommandFactory implements ManagedExecutorServiceSupplier, ScpFileOpenerHolder, java.lang.Cloneable
ThisCommandFactorycan be used as a standalone command factory or can be used to augment anotherCommandFactoryand providesSCPsupport.- See Also:
ScpCommand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScpCommandFactory.BuilderA usefulObjectBuilderforScpCommandFactory
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<? extends CloseableExecutorService>executorsProviderprivate ScpFileOpenerfileOpenerprivate ScpTransferEventListenerlistenerProxyprivate java.util.Collection<ScpTransferEventListener>listenersprivate intreceiveBufferSizestatic java.lang.StringSCP_FACTORY_NAMEprivate intsendBufferSize-
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 booleanaddEventListener(ScpTransferEventListener listener)ScpCommandFactoryclone()protected CommandexecuteSupportedCommand(java.lang.String command)java.util.function.Supplier<? extends CloseableExecutorService>getExecutorServiceProvider()intgetReceiveBufferSize()ScpFileOpenergetScpFileOpener()intgetSendBufferSize()booleanisSupportedCommand(java.lang.String command)booleanremoveEventListener(ScpTransferEventListener listener)protected CloseableExecutorServiceresolveExecutorService(java.lang.String command)voidsetExecutorServiceProvider(java.util.function.Supplier<? extends CloseableExecutorService> provider)voidsetReceiveBufferSize(int receiveSize)voidsetScpFileOpener(ScpFileOpener fileOpener)voidsetSendBufferSize(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 java.lang.String SCP_FACTORY_NAME
- See Also:
- Constant Field Values
-
executorsProvider
private java.util.function.Supplier<? extends CloseableExecutorService> executorsProvider
-
fileOpener
private ScpFileOpener fileOpener
-
sendBufferSize
private int sendBufferSize
-
receiveBufferSize
private int receiveBufferSize
-
listeners
private java.util.Collection<ScpTransferEventListener> listeners
-
listenerProxy
private ScpTransferEventListener listenerProxy
-
-
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 java.util.function.Supplier<? extends CloseableExecutorService> getExecutorServiceProvider()
- Specified by:
getExecutorServiceProviderin interfaceExecutorServiceProvider- Returns:
- A
SupplierofCloseableExecutorServiceto be used when asynchronous execution required. Ifnullthen a single-threaded ad-hoc service is used.
-
setExecutorServiceProvider
public void setExecutorServiceProvider(java.util.function.Supplier<? extends CloseableExecutorService> provider)
- Specified by:
setExecutorServiceProviderin interfaceManagedExecutorServiceSupplier- Parameters:
provider- TheSupplierofCloseableExecutorService-s to be used when asynchronous execution is required. Ifnullthen 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- TheScpTransferEventListenerto add- Returns:
trueif this is a new listener instance,falseif the listener is already registered- Throws:
java.lang.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:
java.lang.IllegalArgumentException- ifnulllistener
-
isSupportedCommand
public boolean isSupportedCommand(java.lang.String command)
- Specified by:
isSupportedCommandin classAbstractDelegatingCommandFactory- Parameters:
command- The command about to be executed- Returns:
trueif this command is supported by the command factory,falseif it will be passed on to thedelegatefactory
-
executeSupportedCommand
protected Command executeSupportedCommand(java.lang.String command)
- Specified by:
executeSupportedCommandin classAbstractDelegatingCommandFactory
-
resolveExecutorService
protected CloseableExecutorService resolveExecutorService(java.lang.String command)
-
clone
public ScpCommandFactory clone()
- Overrides:
clonein classjava.lang.Object
-
-