Skip to main content
Jump to: navigation, search

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

(What is Record Filter)
Line 1: Line 1:
bundle: org.eclipse.eilf.datamodel.tools
+
== What is Record Filter ==
class: org.eclipse.eilf.datamodel.tools.record.filter.RecordFilterHelper
+
used in: org.eclipse.eilf.blackboard
+
  
Ordinary, Record contains many attributes and annotations but only a few of them are used.  To increase productivity, decrease information sent (by SCA) or 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.  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 sent (by SCA) or 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.
 
+
Utility class:  org.eclipse.eilf.datamodel.tools.record.filter.RecordFilterHelper) 
+
Configuration schema: org.eclipse.eilf.datamodel.tools/schemas/RecordFilters.xsd 
+
 
+
One Record Filter instance is preloaded by Blackboard service (org.eclipse.eilf.blackboard).  Its possible to get filtered Record from Blackboard.
+
  
 
== Configuration ==
 
== Configuration ==
 +
Schema: org.eclipse.eilf.datamodel.tools/schemas/RecordFilters.xsd 
  
By default, Blackboard uses record filter configuration file RecordFilters.xml
+
Configuration is a list of filters (tag Filter) identified by attribute "name". Every filter specified copy rules for Attributes/Annotations.
  
Schema: RecordFilters.xsd (see in schemas/ directory of bundle)
+
== Configuration Example ==
 
+
There are series of filters (tag Filter)
+
Record filter will search first appropriate Filter by name specified. If there is no filter found, RecordFilterNotFoundException will be thrown. Attribute/Annotation will be copied if correspondent, by name, Attribute/Annotation tag will be found in Filter. Attribute "keepAnnotations" is a flag to copy internal attribute annotations.
+
 
+
== Example ==
+
  
 
<source lang="xml">
 
<source lang="xml">
Line 39: Line 28:
 
   </Filter>
 
   </Filter>
 
</RecordFilters>
 
</RecordFilters>
 +
</source>
 +
 +
== Sample Usage ==
 +
Utility class org.eclipse.eilf.datamodel.tools.record.filter.RecordFilterHelper
 +
 +
<source lang="java">
 +
RecordFilterHelper recordFilterHelper = new RecordFilterHelper(configStream);
 +
Record newRecord = recordFilterHelper.filter(record, "only-attributes");
 +
</source>
 +
 +
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 will be found in Filter. 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.eilf.blackboard). 
 +
It loads Record Filer configuration from "configuration/org.eclipse.eilf.blackboard/RecordFilters.xml" file and shares following interface methods related to record filtering.
 +
 +
<source lang="java">
 +
public interface BlackboardService {
 +
...
 +
public Record getRecord(final Id id, final String filterName) throws BlackboardAccessException,RecordFilterNotFoundException;
 +
public Record filterRecord(final Record record, final String filterName) throws RecordFilterNotFoundException;
 
</source>
 
</source>
  
 
[[Category:SMILA]]
 
[[Category:SMILA]]

Revision as of 07:34, 20 August 2008

What is Record Filter

Ordinary, Record contains many attributes and annotations but only a few of them are used. To increase productivity, decrease information sent (by SCA) or 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.

Configuration

Schema: org.eclipse.eilf.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.eilf.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 will be found in Filter. 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.eilf.blackboard). It loads Record Filer configuration from "configuration/org.eclipse.eilf.blackboard/RecordFilters.xml" file and shares following interface methods related to record filtering.

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

Back to the top