org.firebirdsql.event
Class FBEventManager
java.lang.Object
org.firebirdsql.event.FBEventManager
- EventManager
public class FBEventManager
extends java.lang.Object
An EventListener
implementation to listen for database events.
void | addEventListener(String eventName, EventListener listener) - Register an EventListener that will be called when an event occurs.
|
void | connect() - Make a connection with a database to listen for events.
|
void | disconnect() - Close the connection to the database.
|
String | getDatabase() - Returns the database path for the connection to the database.
|
String | getHost() - Returns the host for the connection to the database.
|
String | getPassword() - Returns the password for the connection to the database.
|
int | getPort() - Returns the port for the connection to the database.
|
String | getUser() - Returns the username for the connection to the databaes.
|
boolean | isConnected() - Check whether this object is connected to the database.
|
void | removeEventListener(String eventName, EventListener listener) - Remove an EventListener for a given event.
|
void | setDatabase(String database) - Sets the database path for the connection to the database.
|
void | setHost(String host) - Sets the host for the connection to the database.
|
void | setPassword(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(String user) - Sets the username for the connection to the database .
|
int | waitForEvent(String eventName) - Wait for the one-time occurence of an event.
|
int | waitForEvent(String eventName, int timeout) - Wait for the one-time occurence of an event.
|
FBEventManager
public FBEventManager()
FBEventManager
public FBEventManager(org.firebirdsql.gds.impl.GDSType gdsType)
addEventListener
public void addEventListener(String eventName,
EventListener listener)
throws SQLException
Register an EventListener that will be called when an event occurs.
- addEventListener in interface EventManager
eventName
- The name of the event for which the listener will
be notifiedlistener
- The EventListener that will be called when the given
event occurs
connect
public void connect()
throws SQLException
Make a connection with a database to listen for events.
- connect in interface EventManager
disconnect
public void disconnect()
throws SQLException
Close the connection to the database.
- disconnect in interface EventManager
getDatabase
public String getDatabase()
Returns the database path for the connection to the database.
- getDatabase in interface EventManager
- the database path for the connection to the database.
getHost
public String getHost()
Returns the host for the connection to the database.
- getHost in interface EventManager
- the host for the connection to the database.
getPassword
public String getPassword()
Returns the password for the connection to the database.
- getPassword in interface EventManager
- the password for the connection to the database.
getPort
public int getPort()
Returns the port for the connection to the database.
- getPort in interface EventManager
- the port for the connection to the database.
getUser
public String getUser()
Returns the username for the connection to the databaes.
- getUser in interface EventManager
- the username for the connection to the database.
isConnected
public boolean isConnected()
Check whether this object is connected to the database.
true
if object is connected to the
database, otherwise false
.
removeEventListener
public void removeEventListener(String eventName,
EventListener listener)
throws SQLException
Remove an EventListener for a given event.
- removeEventListener in interface EventManager
eventName
- The name of the event for which the listener
will be unregistered.listener
- The EventListener that is to be unregistered
setDatabase
public void setDatabase(String database)
Sets the database path for the connection to the database.
- setDatabase in interface EventManager
database
- path for the connection to the database.
setHost
public void setHost(String host)
Sets the host for the connection to the database.
- setHost in interface EventManager
host
- for the connection to the database.
setPassword
public void setPassword(String password)
Sets the password for the connection to the database.
- setPassword in interface EventManager
password
- for the connection to the database.
setPort
public void setPort(int port)
Sets the port for the connection to the database.
- setPort in interface EventManager
port
- for the connection to the database.
setUser
public void setUser(String user)
Sets the username for the connection to the database .
- setUser in interface EventManager
waitForEvent
public int waitForEvent(String eventName)
throws InterruptedException,
SQLException
Wait for the one-time occurence of an event.
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.
- waitForEvent in interface EventManager
eventName
- The name of the event to wait for
- The number of occurences of the requested event
waitForEvent
public int waitForEvent(String eventName,
int timeout)
throws InterruptedException,
SQLException
Wait for the one-time occurence of an event.
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.
- waitForEvent in interface EventManager
timeout
- The maximum number of milliseconds to wait
- The number of occurrences of the requested event, or
-1
if the call timed out
Copyright B) 2001 David Jencks and other authors. All rights reserved.