For the last year I’ve been doing different posts about how to include Java Code inside our TIBCO BW processes to increase or extend the functionality the tool provide us. I’ve been doing this kind of work for both of the “current” versions: The 5.x series and the 6.x series.
And, if you have been awared or if you have been the oportunity to work with both tools you have seen some difference in the way and the posibilities you have using one or another tool. We are going to talk a little bit about them in this post.
OSGI vs Traditional Java
First of all, the main different you have to accept is in the core of the products, in their philosophy, in the main behavior. And, you have to face that BW5.x and BW6.x are a very different application in their building and in their internal architecture.
The tradicional BW5.X is a Traditional Java application, so it follows the rules of these kind of application. You have your lib folder with the JAR files you have to use as dependencies. You have your normal Java classes you could add in your BW Process using the Java Code Activity, and so on. It’s like if you create a Java application a few years ago (with no maven, gradle, or any kind of modern framework). Only using the JDK 1.4/1.5 and start coding using your IDE.
But BW6.X is not a tradicional applicaiton, it’s more like a “modern” (not so modern because its architecture have been along us the past 5-7 years or so) application server. It’s an OSGi-based application, so it’s based on OSGI plug-ins. It is not the goal of this post to explain you about what OSGI means, but I leave you a link you can use to learn about it (https://en.wikipedia.org/wiki/OSGi). But the main thing you have to keep in mind, it is that it is not using normal JAR’s but OSGi-plugin’s JAR. So, the first thing, you cannot create your JAR or grab one JAR from the internet and put it inside your classpath and expect that is going to work in TIBCO BW 6.x. Because it is never going to do it that way.
This is not the first time that TIBCO uses this architecture inside its products. The same architecture are used by all the TIBCO AMX suite (TIBCO AMX Service Bus, TIBCO AMX BPM, TIBCO AMX Service Grid, TIBCO AMX Policy Director). So, if you had the opportunity to work with one of these products, maybe you are already familiar with that concepts and the “problems” you are going to have to face it.
If you have to take a deeper look about how to include a JAR file inside your BusinessWorks 6.x you can take a look at this post I published few months ago: BusinessWorks 6.x Importing a JAR file inside a TIBCO BW 6.x process
Adding simple Java Code ? No way
Usually, when you want to introduce Java code inside your TIBCO BW process you didn’t have to import a full library or any big artifact. Maybe, you only want to introduce one or two line code to get your work done. There are a lot of examples of that, but probably the most usual is generating an UUID. TIBCO BW 5.x doesn’t provide an OOTB to do that, and we can get it only with this line:
Ok, we know that we can add a Java Code activity and include only this line in our process and everything is working. But, can we do the same thing in TIBCO BW 6? No, we can’t.
First of all, because the Java Code activity is no where inside the Java Palette. And the most important one is regarding the first point we discussed earlier. With this new architecture we cannot add a code that doesn’t belong to any specific OSGI plugin so, we always have to create a Java project with its own metadata and then we can add the code.
If you want to know more details about how to do it, you can take a look at this post I published few months ago: Using Java inside a Business Works 6.1 Process