Package org.apache.jackrabbit.ocm.exception

Examples of org.apache.jackrabbit.ocm.exception.JcrMappingException


        }
        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());
View Full Code Here


          }
      }

      // ensure class is concrete (neither interface nor abstract)
      if (clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers())) {
          throw new JcrMappingException( "Cannot instantiate non-concrete class " + clazz.getName()
                        + " for node " + path + " of type " + node.getPrimaryNodeType().getName());
      }

            Object object = ReflectionUtils.newInstance(classDescriptor.getClassName());
View Full Code Here

        if (jcrTypeName != null && !jcrTypeName.equals("")) {
          session.getWorkspace().getNodeTypeManager().getNodeType(jcrTypeName);
        }
      }
    } catch (NoSuchNodeTypeException nsnte) {
      throw new JcrMappingException("Mapping for class '" + classDescriptor.getClassName()
          + "' use unknown primary or mixin node type '" + jcrTypeName + "'");
    } catch (RepositoryException re) {
      throw new org.apache.jackrabbit.ocm.exception.RepositoryException(re);
    }
  }
View Full Code Here

  public String getPath(Session session, Object object) {
    ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());

    final FieldDescriptor pathFieldDescriptor = classDescriptor.getPathFieldDescriptor();
    if (pathFieldDescriptor == null) {
      throw new JcrMappingException(
          "Class of type: "
              + object.getClass().getName()
              + " has no path mapping. Maybe attribute path=\"true\" for a field element of this class in mapping descriptor is missing " +
                " or maybe it is defined in an ancestor class which has no mapping descriptor.");
    }
View Full Code Here

  }

  private ClassDescriptor getClassDescriptor(Class beanClass) {
    ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(beanClass);
    if (null == classDescriptor) {
      throw new JcrMappingException("Class of type: " + beanClass.getName()
          + " is not JCR persistable. Maybe element 'class-descriptor' for this type in mapping file is missing");
    }

    return classDescriptor;
  }
View Full Code Here

  }
  protected String getCollectionJcrName(CollectionDescriptor descriptor) {
    String jcrName = descriptor.getJcrName();

    if (null == jcrName) {
      throw new JcrMappingException("The JcrName attribute is not defined for the CollectionDescriptor : "
          + descriptor.getFieldName());
    }

    return jcrName;
  }
View Full Code Here

       
        try {
            return PropertyUtils.getNestedProperty(object, fieldName);
        }
        catch(IllegalAccessException e) {
            throw new JcrMappingException("Cannot access property "
                    + fieldName,
                    e);
        }
        catch(InvocationTargetException e) {
            throw new JcrMappingException("Cannot access property "
                    + fieldName,
                    e);
        }
        catch(NoSuchMethodException e) {
            throw new JcrMappingException("Cannot access property "
                    + fieldName,
                    e);
        }
    }
View Full Code Here

    public static Class getPropertyType(Object object, String fieldName) {
        try {
            return PropertyUtils.getPropertyType(object, fieldName);
        }
        catch(Exception ex) {
            throw new JcrMappingException("Cannot access property "
                    + fieldName,
                    ex);
        }
    }
View Full Code Here

    public static Object newInstance(Class clazz) {
        try {
            return clazz.newInstance();
        }
        catch(Exception ex) {
            throw new JcrMappingException("Cannot create instance for class "
                    + clazz,
                    ex);
        }
    }
View Full Code Here

            Class converterClass= forName(className);
   
            return  ConstructorUtils.invokeConstructor(converterClass, params);
        }
        catch(Exception ex) {
            throw new JcrMappingException("Cannot create instance for class "  + className,  ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.exception.JcrMappingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.