Class AbstractFbWireDatabase
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbAttachment<T>
- 
- org.firebirdsql.gds.ng.AbstractFbDatabase<WireDatabaseConnection>
- 
- org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase
 
 
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- FbAttachment,- FbDatabase,- ExceptionListenable,- TransactionListener,- FbWireAttachment,- FbWireDatabase
 - Direct Known Subclasses:
- V10Database
 
 public abstract class AbstractFbWireDatabase extends AbstractFbDatabase<WireDatabaseConnection> implements FbWireDatabase Abstract class for operations common to all version of the wire protocol implementation.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachmentFbWireAttachment.AcceptPacket
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected ProtocolDescriptorprotocolDescriptorprotected FbWireOperationswireOperations- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbDatabasedatabaseListenerDispatcher
 - 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentconnection, exceptionListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbWireDatabase(WireDatabaseConnection connection, ProtocolDescriptor descriptor)Creates an AbstractFbWireDatabase instance.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancelEvent(EventHandle eventHandle)Cancels a registered event.protected voidcheckAttached()Checks if a physical connection to the server is established and if the connection is attached to a database.protected voidcheckConnected()Checks if a physical connection to the server is established.protected voidcloseConnection()Closes the WireConnection associated with this connection.voidconsumePackets(int numberOfResponses, WarningMessageCallback warningCallback)Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.voidcountEvents(EventHandle eventHandle)Counts the events occurred.FbBlobcreateBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)Creates a blob for read access to an existing blob on the server.FbBlobcreateBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer)Creates a blob for write access to a new blob on the server.EventHandlecreateEventHandle(java.lang.String eventName, EventHandler eventHandler)Creates an event handle for this database type.protected voidfinalize()voidforceClose()Forces the connection to close without proper detach or cleanup.protected XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected XdrOutputStreamgetXdrOut()Gets the XdrOutputStream.XdrStreamAccessgetXdrStreamAccess()abstract FbWireAsynchronousChannelinitAsynchronousChannel()Initializes the asynchronous channel (for event notification).booleanisAttached()Current attachment status.voidqueueEvent(EventHandle eventHandle)Queues a wait for an event.GenericResponsereadGenericResponse(WarningMessageCallback warningCallback)Convenience method to read a Response to a GenericResponseResponsereadResponse(WarningMessageCallback warningCallback)Reads the response from the server.SqlResponsereadSqlResponse(WarningMessageCallback warningCallback)Convenience method to read a Response to a SqlResponsevoidsetNetworkTimeout(int milliseconds)Sets the network timeout for this attachment.- 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbDatabaseaddDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, internalDetach, removeDatabaseListener, setDatabaseDialect, setOdsMajor, setOdsMinor, transactionAdded, transactionStateChanged
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentaddExceptionListener, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, getSynchronizationObject, 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.FbAttachmentattach, close, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getSynchronizationObject
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbDatabaseaddDatabaseListener, addWeakDatabaseListener, cancelOperation, createBlobParameterBuffer, createDatabase, createStatement, createTransactionParameterBuffer, dropDatabase, emptyRowDescriptor, executeImmediate, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInfo, getHandle, getOdsMajor, getOdsMinor, reconnectTransaction, removeDatabaseListener, startTransaction
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachmentauthReceiveResponse
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireDatabaseenqueueDeferredAction, getBlrCalculator, releaseObject
 
- 
 
- 
- 
- 
Field Detail- 
protocolDescriptorprotected final ProtocolDescriptor protocolDescriptor 
 - 
wireOperationsprotected final FbWireOperations wireOperations 
 
- 
 - 
Constructor Detail- 
AbstractFbWireDatabaseprotected AbstractFbWireDatabase(WireDatabaseConnection connection, ProtocolDescriptor descriptor) Creates an AbstractFbWireDatabase instance.- Parameters:
- 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).
 
 
- 
 - 
Method Detail- 
forceClosepublic void forceClose() throws java.sql.SQLExceptionDescription copied from class:AbstractFbAttachmentForces the connection to close without proper detach or cleanup.If a given implementation does not support this, then this method should call FbAttachment.close().Default implementation, calls FbAttachment.close()- Specified by:
- forceClosein interface- FbAttachment
- Overrides:
- forceClosein class- AbstractFbAttachment<WireDatabaseConnection>
- Throws:
- java.sql.SQLException- For problems closing the connection.
 
 - 
getXdrInprotected final XdrInputStream getXdrIn() throws java.sql.SQLException Gets the XdrInputStream.- Returns:
- Instance of XdrInputStream
- Throws:
- java.sql.SQLException- If no connection is opened or when exceptions occur retrieving the InputStream
 
 - 
getXdrOutprotected final XdrOutputStream getXdrOut() throws java.sql.SQLException Gets the XdrOutputStream.- Returns:
- Instance of XdrOutputStream
- Throws:
- java.sql.SQLException- If no connection is opened or when exceptions occur retrieving the OutputStream
 
 - 
getXdrStreamAccesspublic final XdrStreamAccess getXdrStreamAccess() - Specified by:
- getXdrStreamAccessin interface- FbWireAttachment
- Returns:
- Instance of XdrStreamAccessfor this attachment.
 
 - 
isAttachedpublic final boolean isAttached() Description copied from interface:FbAttachmentCurrent attachment status.- Specified by:
- isAttachedin interface- FbAttachment
- Overrides:
- isAttachedin class- AbstractFbAttachment<WireDatabaseConnection>
- Returns:
- trueif connected to the server and attached to a database or service,- falseotherwise.
 
 - 
checkConnectedprotected final void checkConnected() throws java.sql.SQLExceptionChecks if a physical connection to the server is established.- Specified by:
- checkConnectedin class- AbstractFbAttachment<WireDatabaseConnection>
- Throws:
- java.sql.SQLException- If not connected.
 
 - 
checkAttachedprotected final void checkAttached() throws java.sql.SQLExceptionChecks if a physical connection to the server is established and if the connection is attached to a database.This method calls checkConnected(), so it is not necessary to call both.- Throws:
- java.sql.SQLException- If the database not connected or attached.
 
 - 
closeConnectionprotected final void closeConnection() throws java.io.IOExceptionCloses the WireConnection associated with this connection.- Throws:
- java.io.IOException- For errors closing the connection.
 
 - 
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.
 
 - 
createBlobForOutputpublic final FbBlob createBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer) Description copied from interface:FbDatabaseCreates a blob for write access to a new blob on the server.The blob is initially closed. - Specified by:
- createBlobForOutputin interface- FbDatabase
- Parameters:
- transaction- Transaction associated with the blob.
- blobParameterBuffer- Blob Parameter Buffer
- Returns:
- Instance of FbBlob
 
 - 
createBlobForInputpublic final FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) Description copied from interface:FbDatabaseCreates a blob for read access to an existing blob on the server.The blob is initially closed. - Specified by:
- createBlobForInputin interface- FbDatabase
- Parameters:
- transaction- Transaction associated with the blob.
- blobParameterBuffer- Blob Parameter Buffer
- blobId- Handle id of the blob
- Returns:
- Instance of FbBlob
 
 - 
consumePacketspublic final void consumePackets(int numberOfResponses, WarningMessageCallback warningCallback)Description copied from interface:FbWireDatabaseConsumes packets notifying for warnings, but ignoring exceptions thrown from the packet.This 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). - Specified by:
- consumePacketsin interface- FbWireDatabase
- Parameters:
- numberOfResponses- Number of responses to consume.
- warningCallback- Callback for warnings
 
 - 
readGenericResponsepublic final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireAttachmentConvenience method to read a Response to a GenericResponse- Specified by:
- readGenericResponsein interface- FbWireAttachment
- Parameters:
- warningCallback- Callback object for warnings,- nullfor default callback
- Returns:
- GenericResponse
- Throws:
- java.sql.SQLException- For errors returned from the server, or when attempting to read.
- java.io.IOException- For errors reading the response from the connection.
 
 - 
readSqlResponsepublic final SqlResponse readSqlResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireDatabaseConvenience method to read a Response to a SqlResponse- Specified by:
- readSqlResponsein interface- FbWireDatabase
- Parameters:
- warningCallback- Callback object for warnings,- nullfor default callback
- Returns:
- SqlResponse
- Throws:
- java.sql.SQLException- For errors returned from the server, or when attempting to read.
- java.io.IOException- For errors reading the response from the connection.
 
 - 
readResponsepublic final Response readResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireDatabaseReads the response from the server.- Specified by:
- readResponsein interface- FbWireDatabase
- Parameters:
- warningCallback- Callback object for warnings,- nullfor default callback
- Returns:
- Responseread.
- Throws:
- java.sql.SQLException- For errors returned from the server, or when attempting to read
- java.io.IOException- For errors reading the response from the connection.
 
 - 
createEventHandlepublic final EventHandle createEventHandle(java.lang.String eventName, EventHandler eventHandler) Description copied from interface:FbDatabaseCreates an event handle for this database type.The returned event handle can be used with FbDatabase.queueEvent(org.firebirdsql.gds.EventHandle).- Specified by:
- createEventHandlein interface- FbDatabase
- Parameters:
- eventName- Name of the event
- eventHandler- The event handler to call when the event occurred
- Returns:
- A suitable event handle instance
 
 - 
queueEventpublic final void queueEvent(EventHandle eventHandle) throws java.sql.SQLException Description copied from interface:FbDatabaseQueues a wait for an event.- Specified by:
- queueEventin interface- FbDatabase
- Parameters:
- eventHandle- The event handle (created using- FbDatabase.createEventHandle(String, EventHandler)of this instance).
- Throws:
- java.sql.SQLException- For errors establishing the asynchronous channel, or for queuing the event.
 
 - 
cancelEventpublic final void cancelEvent(EventHandle eventHandle) throws java.sql.SQLException Description copied from interface:FbDatabaseCancels a registered event.After cancellation, the event handle should be considered unusable. Before queueing a new event, an new handle needs to be created. - Specified by:
- cancelEventin interface- FbDatabase
- Parameters:
- eventHandle- The event handle to cancel
- Throws:
- java.sql.SQLException- For errors cancelling the event
 
 - 
countEventspublic final void countEvents(EventHandle eventHandle) throws java.sql.SQLException Description copied from interface:FbDatabaseCounts the events occurred.- Specified by:
- countEventsin interface- FbDatabase
- Parameters:
- eventHandle- The event handle
- Throws:
- java.sql.SQLException- When the count can not be done (as - for example - the event handle is of the wrong type)
 
 - 
initAsynchronousChannelpublic abstract FbWireAsynchronousChannel initAsynchronousChannel() throws java.sql.SQLException Initializes the asynchronous channel (for event notification).- Throws:
- java.sql.SQLException- For errors establishing the channel, or if the channel already exists.
 
 - 
finalizeprotected void finalize() throws java.lang.Throwable- Overrides:
- finalizein class- java.lang.Object
- Throws:
- java.lang.Throwable
 
 
- 
 
-