- All Implemented Interfaces:
FbWireOperations
- Direct Known Subclasses:
V10WireOperations
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperations
FbWireOperations.ProcessAttachCallback -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWireOperations(WireConnection<?, ?> connection, WarningMessageCallback defaultWarningMessageCallback) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddServerKeys(byte[] serverKeys) protected final voidfinal voidconsumePackets(int numberOfResponses, WarningMessageCallback warningCallback) Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.protected final IAttachProperties<?>protected final ClientAuthBlockprotected final WireConnection<?,?> protected final WarningMessageCallbackprotected final Encodingprotected final List<KnownServerKey.PluginSpecificData>protected final XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected final XdrOutputStreamGets the XdrOutputStream.final XdrStreamAccessvoidhandleCryptKeyCallback(DbCryptCallback dbCryptCallback) Handles the database encryption key callback.protected final ResponseprocessOperation(int operation) Reads the response based on the specified operation.final voidprocessResponse(Response response) final voidprocessResponseWarnings(Response response, WarningMessageCallback warningCallback) Checks if the response included a warning and signals that warning to the WarningMessageCallback.protected BatchCompletionResponseReads the batch completion response (op_batch_cs) without reading the operation code itself.final GenericResponsereadGenericResponse(WarningMessageCallback warningCallback) Convenience method to read a Response to a GenericResponsefinal intReads the next operation code, after processing deferred packets.final ResponsereadOperationResponse(int operationCode, WarningMessageCallback warningCallback) Reads the response from the server when the operation code has already been read.final ResponsereadResponse(WarningMessageCallback warningCallback) Reads the response from the server.final SqlResponsereadSqlResponse(WarningMessageCallback warningCallback) Convenience method to read a Response to a SqlResponsefinal SQLExceptionProcess the status vector and returns the associatedSQLExceptioninstance.protected final SQLExceptionreadStatusVector(XdrInputStream xdrIn) Process the status vector fromxdrInand returns the associatedSQLExceptioninstance.voidsetNetworkTimeout(int milliseconds) Sets the network timeout for this attachment.protected final LockCloseablewithLock()final voidwriteDirect(byte[] data) Writes directly to theOutputStreamof the underlying connection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperations
authReceiveResponse, completeDeferredActions, enqueueDeferredAction, processDeferredActions
-
Constructor Details
-
AbstractWireOperations
protected AbstractWireOperations(WireConnection<?, ?> connection, WarningMessageCallback defaultWarningMessageCallback)
-
-
Method Details
-
getXdrStreamAccess
- Specified by:
getXdrStreamAccessin interfaceFbWireOperations- Returns:
- Instance of
XdrStreamAccessfor this service.
-
getEncoding
-
getXdrIn
Gets the XdrInputStream.- Returns:
- Instance of XdrInputStream
- Throws:
SQLException- If no connection is opened or when exceptions occur retrieving the InputStream
-
getXdrOut
Gets the XdrOutputStream.- Returns:
- Instance of XdrOutputStream
- Throws:
SQLException- If no connection is opened or when exceptions occur retrieving the OutputStream
-
readStatusVector
Description 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 interfaceFbWireOperations- Returns:
- SQLException from the status vector
- Throws:
SQLException- for errors reading or processing the status vector
-
readStatusVector
Process the status vector fromxdrInand returns the associatedSQLExceptioninstance.- Parameters:
xdrIn- XDR input stream to read from- Returns:
- SQLException from the status vector
- Throws:
SQLException- for errors reading or processing the status vector- See Also:
-
readResponse
public final Response readResponse(WarningMessageCallback warningCallback) throws SQLException, IOException Description copied from interface:FbWireOperationsReads the response from the server.- Specified by:
readResponsein interfaceFbWireOperations- Parameters:
warningCallback- Callback object for warnings,nullfor default callback- Returns:
Responseread.- Throws:
SQLException- For errors returned from the server, or when attempting to readIOException- For errors reading the response from the connection.
-
readOperationResponse
public final Response readOperationResponse(int operationCode, WarningMessageCallback warningCallback) throws SQLException, IOException Description copied from interface:FbWireOperationsReads the response from the server when the operation code has already been read.- Specified by:
readOperationResponsein interfaceFbWireOperations- Parameters:
operationCode- The operation codewarningCallback- Callback object for warnings,nullfor default callback- Returns:
Responseread.- Throws:
SQLException- For errors returned from the server, or when attempting to readIOException- For errors reading the response from the connection.- See Also:
-
readNextOperation
Description 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 interfaceFbWireOperations- Returns:
- next operation
- Throws:
IOException- for errors reading the operation from the connection
-
processOperation
Reads the response based on the specified operation.- Parameters:
operation- Database operation- Returns:
- Response object for the operation
- Throws:
SQLException- For errors reading the response from the connection.IOException- For errors reading the response from the connection.
-
readBatchCompletionResponse
protected BatchCompletionResponse readBatchCompletionResponse(XdrInputStream xdrIn) throws SQLException, 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:
SQLException- for errors reading the response from the connectionSQLFeatureNotSupportedException- when the protocol version does not support this responseIOException- for errors reading the response from the connection- Since:
- 5
-
processResponse
- Specified by:
processResponsein interfaceFbWireOperations- Parameters:
response- Response to process- Throws:
SQLException- For errors returned from the server.
-
processResponseWarnings
public final void processResponseWarnings(Response response, WarningMessageCallback warningCallback) Checks if the response included a warning and signals that warning to the WarningMessageCallback.- Specified by:
processResponseWarningsin interfaceFbWireOperations- Parameters:
response- Response to process
-
readGenericResponse
public final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws SQLException, IOException Description copied from interface:FbWireOperationsConvenience method to read a Response to a GenericResponse- Specified by:
readGenericResponsein interfaceFbWireOperations- Parameters:
warningCallback- Callback object for warnings,nullfor default callback- Returns:
- GenericResponse
- Throws:
SQLException- For errors returned from the server, or when attempting to read.IOException- For errors reading the response from the connection.
-
readSqlResponse
public final SqlResponse readSqlResponse(WarningMessageCallback warningCallback) throws SQLException, IOException Description copied from interface:FbWireOperationsConvenience method to read a Response to a SqlResponse- Specified by:
readSqlResponsein interfaceFbWireOperations- Parameters:
warningCallback- Callback object for warnings,nullfor default callback- Returns:
- SqlResponse
- Throws:
SQLException- For errors returned from the server, or when attempting to read.IOException- For errors reading the response from the connection.
-
handleCryptKeyCallback
public void handleCryptKeyCallback(DbCryptCallback dbCryptCallback) throws IOException, SQLException Description copied from interface:FbWireOperationsHandles the database encryption key callback.- Specified by:
handleCryptKeyCallbackin interfaceFbWireOperations- Parameters:
dbCryptCallback- Database encryption callback plugin- Throws:
IOException- For errors reading data from the socketSQLException- For database errorsSQLFeatureNotSupportedException- If this protocol version does not support crypt key callbacks
-
consumePackets
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 interfaceFbWireOperations- Parameters:
numberOfResponses- Number of responses to consume.warningCallback- Callback for warnings
-
writeDirect
Description 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 interfaceFbWireOperations- Parameters:
data- Data to write- Throws:
IOException- If there is no socket, the socket is closed, or for errors writing to the socket.- See Also:
-
setNetworkTimeout
Description copied from interface:FbWireOperationsSets the network timeout for this attachment.- Specified by:
setNetworkTimeoutin interfaceFbWireOperations- 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.
-
withLock
-
addServerKeys
- Throws:
SQLException
-
clearServerKeys
protected final void clearServerKeys() -
getClientAuthBlock
-
getAttachProperties
- Returns:
- Immutable attach properties
-
getPluginSpecificData
-
getConnection
-
getDefaultWarningMessageCallback
-