Interface EventManager
- 
- All Superinterfaces:
- AttachmentProperties,- java.lang.AutoCloseable,- BaseProperties
 - All Known Implementing Classes:
- FBEventManager
 
 public interface EventManager extends AttachmentProperties, java.lang.AutoCloseable An interface for registeringEventListenerinstances to listen for database events.- Author:
- Gabriel Reid, Mark Rotteveel
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddEventListener(java.lang.String eventName, EventListener listener)Register an EventListener that will be called when an event occurs.voidclose()If connected, disconnects, otherwise does nothing.voidconnect()Make a connection with a database to listen for events.voiddisconnect()Close the connection to the database.java.lang.StringgetDatabase()Deprecated.UsegetDatabaseName(); will be removed in Jaybird 6 or laterjava.lang.StringgetDatabaseName()Get the database name.java.lang.StringgetHost()Deprecated.UseAttachmentProperties.getServerName(); will be removed in Jaybird 6 or laterintgetPort()Deprecated.UseAttachmentProperties.getPortNumber(); will be removed in Jaybird 6 or laterlonggetWaitTimeout()Get the poll timeout in milliseconds of the async thread to check whether it was stopped or not.WireCryptgetWireCryptAsEnum()Get the wire encryption level.booleanisConnected()voidremoveEventListener(java.lang.String eventName, EventListener listener)Remove an EventListener for a given event.voidsetDatabase(java.lang.String database)Deprecated.UsesetDatabaseName(String); will be removed in Jaybird 6 or latervoidsetDatabaseName(java.lang.String databaseName)Set the database name.voidsetHost(java.lang.String host)Deprecated.UseAttachmentProperties.setServerName(String); will be removed in Jaybird 6 or latervoidsetPort(int port)Deprecated.UseAttachmentProperties.setPortNumber(int); will be removed in Jaybird 6 or latervoidsetWaitTimeout(long waitTimeout)Set the poll timeout in milliseconds of the async thread to check whether it was stopped or not.voidsetWireCryptAsEnum(WireCrypt wireCrypt)Set the wire encryption level.intwaitForEvent(java.lang.String eventName)Wait for the one-time occurrence of an event.intwaitForEvent(java.lang.String eventName, int timeout)Wait for the one-time occurrence of an event.- 
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentPropertiesgetAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.BasePropertiesconnectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setProperty
 
- 
 
- 
- 
- 
Method Detail- 
connectvoid connect() throws java.sql.SQLExceptionMake a connection with a database to listen for events.- Throws:
- java.sql.SQLException- If a database communication error occurs
- java.lang.IllegalStateException- If already connected
 
 - 
closevoid close() throws java.sql.SQLExceptionIf connected, disconnects, otherwise does nothing.Contrary to disconnect(), this method does not throwIllegalStateExceptionwhen not connected.- Specified by:
- closein interface- java.lang.AutoCloseable
- Throws:
- java.sql.SQLException- For errors during disconnect
- Since:
- 3.0.7
 
 - 
disconnectvoid disconnect() throws java.sql.SQLExceptionClose the connection to the database.- Throws:
- java.sql.SQLException- If a database communication error occurs
- java.lang.IllegalStateException- If not currently connected
- See Also:
- close()
 
 - 
isConnectedboolean isConnected() - Returns:
- truewhen connected and able to listen for events
- See Also:
- connect(),- disconnect()
 
 - 
getDatabaseNamejava.lang.String getDatabaseName() Get the database name.See DatabaseConnectionProperties.getDatabaseName()for details.- Returns:
- database name
- Since:
- 5
 
 - 
setDatabaseNamevoid setDatabaseName(java.lang.String databaseName) Set the database name.See DatabaseConnectionProperties.setDatabaseName(String)for details.- Parameters:
- databaseName- database name
- Since:
- 5
 
 - 
setDatabase@Deprecated void setDatabase(java.lang.String database) Deprecated.UsesetDatabaseName(String); will be removed in Jaybird 6 or laterSets the database path or url for the connection to the database.- Parameters:
- database- path or url for the connection to the database.
 
 - 
getDatabase@Deprecated java.lang.String getDatabase() Deprecated.UsegetDatabaseName(); will be removed in Jaybird 6 or later- Returns:
- the database path or url for the connection to the database.
 
 - 
getHost@Deprecated java.lang.String getHost() Deprecated.UseAttachmentProperties.getServerName(); will be removed in Jaybird 6 or later- Returns:
- the host for the connection to the database.
 
 - 
setHost@Deprecated void setHost(java.lang.String host) Deprecated.UseAttachmentProperties.setServerName(String); will be removed in Jaybird 6 or laterSets the host for the connection to the database.See AttachmentProperties.setServerName(String)for details.- Parameters:
- host- for the connection to the database.
 
 - 
getPort@Deprecated int getPort() Deprecated.UseAttachmentProperties.getPortNumber(); will be removed in Jaybird 6 or later- Returns:
- the port for the connection to the database.
 
 - 
setPort@Deprecated void setPort(int port) Deprecated.UseAttachmentProperties.setPortNumber(int); will be removed in Jaybird 6 or laterSets the port for the connection to the database.- Parameters:
- port- for the connection to the database.
 
 - 
getWireCryptAsEnumWireCrypt getWireCryptAsEnum() Get the wire encryption level.- Returns:
- Wire encryption level
- Since:
- 5
 
 - 
setWireCryptAsEnumvoid setWireCryptAsEnum(WireCrypt wireCrypt) Set the wire encryption level.- Parameters:
- wireCrypt- Wire encryption level (- nullnot allowed)
- Since:
- 5
 
 - 
getWaitTimeoutlong getWaitTimeout() Get the poll timeout in milliseconds of the async thread to check whether it was stopped or not.Default value is 1000 (1 second). - Returns:
- wait timeout in milliseconds
 
 - 
setWaitTimeoutvoid setWaitTimeout(long waitTimeout) Set the poll timeout in milliseconds of the async thread to check whether it was stopped or not.Default value is 1000 (1 second). - Parameters:
- waitTimeout- wait timeout in milliseconds
 
 - 
addEventListenervoid addEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLExceptionRegister an EventListener that will be called when an event occurs.- Parameters:
- eventName- The name of the event for which the listener will be notified
- listener- The EventListener that will be called when the given event occurs
- Throws:
- java.sql.SQLException- If a database access error occurs
 
 - 
removeEventListenervoid removeEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLExceptionRemove an EventListener for a given event.- Parameters:
- eventName- The name of the event for which the listener will be unregistered.
- listener- The EventListener that is to be unregistered
- Throws:
- java.sql.SQLException- If a database access error occurs
 
 - 
waitForEventint waitForEvent(java.lang.String eventName) throws java.lang.InterruptedException, java.sql.SQLExceptionWait for the one-time occurrence of an event.This method blocks indefinitely until the event identified by the value of eventNameoccurs. The return value is the number of occurrences of the requested event.- Parameters:
- eventName- The name of the event to wait for
- Returns:
- The number of occurences of the requested event
- Throws:
- java.lang.InterruptedException- If interrupted while waiting
- java.sql.SQLException- If a database access error occurs
 
 - 
waitForEventint waitForEvent(java.lang.String eventName, int timeout) throws java.lang.InterruptedException, java.sql.SQLExceptionWait for the one-time occurrence of an event.This method blocks for a maximum of timeoutmilliseconds, waiting for the event identified byeventNameto occur. A timeout value of0means wait indefinitely.The return value is the number of occurences of the event in question, or -1if the call timed out.- Parameters:
- eventName- The name of the event to wait for
- timeout- The maximum number of milliseconds to wait
- Returns:
- The number of occurrences of the requested event, or 1if the call timed out
- Throws:
- java.lang.InterruptedException- If interrupted while waiting
- java.sql.SQLException- If a database access error occurs
 
 
- 
 
-