org.chromattic.api
Interface ChromatticSession


public interface ChromatticSession

Version:
$Revision$
Author:
Julien Viet

Method Summary
 void addEventListener(EventListener listener)
           
 void close()
           
<O> O
create(Class<O> clazz)
          Creates a transient instance of the specified object.
<O> O
create(Class<O> clazz, String name)
          Creates a transient instance of the specified object.
 QueryBuilder<?> createQueryBuilder()
           
<O> O
findById(Class<O> clazz, String id)
           
<O> O
findByNode(Class<O> clazz, javax.jcr.Node node)
           
<O> O
findByPath(Class<O> clazz, String relPath)
           
<O> O
findByPath(Object o, Class<O> clazz, String relPath)
           
 String getId(Object o)
           
 javax.jcr.Session getJCRSession()
           
 String getName(Object o)
           
 String getPath(Object o)
           
 Status getStatus(Object o)
           
<O> O
insert(Class<O> clazz, String name)
          Creates a persistent instance of the specified object.
<O> O
insert(Object parent, Class<O> clazz, String name)
          Creates a persistent instance of the specified object.
 String persist(Object o)
          Persists a transient object relative to the root node.
 String persist(Object parent, Object child)
          Persists a transient object.
 String persist(Object parent, Object o, String name)
          Persists a transient object.
 String persist(Object o, String name)
          Persists a transient object.
 void remove(Object o)
           
 void save()
           
 

Method Detail

create

<O> O create(Class<O> clazz)
         throws NullPointerException,
                IllegalArgumentException,
                ChromatticException
Creates a transient instance of the specified object.

Parameters:
clazz - the object class
Returns:
the instance
Throws:
NullPointerException - if the specified clazz is null
IllegalArgumentException - if the specified class does not have a declared mapping
ChromatticException - any chromattic exception

create

<O> O create(Class<O> clazz,
             String name)
         throws NullPointerException,
                IllegalArgumentException,
                ChromatticException
Creates a transient instance of the specified object. The name if it is not null will be used later when the object is inserted in the JCR session. The clazz argument must be annotated class with the NodeMapping annotation.

Type Parameters:
O - the object class parameter
Parameters:
clazz - the object class
name - the node name
Returns:
the transient object
Throws:
NullPointerException - if the clazz argument is null
IllegalArgumentException - if the name format is not valid
ChromatticException - any chromattic exception

insert

<O> O insert(Class<O> clazz,
             String name)
         throws NullPointerException,
                IllegalArgumentException,
                ChromatticException
Creates a persistent instance of the specified object.

Type Parameters:
O - the object class parameter
Parameters:
clazz - the object class
name - the name under root node
Returns:
the persistent object
Throws:
NullPointerException - if any argument is null
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

insert

<O> O insert(Object parent,
             Class<O> clazz,
             String name)
         throws NullPointerException,
                IllegalArgumentException,
                ChromatticException
Creates a persistent instance of the specified object.

Type Parameters:
O - the object class parameter
Parameters:
parent - the parent object
clazz - the object class
name - the object name
Returns:
the persistent object
Throws:
NullPointerException - if any argument is null
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

persist

String persist(Object o,
               String name)
               throws NullPointerException,
                      IllegalArgumentException,
                      ChromatticException
Persists a transient object.

Parameters:
o - the object to persist
name - the object relative path to the root
Returns:
the object id
Throws:
NullPointerException - if any argument is null
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

persist

String persist(Object parent,
               Object child)
               throws NullPointerException,
                      IllegalArgumentException,
                      ChromatticException
Persists a transient object.

Parameters:
parent - the parent object
child - the object to persist
Returns:
the object id
Throws:
NullPointerException - if any argument is not valid
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

persist

String persist(Object o)
               throws NullPointerException,
                      IllegalArgumentException,
                      ChromatticException
Persists a transient object relative to the root node.

Parameters:
o - the object to persist
Returns:
the object id
Throws:
NullPointerException - if any argument is not valid
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

persist

String persist(Object parent,
               Object o,
               String name)
               throws NullPointerException,
                      IllegalArgumentException,
                      ChromatticException
Persists a transient object.

Parameters:
parent - the parent object
o - the object to persist
name - the object relative name to the parent
Returns:
the object id
Throws:
NullPointerException - if the parent or object argument is null
IllegalArgumentException - if any argument is not valid
ChromatticException - any chromattic exception

findByPath

<O> O findByPath(Object o,
                 Class<O> clazz,
                 String relPath)
             throws ChromatticException
Throws:
ChromatticException

findByPath

<O> O findByPath(Class<O> clazz,
                 String relPath)
             throws ChromatticException
Throws:
ChromatticException

findByNode

<O> O findByNode(Class<O> clazz,
                 javax.jcr.Node node)
             throws ChromatticException
Throws:
ChromatticException

findById

<O> O findById(Class<O> clazz,
               String id)
           throws ChromatticException
Throws:
ChromatticException

createQueryBuilder

QueryBuilder<?> createQueryBuilder()
                                   throws ChromatticException
Throws:
ChromatticException

remove

void remove(Object o)
            throws ChromatticException
Throws:
ChromatticException

getStatus

Status getStatus(Object o)
                 throws ChromatticException
Throws:
ChromatticException

getId

String getId(Object o)
             throws ChromatticException
Throws:
ChromatticException

getName

String getName(Object o)
               throws ChromatticException
Throws:
ChromatticException

getPath

String getPath(Object o)
               throws ChromatticException
Throws:
ChromatticException

addEventListener

void addEventListener(EventListener listener)

save

void save()
          throws ChromatticException
Throws:
ChromatticException

close

void close()

getJCRSession

javax.jcr.Session getJCRSession()


Copyright © 2010 eXo Platform SAS. All Rights Reserved.