on 08-15-2017 2:44 PM
I have spent a while this morning trying to find the solution. We have a set of standard UDF stored in a PI function library. This is not an imported archive but a FL in PI. This function library is called:
FL_System (package name: com.server.xi.FUNCTION_LIBRARY)
I am building a new Function Library for this customer process build (the UDFs here would only ever be used by this customer). I need to call back to the FL_System function library but no matter what I try - I keep getting:
error: package com.server.xi.FUNCTION_LIBRARY does not exist.
These are FL objects in PI. They are compiled and active.
Yes - I have added the package.class to the Import Instructions for the new Function Library but that does not help.
How do you call a UDF that exists in FL A from a UDF that exists in FL B?
Hi Brian,
Just tried this and look like there is no way to call on FL from another FL.
I would suggest you to export the FL_A compile it, import it back as imported Archive and then use this imported archive in your FL_B.
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thought as much.
I was already working on a solution similar to what you suggested. The function library is used by a lot of message maps and java maps. There is no way to change them all to use a IA instead of the Function Library.
So instead, I am making a wrapper class. This class will have all the same functions as the FL, but code will be just a call to the FL. As an example:
public String getSystemEnvironment(Container container) {
FL_System fl = new FL_System(); // name of the function library
return fl.getSystemEnvironment (container);
}
I hope this explains my approach and thank you for your help.
So lets say you have your UDFs in FL_A and you want to call them from FL_B. Let us also assume you have 2 UDFs in FL_A that you want to create a "wrapper" for:
udf_1
udf_2
First, make a compiled version of FL_A in java (this is temporary but necessary).
Second, create a java class that like the following:
package myPackage;
// Any Package name you want can be used here
import FL_A; // The compiled version, this is only for the java compiler and only for this purpose
public class IA_A {
// We use IA for imported Archive, FL for Function Library. You can use any names you want.
protected FL_A fl; // create a reference to the function library
public IA_A {
// instantiate the "class" for the FL_A so you can call the functions directly.
fl = new FL_A();
}
// wrapper classes
public <return value> udf_1 (parameters) throws StreamTransformationException {
return fl.udf_1 (parameters);
}
public <return value> udf_2 (parameters) throws StreamTransformationException {
return fl.udf_2 (parameters);
}
}
Third, Import this class into PI.
Fourth, on the FL_B - add the Import instructions and Archives used
Last, in the UDF that you want to call udf_1, now you do the following:
IA_A ia = new IA_A();
ia.udf_1 (parameters);
This will call the IA which in turn will just call the original Function Library.
I hope this helps clarify what I meant by wrapper class.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.