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:
- java.lang.AutoCloseable,- FbAttachment,- FbService,- JnaAttachment,- ExceptionListenable
 
 public final class JnaService extends AbstractFbService<JnaServiceConnection> implements JnaAttachment Implementation ofFbServicefor native client access.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intSTATUS_VECTOR_SIZE- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbServiceserviceListenerDispatcher
 - 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentconnection, exceptionListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Constructor Description JnaService(JnaServiceConnection connection)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterAttachActions()Additional tasks to execute directly after attach operation.voidattach()Attach to the attachment type.protected voidcheckConnected()Checks if the attachment is connected, and throws aSQLExceptionif it isn't connected.ServiceParameterBuffercreateServiceParameterBuffer()Creates an emptyServiceParameterBuffer.ServiceRequestBuffercreateServiceRequestBuffer()protected voidfinalize()intgetHandle()com.sun.jna.ptr.IntByReferencegetJnaHandle()intgetNetworkTimeout()Gets the current network timeout for this attachment.byte[]getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength)Performs a service info request (service query.protected voidinternalDetach()Actual 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.AbstractFbServiceaddServiceListener, close, getDescribeServiceRequestBuffer, getServiceInfo, getServiceInformationProcessor, getServiceWarningCallback, removeServiceListener
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentaddExceptionListener, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getServerVersionInformation, getSynchronizationObject, isAttached, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion
 - 
Methods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenableaddExceptionListener, removeExceptionListener
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbAttachmentclose, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached
 
- 
 
- 
- 
- 
Field Detail- 
STATUS_VECTOR_SIZEpublic static final int STATUS_VECTOR_SIZE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
JnaServicepublic JnaService(JnaServiceConnection connection) 
 
- 
 - 
Method Detail- 
createServiceParameterBufferpublic ServiceParameterBuffer 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 interface- FbService
- Returns:
- Service
 
 - 
createServiceRequestBufferpublic ServiceRequestBuffer createServiceRequestBuffer() - Specified by:
- createServiceRequestBufferin interface- FbService
- Returns:
- An empty service request buffer
 
 - 
checkConnectedprotected void checkConnected() throws java.sql.SQLExceptionDescription copied from class:AbstractFbAttachmentChecks if the attachment is connected, and throws aSQLExceptionif it isn't connected.- Specified by:
- checkConnectedin class- AbstractFbAttachment<JnaServiceConnection>
- Throws:
- java.sql.SQLException
 
 - 
getServiceInfopublic byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength) throws java.sql.SQLException Description copied from interface:FbServicePerforms a service info request (service query.- Specified by:
- getServiceInfoin interface- FbService
- Parameters:
- serviceParameterBuffer- Service parameters (can be null)
- serviceRequestBuffer- Service request info
- maxBufferLength- Maximum response buffer length to use
- Returns:
- The response buffer (note: length is the actual length of the response, not maxBufferLength
- Throws:
- java.sql.SQLException- For errors retrieving the information.
 
 - 
startServiceActionpublic void startServiceAction(ServiceRequestBuffer serviceRequestBuffer) throws java.sql.SQLException Description copied from interface:FbServiceStarts a service action.- Specified by:
- startServiceActionin interface- FbService
- Parameters:
- serviceRequestBuffer- Service action request details
- Throws:
- java.sql.SQLException- For errors starting the service action.
 
 - 
attachpublic void attach() throws java.sql.SQLExceptionDescription copied from interface:FbAttachmentAttach to the attachment type.- Specified by:
- attachin interface- FbAttachment
- Throws:
- java.sql.SQLException
 
 - 
afterAttachActionsprotected void afterAttachActions() throws java.sql.SQLExceptionAdditional tasks to execute directly after attach operation.Implementation retrieves service information like server version. - Throws:
- java.sql.SQLException- For errors reading or writing database information.
 
 - 
internalDetachprotected void internalDetach() throws java.sql.SQLExceptionDescription 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 class- AbstractFbService<JnaServiceConnection>
- Throws:
- java.sql.SQLException
 
 - 
getHandlepublic int getHandle() - Specified by:
- getHandlein interface- FbAttachment
- Specified by:
- getHandlein interface- FbService
- Returns:
- The attachment handle value
 
 - 
getJnaHandlepublic com.sun.jna.ptr.IntByReference getJnaHandle() 
 - 
setNetworkTimeoutpublic void setNetworkTimeout(int milliseconds) throws java.sql.SQLExceptionDescription copied from interface:FbAttachmentSets the network timeout for this attachment.- Specified by:
- setNetworkTimeoutin interface- FbAttachment
- 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:
- java.sql.SQLException- If this attachment is closed, the value of- millisecondsis smaller than 0, or if setting the timeout fails.
- java.sql.SQLFeatureNotSupportedException- If this attachment doesn't support (changing) the network timeout.
 
 - 
getNetworkTimeoutpublic int getNetworkTimeout() throws java.sql.SQLExceptionDescription copied from interface:FbAttachmentGets the current network timeout for this attachment.- Specified by:
- getNetworkTimeoutin interface- FbAttachment
- Overrides:
- getNetworkTimeoutin class- AbstractFbAttachment<JnaServiceConnection>
- Returns:
- Timeout in milliseconds, 0 means no timeout
- Throws:
- java.sql.SQLException- If this attachment is closed
- java.sql.SQLFeatureNotSupportedException- If this attachment doesn't support network timeout
 
 - 
processStatusVectorpublic void processStatusVector(ISC_STATUS[] statusVector, WarningMessageCallback warningMessageCallback) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
finalizeprotected void finalize() throws java.lang.Throwable- Overrides:
- finalizein class- java.lang.Object
- Throws:
- java.lang.Throwable
 
 
- 
 
-