Interface IDBAdapter.Registry

All Superinterfaces:
org.eclipse.net4j.util.container.IContainer<Map.Entry<String,IDBAdapter>>, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.registry.IRegistry<String,IDBAdapter>, Map<String,IDBAdapter>
Enclosing interface:
IDBAdapter

public static interface IDBAdapter.Registry extends org.eclipse.net4j.util.registry.IRegistry<String,IDBAdapter>
The registry of all registered adapters.

The registry accepts eagerly created adapters and lazy extension descriptors. Metadata methods such as getAdapterIDs() do not instantiate descriptors. Methods returning adapters materialize the requested descriptor on demand and cache the resulting adapter for subsequent lookups.

Registration is keyed by the logical pair of name and version. Names are case-insensitive. Versions are dot-separated numeric values; trailing zero components are insignificant. Thus registering MySQL/8 prevents a second registration of mysql/8.0.0. A lookup by name alone returns the highest registered version. A lookup by an IDBAdapterID or by separate name and version performs an exact logical lookup. The arrays returned by this interface are snapshots and are ordered by name and numeric version.

Since:
4.14
Author:
Eike Stepper
No Implement
This interface is not intended to be implemented by clients.
No Extend
This interface is not intended to be extended by clients.
  • Field Details

  • Method Details

    • getAdapterIDs

      IDBAdapterID[] getAdapterIDs()
      Returns metadata for all registered adapters without instantiating lazy extension descriptors.
      Returns:
      a sorted snapshot of registered adapter identities
    • getAdapterIDs

      IDBAdapterID[] getAdapterIDs(String adapterName)
      Returns metadata for all registered versions of a name without instantiating lazy extension descriptors.
      Parameters:
      adapterName - the adapter name to match, case-insensitively
      Returns:
      a sorted snapshot of matching adapter identities
    • getAdapters

      IDBAdapter[] getAdapters()
      Returns all registered adapters, materializing lazy descriptors as necessary.
      Returns:
      a sorted snapshot of the available adapters
    • getAdapters

      IDBAdapter[] getAdapters(String adapterName)
      Returns all registered variants for a name, materializing matching lazy descriptors as necessary.
      Parameters:
      adapterName - the adapter name to match, case-insensitively
      Returns:
      a sorted snapshot of the matching adapters
    • getAdapter

      IDBAdapter getAdapter(IDBAdapterID id)
      Returns the adapter for an exact logical identity. A lazy descriptor is materialized only if this lookup finds it.
      Parameters:
      id - the identity to match
      Returns:
      the matching adapter, or null if none is registered
    • getAdapter

      IDBAdapter getAdapter(String adapterName, String version)
      Returns the adapter for an exact logical name/version pair. Name matching is case-insensitive and version matching is numeric by dot-separated components. A lazy descriptor is materialized only if this lookup finds it.
      Parameters:
      adapterName - the adapter name to match
      version - the adapter version to match
      Returns:
      the matching adapter, or null if none is registered
    • getAdapter

      IDBAdapter getAdapter(String adapterName)
      Returns the highest registered version for a name. If the matching entry is a lazy descriptor, it is materialized and cached before the adapter is returned.
      Parameters:
      adapterName - the adapter name to match, case-insensitively
      Returns:
      the highest-version adapter, or null if no version is registered
    • getAdapter

      IDBAdapter getAdapter(Connection connection)
      Resolves the registered adapter for a JDBC connection. An adapter associated with an IDBConnection is authoritative. An ordinary JDBC connection is matched against registered adapter recognition metadata using its database product name and any declared driver-name or URL constraints. A direct adapter name match takes precedence over aliases; when different adapter names remain equally applicable, the result is ambiguous. Of multiple versions of one adapter name, the highest version is selected. A matching lazy descriptor is materialized only when selected. Metadata access failures are reported as DBException.
      Parameters:
      connection - the JDBC connection to inspect
      Returns:
      the selected adapter, or null if the product is unknown or cannot be identified unambiguously
      Since:
      4.15