public IDfSessionManager getDBOSession() throws Exception { // this uses the user to get Mrcs Config to look up the DBO! /*-CONFIG-*/ String m = "getDBOSession - "; /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "ST Config lookup...", null, null); StateTransitionConfigFactory sts = StateTransitionConfigFactory.getSTConfig(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "getting config session so we can query for the dbo's name", null, null); IDfSessionManager usersessionmgr = sts.cfgSession(); IDfSession usersession = usersessionmgr.getSession(sts.cfgDocbase()); String docbase = usersession.getDocbaseName(); String dbo = usersession.getDocbaseOwnerName(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "quick dbo name: " + dbo, null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "create query objects for lookup", null, null); String dboquery = "select r_install_owner from dm_server_config"; IDfCollection col = null; IDfQuery q = new DfQuery(); q.setDQL(dboquery); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "executing " + dboquery, null, null); col = q.execute(usersession, IDfQuery.DF_READ_QUERY); if (col.next()) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "query successful, reading dbo's name", null, null); dbo = col.getString("r_install_owner"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "DBO name via query: " + dbo, null, null); col.close(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "releasing user session", null, null); usersessionmgr.release(usersession); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "user session released", null, null); } else { col.close(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "releasing user session", null, null); usersessionmgr.release(usersession); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "user session released", null, null); throw new RuntimeException("r_install_owner not retrievable from docbase"); } /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "creating DCTM client object", null, null); IDfClient client = DfClient.getLocalClient(); IDfSessionManager sMgr = null; DfLoginInfo loginInfo = new DfLoginInfo(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "setting identity to dbo user " + dbo, null, null); loginInfo.setUser(dbo); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "getting DBO session", null, null); sMgr = client.newSessionManager(); sMgr.setIdentity(docbase, loginInfo); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "returning", null, null); return sMgr; }
public IDfSessionManager getDBOSession(Map parameters) throws Exception { /*-CONFIG-*/ String m = "getDBOSession - "; String docbase = ((String[]) parameters.get("docbase_name"))[0]; /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "getting user session so we can query for the dbo's name", null, null); IDfSessionManager usersessionmgr = getUserSession(parameters); IDfSession usersession = usersessionmgr.getSession(docbase); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "quick dbo name: " + usersession.getDocbaseOwnerName(), null, null); String dbo = usersession.getDocbaseOwnerName(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "create query objects", null, null); String dboquery = "select r_install_owner from dm_server_config"; IDfCollection col = null; IDfQuery q = new DfQuery(); q.setDQL(dboquery); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "executing " + dboquery, null, null); col = q.execute(usersession, IDfQuery.DF_READ_QUERY); if (col.next()) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "query successful, reading dbo's name", null, null); dbo = col.getString("r_install_owner"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "DBO name via query: " + dbo, null, null); col.close(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "releasing user session", null, null); usersessionmgr.release(usersession); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "user session released", null, null); } else { col.close(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "releasing user session", null, null); usersessionmgr.release(usersession); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "user session released", null, null); throw new RuntimeException("r_install_owner not retrievable from docbase"); } /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "creating DCTM client object", null, null); IDfClient client = DfClient.getLocalClient(); IDfSessionManager sMgr = null; DfLoginInfo loginInfo = new DfLoginInfo(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "setting identity to dbo user " + dbo, null, null); loginInfo.setUser(dbo); // loginInfo.setPassword(""); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "getting DBO session", null, null); sMgr = client.newSessionManager(); sMgr.setIdentity(docbase, loginInfo); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "returning", null, null); return sMgr; }