A manipulator requires a
PipelineComponentConfiguration class to describe the
extension's configuration, to validate the manipulator's configuration, and to
determine whether a full acquisition is required by the manipulator.
To create a manipulator configuration class:
In the Java project that contains the
Manipulatorimplementation, create a subclass ofPipelineComponentConfiguration.For example:
public class SubstringManipulatorConfig extends PipelineComponentConfiguration<SubstringManipulatorConfig> { }Add each field that you want available as a configuration property in the manipulator.
For example:
private String mSourceProperty; private String mTargetProperty; private int mStartIndex;
Add an annotation to each field. The annotation type must match the field's data type. See package
com.endeca.cas.extension.annotationin the CAS Extension API Reference (Javadoc) to determine which annotations have required attributes and to determine which attributes are appropriate for the field.For example:
@StringProperty(isRequired=true, name="sourceProperty", displayName="Source Property") private String mSourceProperty; @StringProperty(isRequired=true, name="targetProperty", displayName="Target Property") private String mTargetProperty; @IntegerProperty(isRequired=false, name="startIndex", displayName="Substring Start Index", description="Substring start index (zero based)", defaultValue="0") private int mStartIndex;
If you want to order fields within a single group, add a
@ConfigurationGroupOrderannotation to thePipelineComponentConfigurationclass and then add a nested@ConfigurationGroupannotation.For example, here is one group of fields that display in order —
sourceProperty,targetProperty,lengthandstartIndex:@ConfigurationGroupOrder({ @ConfigurationGroup(propertyOrder={"sourceProperty", "targetProperty", "length", "startIndex"}) }) public class SubstringManipulatorConfig extends PipelineComponentConfiguration<SubstringManipulatorConfig> { }If you want to order multiple groups of user-interface fields on a tab, add additional
@ConfigurationGroupannotations within@ConfigurationGroupOrderfor each group of user-interface fields that you want ordered.Optionally, override the default implementation of
isFullAcquisitionRequired(). The default implementation determines whether a configuration change should force full acquisition the next time an acquisition is run by comparing the oldPipelineComponentConfigurationand the newPipelineComponentConfigurationusing theequals()method. The default implementation of theequals()method uses reflection to compare all non-transient fields for equality.You can write code that checks a specific property to determine if a full acquisition is required (rather than check the entire
PipelineComponentConfiguration). If you want to force a full acquisition, write code that always returnstrue.Optionally, override the default implementation of
validate(). CAS Server performs data type and constraint validation (constraints may include minValue and maxValue for integer properties). Any code you write invalidate()performs additional custom validation.If validation fails, the
PipelineComponentConfiguration.validate()method returns a collectionValidationFailureobjects.If it is necessary for unit testing or the implementation of the manipulator runtime, you may also need to write getter and setter methods for each field that you added.
Example 5. Example of a pipeline component configuration for a manipulator
To see many of the steps above, refer to the sample data source
extension in
<install
path>\CAS\.
version\sample\cas-extensions\src\main\com\endeca\cas\extension\sample\
source\csv\SubstringManipulatorConfig.java
Related links

