org.embl.ebi.escience.scuflui.spi
Interface FacetFinderSPI

All Known Implementing Classes:
PropertyFetcher, RegexScanner, Self, ToString

public interface FacetFinderSPI

SPI for decomposing opaque data into facets.

Each jar providing implementations of this SPI should list them in META-INF/services/org.embl.ebi.escience.scuflui.facets.FacetFinderSPI. If a particular SPI needs extra information, it should be in a resource in the same location as the .class file, and prefixed by the local class name, so that it could be retrieved as:

 getClass().getClassLoader().getResourceAsStream(
     getClass().getName().replace('.', '/') + postFix );
 
or alternatively
 getClass().getResourceAsStream(getClass().getName().substring(
     getClass().getPackage().toString() + 1) + postFix );
 

Author:
Matthew Pocock

Nested Class Summary
static interface FacetFinderSPI.ColumnID
           
 
Method Summary
 boolean canMakeFacets(DataThing dataThing)
          Indicate if this facet finder can decompose this DataThing.
 DataThing getFacet(DataThing dataThing, FacetFinderSPI.ColumnID colID)
          Get the value associated with a particular column of a data object.
 java.lang.String getName()
          Get a human readable name for this facetiser.
 java.util.Set getStandardColumns(DataThing dataThing)
          Get a Set of columns this facet finder can use on any data.
 boolean hasColumn(FacetFinderSPI.ColumnID colID)
          Indicate if this facet finder can return data for this column.
 FacetFinderSPI.ColumnID newColumn(DataThing dataThing)
          Get a new, independant column for a data item.
 

Method Detail

canMakeFacets

boolean canMakeFacets(DataThing dataThing)
Indicate if this facet finder can decompose this DataThing.

Parameters:
dataThing - the object to decompose
Returns:
true if it can, false otherwise

getStandardColumns

java.util.Set getStandardColumns(DataThing dataThing)
Get a Set of columns this facet finder can use on any data. The returned Set should be immutable, and should not change. Users of this API should make a copy of this if they want to edit it. Calling mutators on the column ID should not affect the columns returned by previous or future invocations.

Parameters:
dataThing - the dataThing to get standard columns for, or null if default columns should be returned
Returns:
a Set (never null) containing the standard columns

newColumn

FacetFinderSPI.ColumnID newColumn(DataThing dataThing)
Get a new, independant column for a data item. Call this method to get a column ID that can then be customised.

Parameters:
dataThing - the data item to work with
Returns:
a new column ID

hasColumn

boolean hasColumn(FacetFinderSPI.ColumnID colID)
Indicate if this facet finder can return data for this column.

Parameters:
colID - the ColumnID identifying the column
Returns:
true if the colID is known by this facet finder, false otherwise

getFacet

DataThing getFacet(DataThing dataThing,
                   FacetFinderSPI.ColumnID colID)
Get the value associated with a particular column of a data object.

Parameters:
dataThing - the object to decompose
colID - the column identifier
Returns:
a DataThing holding the value of that facet, or null if that column ID could not be fetched for dataThing

getName

java.lang.String getName()
Get a human readable name for this facetiser.

Returns:
the name