Package org.firebirdsql.gds.ng.wire
Class AbstractFbWireService
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbAttachment<T>
- 
- org.firebirdsql.gds.ng.AbstractFbService<WireServiceConnection>
- 
- org.firebirdsql.gds.ng.wire.AbstractFbWireService
 
 
 
- 
- All Implemented Interfaces:
- java.lang.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.FbWireAttachmentFbWireAttachment.AcceptPacket
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected ProtocolDescriptorprotocolDescriptorprotected FbWireOperationswireOperations- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbServiceserviceListenerDispatcher
 - 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentconnection, exceptionListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbWireService(WireServiceConnection connection, ProtocolDescriptor descriptor)Creates an AbstractFbWireDatabase instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.ServiceParameterBuffercreateServiceParameterBuffer()Creates an emptyServiceParameterBuffer.ServiceRequestBuffercreateServiceRequestBuffer()protected voidfinalize()voidforceClose()Forces the connection to close without proper detach or cleanup.intgetHandle()FbWireOperationsgetWireOperations()protected XdrInputStreamgetXdrIn()Gets the XdrInputStream.protected XdrOutputStreamgetXdrOut()Gets the XdrOutputStream.XdrStreamAccessgetXdrStreamAccess()booleanisAttached()Current attachment status.GenericResponsereadGenericResponse(WarningMessageCallback warningCallback)Convenience method to read a Response to a GenericResponsevoidsetNetworkTimeout(int milliseconds)Sets the network timeout for this attachment.- 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbServiceaddServiceListener, close, getDescribeServiceRequestBuffer, getServiceInfo, getServiceInformationProcessor, getServiceWarningCallback, internalDetach, removeServiceListener
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentaddExceptionListener, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, isLockedByCurrentThread, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion, withLock
 - 
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, isLockedByCurrentThread, withLock
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbServiceaddServiceListener, getServiceInfo, getServiceInfo, removeServiceListener, startServiceAction
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachmentauthReceiveResponse
 
- 
 
- 
- 
- 
Field Detail- 
protocolDescriptorprotected final ProtocolDescriptor protocolDescriptor 
 - 
wireOperationsprotected final FbWireOperations wireOperations 
 
- 
 - 
Constructor Detail- 
AbstractFbWireServiceprotected AbstractFbWireService(WireServiceConnection 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- 
getHandlepublic final int getHandle() - Specified by:
- getHandlein interface- FbAttachment
- Specified by:
- getHandlein interface- FbService
- Returns:
- The service handle value
 
 - 
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<WireServiceConnection>
- Throws:
- java.sql.SQLException- For problems closing the connection.
 
 - 
createServiceParameterBufferpublic final ServiceParameterBuffer createServiceParameterBuffer() Description copied from interface:FbServiceCreates an emptyServiceParameterBuffer.Attach expects a service parameter buffer to have the version as the first item. This needs to be added explicitly. - Specified by:
- createServiceParameterBufferin interface- FbService
- Returns:
- Service
 
 - 
createServiceRequestBufferpublic final ServiceRequestBuffer createServiceRequestBuffer() - Specified by:
- createServiceRequestBufferin interface- FbService
- Returns:
- An empty service request buffer
 
 - 
isAttachedpublic final boolean isAttached() Description copied from interface:FbAttachmentCurrent attachment status.- Specified by:
- isAttachedin interface- FbAttachment
- Overrides:
- isAttachedin class- AbstractFbAttachment<WireServiceConnection>
- 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<WireServiceConnection>
- 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.
 
 - 
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.
 
 - 
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
 
 - 
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.
 
 - 
getXdrStreamAccesspublic final XdrStreamAccess getXdrStreamAccess() - Specified by:
- getXdrStreamAccessin interface- FbWireAttachment
- Returns:
- Instance of XdrStreamAccessfor this attachment.
 
 - 
getWireOperationspublic final FbWireOperations getWireOperations() - Specified by:
- getWireOperationsin interface- FbWireAttachment
- Returns:
- Instance of FbWireOperationsfor this attachment.
 
 - 
closeConnectionprotected final void closeConnection() throws java.io.IOExceptionCloses the WireConnection associated with this connection.- Throws:
- java.io.IOException- For errors closing the connection.
 
 - 
finalizeprotected void finalize() throws java.lang.Throwable- Overrides:
- finalizein class- java.lang.Object
- Throws:
- java.lang.Throwable
 
 
- 
 
-