java.lang.Object
org.firebirdsql.gds.ng.AbstractFbAttachment<T>
org.firebirdsql.gds.ng.AbstractFbService<WireServiceConnection>
org.firebirdsql.gds.ng.wire.AbstractFbWireService
- All Implemented Interfaces:
AutoCloseable
,FbAttachment
,FbService
,ExceptionListenable
,FbWireAttachment
,FbWireService
- Direct Known Subclasses:
V10Service
public abstract class AbstractFbWireService
extends AbstractFbService<WireServiceConnection>
implements FbWireService
Abstract service implementation for the wire protocol.
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachment
FbWireAttachment.AcceptPacket
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ProtocolDescriptor
protected final FbWireOperations
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbService
serviceListenerDispatcher
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
connection, exceptionListenerDispatcher
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractFbWireService
(WireServiceConnection connection, ProtocolDescriptor descriptor) Creates an AbstractFbWireDatabase instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Checks if a physical connection to the server is established and if the connection is attached to a database.protected final void
Checks if a physical connection to the server is established.protected final void
Closes the WireConnection associated with this connection.final ServiceParameterBuffer
Creates an emptyServiceParameterBuffer
.final ServiceRequestBuffer
void
Forces the connection to close without proper detach or cleanup.final int
final FbWireOperations
protected final XdrInputStream
getXdrIn()
Gets the XdrInputStream.protected final XdrOutputStream
Gets the XdrOutputStream.final XdrStreamAccess
final boolean
Current attachment status.final GenericResponse
readGenericResponse
(WarningMessageCallback warningCallback) Convenience method to read a Response to a GenericResponsevoid
setNetworkTimeout
(int milliseconds) Sets the network timeout for this attachment.Methods inherited from class org.firebirdsql.gds.ng.AbstractFbService
addServiceListener, close, getDescribeServiceRequestBuffer, getServiceInfo, getServiceInformationProcessor, getServiceWarningCallback, internalDetach, removeServiceListener
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
addExceptionListener, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isLockedByCurrentThread, removeExceptionListener, requireNotAttached, safelyDetach, setAttached, setDetached, setServerVersion, withLock
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
Methods inherited from interface org.firebirdsql.gds.ng.FbAttachment
attach, close, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isLockedByCurrentThread, withLock
Methods inherited from interface org.firebirdsql.gds.ng.FbService
addServiceListener, getServiceInfo, getServiceInfo, removeServiceListener, startServiceAction
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachment
authReceiveResponse
-
Field Details
-
protocolDescriptor
-
wireOperations
-
-
Constructor Details
-
AbstractFbWireService
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 Details
-
getHandle
public final int getHandle()- Specified by:
getHandle
in interfaceFbAttachment
- Specified by:
getHandle
in interfaceFbService
- Returns:
- The service handle value
-
forceClose
Description copied from class:AbstractFbAttachment
Forces 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:
forceClose
in interfaceFbAttachment
- Overrides:
forceClose
in classAbstractFbAttachment<WireServiceConnection>
- Throws:
SQLException
- For problems closing the connection.
-
createServiceParameterBuffer
Description copied from interface:FbService
Creates an emptyServiceParameterBuffer
.Attach expects a service parameter buffer to have the version as the first item. This needs to be added explicitly.
- Specified by:
createServiceParameterBuffer
in interfaceFbService
- Returns:
- Service
-
createServiceRequestBuffer
- Specified by:
createServiceRequestBuffer
in interfaceFbService
- Returns:
- An empty service request buffer
-
isAttached
public final boolean isAttached()Description copied from interface:FbAttachment
Current attachment status.- Specified by:
isAttached
in interfaceFbAttachment
- Overrides:
isAttached
in classAbstractFbAttachment<WireServiceConnection>
- Returns:
true
if connected to the server and attached to a database or service,false
otherwise.
-
checkConnected
Checks if a physical connection to the server is established.- Specified by:
checkConnected
in classAbstractFbAttachment<WireServiceConnection>
- Throws:
SQLException
- If not connected.
-
checkAttached
Checks 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:
SQLException
- If the database not connected or attached.
-
setNetworkTimeout
Description copied from interface:FbAttachment
Sets the network timeout for this attachment.- Specified by:
setNetworkTimeout
in interfaceFbAttachment
- 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 ofmilliseconds
is smaller than 0, or if setting the timeout fails.SQLFeatureNotSupportedException
- If this attachment doesn't support (changing) the network timeout.
-
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
-
readGenericResponse
public final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws SQLException, IOException Description copied from interface:FbWireAttachment
Convenience method to read a Response to a GenericResponse- Specified by:
readGenericResponse
in interfaceFbWireAttachment
- Parameters:
warningCallback
- Callback object for warnings,null
for 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.
-
getXdrStreamAccess
- Specified by:
getXdrStreamAccess
in interfaceFbWireAttachment
- Returns:
- Instance of
XdrStreamAccess
for this attachment.
-
getWireOperations
- Specified by:
getWireOperations
in interfaceFbWireAttachment
- Returns:
- Instance of
FbWireOperations
for this attachment.
-
closeConnection
Closes the WireConnection associated with this connection.- Throws:
IOException
- For errors closing the connection.
-