Package org.apache.sshd.git
Class AbstractGitCommandFactory
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.server.command.AbstractDelegatingCommandFactory
-
- org.apache.sshd.git.AbstractGitCommandFactory
-
- All Implemented Interfaces:
ExecutorServiceProvider,GitLocationResolverCarrier,CommandFactory
- Direct Known Subclasses:
GitPackCommandFactory,GitPgmCommandFactory
public abstract class AbstractGitCommandFactory extends AbstractDelegatingCommandFactory implements ExecutorServiceProvider, GitLocationResolverCarrier
Helper class for various Git command factories
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcmdPrefixprivate java.util.function.Supplier<? extends CloseableExecutorService>executorsProviderprivate GitLocationResolverrootDirResolver-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractGitCommandFactory(java.lang.String name, java.lang.String cmdPrefix)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract AbstractGitCommandcreateGitCommand(java.lang.String command)protected CommandcreateUnsupportedCommand(ChannelSession channel, java.lang.String command)protected CommandexecuteSupportedCommand(ChannelSession channel, java.lang.String command)java.lang.StringgetCommandPrefix()java.util.function.Supplier<? extends CloseableExecutorService>getExecutorServiceProvider()GitLocationResolvergetGitLocationResolver()booleanisSupportedCommand(ChannelSession channel, java.lang.String command)protected CloseableExecutorServiceresolveExecutorService(java.lang.String command)AbstractGitCommandFactorywithDelegate(CommandFactory delegate)AbstractGitCommandFactorywithExecutorServiceProvider(java.util.function.Supplier<? extends CloseableExecutorService> provider)AbstractGitCommandFactorywithGitLocationResolver(GitLocationResolver rootDirResolver)-
Methods inherited from class org.apache.sshd.server.command.AbstractDelegatingCommandFactory
createCommand, getDelegateCommandFactory, setDelegateCommandFactory, toString
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.util.threads.ExecutorServiceProvider
resolveExecutorService
-
-
-
-
Field Detail
-
cmdPrefix
private final java.lang.String cmdPrefix
-
rootDirResolver
private GitLocationResolver rootDirResolver
-
executorsProvider
private java.util.function.Supplier<? extends CloseableExecutorService> executorsProvider
-
-
Method Detail
-
getCommandPrefix
public java.lang.String getCommandPrefix()
-
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.
-
withExecutorServiceProvider
public AbstractGitCommandFactory withExecutorServiceProvider(java.util.function.Supplier<? extends CloseableExecutorService> provider)
- Parameters:
provider- ASupplierofCloseableExecutorServiceto be used when starting a Git command execution. Ifnullthen a single-threaded ad-hoc service is used.- Returns:
- Self instance
-
getGitLocationResolver
public GitLocationResolver getGitLocationResolver()
- Specified by:
getGitLocationResolverin interfaceGitLocationResolverCarrier
-
withGitLocationResolver
public AbstractGitCommandFactory withGitLocationResolver(GitLocationResolver rootDirResolver)
-
withDelegate
public AbstractGitCommandFactory withDelegate(CommandFactory delegate)
-
isSupportedCommand
public boolean isSupportedCommand(ChannelSession channel, java.lang.String command)
- Specified by:
isSupportedCommandin classAbstractDelegatingCommandFactory- Parameters:
channel- TheChannelSessionthrough which the command was receivedcommand- 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(ChannelSession channel, java.lang.String command)
- Specified by:
executeSupportedCommandin classAbstractDelegatingCommandFactory
-
createUnsupportedCommand
protected Command createUnsupportedCommand(ChannelSession channel, java.lang.String command)
- Overrides:
createUnsupportedCommandin classAbstractDelegatingCommandFactory
-
resolveExecutorService
protected CloseableExecutorService resolveExecutorService(java.lang.String command)
-
createGitCommand
protected abstract AbstractGitCommand createGitCommand(java.lang.String command)
-
-