Package org.firebirdsql.gds.ng
Class AbstractFbAttachment<T extends AbstractConnection<? extends IAttachProperties<?>,? extends FbAttachment>>
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbAttachment<T>
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- FbAttachment,- ExceptionListenable
 - Direct Known Subclasses:
- AbstractFbDatabase,- AbstractFbService
 
 public abstract class AbstractFbAttachment<T extends AbstractConnection<? extends IAttachProperties<?>,? extends FbAttachment>> extends java.lang.Object implements FbAttachment Common behavior forAbstractFbServiceandAbstractFbDatabase.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Tconnectionprotected ExceptionListenerDispatcherexceptionListenerDispatcher
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbAttachment(T connection, DatatypeCoder datatypeCoder)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddExceptionListener(ExceptionListener listener)Adds an exception listener to this object.protected abstract voidcheckConnected()Checks if the attachment is connected, and throws aSQLExceptionif it isn't connected.voidforceClose()Forces the connection to close without proper detach or cleanup.DatatypeCodergetDatatypeCoder()EncodinggetEncoding()IEncodingFactorygetEncodingFactory()intgetNetworkTimeout()Gets the current network timeout for this attachment.GDSServerVersiongetServerVersion()protected org.firebirdsql.gds.ng.ServerVersionInformationgetServerVersionInformation()java.lang.ObjectgetSynchronizationObject()Get synchronization object.booleanisAttached()Current attachment status.voidremoveExceptionListener(ExceptionListener listener)Removes an exception listener to this object.protected voidsafelyDetach()PerformsFbAttachment.close()suppressing any exception.protected voidsetAttached()Called when this attachment is attached.protected voidsetDetached()Called when this attachment is detached.protected voidsetServerVersion(java.lang.String... versionStrings)Sets the Firebird version from one or more version string elements.- 
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.FbAttachmentattach, close, getHandle, setNetworkTimeout
 
- 
 
- 
- 
- 
Field Detail- 
exceptionListenerDispatcherprotected final ExceptionListenerDispatcher exceptionListenerDispatcher 
 - 
connectionprotected final T extends AbstractConnection<? extends IAttachProperties<?>,? extends FbAttachment> connection 
 
- 
 - 
Constructor Detail- 
AbstractFbAttachmentprotected AbstractFbAttachment(T connection, DatatypeCoder datatypeCoder) 
 
- 
 - 
Method Detail- 
forceClosepublic void forceClose() throws java.sql.SQLExceptionForces 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
- Throws:
- java.sql.SQLException- For problems closing the connection.
 
 - 
getServerVersionpublic GDSServerVersion getServerVersion() - Specified by:
- getServerVersionin interface- FbAttachment
- Returns:
- Firebird version string
 
 - 
setServerVersionprotected final void setServerVersion(java.lang.String... versionStrings) Sets the Firebird version from one or more version string elements.This method should only be called by this instance. - Parameters:
- versionStrings- Raw version strings
 
 - 
getServerVersionInformationprotected org.firebirdsql.gds.ng.ServerVersionInformation getServerVersionInformation() 
 - 
setAttachedprotected final void setAttached() Called when this attachment is attached.Only this AbstractFbDatabaseinstance should call this method.
 - 
isAttachedpublic boolean isAttached() Description copied from interface:FbAttachmentCurrent attachment status.- Specified by:
- isAttachedin interface- FbAttachment
- Returns:
- trueif connected to the server and attached to a database or service,- falseotherwise.
 
 - 
setDetachedprotected final void setDetached() Called when this attachment is detached.Only this AbstractFbAttachmentinstance should call this method.
 - 
getSynchronizationObjectpublic final java.lang.Object getSynchronizationObject() Description copied from interface:FbAttachmentGet synchronization object.- Specified by:
- getSynchronizationObjectin interface- FbAttachment
- Returns:
- object, cannot be null.
 
 - 
getEncodingFactorypublic final IEncodingFactory getEncodingFactory() - Specified by:
- getEncodingFactoryin interface- FbAttachment
- Returns:
- The IEncodingFactoryfor this connection
 
 - 
getEncodingpublic final Encoding getEncoding() - Specified by:
- getEncodingin interface- FbAttachment
- Returns:
- The connection encoding (should be the same as returned from calling
 IEncodingFactory.getDefaultEncoding()on the result ofFbAttachment.getEncodingFactory().
 
 - 
getDatatypeCoderpublic final DatatypeCoder getDatatypeCoder() - Specified by:
- getDatatypeCoderin interface- FbAttachment
- Returns:
- The DatatypeCoderfor this database implementation.
 
 - 
getNetworkTimeoutpublic int getNetworkTimeout() throws java.sql.SQLExceptionDescription copied from interface:FbAttachmentGets the current network timeout for this attachment.- Specified by:
- getNetworkTimeoutin interface- FbAttachment
- Returns:
- Timeout in milliseconds, 0 means no timeout
- Throws:
- java.sql.SQLException- If this attachment is closed
- java.sql.SQLFeatureNotSupportedException- If this attachment doesn't support network timeout
 
 - 
addExceptionListenerpublic final void addExceptionListener(ExceptionListener listener) Description copied from interface:ExceptionListenableAdds an exception listener to this object.Implementations use WeakReference.- Specified by:
- addExceptionListenerin interface- ExceptionListenable
- Parameters:
- listener- Listener to register
 
 - 
removeExceptionListenerpublic final void removeExceptionListener(ExceptionListener listener) Description copied from interface:ExceptionListenableRemoves an exception listener to this object.- Specified by:
- removeExceptionListenerin interface- ExceptionListenable
- Parameters:
- listener- Listener to remove
 
 - 
checkConnectedprotected abstract void checkConnected() throws java.sql.SQLExceptionChecks if the attachment is connected, and throws aSQLExceptionif it isn't connected.- Throws:
- java.sql.SQLException
 
 - 
safelyDetachprotected final void safelyDetach() PerformsFbAttachment.close()suppressing any exception.
 
- 
 
-