SMILA (incubation) API documentation

org.eclipse.smila.search.highlighting.internal
Class HighlightingServiceImpl

java.lang.Object
  extended by org.eclipse.smila.search.highlighting.internal.HighlightingServiceImpl
All Implemented Interfaces:
HighlightingService

public class HighlightingServiceImpl
extends java.lang.Object
implements HighlightingService

default implementation of the HighlightingService.

Author:
scum36

Field Summary
static java.lang.String HIGHLIGHTING_TRANSFORMER_REFERENCE
          name of OSGi service reference to highlightingTransformer.
static java.lang.String PROPERTY_HIGHLIGHTING_TRANSFORMER_TYPE
          Constant for the OSGi property smila.highlighting.transformer.type.
 
Fields inherited from interface org.eclipse.smila.search.highlighting.HighlightingService
HIGHLIGHTING_PARAMETER_NAME, HIGHLIGHTING_TRANSFORMERS
 
Constructor Summary
HighlightingServiceImpl()
           
 
Method Summary
protected  void activate(ComponentContext context)
          DS activate method.
protected  void deactivate(ComponentContext context)
          DS deactivate method.
 java.util.Map<java.lang.String,DHighlightingTransformer> getTransformerConfigs(QueryParameterAccessor parameters)
          Checks if the query contains any Highlight annotations on attributes and converts them into DHighlightingTransformer configuration objects.
 void highlight(AnyMap resultRecord, java.util.Map<java.lang.String,DHighlightingTransformer> highlightConfigs)
          Executes highlighting for the record with the given Id using the given highlightConfigs.
protected  void setHighlightingTransformer(ServiceReference serviceReference)
          add a highlighting transformer as an OSGi service reference.
protected  void unsetHighlightingTransformer(ServiceReference serviceReference)
          remove a highlighting transformer service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIGHLIGHTING_TRANSFORMER_REFERENCE

public static final java.lang.String HIGHLIGHTING_TRANSFORMER_REFERENCE
name of OSGi service reference to highlightingTransformer.

See Also:
Constant Field Values

PROPERTY_HIGHLIGHTING_TRANSFORMER_TYPE

public static final java.lang.String PROPERTY_HIGHLIGHTING_TRANSFORMER_TYPE
Constant for the OSGi property smila.highlighting.transformer.type.

See Also:
Constant Field Values
Constructor Detail

HighlightingServiceImpl

public HighlightingServiceImpl()
Method Detail

activate

protected void activate(ComponentContext context)
                 throws java.lang.Exception
DS activate method.

Parameters:
context - ComponentContext
Throws:
java.lang.Exception - if any error occurs

deactivate

protected void deactivate(ComponentContext context)
                   throws java.lang.Exception
DS deactivate method.

Parameters:
context - the ComponentContext
Throws:
java.lang.Exception - if any error occurs

setHighlightingTransformer

protected void setHighlightingTransformer(ServiceReference serviceReference)
add a highlighting transformer as an OSGi service reference. To be used by Declarative Services as the bind method.

Parameters:
serviceReference - service reference to add.

unsetHighlightingTransformer

protected void unsetHighlightingTransformer(ServiceReference serviceReference)
remove a highlighting transformer service. To be used by Declarative Services as the unbind method.

Parameters:
serviceReference - service reference to remove.

getTransformerConfigs

public java.util.Map<java.lang.String,DHighlightingTransformer> getTransformerConfigs(QueryParameterAccessor parameters)
                                                                               throws BlackboardAccessException
Checks if the query contains any Highlight annotations on attributes and converts them into DHighlightingTransformer configuration objects.

Specified by:
getTransformerConfigs in interface HighlightingService
Parameters:
parameters - query parameters
Returns:
a Map of attribute names to DHighlightingTransformer configurations
Throws:
BlackboardAccessException - if any record access error occurs

highlight

public void highlight(AnyMap resultRecord,
                      java.util.Map<java.lang.String,DHighlightingTransformer> highlightConfigs)
               throws BlackboardAccessException,
                      HighlightingTransformerException,
                      ParameterException
Executes highlighting for the record with the given Id using the given highlightConfigs.

Specified by:
highlight in interface HighlightingService
Parameters:
resultRecord - a search result record to highlight.
highlightConfigs - the highlightConfigs
Throws:
BlackboardAccessException - if any record access error occurs
HighlightingTransformerException - if any highlight transformation error occurs
ParameterException - if any highlight configuration error occurs

SMILA (incubation) API documentation