Package org.apache.sshd.common.helpers
Class AbstractFactoryManager
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.closeable.IoBaseCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractInnerCloseable
org.apache.sshd.common.kex.AbstractKexFactoryManager
org.apache.sshd.common.helpers.AbstractFactoryManager
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,AttributeRepository
,AttributeStore
,ChannelListenerManager
,ChannelStreamWriterResolver
,ChannelStreamWriterResolverManager
,Closeable
,FactoryManager
,PortForwardingEventListenerManager
,IoServiceEventListenerManager
,KexExtensionHandlerManager
,KexFactoryManager
,PropertyResolver
,ReservedSessionMessagesManager
,SessionDisconnectHandlerManager
,SessionHeartbeatController
,SessionListenerManager
,UnknownChannelReferenceHandlerManager
,SignatureFactoriesHolder
,SignatureFactoriesManager
public abstract class AbstractFactoryManager
extends AbstractKexFactoryManager
implements FactoryManager
- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T extends Object>
Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType
-
Field Summary
Modifier and TypeFieldDescriptionprotected SshAgentFactory
protected List<? extends ChannelFactory>
protected final ChannelListener
protected final Collection<ChannelListener>
protected ScheduledExecutorService
protected FileSystemFactory
protected ForwarderFactory
protected ForwardingFilter
protected List<RequestHandler<ConnectionService>>
protected IoServiceFactory
protected IoServiceFactoryFactory
protected List<? extends ServiceFactory>
protected final SessionListener
protected final Collection<SessionListener>
protected SessionTimeoutListener
protected boolean
protected ScheduledFuture<?>
protected final PortForwardingEventListener
protected final Collection<PortForwardingEventListener>
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver
NONE
Fields inherited from interface org.apache.sshd.common.FactoryManager
DEFAULT_VERSION
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChannelListener
(ChannelListener listener) Add a channel listenervoid
Add a port forwarding listenervoid
addSessionListener
(SessionListener listener) Add a session listener.protected void
void
<T> T
computeAttributeIfAbsent
(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>, ? extends T> resolver) protected SessionTimeoutListener
Retrieve the agent factory for creatingSshAgent
objects.<T> T
int
List<? extends ChannelFactory>
Retrieve the list of named factories forChannel
objects.Retrieve theFileSystemFactory
to be used to traverse the file system.Retrieve the forwarder factory used to support forwarding.Retrieve theForwardingFilter
to be used by the SSH server.Retrieve the list of global request handlers.int
Retrieve theRandom
factory to be used.Retrieve theScheduledExecutorService
to be used.List<? extends ServiceFactory>
Retrieve the list of SSHService
factories.An upper case string identifying the version of the software used on client or server side.<T> T
void
removeChannelListener
(ChannelListener listener) Remove a channel listenervoid
Remove a port forwarding listenervoid
removeSessionListener
(SessionListener listener) Remove a session listener.protected void
removeSessionTimeout
(AbstractSessionFactory<?, ?> sessionFactory) Check if current manager has a specific handler set for it - if not, try and resolve one from the "parent" container (if any)void
setAgentFactory
(SshAgentFactory agentFactory) <T> T
setAttribute
(AttributeRepository.AttributeKey<T> key, T value) void
setChannelFactories
(List<? extends ChannelFactory> channelFactories) void
void
setFileSystemFactory
(FileSystemFactory fileSystemFactory) void
setForwarderFactory
(ForwarderFactory forwarderFactory) void
setForwardingFilter
(ForwardingFilter forwardingFilter) void
setGlobalRequestHandlers
(List<RequestHandler<ConnectionService>> globalRequestHandlers) void
void
setIoServiceFactoryFactory
(IoServiceFactoryFactory ioServiceFactory) void
setNioWorkers
(int nioWorkers) void
void
setRandomFactory
(Factory<? extends Random> randomFactory) void
void
void
setScheduledExecutorService
(ScheduledExecutorService executor, boolean shutdownExecutor) void
setServiceFactories
(List<? extends ServiceFactory> serviceFactories) void
setSessionDisconnectHandler
(SessionDisconnectHandler sessionDisconnectHandler) void
setUnknownChannelReferenceHandler
(UnknownChannelReferenceHandler unknownChannelReferenceHandler) protected void
setupSessionTimeout
(AbstractSessionFactory<?, ?> sessionFactory) protected void
stopSessionTimeoutListener
(AbstractSessionFactory<?, ?> sessionFactory) Methods inherited from class org.apache.sshd.common.kex.AbstractKexFactoryManager
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactories
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately, getInnerCloseable
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
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, toString, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager
resolveChannelStreamWriter, resolveChannelStreamWriterResolver
Methods inherited from interface org.apache.sshd.common.FactoryManager
getAgentForwardingFilter, getTcpForwardingFilter, getX11ForwardingFilter, resolveAttribute
Methods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandler
Methods inherited from interface org.apache.sshd.common.kex.KexFactoryManager
getCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNames
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty, isEmpty
Methods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeat
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesHolder
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
-
Field Details
-
ioServiceFactoryFactory
-
ioServiceFactory
-
randomFactory
-
channelFactories
-
agentFactory
-
executor
-
shutdownExecutor
protected boolean shutdownExecutor -
forwarderFactory
-
forwardingFilter
-
fileSystemFactory
-
serviceFactories
-
globalRequestHandlers
-
sessionTimeoutListener
-
timeoutListenerFuture
-
sessionListeners
-
sessionListenerProxy
-
channelListeners
-
channelListenerProxy
-
tunnelListeners
-
tunnelListenerProxy
-
-
Constructor Details
-
AbstractFactoryManager
protected AbstractFactoryManager()
-
-
Method Details
-
getIoServiceFactory
- Specified by:
getIoServiceFactory
in interfaceFactoryManager
-
getIoServiceFactoryFactory
-
setIoServiceFactoryFactory
-
getIoServiceEventListener
- Specified by:
getIoServiceEventListener
in interfaceIoServiceEventListenerManager
-
setIoServiceEventListener
- Specified by:
setIoServiceEventListener
in interfaceIoServiceEventListenerManager
-
getRandomFactory
Description copied from interface:FactoryManager
Retrieve theRandom
factory to be used.- Specified by:
getRandomFactory
in interfaceFactoryManager
- Returns:
- The
Random
factory, nevernull
-
setRandomFactory
-
getProperties
- Specified by:
getProperties
in interfacePropertyResolver
-
getAttributesCount
public int getAttributesCount()- Specified by:
getAttributesCount
in interfaceAttributeRepository
-
getAttribute
- Specified by:
getAttribute
in interfaceAttributeRepository
-
attributeKeys
- Specified by:
attributeKeys
in interfaceAttributeRepository
-
computeAttributeIfAbsent
public <T> T computeAttributeIfAbsent(AttributeRepository.AttributeKey<T> key, Function<? super AttributeRepository.AttributeKey<T>, ? extends T> resolver) - Specified by:
computeAttributeIfAbsent
in interfaceAttributeStore
-
setAttribute
- Specified by:
setAttribute
in interfaceAttributeStore
-
removeAttribute
- Specified by:
removeAttribute
in interfaceAttributeStore
-
clearAttributes
public void clearAttributes()- Specified by:
clearAttributes
in interfaceAttributeStore
-
getParentPropertyResolver
- Specified by:
getParentPropertyResolver
in interfacePropertyResolver
-
setParentPropertyResolver
-
getVersion
Description copied from interface:FactoryManager
An upper case string identifying the version of the software used on client or server side. This version includes the name and version of the software and usually looks like this:SSHD-CORE-1.0
- Specified by:
getVersion
in interfaceFactoryManager
- Returns:
- the version of the software
-
getChannelFactories
Description copied from interface:FactoryManager
Retrieve the list of named factories forChannel
objects.- Specified by:
getChannelFactories
in interfaceFactoryManager
- Returns:
- A list of
ChannelFactory
-ies, nevernull
-
setChannelFactories
-
getNioWorkers
public int getNioWorkers() -
setNioWorkers
public void setNioWorkers(int nioWorkers) -
getAgentFactory
Description copied from interface:FactoryManager
Retrieve the agent factory for creatingSshAgent
objects.- Specified by:
getAgentFactory
in interfaceFactoryManager
- Returns:
- The
SshAgentFactory
-
setAgentFactory
-
getScheduledExecutorService
Description copied from interface:FactoryManager
Retrieve theScheduledExecutorService
to be used.- Specified by:
getScheduledExecutorService
in interfaceFactoryManager
- Returns:
- The
ScheduledExecutorService
, nevernull
-
setScheduledExecutorService
-
setScheduledExecutorService
public void setScheduledExecutorService(ScheduledExecutorService executor, boolean shutdownExecutor) -
getForwarderFactory
Description copied from interface:FactoryManager
Retrieve the forwarder factory used to support forwarding.- Specified by:
getForwarderFactory
in interfaceFactoryManager
- Returns:
- The
ForwarderFactory
-
setForwarderFactory
-
getForwardingFilter
Description copied from interface:FactoryManager
Retrieve theForwardingFilter
to be used by the SSH server. If no filter has been configured (i.e. this method returnsnull
), then all forwarding requests will be rejected.- Specified by:
getForwardingFilter
in interfaceFactoryManager
- Returns:
- The
ForwardingFilter
ornull
-
setForwardingFilter
-
getFileSystemFactory
Description copied from interface:FactoryManager
Retrieve theFileSystemFactory
to be used to traverse the file system.- Specified by:
getFileSystemFactory
in interfaceFactoryManager
- Returns:
- a valid
FileSystemFactory
instance ornull
if file based interactions are not supported on this server
-
setFileSystemFactory
-
getServiceFactories
Description copied from interface:FactoryManager
Retrieve the list of SSHService
factories.- Specified by:
getServiceFactories
in interfaceFactoryManager
- Returns:
- a list of named
Service
factories, nevernull
-
setServiceFactories
-
getGlobalRequestHandlers
Description copied from interface:FactoryManager
Retrieve the list of global request handlers.- Specified by:
getGlobalRequestHandlers
in interfaceFactoryManager
- Returns:
- a list of named
GlobalRequestHandler
-
setGlobalRequestHandlers
-
getReservedSessionMessagesHandler
- Specified by:
getReservedSessionMessagesHandler
in interfaceReservedSessionMessagesManager
- Returns:
- The currently registered
ReservedSessionMessagesHandler
- may benull
-
setReservedSessionMessagesHandler
- Specified by:
setReservedSessionMessagesHandler
in interfaceReservedSessionMessagesManager
- Parameters:
handler
- TheReservedSessionMessagesHandler
to use - may benull
-
getSessionDisconnectHandler
- Specified by:
getSessionDisconnectHandler
in interfaceSessionDisconnectHandlerManager
-
setSessionDisconnectHandler
- Specified by:
setSessionDisconnectHandler
in interfaceSessionDisconnectHandlerManager
-
getChannelStreamWriterResolver
- Specified by:
getChannelStreamWriterResolver
in interfaceChannelStreamWriterResolverManager
-
setChannelStreamWriterResolver
- Specified by:
setChannelStreamWriterResolver
in interfaceChannelStreamWriterResolverManager
-
getUnknownChannelReferenceHandler
- Specified by:
getUnknownChannelReferenceHandler
in interfaceUnknownChannelReferenceHandlerManager
- Returns:
- The
UnknownChannelReferenceHandlerManager
to use - ifnull
then any reference to unknown channel causes anSshChannelNotFoundException
-
setUnknownChannelReferenceHandler
public void setUnknownChannelReferenceHandler(UnknownChannelReferenceHandler unknownChannelReferenceHandler) - Specified by:
setUnknownChannelReferenceHandler
in interfaceUnknownChannelReferenceHandlerManager
- Parameters:
unknownChannelReferenceHandler
- TheUnknownChannelReferenceHandlerManager
to use - ifnull
then any reference to unknown channel causes anSshChannelNotFoundException
-
resolveUnknownChannelReferenceHandler
Description copied from interface:UnknownChannelReferenceHandlerManager
Check if current manager has a specific handler set for it - if not, try and resolve one from the "parent" container (if any)- Specified by:
resolveUnknownChannelReferenceHandler
in interfaceUnknownChannelReferenceHandlerManager
- Returns:
- The resolved handler instance
-
addSessionListener
Description copied from interface:SessionListenerManager
Add a session listener.- Specified by:
addSessionListener
in interfaceSessionListenerManager
- Parameters:
listener
- TheSessionListener
to add - notnull
-
removeSessionListener
Description copied from interface:SessionListenerManager
Remove a session listener.- Specified by:
removeSessionListener
in interfaceSessionListenerManager
- Parameters:
listener
- TheSessionListener
to remove
-
getSessionListenerProxy
- Specified by:
getSessionListenerProxy
in interfaceSessionListenerManager
- Returns:
- A (never
null
proxySessionListener
that represents all the currently registered listeners. Any method invocation on the proxy is replicated to the currently registered listeners
-
addChannelListener
Description copied from interface:ChannelListenerManager
Add a channel listener- Specified by:
addChannelListener
in interfaceChannelListenerManager
- Parameters:
listener
- TheChannelListener
to add - notnull
-
removeChannelListener
Description copied from interface:ChannelListenerManager
Remove a channel listener- Specified by:
removeChannelListener
in interfaceChannelListenerManager
- Parameters:
listener
- TheChannelListener
to remove
-
getChannelListenerProxy
- Specified by:
getChannelListenerProxy
in interfaceChannelListenerManager
- Returns:
- A (never
null
proxyChannelListener
that represents all the currently registered listeners. Any method invocation on the proxy is replicated to the currently registered listeners
-
getPortForwardingEventListenerProxy
- Specified by:
getPortForwardingEventListenerProxy
in interfacePortForwardingEventListenerManager
- Returns:
- A proxy listener representing all the currently registered listener through this manager
-
addPortForwardingEventListener
Description copied from interface:PortForwardingEventListenerManager
Add a port forwarding listener- Specified by:
addPortForwardingEventListener
in interfacePortForwardingEventListenerManager
- Parameters:
listener
- ThePortForwardingEventListener
to add - nevernull
-
removePortForwardingEventListener
Description copied from interface:PortForwardingEventListenerManager
Remove a port forwarding listener- Specified by:
removePortForwardingEventListener
in interfacePortForwardingEventListenerManager
- Parameters:
listener
- ThePortForwardingEventListener
to remove - ignored ifnull
-
setupSessionTimeout
-
removeSessionTimeout
-
createSessionTimeoutListener
-
stopSessionTimeoutListener
-
checkConfig
protected void checkConfig()
-