Class AbstractWireOperations
- java.lang.Object
- 
- org.firebirdsql.gds.ng.wire.AbstractWireOperations
 
- 
- All Implemented Interfaces:
- FbWireOperations
 - Direct Known Subclasses:
- V10WireOperations
 
 public abstract class AbstractWireOperations extends java.lang.Object implements FbWireOperations - Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperationsFbWireOperations.ProcessAttachCallback
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractWireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddServerKeys(byte[] serverKeys)protected voidclearServerKeys()voidconsumePackets(int numberOfResponses, WarningMessageCallback warningCallback)Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.protected IAttachProperties<?>getAttachProperties()protected ClientAuthBlockgetClientAuthBlock()protected WireConnection<?,?>getConnection()protected WarningMessageCallbackgetDefaultWarningMessageCallback()protected EncodinggetEncoding()protected java.util.List<KnownServerKey.PluginSpecificData>getPluginSpecificData()protected XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected XdrOutputStreamgetXdrOut()Gets the XdrOutputStream.XdrStreamAccessgetXdrStreamAccess()voidhandleCryptKeyCallback(DbCryptCallback dbCryptCallback)Handles the database encryption key callback.protected ResponseprocessOperation(int operation)Reads the response based on the specified operation.voidprocessResponse(Response response)voidprocessResponseWarnings(Response response, WarningMessageCallback warningCallback)Checks if the response included a warning and signals that warning to the WarningMessageCallback.protected BatchCompletionResponsereadBatchCompletionResponse(XdrInputStream xdrIn)Reads the batch completion response (op_batch_cs) without reading the operation code itself.GenericResponsereadGenericResponse(WarningMessageCallback warningCallback)Convenience method to read a Response to a GenericResponseprotected InlineBlobResponsereadInlineBlobResponse(XdrInputStream xdrIn)Reads the inline blob response (op_inline_blob) without reading the operation code itself.intreadNextOperation()Reads the next operation code, after processing deferred packets.ResponsereadOperationResponse(int operationCode, WarningMessageCallback warningCallback)Reads the response from the server when the operation code has already been read.ResponsereadResponse(WarningMessageCallback warningCallback)Reads the response from the server.SqlResponsereadSqlResponse(WarningMessageCallback warningCallback)Convenience method to read a Response to a SqlResponsejava.sql.SQLExceptionreadStatusVector()Process the status vector and returns the associatedSQLExceptioninstance.protected java.sql.SQLExceptionreadStatusVector(XdrInputStream xdrIn)Process the status vector fromxdrInand returns the associatedSQLExceptioninstance.voidsetNetworkTimeout(int milliseconds)Sets the network timeout for this attachment.protected LockCloseablewithLock()voidwriteDirect(byte[] data)Writes directly to theOutputStreamof the underlying connection.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperationsauthReceiveResponse, enqueueDeferredAction, processDeferredActions
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractWireOperationsprotected AbstractWireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback) 
 
- 
 - 
Method Detail- 
getXdrStreamAccesspublic final XdrStreamAccess getXdrStreamAccess() - Specified by:
- getXdrStreamAccessin interface- FbWireOperations
- Returns:
- Instance of XdrStreamAccessfor this service.
 
 - 
getEncodingprotected final Encoding getEncoding() 
 - 
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
 
 - 
readStatusVectorpublic final java.sql.SQLException readStatusVector() throws java.sql.SQLExceptionDescription copied from interface:FbWireOperationsProcess the status vector and returns the associatedSQLExceptioninstance.NOTE: This method returns the SQLException read from the status vector, and only throws SQLException when an error occurs processing the status vector. - Specified by:
- readStatusVectorin interface- FbWireOperations
- Returns:
- SQLException from the status vector
- Throws:
- java.sql.SQLException- for errors reading or processing the status vector
 
 - 
readStatusVectorprotected final java.sql.SQLException readStatusVector(XdrInputStream xdrIn) throws java.sql.SQLException Process the status vector fromxdrInand returns the associatedSQLExceptioninstance.- Parameters:
- xdrIn- XDR input stream to read from
- Returns:
- SQLException from the status vector
- Throws:
- java.sql.SQLException- for errors reading or processing the status vector
- See Also:
- FbWireOperations.readStatusVector()
 
 - 
readResponsepublic final Response readResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireOperationsReads the response from the server.- Specified by:
- readResponsein interface- FbWireOperations
- 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.
 
 - 
readOperationResponsepublic final Response readOperationResponse(int operationCode, WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireOperationsReads the response from the server when the operation code has already been read.- Specified by:
- readOperationResponsein interface- FbWireOperations
- Parameters:
- operationCode- The operation code
- 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.
- See Also:
- FbWireOperations.readResponse(WarningMessageCallback)
 
 - 
readNextOperationpublic final int readNextOperation() throws java.io.IOExceptionDescription copied from interface:FbWireOperationsReads the next operation code, after processing deferred packets.In general, calling FbWireOperations.readResponse(WarningMessageCallback)or one of the specificreadXXXResponsemethods should be preferred to read the response code and the response body. Use this method only for reading custom responses, or if you need to process the response in a way that is not possible withFbWireOperations.readResponse(WarningMessageCallback).- Specified by:
- readNextOperationin interface- FbWireOperations
- Returns:
- next operation
- Throws:
- java.io.IOException- for errors reading the operation from the connection
 
 - 
processOperationprotected final Response processOperation(int operation) throws java.sql.SQLException, java.io.IOException Reads the response based on the specified operation.- Parameters:
- operation- Database operation
- Returns:
- Response object for the operation
- Throws:
- java.sql.SQLException- For errors reading the response from the connection.
- java.io.IOException- For errors reading the response from the connection.
 
 - 
readBatchCompletionResponseprotected BatchCompletionResponse readBatchCompletionResponse(XdrInputStream xdrIn) throws java.sql.SQLException, java.io.IOException Reads the batch completion response (op_batch_cs) without reading the operation code itself.- Parameters:
- xdrIn- XDR input stream to read
- Returns:
- batch completion response
- Throws:
- java.sql.SQLException- for errors reading the response from the connection
- java.sql.SQLFeatureNotSupportedException- when the protocol version does not support this response
- java.io.IOException- for errors reading the response from the connection
- Since:
- 5
 
 - 
readInlineBlobResponseprotected InlineBlobResponse readInlineBlobResponse(XdrInputStream xdrIn) throws java.sql.SQLException, java.io.IOException Reads the inline blob response (op_inline_blob) without reading the operation code itself.- Parameters:
- xdrIn- XDR input stream to read
- Returns:
- inline blob response
- Throws:
- java.sql.SQLException- for errors reading the response from the connection
- java.sql.SQLFeatureNotSupportedException- when the protocol version does not support this response
- java.io.IOException- for errors reading the response from the connection
- Since:
- 5.0.8
 
 - 
processResponsepublic final void processResponse(Response response) throws java.sql.SQLException - Specified by:
- processResponsein interface- FbWireOperations
- Parameters:
- response- Response to process
- Throws:
- java.sql.SQLException- For errors returned from the server.
 
 - 
processResponseWarningspublic final void processResponseWarnings(Response response, WarningMessageCallback warningCallback) Checks if the response included a warning and signals that warning to the WarningMessageCallback.- Specified by:
- processResponseWarningsin interface- FbWireOperations
- Parameters:
- response- Response to process
 
 - 
readGenericResponsepublic final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException Description copied from interface:FbWireOperationsConvenience method to read a Response to a GenericResponse- Specified by:
- readGenericResponsein interface- FbWireOperations
- 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:FbWireOperationsConvenience method to read a Response to a SqlResponse- Specified by:
- readSqlResponsein interface- FbWireOperations
- 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.
 
 - 
handleCryptKeyCallbackpublic void handleCryptKeyCallback(DbCryptCallback dbCryptCallback) throws java.io.IOException, java.sql.SQLException Description copied from interface:FbWireOperationsHandles the database encryption key callback.- Specified by:
- handleCryptKeyCallbackin interface- FbWireOperations
- Parameters:
- dbCryptCallback- Database encryption callback plugin
- Throws:
- java.io.IOException- For errors reading data from the socket
- java.sql.SQLException- For database errors
- java.sql.SQLFeatureNotSupportedException- If this protocol version does not support crypt key callbacks
 
 - 
consumePacketspublic final void consumePackets(int numberOfResponses, WarningMessageCallback warningCallback)Description copied from interface:FbWireOperationsConsumes 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- FbWireOperations
- Parameters:
- numberOfResponses- Number of responses to consume.
- warningCallback- Callback for warnings
 
 - 
writeDirectpublic final void writeDirect(byte[] data) throws java.io.IOExceptionDescription copied from interface:FbWireOperationsWrites directly to theOutputStreamof the underlying connection.Use of this method might lead to hard to find race conditions in the protocol. It is currently only used to allow FbDatabase.cancelOperation(int)to work.- Specified by:
- writeDirectin interface- FbWireOperations
- Parameters:
- data- Data to write
- Throws:
- java.io.IOException- If there is no socket, the socket is closed, or for errors writing to the socket.
- See Also:
- WireConnection.writeDirect(byte[])
 
 - 
setNetworkTimeoutpublic void setNetworkTimeout(int milliseconds) throws java.sql.SQLExceptionDescription copied from interface:FbWireOperationsSets the network timeout for this attachment.- Specified by:
- setNetworkTimeoutin interface- FbWireOperations
- 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.
 
 - 
withLockprotected final LockCloseable withLock() 
 - 
addServerKeysprotected final void addServerKeys(byte[] serverKeys) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
clearServerKeysprotected final void clearServerKeys() 
 - 
getClientAuthBlockprotected final ClientAuthBlock getClientAuthBlock() 
 - 
getAttachPropertiesprotected final IAttachProperties<?> getAttachProperties() - Returns:
- Immutable attach properties
 
 - 
getPluginSpecificDataprotected final java.util.List<KnownServerKey.PluginSpecificData> getPluginSpecificData() 
 - 
getConnectionprotected final WireConnection<?,?> getConnection() 
 - 
getDefaultWarningMessageCallbackprotected final WarningMessageCallback getDefaultWarningMessageCallback() 
 
- 
 
-