rdb-extending-open-text-delivery-server-with-your-own-java-classes.png

rdb: Extending Open Text Delivery Server with your own Java Classes

Guest writer Marek Korch, RedDot/Open Text Consultant at infinity-group.pl in Poland and working for clients like BNP Paribas Fortis, Dan-wood, Allianz and Nordea. He enjoys new challenges in Open Texts Management / Delivery Server systems and learning new things around the ECM world and how to improve them.

In this article we will show you how to find the right files to extend Open Texts Delivery Server (formerly known as RedDot LiveServer) with your own Java classes.

You might have worked with LiveServer DynaMents before and sometimes you just wish you would have that special method or a nicer way to process this bit of information but the existing set of Delivery Server DynaMents just doesn’t exactly fit your needs. Therefore here comes your LiveServer tutorial for including your own Dynaments inside of LiveServer.

If you want to start your own adventure with DynaMents and inline Java functions which will extend the DynaMents functionality, you’ll need to go through the following steps:

  1. Prepare the LiveServer (Delivery Server) environment
  2. Prepare the java package and the java class files
  3. Create your own class which you want to use to extend the built-in java classes
     

Prepare the LiveServer Delivery Server environment

First of all check your Delivery Server version and build. I was working on LiveServer (Delivery Server) build 4.0.0.8 but it’s recommended to upgrade it to LiveServer 4 SP1. Of course it is not necessary to upgrade your LiveServerS/Delivery Server, but it makes things easier if you are able to go with the upgrade as you will see below. (Always keep in mind to check the release notes and check issues affecting your environment. LS 4 for example has a known defect with updating/connecting to Active Directory which is yet about to get fixed)
 

Prepare the java package and the java class files

Finding the classes on your LiveServer environment can be a bit tricky, to create your own Java class file you will have to import one very important class package which is built in the LS. The class is called:

 Java 
de.reddot.xmaps.dynament.DefaultInlineFunctions;

There are two ways to find it and to import into your class package during the compilation process:

A) Especially recommended to use if you have LiveServer without SP1, is to import the above mentioned class into your java project in which you will compile your own class. To accomplish that, simply import the JAR file with the necessary class which is located in
 

 Console 
<LiveServer_Install_Directory>\tomcat\webapps\cps\WEB-INF\lib\rdls-rde-x.x.x.x.jar

x.x.x.x corresponds to a build version of LS. In my case it was rdls-rde-4.0.0.8.jar.
 

B) If you already have LiveServer running with the SP1 updgrade, you can find the necessary class in

 Console 
<LiveServer_Install_Directory>\tomcat\webapps\cps\WEB-INF\classes\de\reddot\xmaps\dynament\DefaultInlineFunctions.class

 

Create your own class which you want to use to extend the built-in java classes

The Next step is to prepare a definition of your own class. It should looks like this:

 Java 
// ############################
package com.company.package;
import de.reddot.xmaps.dynament.DefaultInlineFunctions;
public class ExtendedInlineFunctionsClassName extends DefaultInlineFunctions{
         public String function(String value, ...ANY OTHER VARS DESIRED){
                   String mustReturnAString=value;
                   return mustReturnAString;
         }
         //called inline like [#source:attribute#].function(...ANY OTHER VARS DESIRED)
}
// ############################

After that, all you have to do is to compile your own class file with your function(s) and then copying it to to the classes folder on your LiveServer directory:

 Console 
<LiveServer_Install_Directory>\tomcat\webapps\cps\WEB-INF\classes

And Voila! Based on that you are ready to go. Create your own Java methods and use the according DynaMents in your LiveServer project.