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, org.apache.sshd.common.AttributeRepository, org.apache.sshd.common.AttributeStore, ChannelListenerManager, ChannelStreamWriterResolver, ChannelStreamWriterResolverManager, org.apache.sshd.common.Closeable, FactoryManager, PortForwardingEventListenerManager, org.apache.sshd.common.io.IoServiceEventListenerManager, KexExtensionHandlerManager, KexFactoryManager, org.apache.sshd.common.PropertyResolver, ReservedSessionMessagesManager, SessionDisconnectHandlerManager, org.apache.sshd.common.session.SessionHeartbeatController, SessionListenerManager, UnknownChannelReferenceHandlerManager, org.apache.sshd.common.signature.SignatureFactoriesHolder, org.apache.sshd.common.signature.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
org.apache.sshd.common.util.closeable.AbstractCloseable.StateNested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
org.apache.sshd.common.AttributeRepository.AttributeKey<T>Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
org.apache.sshd.common.session.SessionHeartbeatController.HeartbeatType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SshAgentFactoryprotected List<? extends ChannelFactory> protected final ChannelListenerprotected final Collection<ChannelListener> protected ScheduledExecutorServiceprotected org.apache.sshd.common.file.FileSystemFactoryprotected ForwarderFactoryprotected ForwardingFilterprotected List<RequestHandler<ConnectionService>> protected org.apache.sshd.common.io.IoServiceFactoryprotected IoServiceFactoryFactoryprotected org.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> protected List<? extends ServiceFactory> protected final SessionListenerprotected final Collection<SessionListener> protected final AtomicReference<SessionTimeoutListener> protected booleanprotected final AtomicReference<ScheduledFuture<?>> protected final PortForwardingEventListenerprotected final Collection<PortForwardingEventListener> Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface ChannelStreamWriterResolver
NONEFields inherited from interface FactoryManager
DEFAULT_VERSIONFields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChannelListener(ChannelListener listener) Add a channel listenervoidAdd a port forwarding listenervoidaddSessionListener(SessionListener listener) Add a session listener.Collection<org.apache.sshd.common.AttributeRepository.AttributeKey<?>> protected voidvoid<T> TcomputeAttributeIfAbsent(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, Function<? super org.apache.sshd.common.AttributeRepository.AttributeKey<T>, ? extends T> resolver) protected SessionTimeoutListenerRetrieve the agent factory for creatingSshAgentobjects.<T> TgetAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) intList<? extends ChannelFactory> Retrieve the list of named factories forChannelobjects.org.apache.sshd.common.file.FileSystemFactoryRetrieve theFileSystemFactoryto be used to traverse the file system.Retrieve the forwarder factory used to support forwarding.Retrieve theForwardingFilterto be used by the SSH server.Retrieve the list of global request handlers.org.apache.sshd.common.io.IoServiceEventListenerorg.apache.sshd.common.io.IoServiceFactoryintorg.apache.sshd.common.PropertyResolverorg.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> Retrieve theRandomfactory to be used.Retrieve theScheduledExecutorServiceto be used.List<? extends ServiceFactory> Retrieve the list of SSHServicefactories.An upper case string identifying the version of the software used on client or server side.<T> TremoveAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) voidremoveChannelListener(ChannelListener listener) Remove a channel listenervoidRemove a port forwarding listenervoidremoveSessionListener(SessionListener listener) Remove a session listener.protected voidremoveSessionTimeout(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)voidsetAgentFactory(SshAgentFactory agentFactory) <T> TsetAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, T value) voidsetChannelFactories(List<? extends ChannelFactory> channelFactories) voidvoidsetFileSystemFactory(org.apache.sshd.common.file.FileSystemFactory fileSystemFactory) voidsetForwarderFactory(ForwarderFactory forwarderFactory) voidsetForwardingFilter(ForwardingFilter forwardingFilter) voidsetGlobalRequestHandlers(List<RequestHandler<ConnectionService>> globalRequestHandlers) voidsetIoServiceEventListener(org.apache.sshd.common.io.IoServiceEventListener listener) voidsetIoServiceFactoryFactory(IoServiceFactoryFactory ioServiceFactory) voidsetNioWorkers(int nioWorkers) voidsetParentPropertyResolver(org.apache.sshd.common.PropertyResolver parent) voidsetRandomFactory(org.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> randomFactory) voidvoidvoidsetScheduledExecutorService(ScheduledExecutorService executor, boolean shutdownExecutor) voidsetServiceFactories(List<? extends ServiceFactory> serviceFactories) voidsetSessionDisconnectHandler(SessionDisconnectHandler sessionDisconnectHandler) voidsetUnknownChannelReferenceHandler(UnknownChannelReferenceHandler unknownChannelReferenceHandler) protected voidsetupSessionTimeout(AbstractSessionFactory<?, ?> sessionFactory) protected voidstopSessionTimeoutListener(AbstractSessionFactory<?, ?> sessionFactory) Methods inherited from class AbstractKexFactoryManager
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactoriesMethods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately, getInnerCloseableMethods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerMethods 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, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelStreamWriterResolverManager
resolveChannelStreamWriter, resolveChannelStreamWriterResolverMethods inherited from interface org.apache.sshd.common.Closeable
close, isOpenMethods inherited from interface FactoryManager
getAgentForwardingFilter, getTcpForwardingFilter, getX11ForwardingFilter, resolveAttributeMethods inherited from interface KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandlerMethods inherited from interface KexFactoryManager
getCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNamesMethods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty, isEmptyMethods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeatMethods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesHolder
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNamesMethods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
-
Field Details
-
ioServiceFactoryFactory
-
ioServiceFactory
protected org.apache.sshd.common.io.IoServiceFactory ioServiceFactory -
randomFactory
protected org.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> randomFactory -
channelFactories
-
agentFactory
-
executor
-
shutdownExecutor
protected boolean shutdownExecutor -
forwarderFactory
-
forwardingFilter
-
fileSystemFactory
protected org.apache.sshd.common.file.FileSystemFactory fileSystemFactory -
serviceFactories
-
globalRequestHandlers
-
sessionTimeoutListener
-
timeoutListenerFuture
-
sessionListeners
-
sessionListenerProxy
-
channelListeners
-
channelListenerProxy
-
tunnelListeners
-
tunnelListenerProxy
-
-
Constructor Details
-
AbstractFactoryManager
protected AbstractFactoryManager()
-
-
Method Details
-
getIoServiceFactory
public org.apache.sshd.common.io.IoServiceFactory getIoServiceFactory()- Specified by:
getIoServiceFactoryin interfaceFactoryManager
-
getIoServiceFactoryFactory
-
setIoServiceFactoryFactory
-
getIoServiceEventListener
public org.apache.sshd.common.io.IoServiceEventListener getIoServiceEventListener()- Specified by:
getIoServiceEventListenerin interfaceorg.apache.sshd.common.io.IoServiceEventListenerManager
-
setIoServiceEventListener
public void setIoServiceEventListener(org.apache.sshd.common.io.IoServiceEventListener listener) - Specified by:
setIoServiceEventListenerin interfaceorg.apache.sshd.common.io.IoServiceEventListenerManager
-
getRandomFactory
public org.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> getRandomFactory()Description copied from interface:FactoryManagerRetrieve theRandomfactory to be used.- Specified by:
getRandomFactoryin interfaceFactoryManager- Returns:
- The
Randomfactory, nevernull
-
setRandomFactory
public void setRandomFactory(org.apache.sshd.common.Factory<? extends org.apache.sshd.common.random.Random> randomFactory) -
getProperties
-
getAttributesCount
public int getAttributesCount()- Specified by:
getAttributesCountin interfaceorg.apache.sshd.common.AttributeRepository
-
getAttribute
public <T> T getAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) - Specified by:
getAttributein interfaceorg.apache.sshd.common.AttributeRepository
-
attributeKeys
- Specified by:
attributeKeysin interfaceorg.apache.sshd.common.AttributeRepository
-
computeAttributeIfAbsent
public <T> T computeAttributeIfAbsent(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, Function<? super org.apache.sshd.common.AttributeRepository.AttributeKey<T>, ? extends T> resolver) - Specified by:
computeAttributeIfAbsentin interfaceorg.apache.sshd.common.AttributeStore
-
setAttribute
public <T> T setAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key, T value) - Specified by:
setAttributein interfaceorg.apache.sshd.common.AttributeStore
-
removeAttribute
public <T> T removeAttribute(org.apache.sshd.common.AttributeRepository.AttributeKey<T> key) - Specified by:
removeAttributein interfaceorg.apache.sshd.common.AttributeStore
-
clearAttributes
public void clearAttributes()- Specified by:
clearAttributesin interfaceorg.apache.sshd.common.AttributeStore
-
getParentPropertyResolver
public org.apache.sshd.common.PropertyResolver getParentPropertyResolver()- Specified by:
getParentPropertyResolverin interfaceorg.apache.sshd.common.PropertyResolver
-
setParentPropertyResolver
public void setParentPropertyResolver(org.apache.sshd.common.PropertyResolver parent) -
getVersion
Description copied from interface:FactoryManagerAn 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:
getVersionin interfaceFactoryManager- Returns:
- the version of the software
-
getChannelFactories
Description copied from interface:FactoryManagerRetrieve the list of named factories forChannelobjects.- Specified by:
getChannelFactoriesin interfaceFactoryManager- Returns:
- A list of
ChannelFactory-ies, nevernull
-
setChannelFactories
-
getNioWorkers
public int getNioWorkers() -
setNioWorkers
public void setNioWorkers(int nioWorkers) -
getAgentFactory
Description copied from interface:FactoryManagerRetrieve the agent factory for creatingSshAgentobjects.- Specified by:
getAgentFactoryin interfaceFactoryManager- Returns:
- The
SshAgentFactory
-
setAgentFactory
-
getScheduledExecutorService
Description copied from interface:FactoryManagerRetrieve theScheduledExecutorServiceto be used.- Specified by:
getScheduledExecutorServicein interfaceFactoryManager- Returns:
- The
ScheduledExecutorService, nevernull
-
setScheduledExecutorService
-
setScheduledExecutorService
public void setScheduledExecutorService(ScheduledExecutorService executor, boolean shutdownExecutor) -
getForwarderFactory
Description copied from interface:FactoryManagerRetrieve the forwarder factory used to support forwarding.- Specified by:
getForwarderFactoryin interfaceFactoryManager- Returns:
- The
ForwarderFactory
-
setForwarderFactory
-
getForwardingFilter
Description copied from interface:FactoryManagerRetrieve theForwardingFilterto 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:
getForwardingFilterin interfaceFactoryManager- Returns:
- The
ForwardingFilterornull
-
setForwardingFilter
-
getFileSystemFactory
public org.apache.sshd.common.file.FileSystemFactory getFileSystemFactory()Description copied from interface:FactoryManagerRetrieve theFileSystemFactoryto be used to traverse the file system.- Specified by:
getFileSystemFactoryin interfaceFactoryManager- Returns:
- a valid
FileSystemFactoryinstance ornullif file based interactions are not supported on this server
-
setFileSystemFactory
public void setFileSystemFactory(org.apache.sshd.common.file.FileSystemFactory fileSystemFactory) -
getServiceFactories
Description copied from interface:FactoryManagerRetrieve the list of SSHServicefactories.- Specified by:
getServiceFactoriesin interfaceFactoryManager- Returns:
- a list of named
Servicefactories, nevernull
-
setServiceFactories
-
getGlobalRequestHandlers
Description copied from interface:FactoryManagerRetrieve the list of global request handlers.- Specified by:
getGlobalRequestHandlersin interfaceFactoryManager- Returns:
- a list of named
GlobalRequestHandler
-
setGlobalRequestHandlers
-
getReservedSessionMessagesHandler
- Specified by:
getReservedSessionMessagesHandlerin interfaceReservedSessionMessagesManager- Returns:
- The currently registered
ReservedSessionMessagesHandler- may benull
-
setReservedSessionMessagesHandler
- Specified by:
setReservedSessionMessagesHandlerin interfaceReservedSessionMessagesManager- Parameters:
handler- TheReservedSessionMessagesHandlerto use - may benull
-
getSessionDisconnectHandler
- Specified by:
getSessionDisconnectHandlerin interfaceSessionDisconnectHandlerManager
-
setSessionDisconnectHandler
- Specified by:
setSessionDisconnectHandlerin interfaceSessionDisconnectHandlerManager
-
getChannelStreamWriterResolver
- Specified by:
getChannelStreamWriterResolverin interfaceChannelStreamWriterResolverManager
-
setChannelStreamWriterResolver
- Specified by:
setChannelStreamWriterResolverin interfaceChannelStreamWriterResolverManager
-
getUnknownChannelReferenceHandler
- Specified by:
getUnknownChannelReferenceHandlerin interfaceUnknownChannelReferenceHandlerManager- Returns:
- The
UnknownChannelReferenceHandlerManagerto use - ifnullthen any reference to unknown channel causes anSshChannelNotFoundException
-
setUnknownChannelReferenceHandler
public void setUnknownChannelReferenceHandler(UnknownChannelReferenceHandler unknownChannelReferenceHandler) - Specified by:
setUnknownChannelReferenceHandlerin interfaceUnknownChannelReferenceHandlerManager- Parameters:
unknownChannelReferenceHandler- TheUnknownChannelReferenceHandlerManagerto use - ifnullthen any reference to unknown channel causes anSshChannelNotFoundException
-
resolveUnknownChannelReferenceHandler
Description copied from interface:UnknownChannelReferenceHandlerManagerCheck if current manager has a specific handler set for it - if not, try and resolve one from the "parent" container (if any)- Specified by:
resolveUnknownChannelReferenceHandlerin interfaceUnknownChannelReferenceHandlerManager- Returns:
- The resolved handler instance
-
addSessionListener
Description copied from interface:SessionListenerManagerAdd a session listener.- Specified by:
addSessionListenerin interfaceSessionListenerManager- Parameters:
listener- TheSessionListenerto add - notnull
-
removeSessionListener
Description copied from interface:SessionListenerManagerRemove a session listener.- Specified by:
removeSessionListenerin interfaceSessionListenerManager- Parameters:
listener- TheSessionListenerto remove
-
getSessionListenerProxy
- Specified by:
getSessionListenerProxyin interfaceSessionListenerManager- Returns:
- A (never
nullproxySessionListenerthat represents all the currently registered listeners. Any method invocation on the proxy is replicated to the currently registered listeners
-
addChannelListener
Description copied from interface:ChannelListenerManagerAdd a channel listener- Specified by:
addChannelListenerin interfaceChannelListenerManager- Parameters:
listener- TheChannelListenerto add - notnull
-
removeChannelListener
Description copied from interface:ChannelListenerManagerRemove a channel listener- Specified by:
removeChannelListenerin interfaceChannelListenerManager- Parameters:
listener- TheChannelListenerto remove
-
getChannelListenerProxy
- Specified by:
getChannelListenerProxyin interfaceChannelListenerManager- Returns:
- A (never
nullproxyChannelListenerthat represents all the currently registered listeners. Any method invocation on the proxy is replicated to the currently registered listeners
-
getPortForwardingEventListenerProxy
- Specified by:
getPortForwardingEventListenerProxyin interfacePortForwardingEventListenerManager- Returns:
- A proxy listener representing all the currently registered listeners in this manager
-
addPortForwardingEventListener
Description copied from interface:PortForwardingEventListenerManagerAdd a port forwarding listener- Specified by:
addPortForwardingEventListenerin interfacePortForwardingEventListenerManager- Parameters:
listener- ThePortForwardingEventListenerto add - nevernull
-
removePortForwardingEventListener
Description copied from interface:PortForwardingEventListenerManagerRemove a port forwarding listener- Specified by:
removePortForwardingEventListenerin interfacePortForwardingEventListenerManager- Parameters:
listener- ThePortForwardingEventListenerto remove - ignored ifnull
-
setupSessionTimeout
-
removeSessionTimeout
-
createSessionTimeoutListener
-
stopSessionTimeoutListener
-
checkConfig
protected void checkConfig()
-