Package org.firebirdsql.gds.ng
Class AbstractConnection<T extends IAttachProperties<T>,C extends FbAttachment>
- java.lang.Object
-
- org.firebirdsql.gds.ng.AbstractConnection<T,C>
-
- Type Parameters:
T
- Type of attach propertiesC
- Type of connection handle
- Direct Known Subclasses:
JnaConnection
,WireConnection
public abstract class AbstractConnection<T extends IAttachProperties<T>,C extends FbAttachment> extends java.lang.Object
Abstract class with common logic for connections.- Since:
- 3.0
- Author:
- Mark Rotteveel
-
-
Field Summary
Fields Modifier and Type Field Description protected T
attachProperties
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractConnection(T attachProperties, IEncodingFactory encodingFactory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DbCryptCallback
createDbCryptCallback()
Creates an instance ofDbCryptCallback
for this connection.java.lang.String
getAttachObjectName()
T
getAttachProperties()
Encoding
getEncoding()
EncodingDefinition
getEncodingDefinition()
IEncodingFactory
getEncodingFactory()
int
getPortNumber()
java.lang.String
getServerName()
abstract C
identify()
Performs the connection identification phase of the protocol and returns the connection handle implementation for the agreed protocol.
-
-
-
Field Detail
-
attachProperties
protected final T extends IAttachProperties<T> attachProperties
-
-
Constructor Detail
-
AbstractConnection
protected AbstractConnection(T attachProperties, IEncodingFactory encodingFactory) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-
Method Detail
-
identify
public abstract C identify() throws java.sql.SQLException
Performs the connection identification phase of the protocol and returns the connection handle implementation for the agreed protocol.- Returns:
- Connection handle (ie
FbDatabase
orFbService
) - Throws:
java.sql.SQLException
- For exceptions connecting
-
getServerName
public final java.lang.String getServerName()
-
getPortNumber
public final int getPortNumber()
-
getAttachObjectName
public final java.lang.String getAttachObjectName()
-
getAttachProperties
public final T getAttachProperties()
- Returns:
- An immutable copy of the current attach properties.
-
getEncodingDefinition
public final EncodingDefinition getEncodingDefinition()
-
getEncoding
public final Encoding getEncoding()
-
getEncodingFactory
public final IEncodingFactory getEncodingFactory()
-
createDbCryptCallback
@InternalApi public final DbCryptCallback createDbCryptCallback() throws java.sql.SQLException
Creates an instance ofDbCryptCallback
for this connection.- Returns:
- Database encryption callback.
- Throws:
java.sql.SQLException
- For errors initializing the callback
-
-