Package org.dmd.util.parsing

Examples of org.dmd.util.parsing.ConfigLocation


       
       
        if (autogen.booleanValue()){
         
          for(ConfigVersion version: configFinder.getVersions().values()){
            ConfigLocation loc = version.getLatestVersion();
           
//                DebugInfo.debug(loc.toString());
           
            if (!loc.isFromJAR()){
              // Wasn't in a jar, so try to generate
//                  DebugInfo.debug("Config is not from JAR - generating: " + loc.getConfigName());
              generateFromConfig(version);
            }
           
            aggregateManager.mergeDefinitions(defManager);
          }
         
          System.out.println("DONE");
         
      try {
        if (docdir.length() > 0){
          if (workspace.length() > 0)
              docGenerator.dumpDocumentation(workspace.toString() + "/" + docdir.toString());
          else
            docGenerator.dumpDocumentation(docdir.toString());
        }
      } catch (IOException e) {
        System.err.println(e.toString());
        e.printStackTrace();
        System.exit(1);
      }

          System.exit(0);
        }
       
       
        System.out.println("\nmvw generator - enter the name of a Model View Whatever config\n");
        System.out.println("Enter ? for a list of configs...\n\n");
       
        while(true){
            try{
              String s = in.readLine();
              if (s == null)
                return;
             
                currLine = s.trim();

                if (currLine.length() == 0)
                    continue;
               
                tokens = classifier.classify(currLine, false);
               
                if (tokens.size() == 0)
                  continue;
               
                ConfigVersion currConfig = configFinder.getConfig(tokens.nth(0).getValue());

                if (tokens.nth(0).getValue().equals("?")){
                  System.out.println("");
                 
                  System.out.println(configFinder.getSearchInfo() + "\n");
                 
                  Iterator<ConfigVersion> it = configFinder.getVersions().values().iterator();
                  while(it.hasNext()){
                    ConfigVersion version = it.next();
                    ConfigLocation loc = version.getLatestVersion();
                   
                    if (loc.getJarFilename() == null){
                        System.out.println(format.sprintf(loc.getConfigName()) + "   version: " + loc.getVersion());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                    else{
                      System.out.println(format.sprintf("JAR " + loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                  }
                  System.out.println("");
                }
                else if (currConfig == null){
View Full Code Here


     * presence of WARNINGs on the result set when parsing is complete.
     */
    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);
        }
       
        location = config.getLatestVersion();
       
        currFile = location.getFileName();

        if (!terseV)
            System.out.println("\nParsing schema: " + schemaName);
       
        // Hold the directory name globally so that we can use it later
        schemaDir = new String(location.getDirectory());

        if ( (loadedFiles.containsKey(currFile) == false) &&
             ( (nativeSchema = allSchema.isSchema(schemaName)) == null)){
            // System.out.println("Opening " + currFile);
            // We didn't have the file, so add it to our loadedFiles set
            // and proceed with parsing.
            loadedFiles.put(currFile,null);

            if (!terseV)
                System.out.println("    Reading " + currFile);
           
          schemaParser.parseFile(currFile, location.isFromJAR());
            currSchema = (SchemaDefinition)schemaStack.pop();
           
            loadedFiles.remove(currFile);
            loadedFiles.put(currFile,currSchema);
           
            allSchema.addDefinition(currSchema);
           
            // And now check to see if everything is resolved
            allSchema.resolveReferences(currSchema);
           
            Iterator<AttributeDefinition> adl = currSchema.getAttributeDefList();
            if (adl != null){
              allSchema.resolveNameTypes(adl);
            }
           
        }
        else{
            if (nativeSchema == null){
                // If we already had the file - no problem.
                currSchema = (SchemaDefinition)loadedFiles.get(currFile);
            }
            else
                currSchema = nativeSchema;
        }
       
        currSchema.setVersion(location.getVersion());

        return(currSchema);
    }
View Full Code Here

//DebugInfo.debug("Reading dependsOn: " + depSchema);
//if (depSchema.equals("dmv"))
//  DebugInfo.debugWithTrace("Parsing DMV");

                          ConfigVersion  config    = finder.getConfig(depSchema);
                          ConfigLocation  location  = null;
                           
                            if (config == null){
                              ResultException ex = new ResultException();
                              ex.addError("Couldn't find schema: " + depSchema + " on which schema: " + currSchema.getObjectName() + " depends.");
                              throw(ex);
                            }

                            location = config.getLatestVersion();
                           
                            currFile = location.getFileName();
                           
                            if (loadedFiles.containsKey(currFile) == false){
                                // Only load the schema if we haven't already parsed it
                                if ( (newSchema = this.parseSchemaInternal(depSchema)) == null){
                                  ResultException ex = new ResultException();
                                  ex.result.addResult(Result.FATAL,"Failed to parse schema: " + depSchema);
                                    throw(ex);
                                }

                                currSchema.addDependsOnRef(newSchema);

                                // Now reset schemaLoading to be null once more to
                                // mask the schema that we just read
                                schemaLoading = null;
                            }
                            else{
                                // We've already loaded this file, but we still
                                // need to update the dependsOnRef
                              // System.out.println("Adding ref to previously parsed schema: " + ((SchemaDefinition)loadedFiles.get(currFile)).getName());
                                currSchema.addDependsOnRef(loadedFiles.get(currFile));
                            }
                        }

                        // Switch back to the schema at this level of parsing
                        schemaLoading = currSchema;
//DebugInfo.debug("Switching back to : " + schemaLoading.getName());

            allSchema.schemaBeingLoaded(schemaLoading);
                    }

//                    // We let the SchemaManager know that we're loading a new schema.
//                    // This gives it the opportunity to notify its schema extensions
//                    // that this is happening.
//                    allSchema.schemaBeingLoaded(schemaLoading);

                    if ((defFiles = schemaLoading.getDefFiles()) != null){
                      ConfigLocation location = finder.getConfig(schemaLoading.getName().getNameString()).getLatestVersion();
                     
                        // And now load the files associated with this schema
                        while(defFiles.hasNext()){
                          if (location.isFromJAR())
                            currFile = "/" + location.getDirectory() + "/" + defFiles.next();
                          else
                            currFile = location.getDirectory() + File.separator + defFiles.next();
//                            currFile = schemaDir + File.separator + defFiles.next();
//DebugInfo.debug("Reading def file: " + currFile);

                            if (!terseV){
                              if (location.isFromJAR())
                                System.out.println("      Reading " + currFile + " - from " + location.getJarFilename());
                              else
                                System.out.println("      Reading " + currFile);
                            }
                           
                            if (location.isFromJAR()){
                              defParser.parseFile(currFile,true);
                            }
                            else{
                              defParser.parseFile(currFile);
                            }
View Full Code Here

//        boolean      shared    = false;
       
        if (autogen.booleanValue()){
         
          for(ConfigVersion version: finder.getVersions().values()){
            ConfigLocation loc = version.getLatestVersion();
            if (!loc.isFromJAR()){
              // Wasn't in a jar, so try to generate
              generateFromConfig(loc);
            }
          }
         
      try {
        if (docdir.length() > 0){
          if (workspace.length() > 0)
              docGenerator.dumpDocumentation(workspace.toString() + "/" + docdir.toString());
          else
            docGenerator.dumpDocumentation(docdir.toString());
        }
      } catch (IOException e) {
        System.err.println(e.toString());
        e.printStackTrace();
        System.exit(1);
      }
         
          System.exit(0);
        }

        System.out.println("\n-- dmo generator utility --\n");
        System.out.println("Enter the name of a local (non-JAR) schema to generate its code\n");
        System.out.println("Enter ? for a list of schemas...\n\n");
        while(true){
            try{
              String s = in.readLine();
              if (s == null)
                return;
             
                currLine = s.trim();

              if (currLine.length() == 0)
                    continue;
               
              tokens = classifier.classify(currLine, false);

//                DmsSchemaLocation currLoc = finder.getLocation(tokens.nth(0).getValue());
//                DmsSchemaLocation currLoc = finder.getLocation(tokens.nth(0).getValue());
              ConfigVersion    config    = finder.getConfig(tokens.nth(0).getValue());
              ConfigLocation    currLoc  = null;
             
              if (config != null)
                currLoc = config.getLatestVersion();

                if (currLine.equals("?")){
                 
                  System.out.println("");
                 
                  System.out.println(finder.getSearchInfo() + "\n");
                 
                  Iterator<ConfigVersion> it = finder.getVersions().values().iterator();
                  while(it.hasNext()){
                    ConfigVersion version = it.next();
                    ConfigLocation loc = version.getLatestVersion();
                   
                    if (loc.getJarFilename() == null){
                        System.out.println(format.sprintf(loc.getConfigName()) + "   version: " + loc.getVersion());
//                      System.out.println(format.sprintf(loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                    else{
                      System.out.println(format.sprintf("JAR " + loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                  }
                  System.out.println("");
                }
                else if (currLoc == null){
View Full Code Here

        if (autogen.booleanValue()){
         
            if (autogen.booleanValue()){
             
              for(ConfigVersion version: configFinder.getVersions().values()){
                ConfigLocation loc = version.getLatestVersion();
                if (!loc.isFromJAR()){
                  // Wasn't in a jar, so try to generate
//                  DebugInfo.debug("Generating: " + loc.getConfigName());
                  generateFromConfig(version);
                }
              }
             
              System.exit(0);
            }
         
          System.exit(0);
        }

        System.out.println("\ndmg generator - enter the name of the Dark Matter Generator config\n");
        System.out.println("Enter ? for a list of configs...\n\n");
       
        while(true){
            try{
              String s = in.readLine();
              if (s == null)
                return;
             
                currLine = s.trim();

                if (currLine.length() == 0)
                    continue;
               
                ConfigVersion currConfig = configFinder.getConfig(currLine);

                if (currLine.equals("?")){
                  System.out.println("");
                 
                  System.out.println(configFinder.getSearchInfo() + "\n");

                  Iterator<ConfigVersion> it = configFinder.getVersions().values().iterator();
                  while(it.hasNext()){
                    ConfigVersion version = it.next();
                    ConfigLocation loc = version.getLatestVersion();
                   
                    if (loc.getJarFilename() == null){
                        System.out.println(format.sprintf(loc.getConfigName()) + "   version: " + loc.getVersion());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                    else{
                      System.out.println(format.sprintf("JAR " + loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                  }
                  System.out.println("");
                }
                else if (currConfig == null){
View Full Code Here

TOP

Related Classes of org.dmd.util.parsing.ConfigLocation

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.