Package org.apache.jackrabbit.ocm.mapper.model

Examples of org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor


   */
  public MappingDescriptor loadClassDescriptors()
  {
    try
    {
      MappingDescriptor mappingDescriptor = new MappingDescriptor();
      for (Iterator iter = configFileStreams.iterator(); iter.hasNext();)
      {
        InputStream xmlMappingDescriptorFile = (InputStream) iter.next();
       
        Digester digester = new Digester();
        digester.setValidating(this.validating);
        if (null != this.dtdResolver)
        {
                  digester.register("-//The Apache Software Foundation//DTD Repository//EN",
                                    this.dtdResolver.toString());
              }
            digester.setClassLoader(getClass().getClassLoader());
       
            MappingDescriptor currentMappingDescriptor = new MappingDescriptor();
            digester.push(currentMappingDescriptor);
       

        // --------------------------------------------------------------------------------
        // Rules used for the class-descriptor element
        // -------------------------------------------------------------------------------- 
        digester.addObjectCreate("jackrabbit-ocm/class-descriptor", ClassDescriptor.class);
        digester.addSetProperties("jackrabbit-ocm/class-descriptor");
        digester.addSetNext("jackrabbit-ocm/class-descriptor", "addClassDescriptor");   

        // --------------------------------------------------------------------------------
        // Rules used for the implement-descriptor element
        // --------------------------------------------------------------------------------
        digester.addObjectCreate("jackrabbit-ocm/class-descriptor/implement-descriptor", ImplementDescriptor.class);
        digester.addSetProperties("jackrabbit-ocm/class-descriptor/implement-descriptor");
              digester.addSetNext("jackrabbit-ocm/class-descriptor/implement-descriptor", "addImplementDescriptor");
       
        // --------------------------------------------------------------------------------
        // Rules used for the field-descriptor element
        // --------------------------------------------------------------------------------
        digester.addObjectCreate("jackrabbit-ocm/class-descriptor/field-descriptor", FieldDescriptor.class);
        digester.addSetProperties("jackrabbit-ocm/class-descriptor/field-descriptor");
              digester.addSetNext("jackrabbit-ocm/class-descriptor/field-descriptor", "addFieldDescriptor");

        // --------------------------------------------------------------------------------
        // Rules used for the bean-descriptor element
        // --------------------------------------------------------------------------------
        digester.addObjectCreate("jackrabbit-ocm/class-descriptor/bean-descriptor", BeanDescriptor.class);
        digester.addSetProperties("jackrabbit-ocm/class-descriptor/bean-descriptor");
              digester.addSetNext("jackrabbit-ocm/class-descriptor/bean-descriptor", "addBeanDescriptor");

        // --------------------------------------------------------------------------------
        // Rules used for the collection-descriptor element
        // --------------------------------------------------------------------------------
        digester.addObjectCreate("jackrabbit-ocm/class-descriptor/collection-descriptor", CollectionDescriptor.class);
        digester.addSetProperties("jackrabbit-ocm/class-descriptor/collection-descriptor");
              digester.addSetNext("jackrabbit-ocm/class-descriptor/collection-descriptor", "addCollectionDescriptor");     

              currentMappingDescriptor = (MappingDescriptor) digester.parse(xmlMappingDescriptorFile);
       
        mappingDescriptor.getClassDescriptorsByClassName().putAll(currentMappingDescriptor.getClassDescriptorsByClassName());
        mappingDescriptor.getClassDescriptorsByNodeType().putAll(currentMappingDescriptor.getClassDescriptorsByNodeType());

      }
      return mappingDescriptor;
    }
    catch (Exception e)
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor

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.