You can create a java classifier. Java classifier can be used to classify data by writing custom logic in Java classes to classify a set of data.
You must have the write permissions on the ASBServer/lib and ASBNode/lib/java folders.
All java based classifiers have to implement ValueBasedClassifier interface by overriding public boolean matchValue(Object value). When a classifier is deployed by overriding the public boolean matchValue(Object value) of the ValueBasedClassifier interface, you should compare the implementation with the actual value. For example, if you want to classify all the values which is between 600000000 and 999999999, you must verify if the value lies between the specified numbers. If the value is between the specified numbers, then it is classified as true and otherwise as false. When the value is true, it is classified with the name you provided in the xml definition.
package my.test.classifier;
import com.ibm.infosphere.ia.classification.ValueBasedClassifier;
public class MyCustom implements ValueBasedClassifier {
public boolean matchValue(Object value) {
// if the value is a number, it matches the class if it is in the expected range
if (value instanceof Number) {
int intValue = ((Number)value).intValue();
return intValue>600000000 && intValue<999999999;
}
// if the value is not a number, it cannot match the class
else {
return false;
}
}
}
XML definition for the above classifier:
<?xml version="1.0" encoding="UTF-8"?>
<tns:DataClasses
xmlns:tns="http://www.ibm.com/infosphere/ia/classification/DataclassesDefinition"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/infosphere/ia/classification
/DataclassesDefinition/../../../model/DataClassesDefinition.xsd ">
<tns:DataClass id="customID" name="CustomName"
description="Custom description" example="999999999">
<tns:JavaClassifier
className="my.test.classifier.MyCustom" />
<tns:DataTypeFilter>
<tns:LogicalDataType>numeric</tns:LogicalDataType>
</tns:DataTypeFilter>
</tns:DataClass>
</tns:DataClasses>
After the two files are created bundle them again into a jar with the required name. The main jar file is a bundle of Customjar and xml file. At the time of deployment pass the Mainjar as the parameter.
IAAdmin -user user_name -password password -url https://host:port -deployDataClasses <path of the Mainjar file>
Install
the java classes related to the new JAVA classifier using the following
command on engine and server tiers. IAAdmin -installClassifiers <path of the Mainjar file>