You create a manipulator by extending the
Manipulator
abstract class and other supporting classes.
A
Manipulator
requires an
@CasManipulator
annotation. The annotation has several
important attributes you can configure:
supportsIncrementals
. Required. A Boolean value that indicates whether the manipulator supports input from an incremental acquisition. If one manipulator in an incremental acquisition has this set tofalse
, the incremental acquisition runs in full mode.deleteRecordsBypassManipulator
. Required. A Boolean value that indicates whether to send deleted input records directly to the manipulator's output channel or to send deleted input records into the manipulator. A value oftrue
sends records to the output channel (by passing the manipulator). A value offalse
sends records into the manipulator.displayName
. Optional. The name of a manipulator as returned from thelistModules
task of the CAS Server Command-line Utility.description
. Optional. The description of a what the manipulator does to Endeca records that it processes. The description is returned from thelistModules
task of the CAS Server Command-line Utility, and the description displays in the Add Manipulator dialog of CAS Console.id
. Optional. If unspecified, the extension defaults to using the fully qualified class name as itsid
.
The
listModules
task of the CAS Server Command-line
Utility and the
listModules()
call of the CAS Server API both return
the attribute values you specify in the
@CasManipulator
annotations.
To create a manipulator extension:
Create a Java project in your development environment of your choice.
If you are creating several extensions in one plug-in, you can use the same Java project for each extension.
Add the CAS Extension API libraries to your compile classpath. These include all the libraries available in
CAS\
.version
\lib\cas-extension-apiCreate a subclass of
Manipulator
and specify thePipelineComponentConfiguration
subclass that the extension uses.For example:
public class SubstringManipulator extends Manipulator<SubstringManipulatorConfig>{ }
Add a
@CasManipulator
annotation to theManipulator
class and any attributes as described above.For example:
@CasManipulator( supportsIncrementals=true, deleteRecordsBypassManipulator = true, displayName="Substring Manipulator", description="Generates a new property that is a substring of another property value") public class SubstringManipulator extends Manipulator<SubstringManipulatorConfig>
Implement the
getConfigurationClass()
method to return the appropriatePipelineComponentConfiguration
subclass.For example:
public Class<SubstringManipulatorConfig> getConfigurationClass() { return SubstringManipulatorConfig.class; }
Implement the
createManipulatorRuntime()
method to create an implementation of theManipulatorRuntime
class.For example:
public ManipulatorRuntime createManipulatorRuntime( SubstringManipulatorConfig configuration, PipelineComponentRuntimeContext context) { return new SubstringManipulatorRuntime(context, configuration); }
Implement the
getRuntimeClass()
method to return the runtime class the manipulator creates.For example:
public Class<SubstringManipulatorRuntime> getRuntimeClass() { return SubstringManipulatorRuntime.class; }
Optionally, override the
deleteInstance()
method. CAS Server callsdeleteInstance()
when it removes an extension from an acquisition. In this method, you can perform any clean up that is necessary when CAS Server callsdeleteInstance()
to remove the extension from an acquisition. The default implementation ofdeleteInstance()
is empty.
Example 4. Example of a manipulator extension
To see many of the steps above, refer to the sample manipulator
extension in
<install
path>\CAS\
.
version
\sample\cas-extensions\src\main\com\endeca\cas\extension
\sample\manipulator\substring\SubstringManipulator.java