Class FactoryManager

java.lang.Object
org.proto4j.redis.FactoryManager

public class FactoryManager
extends java.lang.Object
The basic service for managing a set of SQLFactories.

As part of its initialization, the FactoryManager class will attempt to load available SQLFactory classes by using:

  • Service providers of the java.sql.Driver class, that are loaded via the ServiceLoader.load(Class) mechanism.
Since:
1.0
See Also:
SQLFactory
  • Method Summary

    Modifier and Type Method Description
    static void deregisterFactory​(SQLFactory factory)
    Removes the specified driver from the FactoryManager's list of registered factories.
    static java.util.stream.Stream<SQLFactory> factories()
    Retrieves a Stream with all the currently loaded factories to which the current caller has access.
    static java.util.Enumeration<SQLFactory> getFactories()
    Retrieves an Enumeration with all the currently loaded factories to which the current caller has access.
    static SQLFactory getFactory​(java.lang.String driverType)
    Attempts to locate a factory that is bound to the given driver type.
    static void registerFactory​(SQLFactory factory)
    Registers the given factory with the FactoryManager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • registerFactory

      public static void registerFactory​(SQLFactory factory)
      Registers the given factory with the FactoryManager. A newly-loaded driver class should call the method registerDriver to make itself known to the FactoryManager. If the driver is currently registered, no action is taken.
      Parameters:
      factory - the new SQLFactory that is to be registered with the FactoryManager
      Throws:
      java.lang.NullPointerException - if factory is null
    • deregisterFactory

      public static void deregisterFactory​(SQLFactory factory)
      Removes the specified driver from the FactoryManager's list of registered factories.

      If a null value is specified for the driver to be removed, then no action is taken.

      If the specified factory is not found in the list of registered factories, then no action is taken. If the factory was found, it will be removed from the list of registered factories.

      Parameters:
      factory - the SQLFactory to remove
    • getFactory

      public static SQLFactory getFactory​(java.lang.String driverType)
      Attempts to locate a factory that is bound to the given driver type.
      Parameters:
      driverType - a string representation of the driver type
      Returns:
      a SQLFactory object that can create SQLService and SQLSource instances.
    • getFactories

      public static java.util.Enumeration<SQLFactory> getFactories()
      Retrieves an Enumeration with all the currently loaded factories to which the current caller has access.

      Note: The classname of a driver can be found using d.getClass().getName()

      Returns:
      the list of SQLFactory loaded by the caller's class loader
      See Also:
      factories()
    • factories

      public static java.util.stream.Stream<SQLFactory> factories()
      Retrieves a Stream with all the currently loaded factories to which the current caller has access.
      Returns:
      the stream of SQLFactory loaded by the caller's class loader
      Since:
      Java 9