Knopflerfish OSGi 5.2.0

org.osgi.service.indexer
Interface ResourceAnalyzer


public interface ResourceAnalyzer

A resource analyzer is responsible for analyzing a resource for some specific purpose, and discovering requirements and capabilities that may not be discovered by the basic Bundle Analyzer.

Clients may implement this interface and register instances as services.

Author:
Neil Bartlett

Field Summary
static java.lang.String FILTER
          The service property used to declare a resource filter, so that the analyzer is only invoked on a subset of resources.
 
Method Summary
 void analyzeResource(Resource resource, java.util.List<Capability> capabilities, java.util.List<Requirement> requirements)
           This method is invoked for each resource that the analyzer is requested to analyze.
 

Field Detail

FILTER

static final java.lang.String FILTER
The service property used to declare a resource filter, so that the analyzer is only invoked on a subset of resources. Example: (&(|(name=foo.jar)(name=*.ear))(lastmodified>=1262217600753))

See Also:
Constant Field Values
Method Detail

analyzeResource

void analyzeResource(Resource resource,
                     java.util.List<Capability> capabilities,
                     java.util.List<Requirement> requirements)
                     throws java.lang.Exception

This method is invoked for each resource that the analyzer is requested to analyze. Implementations add zero or more capabilities and/or requirements to the supplied lists.

Analyzers may examine the lists of already-discovered requirements and capabilities; for example they may wish to add a certain capability if (and only if) it has not already been added.

However, analyzers should not rely on being invoked in any particular order, i.e. either before or after any other analyzer.

Analyzers MUST NOT attempt to remove or replace any capability or requirement from the supplied list. Clients of this method may enforce this by passing List implementations that throw UnsupportedOperationException upon any attempt to call List.remove(int), etc.

Parameters:
resource - The current resource.
capabilities - The list of capabilities.
requirements - The list of requirements.
Throws:
java.lang.Exception - If something goes wrong. The error will be logged to the OSGi Log Service (if available) and the next ResourceAnalyzer (if any) will be asked to analyze the resource.

Knopflerfish OSGi 5.2.0