Package org.dmd.dms

Examples of org.dmd.dms.SchemaDefinition


        ClassDefinition     cd                  = null;
        boolean             isSchema            = false;
        DmsDefinition      newDef              = null;
        Iterator<String>    dependsOnSchemas    = null;
        Iterator<String>    defFiles            = null;
        SchemaDefinition    currSchema          = null;
        String              depSchema           = null;
        SchemaDefinition    newSchema           = null;
        String              currFile            = null;
        String         srcFile       = "";
        // Determine if we have a valid class
        if ((cd = allSchema.isClass((String)uco.classes.get(0))) == null){
          ResultException ex = new ResultException();
View Full Code Here


                  try {
                    // Create a new manager into which the parsed schemas will be loaded
                    readSchemas = new SchemaManager();
                   
                    // Parse the specified schema
            SchemaDefinition sd = parser.parseSchema(readSchemas, tokens.nth(0).getValue(), false);
           
            // Generate the code
           
            FileUpdateManager.instance().reportProgress(System.out);
            FileUpdateManager.instance().reportErrors(System.err);
View Full Code Here

      try {
        // Create a new manager into which the parsed schemas will be loaded
        readSchemas = new SchemaManager();
       
        // Parse the specified schema
      SchemaDefinition sd = parser.parseSchema(readSchemas, location.getConfigName(), false);
     
      if ((sd != null) && checkRules.booleanValue()){
        parser.checkRules(sd);
      }
     
View Full Code Here

   
    createWrappers(config, loc, f, sm);
   
    sformatter.setFileHeader(fileHeader);
    sformatter.setProgressStream(progress);
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
    sformatter.dumpSchema(gendir, config.getGenPackage(), sd, sm);
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////////
  // Our functionality
 

  void createTypeIterables(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm) throws IOException, ResultException {
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
   
    sd.dumpInfo();
   
    Iterator<ClassDefinition>  classes = sd.getClassDefList();
    if (classes != null){
      // We only generate the iterators for unnamed classes. Named classes will have their
      // Iterable generated along with the types because internal types are generated for them
      while(classes.hasNext()){
        ClassDefinition cd = classes.next();
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY)
          continue;
       
        if (cd.getIsNamedBy() == null){
          String dmwImport = cd.getDmwImport();
          if (cd.getUseWrapperType() == WrapperTypeEnum.EXTENDED)
            dmwImport = cd.getDmeImport();
         
          GenUtility.dumpObjectIterable(dmwdir, sd.getDmwPackage(), cd.getDmoImport(), cd.getName().getNameString(), dmwImport, "", fileHeader, progress);
        }
      }
     
    }
   
    Iterator<TypeDefinition> types = sd.getTypeDefList();
    if (types != null){
      while(types.hasNext()){
        TypeDefinition td = types.next();
       
        if (td.getIsExtendedRefType())
          continue;
       
        String genericArgs = td.getGenericArgs();
        if (genericArgs == null)
          genericArgs = "";
       
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), td.getPrimitiveType(), td.getName().getNameString(), genericArgs, fileHeader, progress);
      }
    }
   
    Iterator<EnumDefinition>  enums = sd.getEnumDefList();
    if (enums != null){
      while(enums.hasNext()){
        EnumDefinition ed = enums.next();
       
        String enumPrimitive = sd.getSchemaPackage() + ".generated.enums." + ed.getName().getNameString();
       
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), enumPrimitive, ed.getName().getNameString(), "", fileHeader, progress);
      }
    }
   
    Iterator<ComplexTypeDefinition>  ctypes = sd.getComplexTypeDefList();
    if (ctypes != null){
      while(ctypes.hasNext()){
        ComplexTypeDefinition ctd = ctypes.next();
        DebugInfo.debug("Generating Iterator for: " + ctd.getName().getNameString());
       
        String primitive = sd.getSchemaPackage() + ".generated.types." + ctd.getName().getNameString();
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), primitive, ctd.getName().getNameString(), "", fileHeader, progress);
       
      }
    }
   
  }
View Full Code Here

   
    createWrappers(config, loc, f, sm);
   
    sformatter.setFileHeader(fileHeader);
    sformatter.setProgressStream(progress);
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
    sformatter.dumpSchema(gendir, config.getGenPackage(), sd, sm);
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////////
  // Our functionality

  void createTypeIterables(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm) throws IOException, ResultException {
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
   
    sd.dumpInfo();
   
    Iterator<ClassDefinition>  classes = sd.getClassDefList();
    if (classes != null){
      createIfRequired(dmwdir);
     
      // We only generate the iterators for unnamed classes. Named classes will have their
      // Iterable generated along with the types because internal types are generated for them
      while(classes.hasNext()){
        ClassDefinition cd = classes.next();
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY)
          continue;
       
        if (cd.getIsNamedBy() == null){
          String dmwImport = cd.getDmwImport();
          if (cd.getUseWrapperType() == WrapperTypeEnum.EXTENDED)
            dmwImport = cd.getDmeImport();
         
          GenUtility.dumpObjectIterable(dmwdir, sd.getDmwPackage(), cd.getDmoImport(), cd.getName().getNameString(), dmwImport, "", fileHeader, progress);
        }
      }
     
    }
   
    Iterator<TypeDefinition> types = sd.getTypeDefList();
    if (types != null){
      while(types.hasNext()){
        TypeDefinition td = types.next();
        String genericArgs = td.getGenericArgs();
        if (genericArgs == null)
          genericArgs = "";
       
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), td.getPrimitiveType(), td.getName().getNameString(), genericArgs, fileHeader, progress);
      }
    }
   
    Iterator<EnumDefinition>  enums = sd.getEnumDefList();
    if (enums != null){
      while(enums.hasNext()){
        EnumDefinition ed = enums.next();
       
        String enumPrimitive = sd.getSchemaPackage() + ".generated.enums." + ed.getName().getNameString();
       
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), enumPrimitive, ed.getName().getNameString(), "", fileHeader, progress);
      }
    }
   
    Iterator<ComplexTypeDefinition>  ctypes = sd.getComplexTypeDefList();
    if (ctypes != null){
      while(ctypes.hasNext()){
        ComplexTypeDefinition ctd = ctypes.next();
        DebugInfo.debug("Generating Iterator for: " + ctd.getName().getNameString());
       
        String primitive = sd.getSchemaPackage() + ".generated.types." + ctd.getName().getNameString();
        GenUtility.dumpIterable(dmwdir, sd.getDmwPackage(), primitive, ctd.getName().getNameString(), "", fileHeader, progress);
       
      }
    }
   
  }
View Full Code Here

      ArrayList<RuleIF>    allRules   = new ArrayList<RuleIF>();
     
    Iterator<SchemaDefinition> schemas = sm.getSchemas();
    if (schemas != null){
      while(schemas.hasNext()){
        SchemaDefinition curr = schemas.next();
       
            Iterator<DmcUncheckedObject> ucoIT = curr.getParsedRules();
            if (ucoIT != null){
          while(ucoIT.hasNext()){
            DmcUncheckedObject   uco = ucoIT.next();
            ClassDefinition   ruleDataCD   = sm.cdef(uco.getConstructionClass());
            RuleDefinition    ruleDEF    = ruleDataCD.getRuleDefinition();
            RuleDataDMO     ruledata  = null;
            SourceInfo      source    = getSource(uco);
           
            try{
              ruledata = (RuleDataDMO) dmofactory.createObject(uco);
//              DebugInfo.debug("Parsed and instantiated:\n\n" + ruledata.toOIF());
            }
            catch(ClassNotFoundException cnf){
              // This may be thrown from TypeDefinition when trying to instantiate a
              // holder for an attribute. This would likely result from not having
              // the compiled output of a previous code generation run specified on
              // the class path for the dmogen call that's checking the rules
              StringBuffer sb = new StringBuffer();
              sb.append(cnf.getMessage() + "\n\n");
              sb.append("You probably need to augment the following classpath:\n");
              ClassLoader cl = ClassLoader.getSystemClassLoader();
                  URL[] urls = ((URLClassLoader)cl).getURLs();
                  for(URL url: urls){
                    sb.append(url.getFile() + "\n");
                  }
                  sb.append("\nwith the classpath info for the missing class.");

              DmcRuleException ex = new DmcRuleException(sb.toString(), null);
              ex.source(source);
             
              if (rc == null)
                rc = new DmcRuleExceptionSet();
              rc.add(ex);
             
              // This is a show stopper, so just fire it now.
              throw(rc);
            }
            catch(DmcValueException dve){
              // If a value for an attribute doesn't pass the basic tests, we'll
              // get one of these, just repackage it as a rule exception
              DmcRuleException ex = new DmcRuleException(dve.getMessage(), null);
              ex.source(source);

              if (rc == null)
                rc = new DmcRuleExceptionSet();
              rc.add(ex);             
            }
            catch(ResultException rex){
              // If we can't find a class or attribute, we'll get one of these
              DmcRuleException ex = new DmcRuleException(rex.getMessage(), null);
              ex.source(source);

              if (rc == null)
                rc = new DmcRuleExceptionSet();
              rc.add(ex)
             
//              System.err.println(ex.toString());
            }
           
            if (ruledata == null)
              continue;
           
            try{
              ruledata.resolveReferences(sm);
            }
            catch(DmcValueExceptionSet ex){
              System.err.println(ex.toString() + "\nFile: " + ruledata.getFile() + "  Line: " + ruledata.getLineNumber());
            }
             
            try{
              DynamicInitIF rule = (DynamicInitIF) ruleDEF.newRuleInstance();
              rule.setRuleData(ruledata);
             
              allRuleData.add(ruledata);
             
//              addThisRule((RuleIF) rule);
              allRules.add((RuleIF) rule);
            }
            catch(Exception ex){
              System.err.println(ex.toString());
            }
          }
            }
      }
     
      DmcOmni.instance().reset();
      schemas = sm.getSchemas();
      while(schemas.hasNext()){
        SchemaDefinition curr = schemas.next();
        DmcOmni.instance().addCompactSchema(curr.getCompactSchema());
      }
     
      // We add the rules after we've reinitialized the DmcOmni so that we can resolve
      // applyToClass information.
      for(RuleIF rule: allRules)
View Full Code Here

//        dmwFactory      = new DmwObjectFactory(sm);
   
    Iterator<SchemaDefinition> sdit = sm.getSchemas();
    if (sdit != null){
      while(sdit.hasNext()){
        SchemaDefinition sd = sdit.next();
        allSchemasByID.put(sd.getSchemaBaseID(), sd);
        allSchemasByName.put(sd.getName().getNameString(), sd);
       
      }
    }
   
    buildSidebar();
   
    buildIDSummary();
   
    DmcOmni.instance().setTrackSchemaReferences(true);
    DmcOmni.instance().backRefTracking(true);   

    for(DmsDefinition def: sm.allDefs.values()){
      def.getDMO().clearReferenceInfo();
    }
   
    for(DmsDefinition def: sm.allDefs.values()){
      addDefinition(def);
      try {
        def.resolveReferences(sm);
       
      } catch (DmcValueExceptionSet e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
   
    for(SchemaDefinition sd: allSchemasByName.values()){
      Iterator<RuleDataDMO> rules = sd.getParsedRulesDMOs(sm);
      while(rules.hasNext()){
        RuleDataDMO rule = rules.next();
        try {
          rule.resolveReferences(sm);
        } catch (DmcValueExceptionSet e) {
View Full Code Here

  public void addReadSchemas(SchemaManager sm) throws IOException {
       
    Iterator<SchemaDefinition> sdit = sm.getSchemas();
    if (sdit != null){
      while(sdit.hasNext()){
        SchemaDefinition sd = sdit.next();
       
        allSchemasByID.put(sd.getSchemaBaseID(), sd);
        allSchemasByName.put(sd.getName().getNameString(), sd);
       
        if (sd.getName().getNameString().length() > longest)
          longest = sd.getName().getNameString().length();
      }
    }
   
   
  }
View Full Code Here

TOP

Related Classes of org.dmd.dms.SchemaDefinition

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.