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.Driverclass, that are loaded via theServiceLoader.load(Class)mechanism.
- Since:
- 1.0
- See Also:
SQLFactory
-
Method Summary
Modifier and Type Method Description static voidderegisterFactory(SQLFactory factory)Removes the specified driver from theFactoryManager'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 SQLFactorygetFactory(java.lang.String driverType)Attempts to locate a factory that is bound to the given driver type.static voidregisterFactory(SQLFactory factory)Registers the given factory with theFactoryManager.
-
Method Details
-
registerFactory
Registers the given factory with theFactoryManager. A newly-loaded driver class should call the methodregisterDriverto make itself known to theFactoryManager. If the driver is currently registered, no action is taken.- Parameters:
factory- the newSQLFactorythat is to be registered with theFactoryManager- Throws:
java.lang.NullPointerException- iffactoryis null
-
deregisterFactory
Removes the specified driver from theFactoryManager's list of registered factories.If a
nullvalue 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- theSQLFactoryto remove
-
getFactory
Attempts to locate a factory that is bound to the given driver type.- Parameters:
driverType- a string representation of the driver type- Returns:
- a
SQLFactoryobject that can createSQLServiceandSQLSourceinstances.
-
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
SQLFactoryloaded by the caller's class loader - See Also:
factories()
-
factories
Retrieves a Stream with all the currently loaded factories to which the current caller has access.- Returns:
- the stream of
SQLFactoryloaded by the caller's class loader - Since:
- Java 9
-