org.apache.jackrabbit.ocm.mapper.impl
Class AbstractMapperImpl

java.lang.Object
  extended by org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl
All Implemented Interfaces:
Mapper
Direct Known Subclasses:
AnnotationMapperImpl, DigesterMapperImpl

public abstract class AbstractMapperImpl
extends Object
implements Mapper

Abstract class for Mapper

Author:
Lombart Christophe , : Boni Gopalan TODO : Add more reference tests. For exemple, the mapper has to check if the class used for the elements of a collectiondescriptor exists. For performance reasone, we can defined some optional validations.

Field Summary
protected  DescriptorReader descriptorReader
           
protected static org.apache.commons.logging.Log log
           
protected  MappingDescriptor mappingDescriptor
           
protected  Collection rootClassDescriptors
           
 
Constructor Summary
AbstractMapperImpl()
           
 
Method Summary
 void buildMapper()
           
 ClassDescriptor getClassDescriptorByClass(Class clazz)
          Get the mapping defition to be used for a specific java bean
 ClassDescriptor getClassDescriptorByNodeType(String jcrNodeType)
          Get the mapping defition to be used for a specific JCR node type
protected  String getErrorMessage(List errors)
           
protected  List solveReferences(List errors)
          This method check class descriptor references (ancestor & implemented interfaces) : For each classdescriptor found, this method will check if the ancestor class and the implemented interfaces are also persistent or not.
protected  List validateDescriptors(List errors, Collection classDescriptors)
          Validate all class descriptors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

descriptorReader

protected DescriptorReader descriptorReader

mappingDescriptor

protected MappingDescriptor mappingDescriptor

rootClassDescriptors

protected Collection rootClassDescriptors
Constructor Detail

AbstractMapperImpl

public AbstractMapperImpl()
Method Detail

buildMapper

public void buildMapper()

solveReferences

protected List solveReferences(List errors)
This method check class descriptor references (ancestor & implemented interfaces) : For each classdescriptor found, this method will check if the ancestor class and the implemented interfaces are also persistent or not.

Parameters:
errors -
Returns:

validateDescriptors

protected List validateDescriptors(List errors,
                                   Collection classDescriptors)
Validate all class descriptors. This method validates the toplevel ancestors and after the descendants. Otherwise, we can have invalid settings in the class descriptors

Parameters:
errors - all errors found during the validation process
classDescriptors - the ancestor classdescriptors
Returns:

getErrorMessage

protected String getErrorMessage(List errors)

getClassDescriptorByClass

public ClassDescriptor getClassDescriptorByClass(Class clazz)
Description copied from interface: Mapper
Get the mapping defition to be used for a specific java bean

Specified by:
getClassDescriptorByClass in interface Mapper
Parameters:
clazz - The java bean class
Returns:
The mapping class found for the desired java bean class
See Also:
Mapper.getClassDescriptorByClass(java.lang.Class)

getClassDescriptorByNodeType

public ClassDescriptor getClassDescriptorByNodeType(String jcrNodeType)
Description copied from interface: Mapper
Get the mapping defition to be used for a specific JCR node type

Specified by:
getClassDescriptorByNodeType in interface Mapper
Parameters:
jcrNodeType - the jcr node type
Returns:
The mapping class found for the desired java bean class
See Also:
Mapper.getClassDescriptorByNodeType(String)


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.