Class BaseCommitterConfig

java.lang.Object
com.norconex.committer.core.BaseCommitterConfig
Direct Known Subclasses:
BaseBatchCommitterConfig, BaseFsCommitterConfig, LogCommitterConfig, MemoryCommitterConfig

public class BaseCommitterConfig extends Object

A base implementation taking care of basic plumbing for field mappings and restrictions for filtering unwanted requests.

Restricting committer to specific documents

Optionally apply a committer only to certain type of documents. Documents are restricted based on their metadata field names and values. This option can be used to perform document routing when you have multiple Committers defined.

Field mappings

By default, this abstract class applies field mappings for metadata fields, but leaves the document reference and content (input stream) for concrete implementations to handle. In other words, they only apply to a committer request metadata. Field mappings are performed on committer requests before upserts and deletes are actually performed.

  • Constructor Details

    • BaseCommitterConfig

      public BaseCommitterConfig()
  • Method Details

    • addRestriction

      public BaseCommitterConfig addRestriction(PropertyMatcher restriction)
      Adds one restriction this committer should be restricted to.
      Parameters:
      restriction - the restriction
      Returns:
      this
    • addRestrictions

      public BaseCommitterConfig addRestrictions(List<PropertyMatcher> restrictions)
      Adds restrictions this committer should be restricted to.
      Parameters:
      restrictions - the restrictions
      Returns:
      this
    • removeRestriction

      public int removeRestriction(String field)
      Removes all restrictions on a given field.
      Parameters:
      field - the field to remove restrictions on
      Returns:
      how many elements were removed
    • removeRestriction

      public boolean removeRestriction(PropertyMatcher restriction)
      Removes a restriction.
      Parameters:
      restriction - the restriction to remove
      Returns:
      true if this committer contained the restriction
    • clearRestrictions

      public void clearRestrictions()
      Clears all restrictions.
    • getRestrictions

      public PropertyMatchers getRestrictions()
      Gets all restrictions
      Returns:
      the restrictions
    • getFieldMappings

      public Map<String,String> getFieldMappings()
      Gets an unmodifiable copy of the metadata mappings.
      Returns:
      metadata mappings
    • setFieldMapping

      public BaseCommitterConfig setFieldMapping(String fromField, String toField)
      Sets a metadata field mapping.
      Parameters:
      fromField - source field
      toField - target field
      Returns:
      this
    • setFieldMappings

      public BaseCommitterConfig setFieldMappings(Map<String,String> mappings)
      Sets a metadata field mappings, where the key is the source field and the value is the target field.
      Parameters:
      mappings - metadata field mappings
      Returns:
      this
    • removeFieldMapping

      public String removeFieldMapping(String fromField)
    • clearFieldMappings

      public void clearFieldMappings()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object