public final class ConnectTableUpdater extends java.lang.Object implements ConnectionListener
database connection listener
implementation
which receives notifications of database connection events (at a Progress
level, not JDBC level) and updates the metadata connect table accordingly. This involves the
creation, lookup, and deletion of metadata connect records. Since such events are minimized in
real applications (it is a relatively expensive operation), this work is done inline (as
opposed to offloaded into a worker thread).Modifier and Type | Class and Description |
---|---|
private static class |
ConnectTableUpdater.Handler
Invocation handler which delegates calls to the
ConnectTableUpdater.MinimalConnect proxy methods to the
backing DMO instance. |
static interface |
ConnectTableUpdater.MinimalConnect
Interface which defines the minimally required methods of the
MetaConnect
interface. |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CONNECT_TABLE
Metadata connect table name
|
private static java.lang.Class<?> |
dmoClass
MetaConnectImpl DMO implementation class
|
private ConnectTableUpdater.Handler |
handler
Invocation handler which maps proxy method calls to underlying DMO methods
|
private static java.lang.String |
HQL_CONNECT
HQL query to find a connect record by connect ID
|
private java.lang.Object |
lock
Object on which connect/disconnect updates are synchronized
|
private static java.util.logging.Logger |
log
Logger
|
private static java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> |
methodMap
Map of
MinimalConnect methods to MetaConnectImpl methods |
private Persistence |
persistence
Persistence helper object for metadata database
|
private ConnectTableUpdater.MinimalConnect |
proxy
Proxy object for the current metadata connect DMO
|
private static org.hibernate.type.Type[] |
TYPES_CONNECT
Parameter types for connect record query
|
Constructor and Description |
---|
ConnectTableUpdater(Database metaDB)
Constructor which stores a persistence object for the associated metadata database, and
initializes a proxy for the application-specific DMO.
|
Modifier and Type | Method and Description |
---|---|
void |
databaseConnected(int64 connectID)
Create a new connect record in the metadata database, in response to a connection event.
|
void |
databaseDisconnected(int64 connectID)
Remove the connect record with the given ID from the metadata database, in response to a
disconnection event.
|
private static final java.util.logging.Logger log
private static final java.lang.String CONNECT_TABLE
private static final java.lang.String HQL_CONNECT
private static final org.hibernate.type.Type[] TYPES_CONNECT
private static final java.lang.Class<?> dmoClass
private static final java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodMap
MinimalConnect
methods to MetaConnectImpl
methodsprivate final Persistence persistence
private final ConnectTableUpdater.MinimalConnect proxy
private final ConnectTableUpdater.Handler handler
private final java.lang.Object lock
public ConnectTableUpdater(Database metaDB)
metaDB
- Metadata database helper object.public void databaseConnected(int64 connectID)
databaseConnected
in interface ConnectionListener
connectID
- Unique identifier for the database connection.public void databaseDisconnected(int64 connectID)
databaseDisconnected
in interface ConnectionListener
connectID
- Unique identifier for the database connection.