public interface EventManager
extends java.lang.AutoCloseable
EventListener
instances to listen for database events.Modifier and Type | Method and Description |
---|---|
void |
addEventListener(java.lang.String eventName,
EventListener listener)
Register an EventListener that will be called when an event occurs.
|
void |
close()
If connected, disconnects, otherwise does nothing.
|
void |
connect()
Make a connection with a database to listen for events.
|
void |
disconnect()
Close the connection to the database.
|
java.lang.String |
getDatabase() |
java.lang.String |
getDbCryptConfig()
Get the database encryption plugin configuration.
|
java.lang.String |
getHost() |
java.lang.String |
getPassword() |
int |
getPort() |
java.lang.String |
getUser() |
long |
getWaitTimeout()
Get the poll timeout in milliseconds of the async thread to check whether it was stopped or not.
|
WireCrypt |
getWireCrypt()
Get the wire encryption level.
|
boolean |
isConnected() |
void |
removeEventListener(java.lang.String eventName,
EventListener listener)
Remove an EventListener for a given event.
|
void |
setDatabase(java.lang.String database)
Sets the database path for the connection to the database.
|
void |
setDbCryptConfig(java.lang.String dbCryptConfig)
Sets the database encryption plugin configuration.
|
void |
setHost(java.lang.String host)
Sets the host for the connection to the database.
|
void |
setPassword(java.lang.String password)
Sets the password for the connection to the database.
|
void |
setPort(int port)
Sets the port for the connection to the database.
|
void |
setUser(java.lang.String user)
Sets the username for the connection to the database .
|
void |
setWaitTimeout(long waitTimeout)
Set the poll timeout in milliseconds of the async thread to check whether it was stopped or not.
|
void |
setWireCrypt(WireCrypt wireCrypt)
Set the wire encryption level.
|
int |
waitForEvent(java.lang.String eventName)
Wait for the one-time occurrence of an event.
|
int |
waitForEvent(java.lang.String eventName,
int timeout)
Wait for the one-time occurrence of an event.
|
void connect() throws java.sql.SQLException
java.sql.SQLException
- If a database communication error occursjava.lang.IllegalStateException
- If already connectedvoid close() throws java.sql.SQLException
Contrary to disconnect()
, this method does not throw IllegalStateException
when not connected.
close
in interface java.lang.AutoCloseable
java.sql.SQLException
- For errors during disconnectvoid disconnect() throws java.sql.SQLException
java.sql.SQLException
- If a database communication error occursjava.lang.IllegalStateException
- If not currently connectedclose()
boolean isConnected()
true
when connected and able to listen for eventsconnect()
,
disconnect()
void setUser(java.lang.String user)
user
- for the connection to the database.java.lang.String getUser()
void setPassword(java.lang.String password)
password
- for the connection to the database.java.lang.String getPassword()
void setDatabase(java.lang.String database)
database
- path for the connection to the database.java.lang.String getDatabase()
java.lang.String getHost()
void setHost(java.lang.String host)
host
- for the connection to the database.int getPort()
void setPort(int port)
port
- for the connection to the database.WireCrypt getWireCrypt()
void setWireCrypt(WireCrypt wireCrypt)
wireCrypt
- Wire encryption level (null
not allowed)java.lang.String getDbCryptConfig()
void setDbCryptConfig(java.lang.String dbCryptConfig)
dbCryptConfig
- Database encryption plugin configuration, meaning plugin specificlong getWaitTimeout()
Default value is 1000 (1 second).
void setWaitTimeout(long waitTimeout)
Default value is 1000 (1 second).
waitTimeout
- wait timeout in millisecondsvoid addEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLException
eventName
- The name of the event for which the listener will be notifiedlistener
- The EventListener that will be called when the given event occursjava.sql.SQLException
- If a database access error occursvoid removeEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLException
eventName
- The name of the event for which the listener will be unregistered.listener
- The EventListener that is to be unregisteredjava.sql.SQLException
- If a database access error occursint waitForEvent(java.lang.String eventName) throws java.lang.InterruptedException, java.sql.SQLException
This method blocks indefinitely until the event identified by the value of eventName
occurs. The return
value is the number of occurrences of the requested event.
eventName
- The name of the event to wait forjava.lang.InterruptedException
- If interrupted while waitingjava.sql.SQLException
- If a database access error occursint waitForEvent(java.lang.String eventName, int timeout) throws java.lang.InterruptedException, java.sql.SQLException
This method blocks for a maximum of timeout
milliseconds, waiting for the event identified by
eventName
to occur. A timeout value of 0
means wait indefinitely.
The return value is the number of occurences of the event in question, or -1
if the call timed out.
eventName
- The name of the event to wait fortimeout
- The maximum number of milliseconds to wait1
if the call timed outjava.lang.InterruptedException
- If interrupted while waitingjava.sql.SQLException
- If a database access error occursCopyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.