org.apache.jackrabbit.ocm.manager.beanconverter.impl
Class ParentBeanConverterImpl

java.lang.Object
  extended by org.apache.jackrabbit.ocm.manager.beanconverter.impl.AbstractBeanConverterImpl
      extended by org.apache.jackrabbit.ocm.manager.beanconverter.impl.ParentBeanConverterImpl
All Implemented Interfaces:
BeanConverter

public class ParentBeanConverterImpl
extends AbstractBeanConverterImpl
implements BeanConverter

Bean converter used to access to the parent object. the mixin type referenceable is not mandatory for the node matching to the parent object.

Author:
Lombart Christophe

Field Summary
 
Fields inherited from class org.apache.jackrabbit.ocm.manager.beanconverter.impl.AbstractBeanConverterImpl
atomicTypeConverterProvider, mapper, objectConverter
 
Constructor Summary
ParentBeanConverterImpl(Mapper mapper, ObjectConverter objectConverter, AtomicTypeConverterProvider atomicTypeConverterProvider)
           
 
Method Summary
 Object getObject(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Class beanClass, Object parent)
          Retrieve a bean from the repository.
 String getPath(Session session, BeanDescriptor beanDescriptor, Node parentNode)
          Default implementation for many BeanConverter.
 void insert(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
          Insert the object.
 void remove(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
          Remove the bean from the repository.
 void update(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
          Update repository from bean values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParentBeanConverterImpl

public ParentBeanConverterImpl(Mapper mapper,
                               ObjectConverter objectConverter,
                               AtomicTypeConverterProvider atomicTypeConverterProvider)
Method Detail

insert

public void insert(Session session,
                   Node parentNode,
                   BeanDescriptor beanDescriptor,
                   ClassDescriptor beanClassDescriptor,
                   Object object,
                   ClassDescriptor parentClassDescriptor,
                   Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Description copied from interface: BeanConverter
Insert the object.

Specified by:
insert in interface BeanConverter
Specified by:
insert in class AbstractBeanConverterImpl
Parameters:
session - the JCR session
parentNode - The node which will contain the converter bean
beanDescriptor - The bean descriptor
beanClassDescriptor - the Class Descriptor associated to the bean to insert
object - the bean to convert( insert into the JCR structure)
parentClassDescriptor - The Class Descriptor associated to the parent object
parent - the object which will contain the bean to convert
Throws:
ObjectContentManagerException - thrown in case the insert fails; marks a failure due to logic of the insert (parent node cannot be accessed, the insert fails, etc.)
RepositoryException - thrown in case the underlying repository has thrown a javax.jcr.RepositoryException that is not possible to be handled or wrapped in ObjectContentManagerException; marks a repository failure
JcrMappingException - throws in case the mapping of the bean is not correct

update

public void update(Session session,
                   Node parentNode,
                   BeanDescriptor beanDescriptor,
                   ClassDescriptor beanClassDescriptor,
                   Object object,
                   ClassDescriptor parentClassDescriptor,
                   Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Description copied from interface: BeanConverter
Update repository from bean values.

Specified by:
update in interface BeanConverter
Specified by:
update in class AbstractBeanConverterImpl
Parameters:
session - the JCR session
parentNode - The node which will contain the converter bean
beanDescriptor - The bean descriptor
beanClassDescriptor - the Class Descriptor associated to the bean to update
object - the bean to convert( insert into the JCR structure)
parentClassDescriptor - The Class Descriptor associated to the parent object
parent - the object which will contain the bean to convert
Throws:
ObjectContentManagerException - thrown in case the update fails; marks a failure due to logic of update (parent node cannot be accessed, the update fails, etc.)
RepositoryException - thrown in case the underlying repository has thrown a javax.jcr.RepositoryException that is not possible to be handled or wrapped in ObjectContentManagerException; marks a repository failure
JcrMappingException - throws in case the mapping of the bean is not correct

getObject

public Object getObject(Session session,
                        Node parentNode,
                        BeanDescriptor beanDescriptor,
                        ClassDescriptor beanClassDescriptor,
                        Class beanClass,
                        Object parent)
                 throws ObjectContentManagerException,
                        RepositoryException,
                        JcrMappingException
Description copied from interface: BeanConverter
Retrieve a bean from the repository.

Specified by:
getObject in interface BeanConverter
Specified by:
getObject in class AbstractBeanConverterImpl
Parameters:
session - the JCR session
parentNode - The parent node
beanDescriptor - The bean descriptor
beanClassDescriptor - the Class Descriptor associated to the bean to insert
beanClass - The bean Class
parent - The parent which contain the bean to retrieve
Throws:
ObjectContentManagerException - thrown in case the bean cannot be retrieved or initialized; marks a failure due to logic of retrieval
RepositoryException - thrown in case the underlying repository has thrown a javax.jcr.RepositoryException that is not possible to be handled or wrapped in ObjectContentManagerException; marks a repository failure
JcrMappingException - throws in case the mapping of the bean is not correct

remove

public void remove(Session session,
                   Node parentNode,
                   BeanDescriptor beanDescriptor,
                   ClassDescriptor beanClassDescriptor,
                   Object object,
                   ClassDescriptor parentClassDescriptor,
                   Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Description copied from interface: BeanConverter
Remove the bean from the repository.

Specified by:
remove in interface BeanConverter
Specified by:
remove in class AbstractBeanConverterImpl
Parameters:
session - the JCR session
parentNode - The node which will contain the converter bean
beanDescriptor - The bean descriptor
beanClassDescriptor - the Class Descriptor associated to the bean to update
object - the bean to convert( insert into the JCR structure)
parentClassDescriptor - The Class Descriptor associated to the parent object
parent - the object which contains the bean to convert
Throws:
ObjectContentManagerException - thrown in case the bean cannot be removed; marks a failure due to logic of removal
RepositoryException - thrown in case the underlying repository has thrown a javax.jcr.RepositoryException that is not possible to be handled or wrapped in ObjectContentManagerException; marks a repository failure
JcrMappingException - throws in case the mapping of the bean is not correct

getPath

public String getPath(Session session,
                      BeanDescriptor beanDescriptor,
                      Node parentNode)
               throws ObjectContentManagerException
Default implementation for many BeanConverter. This method can be overridden in specific BeanConverter

Specified by:
getPath in interface BeanConverter
Overrides:
getPath in class AbstractBeanConverterImpl
Parameters:
session - the JCR session
beanDescriptor - The descriptor of the bean to convert
parentNode - the node which contain this bean (its corresponfing subnode)
Returns:
the bean path
Throws:
ObjectContentManagerException


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