Converting existing function classes without Eclipse
About this task
Procedure
- Create a folder in which to develop your custom function. For example, c:\customFunction.
- Create folders for the source and the build output. For example, c:\customFunction\src and c:\customFunction\build.
- Copy the plugin.xml file and the META-INF directory from C:\Program Files\IBM\RationalIntegrationTester\examples\FunctionsSamplePlugin into the build directory. Both the plugin.xml file and the META-INF directory must be copied to the same target directory (C:\customFunction\build).
- Create the required directory structure
under src to contain your custom function code.
For information about how to write your custom function code, see Implementing the function class.
If you have existing code, copy the root package and all sub packages
under the src folder. For example: C:\customFunction\src\com\samples\functions\FormatDate.java. An example directory structure follows:
Except in the src folder, if you compile your own function, you have your own Java™ classes in a similar folder hierarchy. For example:
- Remove the register() method as it is not required anymore.
- Change the visibility of the default constructor to be public. No other visibility (for example, protected) can be used, otherwise an exception is generated when you try to execute the function.
- Remove the super(String, String, int, int) call
in the default constructor.
This super constructor does not exist anymore, so any calls to it produce an error. This call is replaced by the information that is contained in the extension point definition.
- Remove the method getSyntax(). This information is now contained in the extension point definition.
- In your command prompt or terminal, from the C:\customFunction\src folder
compile the custom function into the build directory,
such as by running the following command: Note: Run the javac executable from the Java Development Kit (JDK). If the commands shown do not find that executable, add the full path to the executable's location to the beginning of each command.
javac -d ../build -classpath .;"C:/Program Files/IBM/IBMIMShared/plugins/*" com/samples/functions/FormatDate.java
Note: If the source contains multiple Java files, you must specify each file in the command. For example, if you use the second directory structure above, the command is:javac -d ../build -classpath .;"C:/Program Files/IBM/IBMIMShared/plugins/*" com/mycompany/myfunction/MyFunction.java com/mycompany/myfunction/MyUtilities.java
or
javac -d ../build -classpath .;"C:/Program Files/IBM/IBMIMShared/plugins/*" com/mycompany/myfunction/*.java
On a Linux or UNIX system, the command is:javac -d ../build -classpath .:"/opt/IBM/IBMIMShared/plugins/*" **/*.java
- Edit MANIFEST.MF, which
is in the META-INF directory under the build directory,
for example, META-INF/MANIFEST.MF and change
the following values: An example of a manifest file follows:
Value Change to... Bundle-Name Enter a descriptive name for the plug-in (for example, Format Date Function). Bundle-SymbolicName Enter a unique ID that describes your plug-in. This ID must be different from any other plug-in, as two plug-ins with the same ID cannot be loaded at one time. Leave the "singleton:=true" part untouched. Bundle-Vendor Enter your company’s name or some other provider description. Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 10.0-b19 (Sun Microsystems Inc.) Bundle-ManifestVersion: 2 Bundle-Name: The Function That Does Exactly What I Need Bundle-SymbolicName: com.mycompany.myfunction;singleton:=true Bundle-Version: 1.0.0 Bundle-Vendor: My Company Import-Package: com.ghc.ghTester.expressions
Replace the values for Bundle_Name, the Bundle-SymbolicName, and the Bundle-Vendor with your own. The Bundle-SymbolicName value usually, but does not have to, match the Java package name in which the function Java classes are located.
- Open plug-in.xml (in your build directory) in a text editor and update the values as described in Configuring the extension point element.
- In your command prompt or terminal, from
the c:\customFunction\build directory create
a JAR file that contains your custom function classes, MANIFEST.MF,
and plug-in.xml. For example, you can use the
following command: Note: Run the jar executable from the Java Development Kit (JDK). If the commands shown do not find that executable, add the full path to the executable's location to the beginning of each command.
jar cvfm custom-function-plug-in_1.0.0.jar META-INF\MANIFEST.MF com plugin.xml
Note: You can choose any name for your JAR file, but you must follow a convention that prevents conflicting names. - Copy the new JAR file into the "Functions"
folder of your IBM Rational Integration Tester project.
After a plug-in is generated for your function (Create the plug-ins in Eclipse) and your function is implemented (Implementing the function class), you need to tell Rational Integration Tester about it.
When finished, follow the instructions to load the function into IBM Rational Integration Tester (see Configuring the function in Rational Integration Tester).
Note: An example of how the plug-in looks can be found under C:\Program Files\IBM\RationalIntegrationTester\examples\FunctionsSamplePlugin.
Feedback