in src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java [323:371]
public Object getObject(Session session, String path) {
try {
if (!session.nodeExists(path)) {
return null;
}
if (requestObjectCache.isCached(path))
{
return requestObjectCache.getObject(path);
}
ClassDescriptor classDescriptor;
Node node = session.getNode(path);
if (node.hasProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY)) {
String className = node.getProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY).getValue().getString();
classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.forName(className));
} else {
String nodeType = node.getPrimaryNodeType().getName();
if (nodeType.equals(ManagerConstant.FROZEN_NODE_TYPE)) {
nodeType = node.getProperty(ManagerConstant.FROZEN_PRIMARY_TYPE_PROPERTY).getString();
}
classDescriptor = mapper.getClassDescriptorByNodeType(nodeType);
}
if (null == classDescriptor) {
throw new JcrMappingException("Impossible to find the classdescriptor for " + path
+ ". There is no discriminator and associated JCR node type");
}
Object object = ReflectionUtils.newInstance(classDescriptor.getClassName());
if (! requestObjectCache.isCached(path))
{
requestObjectCache.cache(path, object);
}
simpleFieldsHelp.retrieveSimpleFields(session, classDescriptor, node, object);
retrieveBeanFields(session, classDescriptor, node, object, false);
retrieveCollectionFields(session, classDescriptor, node, object, false);
return object;
} catch (PathNotFoundException pnfe) {
// HINT should never get here
throw new ObjectContentManagerException("Impossible to get the object at " + path, pnfe);
} catch (RepositoryException re) {
throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to get the object at " + path, re);
}
}