Multiple environments with Composer

Similar to the previous posts about configuring dqMan/DQLTester (Multiple environments with dqMan/DQLTester) and tomcat (Multiple environments with Tomcat/DA), Composer can be launched the same way:

Folder structure:

  • composer.bat
  • properties
    • env1
      • dev
        • dfc.properties
      • prod
        • dfc.properties
    • env2
      • dev
        • dfc.properties
      • prod
        • dfc.properties
  • etc.

Composer.bat:

@Echo off
SETLOCAL ENABLEEXTENSIONS

SET composerfolder=path to composer folder<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;">&#65279;</span>
SET folderbase=dfcproperties
SET parambase=-Ddfc.properties.file=

echo ****************
echo 1. env1 dev
echo 2. env2 prod
...
echo ****************

SET /p var= ^&gt; Choose option:

if "%var%"=="1" goto op1
if "%var%"=="2" goto op2
...

:op1
SET JAVA_TOOL_OPTIONS=%parambase%%cd%\%folderbase%\env1\dev\dfc.properties
goto finish

:op2
SET JAVA_TOOL_OPTIONS=%parambase%%cd%\%folderbase%\env1\prod\dfc.properties
goto finish
...

:finish

start "" /D %composerfolder% /B %composerfolder%\composer.exe
cls&amp;exit

Custom labels for column values in D2 queries

Problem: We have a query that is using aliases (r_object_type as cod) that shows documents on D2’s objectlist. We want to use a custom dictionary for those values, but the dictionary values are not applied.

Solution: This mappings are stored in d2_attribute_mapping_config, this table contains a list of repeating attributes that store those mappings:

  • type_name: type with the attribute to map
  • attr_name: name of the attribute that contains the values to map
  • dictionary_name: name of the dictionary with the values to show
  • alias_locale_name: auto/language of the values to show

So, this table stores in the repeating attributes the values of the type, attribute and dictionary. This means that you can only map columns that have attribute names.

Solution? Workaround? Append new values to those attributes, indicating the alias you are using, the type used in the “from” clause of the query and the dictionary, and you’re good to go.

Of course, this is completely unsupported by Opentext 🙂

D2 16.5 released

D2 16.5 is available to download (in fact, I think it’s the only Documentum product available in 16.5, not even CS is yet available) including the new UI for D2.

The current version of D2 Smart View Client is ideally suited for users with a content consumer role where searching for and viewing documents is the primary focus. To access more advanced features such as Content Creation, Advanced and Query form searches, Workflow Processing, and Virtual Document creation, users should switch to the D2 Classic Client

D2-Config without ActiveX

If somehow you find yourself working for a customer with very strict security policies that don’t allow ActiveX components, you can still work with D2-Config even if you cannot install the activex component.

You can access /D2-Config/ConnectDialog.html, ignore the popups and login as usual, then you’ll be redirected to /D2-Config/interface.html?interfaceId=null# which is the page with D2-Config matrix.

Every time you click somewhere you’ll get a popup stating the C6 ActiveX is not loaded but you can simply ignore it, as most of the application will work.

If you need to perform a full import of a configuration, you can do so with the following code (note that this will reset D2-Config configurations):

getSManager();
session=sm.getSession("repository");

D2Session.initTBOEx(session,false);
D2Config config=new D2Config(session);

config.importZip(new File("full path to Zip file with configuration"),
true, null, null, true, true, null);

Map arguments = new HashMap();
arguments.put("-callerUrl", "http://server/D2/");
arguments.put("-all", Boolean.TRUE);
D2Method.start(session, D2RefreshCacheMethod.class, arguments);

sm.release(session);

You’ll need to add to your project d2-api.jar and c6-common.jar, mark as approved the dfc instance used by the program’s dfc, and set the java.security parameter as explained in D2 4.7/16.4 configuration in eclipse

D2 4.7/16.4 configuration in eclipse

This post is quite similar to the Debugging D2 4.5/4.6 previously posted, explaining how to set up D2 without lockbox, but much more simple due to the missing lockbox.

Extract all files from D2/D2-Config to a local folder in your computer, configure a new (tomcat) server in Eclipse, and configure the following parameters:

  • JVM arguments:
    • -Djava.io.tmpdir=”<absolute path to some temp folder>\d2″ (make sure this folder exists)
    • -Djava.security.policy=file:///<absolute path to java.policy file> (the documentation states to change java.policy in your JRE, but I rather use this cleaner solution: create a local java.policy file with a single line:

      grant { permission com.documentum.fc.client.impl.bof.security.RolePermission “*”, “propagate”;}; and reference it with the java.security.policy parameter)

    • Additional memory/custom parameters

Now, start the server, take note of the dfc.keystore id, mark it as approved privilege client in DA and you are good to go.

How to read environment variables

By the talented team way:

 String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("win") >= 0) {
p = r.exec("cmd.exe /c set");
} else {
p = r.exec("env");
}
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null)
{
String[] inputs = line.split("=");
if ("DOCUMENTUM".equalsIgnoreCase(inputs[0])) {
retCode = inputs[1];
}
}
if (br != null) {
br.close();
}

I guess System.getenv was way too complex…

Oh, and they use the same method to read a properties file:

while ((record = dis.readLine()) != null)
{
recCount++;
if ((!record.startsWith("#")) && (!record.trim().equalsIgnoreCase("")))
{
String[] inputs = record.split("=");
params.put(inputs[0], inputs[1]);
}
}