To write a Java manipulator you use a collection of Java classes
from the CADK. Ensure that all Java manipulators that you write adhere to the
com.endeca.edf.adapter.Adapter
interface defined in the
CADK.
A typical Java manipulator works as follows:
It implements the
com.endeca.edf.adapter.Adapter
interface. This enables your Java manipulator to be understood by Forge.It imports the Java classes from the CADK. It also imports the
java.util.logging.Logger
from the JVM.It defines its own logging by using the JVM
Logger
class. Defining logging is optional, although it is recommended.It specifies zero or more pass throughs. The pass through mechanism lets you specify arbitrary, key-value configuration pairs in the pipeline using the Developer Studio, and use those pairs in the Java manipulator. For example, the name and value pairs that you specify may “represent” the record properties that will be changed with your Java manipulator method. The
AdapterConfig
class defines a list of methods that you can use to conveniently handle the pass throughs.You can make the manipulator issue an error if a property that you wanted specified was not specified, or you can assign the pass through some default value.
It takes inputs from one or more pipeline components, such as record adapters or other pipeline components. You can use the
getRecord
andgetNumInputs
methods on theAdapterHandler
class for this task. For example, thegetNumInputs
method returns the number of record inputs that are used by the Java manipulator.Next, the code defines a loop within which your Java code for cleaning or changing the records runs.
Once you are done changing or cleaning each record, use the
emit
method of theAdapterHandler
class to send the records to the next step in the pipeline (by passing the records to theAdapterExecute
class).