public class ScpCommandFactory extends Object implements CommandFactory, Cloneable, ExecutorServiceConfigurer
CommandFactory can be used as a standalone command factory
or can be used to augment another CommandFactory and provides
SCP support.ScpCommand| Modifier and Type | Class and Description |
|---|---|
static class |
ScpCommandFactory.Builder
A useful
ObjectBuilder for ScpCommandFactory |
| Constructor and Description |
|---|
ScpCommandFactory() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEventListener(ScpTransferEventListener listener) |
ScpCommandFactory |
clone() |
Command |
createCommand(String command)
Parses a command string and verifies that the basic syntax is
correct.
|
CommandFactory |
getDelegateCommandFactory() |
ExecutorService |
getExecutorService() |
int |
getReceiveBufferSize() |
int |
getSendBufferSize() |
boolean |
isShutdownOnExit() |
boolean |
removeEventListener(ScpTransferEventListener listener) |
void |
setDelegateCommandFactory(CommandFactory factory) |
void |
setExecutorService(ExecutorService service) |
void |
setReceiveBufferSize(int receiveSize) |
void |
setSendBufferSize(int sendSize) |
void |
setShutdownOnExit(boolean shutdown) |
public CommandFactory getDelegateCommandFactory()
public void setDelegateCommandFactory(CommandFactory factory)
factory - A CommandFactory to be used if the
command is not an SCP one. If null then an IllegalArgumentException
will be thrown when attempting to invoke createCommand(String)
with a non-SCP commandpublic ExecutorService getExecutorService()
getExecutorService in interface ExecutorServiceCarrierpublic void setExecutorService(ExecutorService service)
setExecutorService in interface ExecutorServiceConfigurerservice - An ExecutorService to be used when
starting ScpCommand execution. If null then a single-threaded
ad-hoc service is used. Note: the service will not be shutdown
when the command is terminated - unless it is the ad-hoc service, which will be
shutdown regardlesspublic boolean isShutdownOnExit()
isShutdownOnExit in interface ExecutorServiceCarriertrue then the ExecutorService.shutdownNow()
will be called (unless it is an internally allocated service which is always
closed)public void setShutdownOnExit(boolean shutdown)
setShutdownOnExit in interface ExecutorServiceConfigurershutdown - If true the ExecutorService.shutdownNow()
will be called when command terminates - unless it is the ad-hoc
service, which will be shutdown regardlesspublic int getSendBufferSize()
public void setSendBufferSize(int sendSize)
sendSize - Size (in bytes) of buffer to use when sending filesScpHelper.MIN_SEND_BUFFER_SIZEpublic int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveSize)
receiveSize - Size (in bytes) of buffer to use when receiving filesScpHelper.MIN_RECEIVE_BUFFER_SIZEpublic boolean addEventListener(ScpTransferEventListener listener)
listener - The ScpTransferEventListener to addtrue if this is a new listener instance,
false if the listener is already registeredIllegalArgumentException - if null listenerpublic boolean removeEventListener(ScpTransferEventListener listener)
listener - The ScpTransferEventListener to removetrue if the listener was registered and removed,
false if the listener was not registered to begin withIllegalArgumentException - if null listenerpublic Command createCommand(String command)
CommandFactory instance; if one exist.createCommand in interface CommandFactorycommand - command to parseCommand instanceIllegalArgumentException - if not an SCP command and no
delegate command factory is availableScpHelper.SCP_COMMAND_PREFIXpublic ScpCommandFactory clone()
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.