org.apache.jackrabbit.ocm.manager.beanconverter
Interface BeanConverter

All Known Implementing Classes:
AbstractBeanConverterImpl, DefaultBeanConverterImpl, InlineBeanConverterImpl, ParentBeanConverterImpl, ReferenceBeanConverterImpl

public interface BeanConverter

Interface describing a custom bean converter.

Author:
Alexandru Popescu

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)
          Get the bean path.
 void insert(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object bean, ClassDescriptor parentClassDescriptor, Object parent)
          Insert the object.
 void remove(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object bean, ClassDescriptor parentClassDescriptor, Object parent)
          Remove the bean from the repository.
 void update(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object bean, ClassDescriptor parentClassDescriptor, Object parent)
          Update repository from bean values.
 

Method Detail

insert

void insert(Session session,
            Node parentNode,
            BeanDescriptor beanDescriptor,
            ClassDescriptor beanClassDescriptor,
            Object bean,
            ClassDescriptor parentClassDescriptor,
            Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Insert the object.

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
bean - 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

void update(Session session,
            Node parentNode,
            BeanDescriptor beanDescriptor,
            ClassDescriptor beanClassDescriptor,
            Object bean,
            ClassDescriptor parentClassDescriptor,
            Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Update repository from bean values.

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
bean - 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

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

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

void remove(Session session,
            Node parentNode,
            BeanDescriptor beanDescriptor,
            ClassDescriptor beanClassDescriptor,
            Object bean,
            ClassDescriptor parentClassDescriptor,
            Object parent)
            throws ObjectContentManagerException,
                   RepositoryException,
                   JcrMappingException
Remove the bean from the repository.

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
bean - 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

String getPath(Session session,
               BeanDescriptor beanDescriptor,
               Node parentNode)
               throws ObjectContentManagerException
Get the bean path. When the bean is mapped to a subnode, the bean path is the parent node path + the jcrname of the current bean. Sometime a BeanConverter can be used to access to a bean which is not mapped to a subnode. In this case, another implementation can be provided in this method getPath. ParentBeanConverterImpl is a good example.

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:
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
ObjectContentManagerException


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