Package org.dmd.dms

Examples of org.dmd.dms.SchemaDefinition


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

   
  }

  void createWrappers(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm) throws IOException, ResultException {
       
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
        cd.adjustJavaClass();
       
        if (cd.getDMWPackage() == null){
          ResultException ex = new ResultException();
          ex.addError("The " + cd.getDefinedIn().getName() + " schema must define the dmwPackage attribute to facilitate wrapper creation.");
          ex.result.lastResult().fileName(cd.getDefinedIn().getFile());
          throw(ex);
        }
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
          dumpWrapper(config, loc, f, sm, cd);
        }
      }
    }
   
   
    Iterator<TypeDefinition>  tdefs = sd.getInternalTypeDefList();
    while(tdefs.hasNext()){
      TypeDefinition td = tdefs.next();
     
      ClassDefinition cd = td.getOriginalClass();
      if (cd != null){
View Full Code Here

    namedWrapper = namedWrapperImport.substring(lastdot+1);
       
    lastdot = hierarchicWrapperImport.lastIndexOf(".");
    hierarchicWrapper = hierarchicWrapperImport.substring(lastdot+1);
       
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
   
    if (sd.getDmwPackage(genContext) == null){
      System.err.println("The " + sd.getName() + " schema must define a dmwTypeToPackage mapping for this context: " + genContext);
      System.err.println("You should do this for all other schemas on which this schema depends.\n");
      System.err.println("Example: dmwTypeToPackage gxt com.example.client\n");
      System.exit(1);
    }
   
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
       
        if (cd.generateWrapper(genContext) == false){
//          DebugInfo.debug("Skipping " + cd.getName() + " for context " + genContext);
          continue;
        }
       
        cd.adjustJavaClass(genContext,genSuffix);
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          createIfRequired(auxwdir);
          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
          dumpWrapper(config, loc, f, sm, cd);
        }
      }
    }
   
    if (useWrappedObjectRefs){
      Iterator<TypeDefinition>  tdefs = sd.getInternalTypeDefList();
      while(tdefs.hasNext()){
        TypeDefinition td = tdefs.next();
       
        ClassDefinition cd = td.getOriginalClass();
        if (cd != null){
          dumpIterable(config, loc, f, sm, cd, sd);
        }
      }
     
      Iterator<ExtendedReferenceTypeDefinition> extrefs = sd.getExtendedReferenceTypeDefList();
      while(extrefs.hasNext()){
        ExtendedReferenceTypeDefinition ertd = extrefs.next();
        ClassDefinition cd = ertd.getExtendedReferenceClass();
        dumpExtendedReferenceIterable(config, loc, f, sm, cd, sd, ertd);
      }
View Full Code Here

        out.write("        staticRefName   = \"" + genPackage + ".generated." + schemaName + "\";\n\n");
        if (hasDependency){
          Iterator<String> dependsOn = schema.getDependsOn();
          while(dependsOn.hasNext()){
            String dep = dependsOn.next();
                SchemaDefinition ds = sm.isSchema(dep);
                String sclass = ds.getDmwPackage() + ".generated." + GeneratorUtils.dotNameToCamelCase(dep) + "SchemaAG";
                out.write("        dependsOnSchemaClasses.put(\"" + dep + "\"," + "\"" + sclass + "\");\n");
          }
          out.write("\n");
        }

        out.write("    }\n\n");
       
        out.write("    private void initialize() throws DmcValueException {\n");
        out.write("        if (instance == null){\n");
        out.write("            instance        = this;\n");
       
        out.write("            SchemaDefinitionDMO me = (SchemaDefinitionDMO) this.getDmcObject();\n");
        out.write("            me.setName(\"" +       schema.getName() + "\");\n");
        out.write("            me.setSchemaPackage(\"" +   schema.getSchemaPackage() + "\");\n");
        out.write("            me.setDmwPackage(\"" +     schema.getDmwPackage() + "\");\n");
        out.write("            me.setFile(\"" +       schema.getFile() + "\");\n\n");
       
        if (hasDependency){
          Iterator<String> dependsOn = schema.getDependsOn();
       
          out.write("\n");
          while(dependsOn.hasNext()){
            String dep = dependsOn.next();
                out.write("            me.addDependsOn(\"" + dep + "\");\n");
                SchemaDefinition ds = sm.isSchema(dep);
                String sclass = ds.getDmwPackage() + ".generated." + GeneratorUtils.dotNameToCamelCase(dep) + "SchemaAG";
                out.write("            dependsOnSchemaClasses.put(\"" + dep + "\"," + "\"" + sclass + "\");\n\n");
          }
          out.write("\n");
        }
       
View Full Code Here

    namedWrapper = namedWrapperImport.substring(lastdot+1);
       
    lastdot = hierarchicWrapperImport.lastIndexOf(".");
    hierarchicWrapper = hierarchicWrapperImport.substring(lastdot+1);
       
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
   
    if (sd.getDmwPackage(genContext) == null){
      System.err.println("The " + sd.getName() + " schema must define a dmwTypeToPackage mapping for this context: " + genContext);
      System.err.println("You should do this for all other schemas on which this schema depends.\n");
      System.err.println("Example: dmwTypeToPackage gxt com.example.client\n");
      System.exit(1);
    }
   
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
        cd.adjustJavaClass(genContext,genSuffix);
View Full Code Here

    namedWrapper = namedWrapperImport.substring(lastdot+1);
       
    lastdot = hierarchicWrapperImport.lastIndexOf(".");
    hierarchicWrapper = hierarchicWrapperImport.substring(lastdot+1);
       
    SchemaDefinition sd = sm.isSchema(config.getSchemaToLoad());
   
    if (sd.getDmwPackage(genContext) == null){
      System.err.println("The " + sd.getName() + " schema must define a dmwTypeToPackage mapping for this context: " + genContext);
      System.err.println("You should do this for all other schemas on which this schema depends.\n");
      System.err.println("Example: dmwTypeToPackage gxt com.example.client\n");
      System.exit(1);
    }
   
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
       
        if (cd.generateWrapper(genContext) == false){
//          DebugInfo.debug("Skipping " + cd.getName() + " for context " + genContext);
          continue;
        }
       
        cd.adjustJavaClass(genContext,genSuffix);
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
//          createIfRequired(auxwdir);
          dumpAUX(cd, dmwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
          dumpWrapper(config, loc, f, sm, cd);
        }
      }
    }
   
    if (useWrappedObjectRefs){
      Iterator<TypeDefinition>  tdefs = sd.getInternalTypeDefList();
      while(tdefs.hasNext()){
        TypeDefinition td = tdefs.next();
       
        ClassDefinition cd = td.getOriginalClass();
        if (cd != null){
          dumpIterable(config, loc, f, sm, cd, sd);
        }
      }
     
      Iterator<ExtendedReferenceTypeDefinition> extrefs = sd.getExtendedReferenceTypeDefList();
      while(extrefs.hasNext()){
        ExtendedReferenceTypeDefinition ertd = extrefs.next();
        ClassDefinition cd = ertd.getExtendedReferenceClass();
        dumpExtendedReferenceIterable(config, loc, f, sm, cd, sd, ertd);
      }
View Full Code Here

   * @param mdm The
   */
  public void mergeDefinitions(MvwDefinitionManager mdm){
    Iterator<SchemaDefinition>  schemas = mdm.readSchemas.getSchemas();
    while(schemas.hasNext()){
      SchemaDefinition sd = schemas.next();
      try {
        if (readSchemas.isSchema(sd.getName().getNameString()) == null)
          readSchemas.manageSchemaInternal(sd, false);
      } catch (ResultException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (DmcValueException e) {
View Full Code Here

     * NOTE: If WARNINGs are encountered, we still the schema - just check for the
     * presence of WARNINGs on the result set when parsing is complete.
     * @throws DmcRuleExceptionSet
     */
    public SchemaDefinition parseSchema(SchemaManager am, String schemaName, boolean terse) throws ResultException, DmcValueException, DmcRuleExceptionSet {
        SchemaDefinition rc;
       
        allSchema = am;
        initialize();

        terseV = terse;
View Full Code Here

     */
    SchemaDefinition parseSchemaInternal(String schemaName) throws ResultException, DmcValueException, DmcRuleExceptionSet {
//      DmsSchemaLocation  location  = finder.getLocation(schemaName);
      ConfigVersion    config    = finder.getConfig(schemaName);
      ConfigLocation    location  = null;
        SchemaDefinition    currSchema = null;
        String            currFile = null;
        SchemaDefinition    nativeSchema = null;
       
        if (config == null){
          ResultException ex = new ResultException();
          ex.addError("The specified schema couldn't be found: " + schemaName);
          throw(ex);
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.