incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artem Melentyev <>
Subject jcr-mapping contribution
Date Wed, 09 Aug 2006 15:27:13 GMT

I'm Google Summer of Code student ( ) in
XWiki organization ( .com )
I am writing JCR Store backend for XWiki. (XWiki works only on Hibernate
for now)

I'm using ObjectConverter directly without PersistenceManager (it is too
high-level, and I don't want to add jcrpath field to beens).

I would like to contribute my small changes. patch relatively svn trunk
is attached.

 Interface problems if same name siblings used (1,2):
  1) ObjectConverter.insert method don't returns created Node and
impossible find it, if where are many nodes with same name.
I offer:
public Node insert(Session session, Node parentNode, String nodeName,
Object object);

  2) ObjectConverter.update method uses "parentNode.getNode(nodeName)",
but if there are many nodes with same name?
I added following method:
public void update(Session session, Node objectNode, Object object)

 3) I want to store descendants of some class A, the same as A, without
putting descendants classes in mappings. How to make it?
I write in ObjectConverterImpl additional methods insert and update with
additional parameter Class objclass. Maybe there is a way better?

 4) ObjectConverter.retrieveSimpleFields method:
in if (classDescriptor.usesNodeTypePerHierarchyStrategy() &&
  String value = node.getProperty(propertyName).getValue().getString();

Why only String? I have a exceptions because it. I think should be:

  Value propValue = node.getProperty(propertyName).getValue();
  AtomicTypeConverter converter =
getAtomicTypeConverter(fieldDescriptor, initializedBean, fieldName);
  Object fieldValue = converter.getObject(propValue);
  ReflectionUtils.setNestedProperty(initializedBean, fieldName, fieldValue);

 5) ManageableCollectionUtil.getManageableCollection:
Why I can't store non standard, but Collection or Set compatible
classes? (ex: from org.apache.commons.collections)
i write following. It works fine for me:
if (object instanceof Vector) {
  ManageableVector manageableVector = new ManageableVector();
  manageableVector.addAll((Collection) object);
  return manageableVector;
if (object instanceof Set) {
  return new ManageableSet((Set) object);
if (object instanceof Collection) {
  ManageableArrayList manageableArrayList = new ManageableArrayList();
  manageableArrayList.addAll((Collection) object);
  return manageableArrayList;

  Artem Melentyev. UralSU, CS401.

View raw message