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: [EMAIL PROTECTED]
internet: http://www.aura.cz
http://www.j2ee.cz
---------------------------------