Vous êtes sur la page 1sur 10

TIBCO

TIBCO Java Custom Function Palette

Enterprise
Application
Integration
Author:
Ranjeet Singh

Confidentiality Statement

This document contains information that is proprietary and confidential to Tata Consultancy
Services. Any use or disclosure in whole or in part of this information without express written
permission of Tata Consultancy Services is prohibited.
Any other company and product names mentioned are used for identification purposes only, and
may be trademarks of their respective owners.
Copyright 2007 Tata Consultancy Services (TCS).

JavaCustomFunction Palette

About the Author


The Author, Ranjeet Singh, is working with Tata Consultancy Services since 2005 and is
associated with Nielsen TIBCO COE from last 4 months. He has rich experience in modeling
integration projects using Tibco/SAP XI/WebMethods Middlewares.

About the Domain


Tibco middleware has been used on a big level to integrate various applications like Oracle,
Siebel, SAP and other custom application. While doing so tibco provides a real time data loading
and processing from one application to another. Tibco Interface contains a combination of
components which ensures 100% message guarantee as well as real time data processing.

Confidential

JavaCustomFunction Palette

Contents

Introduction
Step By Step Procedure to create a Java Custom Function
List of Softwares Required
Conclusion

Confidential

4
5
10
10

JavaCustomFunction Palette

Introduction
The Java Custom Function resource allows you to create custom functions to use when mapping
data in an activitys input tab. These functions are also displayed when using the XPath Editor to
build an XPath expression. To create a custom function, you must write the function as a method
of a Java class and compile the code into a Java class file. You then load that class file into the
project using this resource. When the class is loaded using this resource, TIBCO ActiveMatrix
BusinessWorks inspects the contents of the class and only the class methods that meet the
following restrictions are made available in XPath:

Only methods declared as public and static are loaded.

The input parameters and return values must be of one of the types described in

The return value of the function cannot be void.

The method cannot be a constructor.

The method cannot explicitly throw an exception. Runtime exceptions are


allowed, however.

Method names cannot be overloaded in a class or any imported classes in a


single Java Custom Function resource. You can load methods of the same name
into separate classes in separate Java Custom Function resources and use the
Prefix field to differentiate between the methods.

If you make references to any imported class files, these classes must be
available in the classpath configured for TIBCO ActiveMatrix BusinessWorks.
The easiest way to make the imported classes available is to place them in the
TIBCO/bw/2.0/lib directory.

Inner classes are not supported.

Confidential

JavaCustomFunction Palette

Step By Step Procedure to create a Java Custom Function


1. Create a java function. Method should be declared as public static.

package com.tibco;
public class Concat {
public static String CustomConcat(String first,String
second)
{
return first + second ;
}
public static void main(String args[])
{
System.out.println(CustomConcat("Ranjeet ","Singh"));

Confidential

JavaCustomFunction Palette

2. Compile the code and get the class class file.

3. To add this java function under Xpath library, copy the class file and put it under
C:\tibco\jre\1.5.0\lib ( tibco bw library path).
4. Now open designer.
5. Use a JavaCustomPallete and give the path of above class file. Load the class file once.
This is one time activity. Once class file is loaded , next time we need to load it again. The
class file can be moved or deleted from OS level/path. But class file must be present
under bw library path.
6. There is another way of referencing the class file. Give the path of class file in
designer.tra and bwengine.tra files as we do for any java class file when we intent to use
them in BW.

Confidential

JavaCustomFunction Palette

7. Create a business process and take mapper activity palette.

8. Use Xpath expression for mapping the param field under root node.

Confidential

JavaCustomFunction Palette

9. Our custom java function CustomConcat has been added to the default list of Xpath
function builder.

10.Run the process.

Confidential

JavaCustomFunction Palette

11. We should get concated value as output as shown in the screen above.

List of Softwares Required

Tibco Business Works

Conclusion
Java Custom Function palette can be used in a scenario where tibco does not provide XPATH
function for any of our requirement. This is also be used in case when we have some reusable
function that need to be implemented across the whole project.

Confidential

Vous aimerez peut-être aussi