org.compass.core.mapping
Class AbstractResourceMapping

java.lang.Object
  extended by org.compass.core.mapping.AbstractMapping
      extended by org.compass.core.mapping.AbstractMultipleMapping
          extended by org.compass.core.mapping.AbstractResourceMapping
All Implemented Interfaces:
AliasMapping, Mapping, MultipleMapping, PostProcessingMapping, ResourceMapping
Direct Known Subclasses:
ClassMapping, NullResourceMapping, RawResourceMapping

public abstract class AbstractResourceMapping
extends AbstractMultipleMapping
implements ResourceMapping, AliasMapping, PostProcessingMapping

Author:
kimchy

Field Summary
 
Fields inherited from class org.compass.core.mapping.AbstractMultipleMapping
mappings, mappingsMap
 
Constructor Summary
AbstractResourceMapping()
           
 
Method Summary
 int addMapping(Mapping mapping)
          No duplicate names are allowed when added an id (applies the property names)
protected  void copy(AbstractResourceMapping resourceMapping)
           
protected abstract  void doPostProcess()
           
 String getAlias()
          The alias of the Resource.
 String getAllAnalyzer()
          Returns the analyzer name that is associated with the all property.
 String getAllProperty()
          Returns the name of the all property for the given resoruce.
 Property.TermVector getAllTermVector()
          Returns the term vector configuration for the given all proeprty.
 String getAnalyzer()
          Returns the analyzer name that need to be used with the resouce.
 ResourceAnalyzerController getAnalyzerController()
          Returns the analzer controller that is associated with the Resource.
 float getBoost()
          Returns the boost of the given resource.
 String[] getExtendedMappings()
           
 ResourcePropertyMapping[] getIdMappings()
          Returns all the resource property mappings that acts as the id of the resource.
 ResourcePropertyMapping getResourcePropertyMapping(String propertyName)
          Returns the first resource property mapping that match the given proeprty name (Mapping.getName(), or null if not exists.
 ResourcePropertyMapping getResourcePropertyMappingByPath(String path)
          Returns the ResourcePropertyMapping that match the given path (Mapping.getPath(), or null of not exists.
 ResourcePropertyMapping[] getResourcePropertyMappings(String propertyName)
          Returns the list of resource property mappings that match the given proeprty name (Mapping.getName(), or null if not exists.
 String[] getResourcePropertyNames()
          Returns all the mapped property names for the resoruce.
 String getSubIndex()
          The sub index that the Resource will be saved to in the search engine.
 boolean hasSpecificAnalyzerPerResourceProperty()
          Returns true if the resource proeprty mapping of the resource have a specific analyzer set.
 boolean isAllSupported()
          Returns true if the "all" property will be created for the resource.
 boolean isRoot()
          Returns true if it is a root resource mapping.
 void postProcess()
          Perform the post processing of the mapping, after it's internal data has been set.
 void setAlias(String alias)
           
 void setAllAnalyzer(String allAnalyzer)
           
 void setAllProperty(String allProperty)
           
 void setAllSupported(boolean isAllSupported)
           
 void setAllTermVector(Property.TermVector allTermVector)
           
 void setAnalyzer(String analyzer)
           
 void setAnalyzerController(ResourceAnalyzerController analyzerController)
           
 void setBoost(float boost)
           
 void setExtendedMappings(String[] extendedMappings)
           
 void setRoot(boolean isRoot)
           
 void setSubIndex(String subIndex)
           
 void shallowCopy(AbstractResourceMapping resourceMapping)
           
 
Methods inherited from class org.compass.core.mapping.AbstractMultipleMapping
clearMappings, copy, getMapping, getMapping, mappingsIt, mappingsSize, removeExistingByName, removeExistingByPath, shallowCopy
 
Methods inherited from class org.compass.core.mapping.AbstractMapping
controlsObjectNullability, copy, getConverter, getConverterName, getName, getPath, setConverter, setConverterName, setName, setPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.mapping.ResourceMapping
getResourcePropertyMappingByDotPath, getResourcePropertyMappings, isIncludePropertiesWithNoMappingsInAll
 
Methods inherited from interface org.compass.core.mapping.AliasMapping
shallowCopy
 
Methods inherited from interface org.compass.core.mapping.MultipleMapping
getMapping, getMapping, mappingsIt
 

Constructor Detail

AbstractResourceMapping

public AbstractResourceMapping()
Method Detail

getIdMappings

public ResourcePropertyMapping[] getIdMappings()
Description copied from interface: ResourceMapping
Returns all the resource property mappings that acts as the id of the resource. Used to load the resource or delete it.

Specified by:
getIdMappings in interface ResourceMapping

copy

protected void copy(AbstractResourceMapping resourceMapping)

shallowCopy

public void shallowCopy(AbstractResourceMapping resourceMapping)

postProcess

public void postProcess()
                 throws MappingException
Description copied from interface: PostProcessingMapping
Perform the post processing of the mapping, after it's internal data has been set.

Specified by:
postProcess in interface PostProcessingMapping
Throws:
MappingException

doPostProcess

protected abstract void doPostProcess()
                               throws MappingException
Throws:
MappingException

addMapping

public int addMapping(Mapping mapping)
No duplicate names are allowed when added an id (applies the property names)

Specified by:
addMapping in interface MultipleMapping
Overrides:
addMapping in class AbstractMultipleMapping
Parameters:
mapping - The mapping to add
Returns:
The location the mapping was added to.

getResourcePropertyMappings

public ResourcePropertyMapping[] getResourcePropertyMappings(String propertyName)
Description copied from interface: ResourceMapping
Returns the list of resource property mappings that match the given proeprty name (Mapping.getName(), or null if not exists.

Specified by:
getResourcePropertyMappings in interface ResourceMapping

getResourcePropertyMapping

public ResourcePropertyMapping getResourcePropertyMapping(String propertyName)
Description copied from interface: ResourceMapping
Returns the first resource property mapping that match the given proeprty name (Mapping.getName(), or null if not exists.

Specified by:
getResourcePropertyMapping in interface ResourceMapping

getResourcePropertyMappingByPath

public ResourcePropertyMapping getResourcePropertyMappingByPath(String path)
Description copied from interface: ResourceMapping
Returns the ResourcePropertyMapping that match the given path (Mapping.getPath(), or null of not exists.

Specified by:
getResourcePropertyMappingByPath in interface ResourceMapping

getAlias

public String getAlias()
Description copied from interface: ResourceMapping
The alias of the Resource.

Specified by:
getAlias in interface AliasMapping
Specified by:
getAlias in interface ResourceMapping

setAlias

public void setAlias(String alias)
Specified by:
setAlias in interface AliasMapping

getExtendedMappings

public String[] getExtendedMappings()
Specified by:
getExtendedMappings in interface AliasMapping

setExtendedMappings

public void setExtendedMappings(String[] extendedMappings)
Specified by:
setExtendedMappings in interface AliasMapping

getBoost

public float getBoost()
Description copied from interface: ResourceMapping
Returns the boost of the given resource.

Specified by:
getBoost in interface ResourceMapping

setBoost

public void setBoost(float boost)

getAnalyzer

public String getAnalyzer()
Description copied from interface: ResourceMapping
Returns the analyzer name that need to be used with the resouce. Can be null.

Specified by:
getAnalyzer in interface ResourceMapping

setAnalyzer

public void setAnalyzer(String analyzer)

isRoot

public boolean isRoot()
Description copied from interface: ResourceMapping
Returns true if it is a root resource mapping. If it is a root mapping, then it controlls the general Resource level settings like alias and sub-index. Usually, non-root resource mapping are mappings that are incorporated within another resoruce.

Specified by:
isRoot in interface ResourceMapping

setRoot

public void setRoot(boolean isRoot)

getAllProperty

public String getAllProperty()
Description copied from interface: ResourceMapping
Returns the name of the all property for the given resoruce.

Specified by:
getAllProperty in interface ResourceMapping

setAllProperty

public void setAllProperty(String allProperty)

isAllSupported

public boolean isAllSupported()
Description copied from interface: ResourceMapping
Returns true if the "all" property will be created for the resource. The all property is a special property that have all the other resource values in it to be searchable.

Specified by:
isAllSupported in interface ResourceMapping

setAllSupported

public void setAllSupported(boolean isAllSupported)

getSubIndex

public String getSubIndex()
Description copied from interface: ResourceMapping
The sub index that the Resource will be saved to in the search engine.

Specified by:
getSubIndex in interface ResourceMapping

setSubIndex

public void setSubIndex(String subIndex)

getAllTermVector

public Property.TermVector getAllTermVector()
Description copied from interface: ResourceMapping
Returns the term vector configuration for the given all proeprty.

Specified by:
getAllTermVector in interface ResourceMapping

setAllTermVector

public void setAllTermVector(Property.TermVector allTermVector)

hasSpecificAnalyzerPerResourceProperty

public boolean hasSpecificAnalyzerPerResourceProperty()
Description copied from interface: ResourceMapping
Returns true if the resource proeprty mapping of the resource have a specific analyzer set.

Specified by:
hasSpecificAnalyzerPerResourceProperty in interface ResourceMapping

getAllAnalyzer

public String getAllAnalyzer()
Description copied from interface: ResourceMapping
Returns the analyzer name that is associated with the all property. Can be null.

Specified by:
getAllAnalyzer in interface ResourceMapping

setAllAnalyzer

public void setAllAnalyzer(String allAnalyzer)

getAnalyzerController

public ResourceAnalyzerController getAnalyzerController()
Description copied from interface: ResourceMapping
Returns the analzer controller that is associated with the Resource. Can be null.

Specified by:
getAnalyzerController in interface ResourceMapping

setAnalyzerController

public void setAnalyzerController(ResourceAnalyzerController analyzerController)

getResourcePropertyNames

public String[] getResourcePropertyNames()
Description copied from interface: ResourceMapping
Returns all the mapped property names for the resoruce.

Specified by:
getResourcePropertyNames in interface ResourceMapping


Copyright (c) 2004-2006 The Compass Project.