public class ScpCommandFactory extends Object implements CommandFactory
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 | Field and Description |
---|---|
static String |
SCP_COMMAND_PREFIX
Command prefix used to identify SCP commands
|
Constructor and Description |
---|
ScpCommandFactory()
Default constructor - uses an ad-hoc
ExecutorService with
no delegate CommandFactory and default send/receive buffer
sizes |
ScpCommandFactory(CommandFactory delegateFactory) |
ScpCommandFactory(CommandFactory delegateFactory,
ExecutorService executorService) |
ScpCommandFactory(CommandFactory delegateFactory,
ExecutorService executorService,
boolean shutdownOnExit) |
ScpCommandFactory(CommandFactory delegateFactory,
ExecutorService executorService,
boolean shutdownOnExit,
int bufferSize) |
ScpCommandFactory(CommandFactory delegateFactory,
ExecutorService executorService,
boolean shutdownOnExit,
int sendSize,
int receiveSize) |
ScpCommandFactory(ExecutorService executorService) |
ScpCommandFactory(int bufferSize)
Uses an ad-hoc
ExecutorService with no delegate CommandFactory |
Modifier and Type | Method and Description |
---|---|
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() |
public static final String SCP_COMMAND_PREFIX
public ScpCommandFactory()
ExecutorService
with
no delegate CommandFactory
and default send/receive buffer
sizesScpHelper.DEFAULT_COPY_BUFFER_SIZE
public ScpCommandFactory(int bufferSize)
ExecutorService
with no delegate CommandFactory
bufferSize
- Size (in bytes) of buffer to be used for both
sending and receiving filesScpCommandFactory(CommandFactory, ExecutorService, boolean, int, int)
public ScpCommandFactory(ExecutorService executorService)
executorService
- An ExecutorService
to be used when
starting ScpCommand
execution. If null
an ad-hoc
single-threaded service is created and used. Note: the
executor service will not be shutdown when command terminates
unless it is the ad-hoc servicepublic ScpCommandFactory(CommandFactory delegateFactory)
delegateFactory
- 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 commandSCP_COMMAND_PREFIX
public ScpCommandFactory(CommandFactory delegateFactory, ExecutorService executorService)
delegateFactory
- 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 commandexecutorService
- 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 regardlessScpCommandFactory(CommandFactory, ExecutorService, boolean)
public ScpCommandFactory(CommandFactory delegateFactory, ExecutorService executorService, boolean shutdownOnExit)
delegateFactory
- 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 commandexecutorService
- 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 regardlessshutdownOnExit
- If true
the ExecutorService.shutdownNow()
will be called when command terminates - unless it is the ad-hoc
service, which will be shutdown regardlessScpCommandFactory(CommandFactory, ExecutorService, boolean, int)
public ScpCommandFactory(CommandFactory delegateFactory, ExecutorService executorService, boolean shutdownOnExit, int bufferSize)
delegateFactory
- 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 commandexecutorService
- 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 regardlessshutdownOnExit
- If true
the ExecutorService.shutdownNow()
will be called when command terminates - unless it is the ad-hoc
service, which will be shutdown regardlessbufferSize
- Size (in bytes) of buffer to be used for both
sending and receiving filesScpCommandFactory(CommandFactory, ExecutorService, boolean, int, int)
public ScpCommandFactory(CommandFactory delegateFactory, ExecutorService executorService, boolean shutdownOnExit, int sendSize, int receiveSize)
delegateFactory
- 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 commandexecutorService
- 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 regardlessshutdownOnExit
- If true
the ExecutorService.shutdownNow()
will be called when command terminates - unless it is the ad-hoc
service, which will be shutdown regardlesssendSize
- Size (in bytes) of buffer to use when sending filesreceiveSize
- Size (in bytes) of buffer to use when receiving filesScpHelper.MIN_SEND_BUFFER_SIZE
,
ScpHelper.MIN_RECEIVE_BUFFER_SIZE
public CommandFactory getDelegateCommandFactory()
public ExecutorService getExecutorService()
public boolean isShutdownOnExit()
public int getSendBufferSize()
public int getReceiveBufferSize()
public Command createCommand(String command)
CommandFactory
instance; if one exist.createCommand
in interface CommandFactory
command
- command to parseCommand
instanceIllegalArgumentException
- if not an SCP command and no
delegate command factory is availableSCP_COMMAND_PREFIX
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.