public final class DBObjectProviderFactory
extends java.lang.Object
Database.getQualifiedName()
) as the
identifier while the offline database (when available) will use its URL.Modifier and Type | Class and Description |
---|---|
static class |
DBObjectProviderFactory.Creator
Factory creator class used to create provider instances when there isn't
one already in the cache.
|
static interface |
DBObjectProviderFactory.Listener
Listener interface that can be registered against this factory to be
notified of provider create and uncache events.
|
Modifier and Type | Method and Description |
---|---|
static <T extends DBObjectProviderFactory.Creator> |
findFactory(java.lang.Class<T> clz)
Deprecated.
use
getCreator(String) instead as it doesn't load classes. |
static DBObjectProvider |
findOrCreateProvider(DBObjectProviderID id)
Finds or creates a provider with the given DBObjectProviderID.
|
static DBObjectProvider |
findOrCreateProvider(java.lang.Object identifier)
Deprecated.
|
static DBObjectProvider |
findOrCreateProvider(java.lang.String providerType,
java.lang.Object identifier)
Finds or creates a provider with the given type and identifier.
|
static DBObjectProvider |
findProvider(DBObjectProviderID id)
Finds a provider using the given id.
|
static DBObjectProvider |
findProvider(java.lang.Object identifier)
Deprecated.
|
static DBObjectProvider |
findProvider(java.lang.String providerType,
java.lang.Object identifier)
Finds a provider using the given identifier key.
|
static DBObjectProviderFactory.Creator |
getCreator(java.lang.String providerType)
Internal use only.
|
static java.lang.String |
getDescription(java.lang.String type,
java.lang.Object identifier)
Gets a displayable string to represent the provider with the given
identifier.
|
static java.lang.Class<? extends DBObjectProvider> |
loadProviderClass(java.lang.String clzName)
Loads the given provider class using the class name.
|
static void |
registerFactory(DBObjectProviderFactory.Creator factory)
Register the given Creator to be available for creating providers.
|
static void |
registerListener(DBObjectProviderFactory.Listener l)
Registers a listener to be notified of any providers being created or
removed from the cache.
|
static void |
registerProviderListener(java.lang.String providerType,
DBObjectProviderListener l)
Registers a DBObjectProviderListener that will in turn be registered
with any DBObjectProvider created of the given providerType.
|
static DBObjectProvider |
uncacheProvider(java.lang.Object identifier)
Deprecated.
use
uncacheProvider(String,Object) to avoid
initialising unnecessary extensions. |
static DBObjectProvider |
uncacheProvider(java.lang.String providerType,
java.lang.Object identifier)
Uncaches a DBObjectProvider instance.
|
static void |
unregisterFactory(DBObjectProviderFactory.Creator factory)
Unregisters the given Creator.
|
static void |
unregisterListener(DBObjectProviderFactory.Listener l)
Unregister the specified listener.
|
static void |
unregisterProviderListener(java.lang.String providerType,
DBObjectProviderListener l)
Unregisters a DBObjectProviderListener that was previously registered
with
registerProviderListener(String,DBObjectProviderListener)
If either argument is null nothing will be unregistered. |
public static void registerListener(DBObjectProviderFactory.Listener l)
l
- public static void unregisterListener(DBObjectProviderFactory.Listener l)
public static void registerProviderListener(java.lang.String providerType, DBObjectProviderListener l)
When a DBObjectProvider instance that the listener has been added to is closed/removed then the listener will be unregistered from it.
providerType
- the type of provider to register the listener withl
- the listener to add to all providers created of the given typepublic static void unregisterProviderListener(java.lang.String providerType, DBObjectProviderListener l)
registerProviderListener(String,DBObjectProviderListener)
If either argument is null nothing will be unregistered.
Unregistering this listener will stop it from being registered with any new DBObjectProvider. If it has already been registered with a DBObjectProvider that has been created since it was registered then it will remain listening to that provider until the provider is closed/removed.
providerType
- the type of provider the listener was registered
againstl
- the listener to unregisterpublic static void registerFactory(DBObjectProviderFactory.Creator factory)
public static void unregisterFactory(DBObjectProviderFactory.Creator factory)
@Deprecated public static <T extends DBObjectProviderFactory.Creator> T findFactory(java.lang.Class<T> clz)
getCreator(String)
instead as it doesn't load classes.@Deprecated public static DBObjectProvider findProvider(java.lang.Object identifier)
findProvider(String,Object)
public static DBObjectProvider findProvider(DBObjectProviderID id)
id
- the ID for the DBObjectProvider to find.public static DBObjectProvider findProvider(java.lang.String providerType, java.lang.Object identifier)
providerType
- the type of provider to findidentifier
- the identifier for the provider - e.g. connection name
or offline database urlDatabase.PROVIDER_TYPE
@Deprecated public static DBObjectProvider findOrCreateProvider(java.lang.Object identifier) throws DBException
findOrCreateProvider(String,Object)
DBException
public static DBObjectProvider findOrCreateProvider(DBObjectProviderID id) throws DBException
id
- the ID object for the providerDBException
public static DBObjectProvider findOrCreateProvider(java.lang.String providerType, java.lang.Object identifier) throws DBException
providerType
- the type of provider to find - e.g.
Database.PROVIDER_TYPE
or
OfflineDBObjectProvider.PROVIDER_TYPE
.identifier
- the identifier for the provider - e.g. connection name
or offline database urlDBException
Database.PROVIDER_TYPE
public static final DBObjectProviderFactory.Creator getCreator(java.lang.String providerType)
@Deprecated public static final DBObjectProvider uncacheProvider(java.lang.Object identifier)
uncacheProvider(String,Object)
to avoid
initialising unnecessary extensions.public static final DBObjectProvider uncacheProvider(java.lang.String providerType, java.lang.Object identifier)
providerType
- the type of provideridentifier
- the unique identified for the providerpublic static java.lang.String getDescription(java.lang.String type, java.lang.Object identifier)
public static final java.lang.Class<? extends DBObjectProvider> loadProviderClass(java.lang.String clzName) throws java.lang.ClassNotFoundException
Class.forName( clzName )
because the given provider
class may not be on the classpath of the api (e.g. in osgi mode).clzName
- the name of the provider class to loadjava.lang.ClassNotFoundException
- if the class cannot be found on any of the
available classpaths.