Package org.firebirdsql.gds.ng.jna
Class JnaService
java.lang.Object
org.firebirdsql.gds.ng.AbstractFbAttachment<T>
org.firebirdsql.gds.ng.AbstractFbService<JnaServiceConnection>
org.firebirdsql.gds.ng.jna.JnaService
- All Implemented Interfaces:
AutoCloseable,FbAttachment,FbService,JnaAttachment,ExceptionListenable
public final class JnaService
extends AbstractFbService<JnaServiceConnection>
implements JnaAttachment
Implementation of
FbService for native client access.- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Field Summary
FieldsFields inherited from class org.firebirdsql.gds.ng.AbstractFbService
serviceListenerDispatcherFields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
connection, exceptionListenerDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdditional tasks to execute directly after attach operation.voidattach()Attach to the attachment type.protected voidChecks if the attachment is connected, and throws aSQLExceptionif it isn't connected.Creates an emptyServiceParameterBuffer.protected voidfinalize()intcom.sun.jna.ptr.IntByReferenceintGets the current network timeout for this attachment.byte[]getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength) Performs a service info request (service query.protected voidActual implementation of service detach.voidprocessStatusVector(ISC_STATUS[] statusVector, WarningMessageCallback warningMessageCallback) voidsetNetworkTimeout(int milliseconds) Sets the network timeout for this attachment.voidstartServiceAction(ServiceRequestBuffer serviceRequestBuffer) Starts a service action.Methods inherited from class org.firebirdsql.gds.ng.AbstractFbService
addServiceListener, close, getDescribeServiceRequestBuffer, getServiceInfo, getServiceInformationProcessor, getServiceWarningCallback, removeServiceListenerMethods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
addExceptionListener, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getServerVersionInformation, getSynchronizationObject, isAttached, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersionMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListenerMethods inherited from interface org.firebirdsql.gds.ng.FbAttachment
close, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached
-
Field Details
-
STATUS_VECTOR_SIZE
public static final int STATUS_VECTOR_SIZE- See Also:
-
-
Constructor Details
-
JnaService
-
-
Method Details
-
createServiceParameterBuffer
Description copied from interface:FbServiceCreates an emptyServiceParameterBuffer.Attach expects a service parameter buffer to have the version as the first item. This needs to be added explicitly.
- Specified by:
createServiceParameterBufferin interfaceFbService- Returns:
- Service
-
createServiceRequestBuffer
- Specified by:
createServiceRequestBufferin interfaceFbService- Returns:
- An empty service request buffer
-
checkConnected
Description copied from class:AbstractFbAttachmentChecks if the attachment is connected, and throws aSQLExceptionif it isn't connected.- Specified by:
checkConnectedin classAbstractFbAttachment<JnaServiceConnection>- Throws:
SQLException
-
getServiceInfo
public byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength) throws SQLException Description copied from interface:FbServicePerforms a service info request (service query.- Specified by:
getServiceInfoin interfaceFbService- Parameters:
serviceParameterBuffer- Service parameters (can be null)serviceRequestBuffer- Service request infomaxBufferLength- Maximum response buffer length to use- Returns:
- The response buffer (note: length is the actual length of the response, not
maxBufferLength - Throws:
SQLException- For errors retrieving the information.
-
startServiceAction
Description copied from interface:FbServiceStarts a service action.- Specified by:
startServiceActionin interfaceFbService- Parameters:
serviceRequestBuffer- Service action request details- Throws:
SQLException- For errors starting the service action.
-
attach
Description copied from interface:FbAttachmentAttach to the attachment type.- Specified by:
attachin interfaceFbAttachment- Throws:
SQLException
-
afterAttachActions
Additional tasks to execute directly after attach operation.Implementation retrieves service information like server version.
- Throws:
SQLException- For errors reading or writing database information.
-
internalDetach
Description copied from class:AbstractFbServiceActual implementation of service detach.Implementations of this method should only be called from
AbstractFbService.close(), and should not notify service listeners of the serviceServiceListener.detaching(FbService)andServiceListener.detached(FbService)events.- Specified by:
internalDetachin classAbstractFbService<JnaServiceConnection>- Throws:
SQLException
-
getHandle
public int getHandle()- Specified by:
getHandlein interfaceFbAttachment- Specified by:
getHandlein interfaceFbService- Returns:
- The attachment handle value
-
getJnaHandle
public com.sun.jna.ptr.IntByReference getJnaHandle() -
setNetworkTimeout
Description copied from interface:FbAttachmentSets the network timeout for this attachment.- Specified by:
setNetworkTimeoutin interfaceFbAttachment- Parameters:
milliseconds- Timeout in milliseconds; 0 means no timeout. If the attachment doesn't support milliseconds, it should round up to the nearest second.- Throws:
SQLException- If this attachment is closed, the value ofmillisecondsis smaller than 0, or if setting the timeout fails.SQLFeatureNotSupportedException- If this attachment doesn't support (changing) the network timeout.
-
getNetworkTimeout
Description copied from interface:FbAttachmentGets the current network timeout for this attachment.- Specified by:
getNetworkTimeoutin interfaceFbAttachment- Overrides:
getNetworkTimeoutin classAbstractFbAttachment<JnaServiceConnection>- Returns:
- Timeout in milliseconds, 0 means no timeout
- Throws:
SQLException- If this attachment is closedSQLFeatureNotSupportedException- If this attachment doesn't support network timeout
-
processStatusVector
public void processStatusVector(ISC_STATUS[] statusVector, WarningMessageCallback warningMessageCallback) throws SQLException - Throws:
SQLException
-
finalize
-