Being able to also transport BusinessObjects content from one system to another, as outlined in my previous post, was a big step forward to achieving complete continuous delivery. But a few things still need some polishing up.
For instance, when using this method to transport connection objects, you end up with connections pointing to the development backend – assuming you have separate backends for the various environments (i.e. DEV/QA/STAG/TEST/PROD). But we all have that, right? 😉
To fix this, we call yet another little tool in our delivery pipeline to fix the connection properties in each environment after deployment. And again, we use the Java API for SAP BusinessObjects BI.
As usual, a session and handle to the InfoStore will be needed:
IEnterpriseSession enSession =
CrystalEnterprise.getSessionMgr().logon(“cmsuser”, “cmspasswd”, “cmshost:cmsport”, IsecEnterprise.KIND);
IInfoStore infoStore = (IInfoStore) enSession.getService(“InfoStore”);
Then we retrieve the connection object we wish to modify:
String query =
“SELECT * FROM CI_APPOBJECTS WHERE SI_KIND = ‘CCIS.DataConnection’ AND SI_NAME = ‘myConnection'”;
IInfoObjects connObjects = infoStore.query(query);
IDataConnection dataConnection =
(IDataConnection) connObjects.get(0); # maybe some error handling?
Connection conn = dataConnection.getConnection();
To modify the connection, it first needs to be cast to MutableConnection. Only then can we change the properties and save the object:
MutableConnection mutConn = (MutableConnection) conn;
Using this after deployment in each environment, we ensure that the connection object will point to the correct backend.
There are also other things which need to be changed after deployment (e.g. permissions on objects) – I’ll try to cover that in a separate post…sometime…