Search in sources :

Example 1 with DAOProxyConnectionListener

use of com.cosylab.cdb.client.DAOProxyConnectionListener in project ACS by ACS-Community.

the class ManagerImpl method getComponentsDAOProxy.

/**
	 * Returns, if necessary also creates, components DAO (CDB access).
	 *
	 * @return	DAOProxy	components DAO (CDB access), otherwise <code>null</code>
	 */
private synchronized DAOProxy getComponentsDAOProxy() {
    if (System.getProperties().containsKey(NAME_CDB_DISABLE))
        return null;
    if (componentsDAO == null) {
        componentsDAO = createDAO("MACI/Components");
        if (componentsDAO != null) {
            // initial refresh
            componentListCache = refreshComponentsList(componentsDAO);
            // ... and install link listener (to refresh after reconnect)
            componentsDAO.addConnectionListener(new DAOProxyConnectionListener() {

                public void connected(DAOProxy proxy) {
                    componentListCache = refreshComponentsList(proxy);
                }

                public void disconnected(DAOProxy proxy) {
                /* noop */
                }
            });
        }
    }
    return componentsDAO;
}
Also used : DAOProxyConnectionListener(com.cosylab.cdb.client.DAOProxyConnectionListener) DAOProxy(com.cosylab.cdb.client.DAOProxy)

Aggregations

DAOProxy (com.cosylab.cdb.client.DAOProxy)1 DAOProxyConnectionListener (com.cosylab.cdb.client.DAOProxyConnectionListener)1