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, InternalResourceMapping, Mapping, MultipleMapping, PostProcessingMapping, ResourceMapping
Direct Known Subclasses:
ClassMapping, NullResourceMapping, RawResourceMapping, XmlObjectMapping

public abstract class AbstractResourceMapping
extends AbstractMultipleMapping
implements InternalResourceMapping, 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.
 AllMapping getAllMapping()
          Returns a set of settings associated with the all mappings.
 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.
 Mapping[] getIdMappings()
          Gets the idMappings of the resource.
 ResourcePropertyMapping[] getResourceIdMappings()
          Returns all the id mappigns for the low level resource mapping.
 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.
 SpellCheckType getSpellCheck()
          Returns the default spell check mode.
 SubIndexHash getSubIndexHash()
          The sub index that the Resource will be saved to in the search engine.
 String getUIDPath()
          Returns the uid property name.
 boolean hasSpecificAnalyzerPerResourceProperty()
          Returns true if the resource proeprty mapping of the resource have a specific analyzer set.
 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 setAllMapping(AllMapping allMapping)
           
 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 setSpellCheck(SpellCheckType spellCheck)
           
 void setSubIndexHash(SubIndexHash subIndexHash)
           
 void setUIDPath(String uid)
           
 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
 
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 Mapping[] getIdMappings()
Gets the idMappings of the resource.

Specified by:
getIdMappings in interface ResourceMapping

getAllMapping

public AllMapping getAllMapping()
Description copied from interface: ResourceMapping
Returns a set of settings associated with the all mappings.

Specified by:
getAllMapping in interface ResourceMapping

setAllMapping

public void setAllMapping(AllMapping allMapping)
Specified by:
setAllMapping in interface InternalResourceMapping

getSpellCheck

public SpellCheckType getSpellCheck()
Description copied from interface: ResourceMapping
Returns the default spell check mode. If NA, will use global setting.

Specified by:
getSpellCheck in interface ResourceMapping

setSpellCheck

public void setSpellCheck(SpellCheckType spellCheck)
Specified by:
setSpellCheck in interface InternalResourceMapping

getResourceIdMappings

public ResourcePropertyMapping[] getResourceIdMappings()
Description copied from interface: ResourceMapping
Returns all the id mappigns for the low level resource mapping.

Specified by:
getResourceIdMappings 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

setUIDPath

public void setUIDPath(String uid)
Specified by:
setUIDPath in interface InternalResourceMapping

getUIDPath

public String getUIDPath()
Description copied from interface: ResourceMapping
Returns the uid property name.

Specified by:
getUIDPath in interface ResourceMapping

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 AliasMapping
Specified by:
getAnalyzer in interface ResourceMapping

setAnalyzer

public void setAnalyzer(String analyzer)
Specified by:
setAnalyzer in interface AliasMapping

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)

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)

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

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-2008 The Compass Project.