public abstract class AbstractFbWireDatabase extends AbstractFbDatabase<WireDatabaseConnection> implements FbWireDatabase
FbWireAttachment.AcceptPacket| Modifier and Type | Field and Description |
|---|---|
protected ProtocolDescriptor |
protocolDescriptor |
protected FbWireOperations |
wireOperations |
databaseListenerDispatcherconnection, exceptionListenerDispatcher| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFbWireDatabase(WireDatabaseConnection connection,
ProtocolDescriptor descriptor)
Creates an AbstractFbWireDatabase instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelEvent(EventHandle eventHandle)
Cancels a registered event.
|
protected void |
checkAttached()
Checks if a physical connection to the server is established and if the
connection is attached to a database.
|
protected void |
checkConnected()
Checks if a physical connection to the server is established.
|
protected void |
closeConnection()
Closes the WireConnection associated with this connection.
|
void |
consumePackets(int numberOfResponses,
WarningMessageCallback warningCallback)
Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.
|
void |
countEvents(EventHandle eventHandle)
Counts the events occurred.
|
FbBlob |
createBlobForInput(FbTransaction transaction,
BlobParameterBuffer blobParameterBuffer,
long blobId)
Creates a blob for read access to an existing blob on the server.
|
FbBlob |
createBlobForOutput(FbTransaction transaction,
BlobParameterBuffer blobParameterBuffer)
Creates a blob for write access to a new blob on the server.
|
EventHandle |
createEventHandle(java.lang.String eventName,
EventHandler eventHandler)
Creates an event handle for this database type.
|
void |
enqueueDeferredAction(DeferredAction deferredAction)
Enqueue a deferred action.
|
protected void |
finalize() |
void |
forceClose()
Forces the connection to close without proper detach or cleanup.
|
byte[] |
getDatabaseInfo(byte[] requestItems,
int maxBufferLength)
Performs a database info request.
|
int |
getHandle() |
byte[] |
getInfo(int operation,
int handle,
byte[] requestItems,
int maxBufferLength,
WarningMessageCallback warningMessageCallback)
Generic info request.
|
protected XdrInputStream |
getXdrIn()
Gets the XdrInputStream.
|
protected XdrOutputStream |
getXdrOut()
Gets the XdrOutputStream.
|
XdrStreamAccess |
getXdrStreamAccess() |
abstract FbWireAsynchronousChannel |
initAsynchronousChannel()
Initializes the asynchronous channel (for event notification).
|
boolean |
isAttached()
Current attachment status.
|
void |
queueEvent(EventHandle eventHandle)
Queues a wait for an event.
|
GenericResponse |
readGenericResponse(WarningMessageCallback warningCallback)
Convenience method to read a Response to a GenericResponse
|
Response |
readResponse(WarningMessageCallback warningCallback)
Reads the response from the server.
|
SqlResponse |
readSqlResponse(WarningMessageCallback warningCallback)
Convenience method to read a Response to a SqlResponse
|
void |
setNetworkTimeout(int milliseconds)
Sets the network timeout for this attachment.
|
addDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, internalDetach, removeDatabaseListener, setDatabaseDialect, setOdsMajor, setOdsMinor, transactionAdded, transactionStateChangedaddExceptionListener, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, isLockedByCurrentThread, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion, withLockclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBlrCalculator, releaseObjectaddDatabaseListener, addWeakDatabaseListener, cancelOperation, createBlobForInput, createBlobForInput, createBlobForOutput, createBlobForOutput, createBlobParameterBuffer, createDatabase, createStatement, createTransactionParameterBuffer, dropDatabase, emptyRowDescriptor, executeImmediate, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getOdsMajor, getOdsMinor, reconnectTransaction, removeDatabaseListener, startTransactionauthReceiveResponseattach, close, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isLockedByCurrentThread, withLockaddExceptionListener, removeExceptionListenerprotected final ProtocolDescriptor protocolDescriptor
protected final FbWireOperations wireOperations
protected AbstractFbWireDatabase(WireDatabaseConnection connection, ProtocolDescriptor descriptor)
connection - A WireConnection with an established connection to the server.descriptor - The ProtocolDescriptor that created this connection (this is
used for creating further dependent objects).public final int getHandle()
getHandle in interface FbAttachmentgetHandle in interface FbDatabasepublic void forceClose()
throws java.sql.SQLException
AbstractFbAttachment
If a given implementation does not support this, then this method should call FbAttachment.close().
Default implementation, calls FbAttachment.close()
forceClose in interface FbAttachmentforceClose in class AbstractFbAttachment<WireDatabaseConnection>java.sql.SQLException - For problems closing the connection.protected final XdrInputStream getXdrIn() throws java.sql.SQLException
java.sql.SQLException - If no connection is opened or when exceptions occur
retrieving the InputStreamprotected final XdrOutputStream getXdrOut() throws java.sql.SQLException
java.sql.SQLException - If no connection is opened or when exceptions occur
retrieving the OutputStreampublic final XdrStreamAccess getXdrStreamAccess()
getXdrStreamAccess in interface FbWireAttachmentXdrStreamAccess for this attachment.public final boolean isAttached()
FbAttachmentisAttached in interface FbAttachmentisAttached in class AbstractFbAttachment<WireDatabaseConnection>true if connected to the server and attached to a database or service, false otherwise.protected final void checkConnected()
throws java.sql.SQLException
checkConnected in class AbstractFbAttachment<WireDatabaseConnection>java.sql.SQLException - If not connected.protected final void checkAttached()
throws java.sql.SQLException
This method calls checkConnected(), so it is not necessary to
call both.
java.sql.SQLException - If the database not connected or attached.protected final void closeConnection()
throws java.io.IOException
java.io.IOException - For errors closing the connection.public void setNetworkTimeout(int milliseconds)
throws java.sql.SQLException
FbAttachmentsetNetworkTimeout in interface FbAttachmentmilliseconds - Timeout in milliseconds; 0 means no timeout. If the attachment doesn't support milliseconds, it should
round up to the nearest second.java.sql.SQLException - If this attachment is closed, the value of milliseconds is smaller than 0, or if setting the
timeout fails.java.sql.SQLFeatureNotSupportedException - If this attachment doesn't support (changing) the network timeout.public final FbBlob createBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer)
FbDatabaseThe blob is initially closed.
createBlobForOutput in interface FbDatabasetransaction - transaction associated with the blobblobParameterBuffer - blob parameter bufferFbBlobpublic final FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)
FbDatabaseThe blob is initially closed.
createBlobForInput in interface FbDatabasetransaction - transaction associated with the blobblobParameterBuffer - blob parameter bufferblobId - id of the blobFbBlobpublic final void consumePackets(int numberOfResponses,
WarningMessageCallback warningCallback)
FbWireDatabaseThis method should only be used inside the implementation if either packets need to be ignored, or to ensure that there is no backlog of packets (eg when an exception occurs during processing of multiple package responses).
consumePackets in interface FbWireDatabasenumberOfResponses - Number of responses to consume.warningCallback - Callback for warningspublic final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireAttachmentreadGenericResponse in interface FbWireAttachmentwarningCallback - Callback object for warnings, null for default callbackjava.sql.SQLException - For errors returned from the server, or when attempting to
read.java.io.IOException - For errors reading the response from the connection.public final SqlResponse readSqlResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireDatabasereadSqlResponse in interface FbWireDatabasewarningCallback - Callback object for warnings, null for default callbackjava.sql.SQLException - For errors returned from the server, or when attempting to
read.java.io.IOException - For errors reading the response from the connection.public final Response readResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireDatabasereadResponse in interface FbWireDatabasewarningCallback - Callback object for warnings, null for default callbackResponse read.java.sql.SQLException - For errors returned from the server, or when attempting to readjava.io.IOException - For errors reading the response from the connection.public final void enqueueDeferredAction(DeferredAction deferredAction)
FbWireDatabase
FbDatabase implementations that do not support deferred actions are allowed to throw an
UnsupportedOperationException
enqueueDeferredAction in interface FbWireDatabasedeferredAction - Deferred actionpublic final EventHandle createEventHandle(java.lang.String eventName, EventHandler eventHandler)
FbDatabase
The returned event handle can be used with FbDatabase.queueEvent(org.firebirdsql.gds.EventHandle).
createEventHandle in interface FbDatabaseeventName - Name of the eventeventHandler - The event handler to call when the event occurredpublic final void queueEvent(EventHandle eventHandle) throws java.sql.SQLException
FbDatabasequeueEvent in interface FbDatabaseeventHandle - The event handle (created using FbDatabase.createEventHandle(String, EventHandler) of this instance).java.sql.SQLException - For errors establishing the asynchronous channel, or for queuing the event.public final void cancelEvent(EventHandle eventHandle) throws java.sql.SQLException
FbDatabaseAfter cancellation, the event handle should be considered unusable. Before queueing a new event, an new handle needs to be created.
cancelEvent in interface FbDatabaseeventHandle - The event handle to canceljava.sql.SQLException - For errors cancelling the eventpublic final void countEvents(EventHandle eventHandle) throws java.sql.SQLException
FbDatabasecountEvents in interface FbDatabaseeventHandle - The event handlejava.sql.SQLException - When the count can not be done (as - for example - the event handle is of the wrong type)public final byte[] getDatabaseInfo(byte[] requestItems,
int maxBufferLength)
throws java.sql.SQLException
FbDatabasegetDatabaseInfo in interface FbDatabaserequestItems - Information items to requestmaxBufferLength - Maximum response buffer length to usemaxBufferLengthjava.sql.SQLException - For errors retrieving the information.public byte[] getInfo(int operation,
int handle,
byte[] requestItems,
int maxBufferLength,
WarningMessageCallback warningMessageCallback)
throws java.sql.SQLException
FbWireDatabaseThe implementation does not perform handle validation nor notification of error dispatchers. Doing that is the responsibility of the caller.
getInfo in interface FbWireDatabaseoperation - Operation codehandle - Handle (db, transaction, statement, blob, etc)requestItems - Information items to requestmaxBufferLength - Maximum response buffer length to usewarningMessageCallback - Callback for warnings when reading the response (can be null to use database default)maxBufferLength)java.sql.SQLException - For errors retrieving the informationpublic abstract FbWireAsynchronousChannel initAsynchronousChannel() throws java.sql.SQLException
java.sql.SQLException - For errors establishing the channel, or if the channel already exists.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.ThrowableCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.