Tivoli Directory Integrator, Version 7.1.1

Developing a Function Component

Implementing a Function Component (FC) follows very much the pattern of developing a Connector. A Function Component is actually easier to implement because of fewer dependencies on the AssemblyLine workflow.

Implementing Function Component Java source code

Similar to the Connector foundation classes, we have "com.ibm.di.fc.FunctionInterface" and the "com.ibm.di.fc.Function" abstract class that implements the interface (the Java sources of both classes are included in the "fc" folder of this package).

You will usually implement your FCs by subclassing the "com.ibm.di.fc.Function" class. These are the most important methods you will usually need to implement:

public void initialize (Object obj)
Put any initialization code here - reading FC's parameters, allocating resources, etc. When the FC is placed into an AssemblyLine, the AssemblyLine will call the "initialize(...)" method once, on startup.

When the FC is created and used programmatically the "initialize(...)" method must be called right after constructing the FC object and setting its parameters, and before calling its "perform(...)" method.

public Object perform (Object obj)
The "perform(...)" method is the actual implementation of the business logic of your FC. In contrast to the Connector where you have different Connector modes and different methods to implement for each of them (getNextEntry(), findEntry(), etc.) all that a FC is supposed to do is implemented in the "perform(...)" method.

The general contract for the "perform(...)" method is that it receives some data on input and based on that input it produces some output data. There are no other assumptions. As you will see below it is not even necessary that your FC works with Entry objects.

When the FC is placed into an AssemblyLine, the AssemblyLine calls its "perform(...)" method on each iteration. In the AssemblyLine context the "perform(...)" method will be given an Entry object as input parameter (this is the Entry object constructed by the Output Attribute Mapping process - also called the conn Entry). And it is supposed to return an Entry object as well; the AssemblyLine will feed the returned Entry object to the Input Attribute Mapping process, the result of which is applied to the AssemblyLine's work Entry - in other words, the returned Entry is the conn Entry in the Input Map. If you want to enable your FC to be placed into an AssemblyLine, you need to support this "Entry on input - Entry on output" behavior.

You might also code the "perform(...)" method so that it receives non-Entry objects on input and returns non-Entry objects on output. This could facilitate the process of programmatically creating and calling an FC. No Attribute Mapping will be done if you use this method.

public void terminate()
The FC's "terminate(...)" method is called by the AssemblyLine after it has finished cycling and before it terminates. You would put here any cleanup code, that is, release connections, resources that you created in the "initialize(...)" method or later during processing.

When using an FC programmatically, you must call the "terminate(...)" method after you have finished using that FC instance.

Building the Function Component source code

When building the source code of your Function Component, include in your CLASSPATH the jar files from the "jars" folder of the IBM® Tivoli® Directory Integrator installation. As a minimum, you would need to include "miserver.jar" and "miconfig.jar".

Note:
When integrating your Java code with IBM Tivoli Directory Integrator, pay attention to the collection of pre-existing components that comprise IBM Tivoli Directory Integrator, notably in the jars directory. If your code relies upon one of your own library components that overlap or clash with one or more that are part of the Tivoli Directory Integrator installation there will most likely be loader problems during execution.

Implementing the Function Component GUI configuration form

The FC GUI is implemented in the same way as for a Connector. Use a "tdi.xml" file to describe the FC configuration form by using the same syntax as used for Connectors.

Packaging and deploying the Function Component

Packaging and deploying an FC is just like packaging and deploying a Connector:

You need a jar file that contains:

  1. The class file(s) of the Function Component
  2. "tdi.xml" file placed in the root of the jar file (and optionally "MyFunction_??.properties" files if you want to support different languages)

After you have created the jar file of the new Function Component, you only need to drop that jar file in the "jars/functions" folder in the IBM Tivoli Directory Integrator installation. The next time the IBM Tivoli Directory Integrator is started it will automatically load the new Function Component and it will be ready for use.

[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1