Package org.firebirdsql.gds.impl
Class GDSFactory
java.lang.Object
org.firebirdsql.gds.impl.GDSFactory
The class
GDSFactory exists to provide a way to obtain objects
implementing GDS and Clumplet.- Author:
- David Jencks, Mark Rotteveel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?>getConnectionClass(GDSType gdsType) Get class extending theFBConnectionthat will be instantiated when new connection is created.static FbDatabaseFactorygetDatabaseFactoryForType(GDSType gdsType) static StringgetDatabasePath(GDSType gdsType, String jdbcUrl) Get path to the database from the specified JDBC URL.static StringgetDatabasePath(GDSType gdsType, String server, Integer port, String path) Get connection string for the specified server name, port and database name/path.static GDSTypeGet default GDS type.static StringgetJdbcUrl(GDSType gdsType, String databasePath) Create JDBC URL for the specified GDS type and database path.Get collection of the supported JDBC protocols.static GDSTypegetTypeForProtocol(String jdbcUrl) Get GDS type for the specified JDBC URL.static voidregisterPlugin(GDSFactoryPlugin plugin) Register plugin for this factory.
-
Constructor Details
-
GDSFactory
public GDSFactory()
-
-
Method Details
-
registerPlugin
Register plugin for this factory. Usually there is no need to register plugins, since this happens automatically during initialization of this class. However, there might be a situation when automatic plugin registration does not work.- Parameters:
plugin- instance ofGDSFactoryPluginto register.
-
getDefaultGDSType
Get default GDS type.- Returns:
- instance of
GDSType.
-
getDatabaseFactoryForType
-
getDatabasePath
public static String getDatabasePath(GDSType gdsType, String server, Integer port, String path) throws GDSException Get connection string for the specified server name, port and database name/path. This method delegates call to the factory plugin corresponding to the specified type.- Parameters:
gdsType- instance ofGDSTypefor which connection string should be returned.server- name or IP address of the database server, applies only to IPC and TCP connection modes, in other cases should benull.port- port on which database server opened listening socket, applies to TCP connection mode only, may benull.path- database name or path to the database- Returns:
- full connection string
- Throws:
GDSException- if connection string cannot be obtained.
-
getDatabasePath
Get path to the database from the specified JDBC URL. This method finds the appropriate plugin and delegates the call to it. Plugin is responsible for the call execution.- Parameters:
gdsType- type of the plugin, to which operation will be delegated to.jdbcUrl- JDBC url from which the database path must be extracted.- Returns:
- path to the database specified in the JDBC URL.
- Throws:
GDSException- error when database path cannot be extracted.
-
getSupportedProtocols
Get collection of the supported JDBC protocols.- Returns:
- set of the supported protocols.
-
getJdbcUrl
Create JDBC URL for the specified GDS type and database path.- Parameters:
gdsType- type of the plugin, to which operation will be delegated to.databasePath- path to the database.- Returns:
- newly created JDBC URL.
-
getTypeForProtocol
Get GDS type for the specified JDBC URL. This method finds the plugin corresponding to the specified type and delegates the call to it.- Parameters:
jdbcUrl- JDBC URL for which GDS type should be obtained.- Returns:
- instance of
GDSType.
-
getConnectionClass
Get class extending theFBConnectionthat will be instantiated when new connection is created. This method finds the plugin for the specified type and delegates the call to it.- Parameters:
gdsType- instance ofGDSType- Returns:
- class to instantiate for the database connection.
-