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, XmlObjectMapping

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

Author:
kimchy

Field Summary
 
Fields inherited from class org.compass.core.mapping.AbstractMultipleMapping
mappings, mappingsByNameMap
 
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()
          Returns the alias this mapping is associated with.
 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.
 BoostPropertyMapping getBoostPropertyMapping()
          Returns an optional boost property mapping associated with the Resource in order to dynmaically set the resource boost value based on it.
 CascadeMapping[] getCascadeMappings()
          Returns a list of all the cascade mappings.
 String[] getExtendedAliases()
          Returns a list of aliases that this alias extends.
 String[] getExtendingAliases()
          Returns a list of all the aliases that extend this mapping.
 ResourcePropertyMapping[] getIdMappings()
          Gets the ids 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(PropertyPath 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.
 SubIndexHash getSubIndexHash()
          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 isAllOmitNorms()
          Expert: If set, omit normalization factors associated with this indexed field.
 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.
 boolean operationAllowed(CascadeMapping.Cascade cascade)
          Returns is an operation is allowed to be performed on this resoruce mappings.
 void postProcess()
          Perform the post processing of the mapping, after it's internal data has been set.
 void setAlias(String alias)
          Sets the alias this mapping is associated with.
 void setAllAnalyzer(String allAnalyzer)
           
 void setAllOmitNorms(boolean allOmitNorms)
           
 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 setBoostPropertyMapping(BoostPropertyMapping boostPropertyMapping)
           
 void setCascades(CascadeMapping[] cascades)
           
 void setExtendedAliases(String[] extendedMappings)
          Sets a list of aliases that this alias extends.
 void setExtendingAliases(String[] extendingAliases)
          Sets a list of all the aliases that extend this mapping.
 void setRoot(boolean isRoot)
           
 void setSubIndexHash(SubIndexHash subIndexHash)
           
 void shallowCopy(AbstractResourceMapping resourceMapping)
           
 
Methods inherited from class org.compass.core.mapping.AbstractMultipleMapping
addMappings, clearMappings, copy, getMapping, getMapping, mappingsIt, mappingsSize, removeExistingByName, replaceMappings, 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
 
Methods inherited from interface org.compass.core.mapping.Mapping
controlsObjectNullability, copy, getConverter, getConverterName, getName, getPath, setConverter, setConverterName, setName, setPath
 

Constructor Detail

AbstractResourceMapping

public AbstractResourceMapping()
Method Detail

getIdMappings

public ResourcePropertyMapping[] getIdMappings()
Gets the ids of the resource.

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(PropertyPath 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

getCascadeMappings

public CascadeMapping[] getCascadeMappings()
Description copied from interface: ResourceMapping
Returns a list of all the cascade mappings. Will return null if no cascading is defined.

Specified by:
getCascadeMappings in interface ResourceMapping

operationAllowed

public boolean operationAllowed(CascadeMapping.Cascade cascade)
Description copied from interface: ResourceMapping
Returns is an operation is allowed to be performed on this resoruce mappings. Root mappings (ResourceMapping.isRoot() always return true, while if it is non root mappings, it should return true if it has cascade mappings that map one of the cascade operations.

Specified by:
operationAllowed in interface ResourceMapping

getAlias

public String getAlias()
Description copied from interface: AliasMapping
Returns the alias this mapping is associated with.

Specified by:
getAlias in interface AliasMapping

setAlias

public void setAlias(String alias)
Description copied from interface: AliasMapping
Sets the alias this mapping is associated with.

Specified by:
setAlias in interface AliasMapping

getExtendedAliases

public String[] getExtendedAliases()
Description copied from interface: AliasMapping
Returns a list of aliases that this alias extends.

Specified by:
getExtendedAliases in interface AliasMapping

setExtendedAliases

public void setExtendedAliases(String[] extendedMappings)
Description copied from interface: AliasMapping
Sets a list of aliases that this alias extends.

Specified by:
setExtendedAliases 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)

getSubIndexHash

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

Specified by:
getSubIndexHash in interface ResourceMapping

setSubIndexHash

public void setSubIndexHash(SubIndexHash subIndexHash)

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)

isAllOmitNorms

public boolean isAllOmitNorms()
Description copied from interface: ResourceMapping
Expert: If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field.

Specified by:
isAllOmitNorms in interface ResourceMapping

setAllOmitNorms

public void setAllOmitNorms(boolean allOmitNorms)

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)

getBoostPropertyMapping

public BoostPropertyMapping getBoostPropertyMapping()
Description copied from interface: ResourceMapping
Returns an optional boost property mapping associated with the Resource in order to dynmaically set the resource boost value based on it. Can be null.

Specified by:
getBoostPropertyMapping in interface ResourceMapping

setBoostPropertyMapping

public void setBoostPropertyMapping(BoostPropertyMapping boostPropertyMapping)

getResourcePropertyNames

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

Specified by:
getResourcePropertyNames in interface ResourceMapping

getExtendingAliases

public String[] getExtendingAliases()
Description copied from interface: AliasMapping
Returns a list of all the aliases that extend this mapping. Note, this is a list of all the aliases down the food chain, not just the first ones.

Specified by:
getExtendingAliases in interface AliasMapping

setExtendingAliases

public void setExtendingAliases(String[] extendingAliases)
Description copied from interface: AliasMapping
Sets a list of all the aliases that extend this mapping. Note, this is a list of all the aliases down the food chain, not just the first ones.

Specified by:
setExtendingAliases in interface AliasMapping

setCascades

public void setCascades(CascadeMapping[] cascades)


Copyright (c) 2004-2006 The Compass Project.