Class DefaultSessionFactoryLocator<F>

java.lang.Object
org.springframework.integration.file.remote.session.DefaultSessionFactoryLocator<F>
Type Parameters:
F - the target system file type.
All Implemented Interfaces:
SessionFactoryLocator<F>

public class DefaultSessionFactoryLocator<F> extends Object implements SessionFactoryLocator<F>
The default implementation of SessionFactoryLocator using a simple map lookup and an optional default to fall back on.
Since:
4.2
Author:
Gary Russell, Andrey Kezhevatov, Artem Bilan
  • Constructor Details

    • DefaultSessionFactoryLocator

      public DefaultSessionFactoryLocator(Map<Object, SessionFactory<F>> factories)
      Parameters:
      factories - A map of factories, keyed by lookup key.
    • DefaultSessionFactoryLocator

      public DefaultSessionFactoryLocator(Map<Object, SessionFactory<F>> factories, @Nullable SessionFactory<F> defaultFactory)
      Parameters:
      factories - A map of factories, keyed by lookup key.
      defaultFactory - A default to be used if the lookup fails.
  • Method Details

    • addSessionFactory

      public void addSessionFactory(Object key, SessionFactory<F> factory)
      Add a session factory.
      Parameters:
      key - the lookup key.
      factory - the factory.
      Since:
      5.3
    • removeSessionFactory

      public @Nullable SessionFactory<F> removeSessionFactory(Object key)
      Remove a session factory.
      Parameters:
      key - the lookup key.
      Returns:
      the factory, if it was present.
    • getSessionFactory

      public @Nullable SessionFactory<F> getSessionFactory(@Nullable Object key)
      Description copied from interface: SessionFactoryLocator
      Return a SessionFactory for the key.
      Specified by:
      getSessionFactory in interface SessionFactoryLocator<F>
      Parameters:
      key - the key.
      Returns:
      the session factory.