I am having troubles with v4 and adding function libraries.
I have made my java file with all the appropriate functions and implementations and created a jarfile with FATJar (test.jar). I have modified setenv and setenvClient (%AWARE_HOME%\test.jar;) and BASServer.props (FunctionLibraryTestJAR=test.TestJAR) and I always get unsupported function.
The question I have is what might I be doing wrong?
It appears that awareIM is still unable to recognize my custom library.
The java file looks like this..
package test;
import java.util.Collection;
import org.openadaptor.util.DateTimeHolder;
import com.bas.shared.data.FunctionDescription;
import com.bas.shared.functions.IFunctionLibrary;
import com.bas.shared.ruleparser.INodeHelper;
import com.bas.shared.ruleparser.ISQLBuilderHelper;
public class TestJAR implements IFunctionLibrary
{
/*
* Default constructor, no global variables or settings to worry about
*/
public TestJAR()
{
}
/*
* Calculate is the name of an expected method by AwareIM
* This method declaration may not be changed
*/
public Object calculate(String arg0, Object[] arg1, INodeHelper arg2)
{
/*
* Prints incoming arguments to screen, this is a good
* way to check values moving to and from AwareIM
*/
for(int i = 0; i < arg1.length; i++)
{
System.out.println(arg1.toString());
}
try
{
if(arg0.compareTo("loi") == 0)
{
if(arg1.length != 1)
{
return("-1");
}
return ("loi was here");
}
else
{
return("-2");
}
}
/* Print out caught exception types with errors */
catch (Exception e)
{
System.out.println(e);
}
return ("-2");
}
/*
* EXTRA CODE
* The following is used for integrating into the wrapper class.
* */
public FunctionDescription[] getAvailableFunctions()
{
FunctionDescription [] description = new FunctionDescription[14];
description[0] = new FunctionDescription("loi",
"Get Test." +
"\nParameters:\n- Test Token" +
"\nReturns: String");
return description;
}
public String getName()
{
return("TestJAR");
}
public Class getTypeClass(String arg0, Collection arg1)
{
if(arg0.compareTo("loi") == 0)
{
return(DateTimeHolder.class);
}
else
{
return(String.class);
}
}
public boolean hasFunction(String arg0, int arg1)
{
if(arg0.compareTo("loi") == 0)
{
return(true);
}
else
{
return(false);
}
}
public String toSQL(String arg0, Collection arg1, ISQLBuilderHelper arg2)
{
return null;
}
}
=======================================
and the console spits out this ...
2008-10-28 12:15:27,656 EmailTest#admin -23 Starting execution of rules when creating business object TestLoi 20
2008-10-28 12:15:27,656 EmailTest#admin -29 Started evaluation of rules
2008-10-28 12:15:27,656 EmailTest#admin -22 Evaluating rule 'newtestloi' If TestLoi IS NEW Then TestLoi.Token = loi(AS_STRING('loi'))
2008-10-28 12:15:27,656 EmailTest#admin -6 Evaluating condition TestLoi IS NEW
2008-10-28 12:15:27,671 EmailTest#admin -8 Condition evaluated to true: null=<UNDEFINED>
2008-10-28 12:15:27,671 EmailTest#admin -2 Adding action TestLoi.Token=loi(AS_STRING('loi')) to the agenda
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished rule evaluation
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished evaluation of rules
2008-10-28 12:15:27,671 EmailTest#admin -15 Executing action TestLoi.Token=loi(AS_STRING('loi')) from rules of object TestLoi
2008-10-28 12:15:27,671 EmailTest#admin -Exception while calculating the action TestLoi.Token=loi(AS_STRING('loi'))
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished executing action TestLoi.Token=loi(AS_STRING('loi')) from rules of object TestLoi
2008-10-28 12:15:27,671 EmailTest#admin -25 Started evaluation of rules after data has been changed by the actions
2008-10-28 12:15:27,671 EmailTest#admin -6 Checking rule newtestloi
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished evaluation of rules after data has been changed by the actions
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished execution of rules when creating business object TestLoi 20
2008-10-28 12:15:27,671 EmailTest#admin -17
2008-10-28 12:15:27,671 EmailTest#admin -17
2008-10-28 12:15:27,671 ERROR EmailTest#admin -Execution Exception after starting system process message Operation error. com.bas.shared.ruleparser.ParseException Unsupported function loi
2008-10-28 12:15:27,671 EmailTest#admin -16 Finished creating business object TestLoi
2008-10-28 12:15:27,671 EmailTest#admin -17
2008-10-28 12:15:27,671 EmailTest#admin -17
Adding Function Libraries
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
The only reason for this is that you made a mistake in the setEnv.bat file or misplaced the jar. The way you described it the jar must be in the AwareIM/Tomcat/shared/lib directory (%AWARE_HOME). Is it there?
Another reason is you could forget to include ";" delimiter in the setEnv.bat.
The bottom line is: Aware IM does not pick up your jar either because it cannot find the file or because its specification in the setEnv.bat is wrong.
Custom functions are working fine in Aware IM - we are sure of that.
Another reason is you could forget to include ";" delimiter in the setEnv.bat.
The bottom line is: Aware IM does not pick up your jar either because it cannot find the file or because its specification in the setEnv.bat is wrong.
Custom functions are working fine in Aware IM - we are sure of that.
Aware IM Support Team
sorry. I didn't mean to imply that v4 was not working properly. I am just puzzled why my Jar isn't being recognized. Is there a Jar builder that you recommend?
I have checked the delimiters in setEnv and setEnvClient.
For BASServer.props is the line supposed to read
FuntionLibrary+[value returned from getName()]=[package name].[class name] ?
I have checked the delimiters in setEnv and setEnvClient.
For BASServer.props is the line supposed to read
FuntionLibrary+[value returned from getName()]=[package name].[class name] ?
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
I have never worked with FATJar and don't know what its doing - just use jar utility from Java Development Kit that comes with Aware IM. This is guaranteed to be compatible. Also make sure that you maintain the package structure within the jar file, otherwise your class will not be found.
Aware IM Support Team