You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by Christophe Lombart <ch...@gmail.com> on 2005/09/05 19:31:36 UTC

VOTE : PersistenceManager & Mapper interface API

Hi all, 

I just commited some code refactoring. 
Can you vote for the PersistenceManager API & the Mapper API ? 
We can expect to see some modification on thoses components when we
will add new features.

See on :
* org.apache.portals.graffito.jcr.persistence.PersistenceManager
* org.apache.portals.graffito.jcr.mapper.Mapper.

You can also check the current impletation. Let me know what you want to do. 
I'm currently reviewing (for the secon time :-) the collection management. 


Christophe

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
2005/9/7, Martin Koci <ma...@aura.cz>:
> See org.apache.portals.graffito.store.ContentStore#getCmsObject(String
> path). It returns org.apache.portals.graffito.model.core.CmsObject.

See the implementation in
org.apache.portals.graffito.store.impl.ojb.GraffitoOJBStore. It used
the ClassName to build the query.

> think it means: I want an object stored in repository. I know that
> object is repository managed. I know path but not type. Maybe this
> situation is equivalent to: /someDirectory/someFileWithoutExtension. I
> can use 'file' on unix and it tells me kind of content. In Java I can
> use if (returnedObject instanceof Document).
> 

I see only 2 solutions : 
* Add an extra property : jcrmapping:classname (as you suggest). In
this case, node which doesn't contain this property cannot be mapped.
Data migration is required if a user want to use this framework.
* or use the class as method parameters. 

Interface support will minimize this issue. it will be possible to do
something like this :

Suppose that we have a ancestor interface : CmsObject and 2
descendants : Folder and Document. it will possible to make query and
retrieve object based on this interface :

For example : 
CmsObject cmsobject = pm.getObject(CmsObject.class, "/test/...");
Collection cmsObjects = pm.retrieveCollection(CmsObject.class, criteria);
Collection cmsObjects = pm.retrieveCollection(Document.class, criteria);

The first one can returns any kind of CmsObject based object (Folder,
Document, Images, ...)
The second method call will return all objects based on the CmsObject
interface and matching to a criteria.
The last one will return only Document based objects (Binary, Word, HTML, ...)

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
See org.apache.portals.graffito.store.ContentStore#getCmsObject(String 
path). It returns org.apache.portals.graffito.model.core.CmsObject. I 
think it means: I want an object stored in repository. I know that 
object is repository managed. I know path but not type. Maybe this 
situation is equivalent to: /someDirectory/someFileWithoutExtension. I 
can use 'file' on unix and it tells me kind of content. In Java I can 
use if (returnedObject instanceof Document).

Christophe Lombart wrote:

>why not but it should be optional. I would like to use this mapping
>framework with JCR repo which are running for a long time without this
>kind of "system" properties (but maybe it is a dream :-) ).
>
>Why it is difficult for you to have the object class ? I expect that
>you cast the object returned by the getObject method - no ?
>eg. 
>
>Document myDoc = (MyDoc) pm.getObject(Document.class, path);
>it is almost the same as 
>Document myDoc = (MyDoc) pm.getObject( path);
>
>Let me think about that before taking a decision and all ideas are welcome
>Christophe
>
>
>  
>


Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
2005/9/7, Martin Koci <ma...@aura.cz>:
> Right, such algorithm may work only for predefined node types and custom
> node types. And only if there is such node type to POJO mapping only
> once (in mapping xml).
> 
> What about special property - JCR spec uses special properties for many
> occasions (jcr:primaryType, jcr: mixinTypes, ...). We can use property
> named e.g. 'jcrMapping:pojoClassName' and store there name of POJO class.
> 
why not but it should be optional. I would like to use this mapping
framework with JCR repo which are running for a long time without this
kind of "system" properties (but maybe it is a dream :-) ).

Why it is difficult for you to have the object class ? I expect that
you cast the object returned by the getObject method - no ?
eg. 

Document myDoc = (MyDoc) pm.getObject(Document.class, path);
it is almost the same as 
Document myDoc = (MyDoc) pm.getObject( path);

Let me think about that before taking a decision and all ideas are welcome
Christophe

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
Right, such algorithm may work only for predefined node types and custom 
node types. And only if there is such node type to POJO mapping only 
once (in mapping xml).

What about special property - JCR spec uses special properties for many 
occasions (jcr:primaryType, jcr: mixinTypes, ...). We can use property 
named e.g. 'jcrMapping:pojoClassName' and store there name of POJO class.


Christophe Lombart wrote:

>If you have only the path, you can have some issues with nodes based
>on nt:unstructured.
>
>If I understand your algorithm is : 
>* Get the JCR node object matching to the path
>* Get the NodeTypeDefintion for this JCR node
>* Found the ClassDescriptor 
>
>What happens if the node type is nt:unstructured ? If we found a
>solution we can review the getObject method like this :
>PersistenceManager#getObject(String path)
>
>Christophe
>
>2005/9/7, Martin Koci <ma...@aura.cz>:
>  
>
>>org.apache.portals.graffito.jcr.persistence.PersistenceManager#getObject(Class
>>pojoClass, String path)  requires knowledge of persistent class but in
>>some cases I know only path in repository.
>>
>>Christophe Lombart wrote:
>>
>>    
>>
>>>ok but in which context this method can be usefull ?
>>>
>>>2005/9/7, Martin Koci <ma...@aura.cz>:
>>>
>>>
>>>      
>>>
>>>>When I know path and therefore a JCR node and its note type I want to
>>>>know class mapped to note type. MappingDescriptor should have new method
>>>>'getClassNameForNodeType':
>>>>
>>>>public class MappingDescriptor {
>>>>private HashMap classDescriptors = new HashMap();
>>>>
>>>>private Map nodeTypeToClassMap = new HashMap();
>>>>
>>>>public void addClassDescriptor(ClassDescriptor classDescriptor)
>>>>{
>>>>classDescriptors.put(classDescriptor.getClassName(), classDescriptor);
>>>>nodeTypeToClassMap.put(classDescriptor.getJcrNodeType(),
>>>>classDescriptor.getClassName());
>>>>}
>>>>
>>>>public ClassDescriptor getClassDescriptor(String className)
>>>>{
>>>>return (ClassDescriptor) classDescriptors.get(className);
>>>>}
>>>>
>>>>public String getClassNameForNodeType(String nodeType) {
>>>>return (String) nodeTypeToClassMap.get(nodeType);
>>>>}
>>>>
>>>>}
>>>>
>>>>
>>>>and DigesterMapperImpl new method:
>>>>
>>>>public Class getClassForNodeType(String nodeType) throws
>>>>JcrMappingException {
>>>>String classNameForNodeType = null;
>>>>try {
>>>>classNameForNodeType = mappingDescriptor.getClassNameForNodeType(nodeType);
>>>>return Class.forName(classNameForNodeType);
>>>>} catch (ClassNotFoundException e) {
>>>>throw new JcrMappingException("Class of name: " + classNameForNodeType +
>>>>" is not found" );
>>>>}
>>>>}
>>>>
>>>>Christophe Lombart wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi all,
>>>>>
>>>>>I just commited some code refactoring.
>>>>>Can you vote for the PersistenceManager API & the Mapper API ?
>>>>>We can expect to see some modification on thoses components when we
>>>>>will add new features.
>>>>>
>>>>>See on :
>>>>>* org.apache.portals.graffito.jcr.persistence.PersistenceManager
>>>>>* org.apache.portals.graffito.jcr.mapper.Mapper.
>>>>>
>>>>>You can also check the current impletation. Let me know what you want to do.
>>>>>I'm currently reviewing (for the secon time :-) the collection management.
>>>>>
>>>>>
>>>>>Christophe
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>--
>>>>Mgr. Martin Kočí
>>>>---------------------------------
>>>>AURA, s.r.o.
>>>>Úvoz 499/56; 602 00 Brno
>>>>ISO 9001 certifikovaná společnost
>>>>tel./fax: +420 5 43 24 51 11
>>>>e-mail:  martin.koci@aura.cz
>>>>internet: http://www.aura.cz
>>>>        http://www.j2ee.cz
>>>>---------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>--
>>Mgr. Martin Kočí
>>---------------------------------
>>AURA, s.r.o.
>>Úvoz 499/56; 602 00 Brno
>>ISO 9001 certifikovaná společnost
>>tel./fax: +420 5 43 24 51 11
>>e-mail:  martin.koci@aura.cz
>>internet: http://www.aura.cz
>>         http://www.j2ee.cz
>>---------------------------------
>>
>>
>>    
>>

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
If you have only the path, you can have some issues with nodes based
on nt:unstructured.

If I understand your algorithm is : 
* Get the JCR node object matching to the path
* Get the NodeTypeDefintion for this JCR node
* Found the ClassDescriptor 

What happens if the node type is nt:unstructured ? If we found a
solution we can review the getObject method like this :
PersistenceManager#getObject(String path)

Christophe

2005/9/7, Martin Koci <ma...@aura.cz>:
> org.apache.portals.graffito.jcr.persistence.PersistenceManager#getObject(Class
> pojoClass, String path)  requires knowledge of persistent class but in
> some cases I know only path in repository.
> 
> Christophe Lombart wrote:
> 
> >ok but in which context this method can be usefull ?
> >
> >2005/9/7, Martin Koci <ma...@aura.cz>:
> >
> >
> >>When I know path and therefore a JCR node and its note type I want to
> >>know class mapped to note type. MappingDescriptor should have new method
> >>'getClassNameForNodeType':
> >>
> >>public class MappingDescriptor {
> >>private HashMap classDescriptors = new HashMap();
> >>
> >>private Map nodeTypeToClassMap = new HashMap();
> >>
> >>public void addClassDescriptor(ClassDescriptor classDescriptor)
> >>{
> >>classDescriptors.put(classDescriptor.getClassName(), classDescriptor);
> >>nodeTypeToClassMap.put(classDescriptor.getJcrNodeType(),
> >>classDescriptor.getClassName());
> >>}
> >>
> >>public ClassDescriptor getClassDescriptor(String className)
> >>{
> >>return (ClassDescriptor) classDescriptors.get(className);
> >>}
> >>
> >>public String getClassNameForNodeType(String nodeType) {
> >>return (String) nodeTypeToClassMap.get(nodeType);
> >>}
> >>
> >>}
> >>
> >>
> >>and DigesterMapperImpl new method:
> >>
> >>public Class getClassForNodeType(String nodeType) throws
> >>JcrMappingException {
> >>String classNameForNodeType = null;
> >>try {
> >>classNameForNodeType = mappingDescriptor.getClassNameForNodeType(nodeType);
> >>return Class.forName(classNameForNodeType);
> >>} catch (ClassNotFoundException e) {
> >>throw new JcrMappingException("Class of name: " + classNameForNodeType +
> >>" is not found" );
> >>}
> >>}
> >>
> >>Christophe Lombart wrote:
> >>
> >>
> >>
> >>>Hi all,
> >>>
> >>>I just commited some code refactoring.
> >>>Can you vote for the PersistenceManager API & the Mapper API ?
> >>>We can expect to see some modification on thoses components when we
> >>>will add new features.
> >>>
> >>>See on :
> >>>* org.apache.portals.graffito.jcr.persistence.PersistenceManager
> >>>* org.apache.portals.graffito.jcr.mapper.Mapper.
> >>>
> >>>You can also check the current impletation. Let me know what you want to do.
> >>>I'm currently reviewing (for the secon time :-) the collection management.
> >>>
> >>>
> >>>Christophe
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--
> >>Mgr. Martin Kočí
> >>---------------------------------
> >>AURA, s.r.o.
> >>Úvoz 499/56; 602 00 Brno
> >>ISO 9001 certifikovaná společnost
> >>tel./fax: +420 5 43 24 51 11
> >>e-mail:  martin.koci@aura.cz
> >>internet: http://www.aura.cz
> >>         http://www.j2ee.cz
> >>---------------------------------
> >>
> >>
> >>
> >>
> 
> 
> --
> Mgr. Martin Kočí
> ---------------------------------
> AURA, s.r.o.
> Úvoz 499/56; 602 00 Brno
> ISO 9001 certifikovaná společnost
> tel./fax: +420 5 43 24 51 11
> e-mail:  martin.koci@aura.cz
> internet: http://www.aura.cz
>          http://www.j2ee.cz
> ---------------------------------
> 
>

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
org.apache.portals.graffito.jcr.persistence.PersistenceManager#getObject(Class 
pojoClass, String path)  requires knowledge of persistent class but in 
some cases I know only path in repository.

Christophe Lombart wrote:

>ok but in which context this method can be usefull ? 
>
>2005/9/7, Martin Koci <ma...@aura.cz>:
>  
>
>>When I know path and therefore a JCR node and its note type I want to
>>know class mapped to note type. MappingDescriptor should have new method
>>'getClassNameForNodeType':
>>
>>public class MappingDescriptor {
>>private HashMap classDescriptors = new HashMap();
>>
>>private Map nodeTypeToClassMap = new HashMap();
>>
>>public void addClassDescriptor(ClassDescriptor classDescriptor)
>>{
>>classDescriptors.put(classDescriptor.getClassName(), classDescriptor);
>>nodeTypeToClassMap.put(classDescriptor.getJcrNodeType(),
>>classDescriptor.getClassName());
>>}
>>
>>public ClassDescriptor getClassDescriptor(String className)
>>{
>>return (ClassDescriptor) classDescriptors.get(className);
>>}
>>
>>public String getClassNameForNodeType(String nodeType) {
>>return (String) nodeTypeToClassMap.get(nodeType);
>>}
>>
>>}
>>
>>
>>and DigesterMapperImpl new method:
>>
>>public Class getClassForNodeType(String nodeType) throws
>>JcrMappingException {
>>String classNameForNodeType = null;
>>try {
>>classNameForNodeType = mappingDescriptor.getClassNameForNodeType(nodeType);
>>return Class.forName(classNameForNodeType);
>>} catch (ClassNotFoundException e) {
>>throw new JcrMappingException("Class of name: " + classNameForNodeType +
>>" is not found" );
>>}
>>}
>>
>>Christophe Lombart wrote:
>>
>>    
>>
>>>Hi all,
>>>
>>>I just commited some code refactoring.
>>>Can you vote for the PersistenceManager API & the Mapper API ?
>>>We can expect to see some modification on thoses components when we
>>>will add new features.
>>>
>>>See on :
>>>* org.apache.portals.graffito.jcr.persistence.PersistenceManager
>>>* org.apache.portals.graffito.jcr.mapper.Mapper.
>>>
>>>You can also check the current impletation. Let me know what you want to do.
>>>I'm currently reviewing (for the secon time :-) the collection management.
>>>
>>>
>>>Christophe
>>>
>>>
>>>
>>>
>>>      
>>>
>>--
>>Mgr. Martin Kočí
>>---------------------------------
>>AURA, s.r.o.
>>Úvoz 499/56; 602 00 Brno
>>ISO 9001 certifikovaná společnost
>>tel./fax: +420 5 43 24 51 11
>>e-mail:  martin.koci@aura.cz
>>internet: http://www.aura.cz
>>         http://www.j2ee.cz
>>---------------------------------
>>
>>
>>    
>>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
ok but in which context this method can be usefull ? 

2005/9/7, Martin Koci <ma...@aura.cz>:
> When I know path and therefore a JCR node and its note type I want to
> know class mapped to note type. MappingDescriptor should have new method
> 'getClassNameForNodeType':
> 
> public class MappingDescriptor {
> private HashMap classDescriptors = new HashMap();
> 
> private Map nodeTypeToClassMap = new HashMap();
> 
> public void addClassDescriptor(ClassDescriptor classDescriptor)
> {
> classDescriptors.put(classDescriptor.getClassName(), classDescriptor);
> nodeTypeToClassMap.put(classDescriptor.getJcrNodeType(),
> classDescriptor.getClassName());
> }
> 
> public ClassDescriptor getClassDescriptor(String className)
> {
> return (ClassDescriptor) classDescriptors.get(className);
> }
> 
> public String getClassNameForNodeType(String nodeType) {
> return (String) nodeTypeToClassMap.get(nodeType);
> }
> 
> }
> 
> 
> and DigesterMapperImpl new method:
> 
> public Class getClassForNodeType(String nodeType) throws
> JcrMappingException {
> String classNameForNodeType = null;
> try {
> classNameForNodeType = mappingDescriptor.getClassNameForNodeType(nodeType);
> return Class.forName(classNameForNodeType);
> } catch (ClassNotFoundException e) {
> throw new JcrMappingException("Class of name: " + classNameForNodeType +
> " is not found" );
> }
> }
> 
> Christophe Lombart wrote:
> 
> >Hi all,
> >
> >I just commited some code refactoring.
> >Can you vote for the PersistenceManager API & the Mapper API ?
> >We can expect to see some modification on thoses components when we
> >will add new features.
> >
> >See on :
> >* org.apache.portals.graffito.jcr.persistence.PersistenceManager
> >* org.apache.portals.graffito.jcr.mapper.Mapper.
> >
> >You can also check the current impletation. Let me know what you want to do.
> >I'm currently reviewing (for the secon time :-) the collection management.
> >
> >
> >Christophe
> >
> >
> >
> >
> 
> 
> --
> Mgr. Martin Kočí
> ---------------------------------
> AURA, s.r.o.
> Úvoz 499/56; 602 00 Brno
> ISO 9001 certifikovaná společnost
> tel./fax: +420 5 43 24 51 11
> e-mail:  martin.koci@aura.cz
> internet: http://www.aura.cz
>          http://www.j2ee.cz
> ---------------------------------
> 
>

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
When I know path and therefore a JCR node and its note type I want to 
know class mapped to note type. MappingDescriptor should have new method 
'getClassNameForNodeType':

public class MappingDescriptor {
private HashMap classDescriptors = new HashMap();

private Map nodeTypeToClassMap = new HashMap();

public void addClassDescriptor(ClassDescriptor classDescriptor)
{
classDescriptors.put(classDescriptor.getClassName(), classDescriptor);
nodeTypeToClassMap.put(classDescriptor.getJcrNodeType(), 
classDescriptor.getClassName());
}

public ClassDescriptor getClassDescriptor(String className)
{
return (ClassDescriptor) classDescriptors.get(className);
}

public String getClassNameForNodeType(String nodeType) {
return (String) nodeTypeToClassMap.get(nodeType);
}

}


and DigesterMapperImpl new method:

public Class getClassForNodeType(String nodeType) throws 
JcrMappingException {
String classNameForNodeType = null;
try {
classNameForNodeType = mappingDescriptor.getClassNameForNodeType(nodeType);
return Class.forName(classNameForNodeType);
} catch (ClassNotFoundException e) {
throw new JcrMappingException("Class of name: " + classNameForNodeType + 
" is not found" );
}
}

Christophe Lombart wrote:

>Hi all, 
>
>I just commited some code refactoring. 
>Can you vote for the PersistenceManager API & the Mapper API ? 
>We can expect to see some modification on thoses components when we
>will add new features.
>
>See on :
>* org.apache.portals.graffito.jcr.persistence.PersistenceManager
>* org.apache.portals.graffito.jcr.mapper.Mapper.
>
>You can also check the current impletation. Let me know what you want to do. 
>I'm currently reviewing (for the secon time :-) the collection management. 
>
>
>Christophe
>
>
>  
>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: VOTE : PersistenceManager & Mapper interface API

Posted by Raj Saini <ra...@gmail.com>.
Since JCR is a acronym, JcrMappingException should be JCRMappingException.

Raj

Martin Koci wrote:

> and all try - catch construct should look like:
> catch (Exception e)
>        {
>            throw new JcrMappingException("Impossible to add the node : 
> " + parentNode, e);  // WITH ROOT EXCEPTION
>        }
>
> not 'throw new JcrMappingException("Impossible to add the node : " + 
> parentNode); '. This masks trivial exceptions like NPE.
>
> Martin
>
> Martin Koci wrote:
>
>> Hi,
>> I think 
>> org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter 
>> methods should return new inserted Node (with method 'insert') and 
>> method 'update' updated javax.jcr.Node. Return values can be used for 
>> testing.
>>
>> Christophe Lombart wrote:
>>
>>> Hi all,
>>> I just commited some code refactoring. Can you vote for the 
>>> PersistenceManager API & the Mapper API ? We can expect to see some 
>>> modification on thoses components when we
>>> will add new features.
>>>
>>> See on :
>>> * org.apache.portals.graffito.jcr.persistence.PersistenceManager
>>> * org.apache.portals.graffito.jcr.mapper.Mapper.
>>>
>>> You can also check the current impletation. Let me know what you 
>>> want to do. I'm currently reviewing (for the secon time :-) the 
>>> collection management.
>>>
>>> Christophe
>>>
>>>
>>>  
>>>
>>
>>
>
>



Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
2005/9/6, Martin Koci <ma...@aura.cz>:
> and all try - catch construct should look like:
> catch (Exception e)
>         {
>             throw new JcrMappingException("Impossible to add the node :
> " + parentNode, e);  // WITH ROOT EXCEPTION
>         }
> 
> not 'throw new JcrMappingException("Impossible to add the node : " +
> parentNode); '. This masks trivial exceptions like NPE.

Ooops - correct thanks ! Hum, you seem to be very motivate today :-)
Are you agree to send me a patch for this kind of fixs :-) 

Thanks !
Christophe

> 
> Martin
> 
> Martin Koci wrote:
> 
> > Hi,
> > I think
> > org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter
> > methods should return new inserted Node (with method 'insert') and
> > method 'update' updated javax.jcr.Node. Return values can be used for
> > testing.
> >
> > Christophe Lombart wrote:
> >
> >> Hi all,
> >> I just commited some code refactoring. Can you vote for the
> >> PersistenceManager API & the Mapper API ? We can expect to see some
> >> modification on thoses components when we
> >> will add new features.
> >>
> >> See on :
> >> * org.apache.portals.graffito.jcr.persistence.PersistenceManager
> >> * org.apache.portals.graffito.jcr.mapper.Mapper.
> >>
> >> You can also check the current impletation. Let me know what you want
> >> to do. I'm currently reviewing (for the secon time :-) the collection
> >> management.
> >>
> >> Christophe
> >>
> >>
> >>
> >>
> >
> >
> 
> 
> --
> Mgr. Martin Kočí
> ---------------------------------
> AURA, s.r.o.
> Úvoz 499/56; 602 00 Brno
> ISO 9001 certifikovaná společnost
> tel./fax: +420 5 43 24 51 11
> e-mail:  martin.koci@aura.cz
> internet: http://www.aura.cz
>          http://www.j2ee.cz
> ---------------------------------
> 
>

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
and all try - catch construct should look like:
catch (Exception e)
        {
            throw new JcrMappingException("Impossible to add the node : 
" + parentNode, e);  // WITH ROOT EXCEPTION
        }

not 'throw new JcrMappingException("Impossible to add the node : " + 
parentNode); '. This masks trivial exceptions like NPE.

Martin

Martin Koci wrote:

> Hi,
> I think 
> org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter 
> methods should return new inserted Node (with method 'insert') and 
> method 'update' updated javax.jcr.Node. Return values can be used for 
> testing.
>
> Christophe Lombart wrote:
>
>> Hi all,
>> I just commited some code refactoring. Can you vote for the 
>> PersistenceManager API & the Mapper API ? We can expect to see some 
>> modification on thoses components when we
>> will add new features.
>>
>> See on :
>> * org.apache.portals.graffito.jcr.persistence.PersistenceManager
>> * org.apache.portals.graffito.jcr.mapper.Mapper.
>>
>> You can also check the current impletation. Let me know what you want 
>> to do. I'm currently reviewing (for the secon time :-) the collection 
>> management.
>>
>> Christophe
>>
>>
>>  
>>
>
>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: VOTE : PersistenceManager & Mapper interface API

Posted by Martin Koci <ma...@aura.cz>.
Hi,
I think 
org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter 
methods should return new inserted Node (with method 'insert') and 
method 'update' updated javax.jcr.Node. Return values can be used for 
testing.

Christophe Lombart wrote:

>Hi all, 
>
>I just commited some code refactoring. 
>Can you vote for the PersistenceManager API & the Mapper API ? 
>We can expect to see some modification on thoses components when we
>will add new features.
>
>See on :
>* org.apache.portals.graffito.jcr.persistence.PersistenceManager
>* org.apache.portals.graffito.jcr.mapper.Mapper.
>
>You can also check the current impletation. Let me know what you want to do. 
>I'm currently reviewing (for the secon time :-) the collection management. 
>
>
>Christophe
>
>
>  
>


-- 
Mgr. Martin Kočí
---------------------------------
AURA, s.r.o.
Úvoz 499/56; 602 00 Brno
ISO 9001 certifikovaná společnost
tel./fax: +420 5 43 24 51 11
e-mail:  martin.koci@aura.cz
internet: http://www.aura.cz
         http://www.j2ee.cz
--------------------------------- 


Re: VOTE : PersistenceManager & Mapper interface API

Posted by Christophe Lombart <ch...@gmail.com>.
Hi Oliver,


2005/9/10, Oliver Kiessler <ol...@gmail.com>:
> 
> Here is some feedback for the PersistenceManager API. First of all,
> the Persistence Manager looks fine to me except that I am not sure if
> it should contain the methods setupRepository(), getRepository(),
> getSession(), getUser(), setJcrCustomNodeTypeCreator() and
> getJcrCustomNodeTypeCreator() because they allow direct access to the
> underlying JCR API and the JCR repository itself. I believe the
> PersistenceManager should avoid allowing methods that circumvent the
> use of the graffito object persistence mechanism. These methods would
> be better off somewhere else.

+1  (100% agree). Either thoses methods becomes private or move somewhere else.

> 
> +1 for the Mapper API
> 
> Currently I am having problems running the unit tests (on linux).
> There is something wrong with the use of the graffito-jcr-mapping.dtd
> in jcrmapping.xml ("..\dtd\graffito-jcr-mapping.dtd" doesn't work on
> linux, "../dtd/graffito-jcr-mapping.dtd" is fine) 

ok done 

>and the
> repository.xml. I exchanged the repository.xml config file to a more
> current one and that worked. Maybe the repository.xml is out of date?
> 
> Also there is a directory "src/test-config/repository-test" that is
> unnecessary. A new JCR repository is created on every test run.
> 
> There are still problems with the lucene file locking mechanism. I
> think we should update to the latest Jackrabbit Snapshot (this
> involves a repository.xml config change).
> 

1. Yes, I think we need to update to a more recent Jackrabbit snaphot
with a new repository config file.
2. The src/test-config/repository-test is necessary until the JCR Node
Type Registration Tools are not yet build (or migrate the Sandro code
to use the new mapper model). It help me to add custom JCR types
quickly for my unit tests.

Thanks,
Christophe

Re: VOTE : PersistenceManager & Mapper interface API

Posted by Oliver Kiessler <ol...@gmail.com>.
hi christophe,

> I just commited some code refactoring.
> Can you vote for the PersistenceManager API & the Mapper API ?
> We can expect to see some modification on thoses components when we
> will add new features.

Here is some feedback for the PersistenceManager API. First of all,
the Persistence Manager looks fine to me except that I am not sure if
it should contain the methods setupRepository(), getRepository(),
getSession(), getUser(), setJcrCustomNodeTypeCreator() and
getJcrCustomNodeTypeCreator() because they allow direct access to the
underlying JCR API and the JCR repository itself. I believe the
PersistenceManager should avoid allowing methods that circumvent the
use of the graffito object persistence mechanism. These methods would
be better off somewhere else.

+1 for the Mapper API

Currently I am having problems running the unit tests (on linux).
There is something wrong with the use of the graffito-jcr-mapping.dtd
in jcrmapping.xml ("..\dtd\graffito-jcr-mapping.dtd" doesn't work on
linux, "../dtd/graffito-jcr-mapping.dtd" is fine) and the
repository.xml. I exchanged the repository.xml config file to a more
current one and that worked. Maybe the repository.xml is out of date?

Also there is a directory "src/test-config/repository-test" that is
unnecessary. A new JCR repository is created on every test run.

There are still problems with the lucene file locking mechanism. I
think we should update to the latest Jackrabbit Snapshot (this
involves a repository.xml config change).

regards,
oliver