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 and myconnection tables accordingly.
This involves the creation, lookup, and deletion of metadata connect and myconnection 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 connProxy methods to the
backing DMO instance. |
static interface |
ConnectTableUpdater.MinimalConnect
Interface which defines the minimally required methods of the
MetaConnect
interface. |
static interface |
ConnectTableUpdater.MinimalMyconnection
Interface which defines the minimally required methods of the
MetaMyconnection
interface. |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CONNECT_TABLE
Metadata connect table name
|
private ConnectTableUpdater.MinimalConnect |
connProxy
Proxy object for the current metadata connect DMO
|
private static java.lang.Class<?> |
dmoConnectClass
MetaConnectImpl DMO implementation class
|
private static java.lang.Class<?> |
dmoMyconnClass
MetaMyconnectionImpl 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 static java.lang.String |
HQL_MYCONNECTION
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 static java.lang.String |
MYCONNECTION_TABLE
Metadata myconnection table name
|
private ConnectTableUpdater.MinimalMyconnection |
myconnProxy
Proxy object for the current metadata myconnection DMO
|
private Persistence |
persistence
Persistence helper object for metadata database
|
private SecurityManager |
securityManager
Security manager
|
private static org.hibernate.type.Type[] |
TYPES_ID
Parameter types for metadata record queries
|
Constructor and Description |
---|
ConnectTableUpdater(Database metaDB)
Constructor which stores a persistence object for the associated metadata database, and
initializes a proxies for the application-specific DMOs.
|
Modifier and Type | Method and Description |
---|---|
void |
databaseConnected(int64 connectID)
Create new records 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 void |
deleteRecord(Persistence persistence,
java.lang.String hql,
int64 connectID)
Delete the record found by the given query.
|
private static final java.util.logging.Logger log
private static final java.lang.String CONNECT_TABLE
private static final java.lang.String MYCONNECTION_TABLE
private static final java.lang.String HQL_CONNECT
private static final java.lang.String HQL_MYCONNECTION
private static final org.hibernate.type.Type[] TYPES_ID
private static final java.lang.Class<?> dmoConnectClass
private static final java.lang.Class<?> dmoMyconnClass
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 SecurityManager securityManager
private final ConnectTableUpdater.MinimalConnect connProxy
private final ConnectTableUpdater.MinimalMyconnection myconnProxy
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.private void deleteRecord(Persistence persistence, java.lang.String hql, int64 connectID) throws PersistenceException
persistence
- Persistence object.hql
- HQL query statement to find record.connectID
- Unique ID for record.PersistenceException
- if an error occurs accessing or deleting the data.