Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/Record Filter"

(Blackboard Service Record Filter)
(What is Record Filter)
Line 2: Line 2:
  
 
Ordinary, Record contains many attributes and annotations but only a few of them are used.  To increase productivity, decrease information stored in JMS queue its better to strip unused data. Record filter is a tool  that  allows to create a copy of Record with only filtered Attributes and Annotations.  Configuration with filtering rules should be described as XML.
 
Ordinary, Record contains many attributes and annotations but only a few of them are used.  To increase productivity, decrease information stored in JMS queue its better to strip unused data. Record filter is a tool  that  allows to create a copy of Record with only filtered Attributes and Annotations.  Configuration with filtering rules should be described as XML.
 +
 +
 +
A Record Filter will always filter the attachments. If you dont want to cut the attachments off, you should not use a filter (dont use the RecordFilter Tag in the Router/Listener Configuration File)
  
 
== Configuration ==
 
== Configuration ==

Revision as of 11:13, 29 July 2009

What is Record Filter

Ordinary, Record contains many attributes and annotations but only a few of them are used. To increase productivity, decrease information stored in JMS queue its better to strip unused data. Record filter is a tool that allows to create a copy of Record with only filtered Attributes and Annotations. Configuration with filtering rules should be described as XML.


A Record Filter will always filter the attachments. If you dont want to cut the attachments off, you should not use a filter (dont use the RecordFilter Tag in the Router/Listener Configuration File)

Configuration

Schema: org.eclipse.smila.datamodel.tools/schemas/RecordFilters.xsd

Configuration is a list of filters (tag Filter) identified by attribute “name”. Every filter specified copy rules for Attributes/Annotations.

Configuration Example

<RecordFilters>
  <Filter name="only-attributes">
    <Attribute name="*"/>
  </Filter>
  <Filter name="no-filter">
    <Attribute name="*" keepAnnotations="true"/>
    <Annotation name="*"/>
  </Filter>
  <Filter name="nothing"/>
  <Filter name="only-attribute1">
    <Attribute name="attribute1"/>
  </Filter>
  <Filter name="filter-single-and-datetime">
    <Attribute name="single value"/>
    <Attribute name="datetime value"/>
  </Filter>
</RecordFilters>

Sample Usage

Utility class org.eclipse.smila.datamodel.tools.record.filter.RecordFilterHelper

RecordFilterHelper recordFilterHelper = new RecordFilterHelper(configStream);
Record newRecord = recordFilterHelper.filter(record, "only-attributes");

Record filter will search first appropriate Filter by name ("only-attributes") specified. If filter not found, then RecordFilterNotFoundException will be thrown.

Attribute/Annotation will be copied if correspondent, by name, Attribute/Annotation tag Filter will be found. Attribute "keepAnnotations" is a flag to copy internal attribute annotations or not.

Blackboard Service Record Filter

One Record Filter instance is preloaded by Blackboard service (org.eclipse.smila.blackboard). It loads Record Filer configuration from “configuration/org.eclipse.smila.blackboard/RecordFilters.xml” file and shares following interface methods related to record filtering.

public interface Blackboard {
...
public Record getRecord(final Id id, final String filterName) throws BlackboardAccessException,RecordFilterNotFoundException;
public Record filterRecord(final Record record, final String filterName) throws RecordFilterNotFoundException;
}

Copyright © Eclipse Foundation, Inc. All Rights Reserved.