public File createManifestFile() throws FileNotFoundException, UnsupportedEncodingException { // create catalog.xml component library: File outputFile = new File(configClassRegistry.getConfig().getSourcePath().get(0), "manifest.xml"); System.out.printf("Creating manifest file %s...%n", outputFile.getPath()); PrintStream out = new PrintStream(new FileOutputStream(outputFile), true, net.jangaroo.exml.api.Exmlc.OUTPUT_CHARSET); Collection<ConfigClass> sourceConfigClasses = configClassRegistry.getSourceConfigClasses(); List<String> classes = new ArrayList<String>(sourceConfigClasses.size() * 2); for (ConfigClass configClass : sourceConfigClasses) { classes.add(configClass.getComponentClassName()); } Collections.sort(classes); out.println("<?xml version=\"1.0\"?>"); out.println("<componentPackage>"); for (String aClass : classes) { out.printf(" <component class=\"%s\"/>%n", aClass); } out.println("</componentPackage>"); out.close(); return outputFile; } }
public File createManifestFile() throws FileNotFoundException, UnsupportedEncodingException { // create catalog.xml component library: File outputFile = new File(configClassRegistry.getConfig().getSourcePath().get(0), "manifest.xml"); System.out.printf("Creating manifest file %s...%n", outputFile.getPath()); PrintStream out = new PrintStream(new FileOutputStream(outputFile), true, net.jangaroo.exml.api.Exmlc.OUTPUT_CHARSET); Collection<ConfigClass> sourceConfigClasses = configClassRegistry.getSourceConfigClasses(); List<String> classes = new ArrayList<String>(sourceConfigClasses.size() * 2); for (ConfigClass configClass : sourceConfigClasses) { classes.add(configClass.getComponentClassName()); } Collections.sort(classes); out.println("<?xml version=\"1.0\"?>"); out.println("<componentPackage>"); for (String aClass : classes) { out.printf(" <component class=\"%s\"/>%n", aClass); } out.println("</componentPackage>"); out.close(); return outputFile; } }
private File exmlToMxml(ExmlSourceFile exmlSourceFile) throws IOException, SAXException { ExmlModel exmlModel = new ExmlToModelParser(configClassRegistry).parse(exmlSourceFile.getSourceFile()); File sourceFile = exmlSourceFile.getSourceFile(); File outputFile = CompilerUtils.fileFromQName(exmlSourceFile.getTargetClassName(), configClassRegistry.getConfig().getSourcePath().get(0), ".mxml"); FileUtils.forceMkdir(outputFile.getParentFile()); PrintStream writer = new PrintStream(new FileOutputStream(outputFile), true, net.jangaroo.exml.api.Exmlc.OUTPUT_CHARSET); ExmlToConfigClassParser.parseFileWithHandler(sourceFile, new ExmlToMxmlHandler(exmlSourceFile, exmlModel, writer)); return outputFile; }
private File exmlToMxml(ExmlSourceFile exmlSourceFile) throws IOException, SAXException { ExmlModel exmlModel = new ExmlToModelParser(configClassRegistry).parse(exmlSourceFile.getSourceFile()); File sourceFile = exmlSourceFile.getSourceFile(); File outputFile = CompilerUtils.fileFromQName(exmlSourceFile.getTargetClassName(), configClassRegistry.getConfig().getSourcePath().get(0), ".mxml"); FileUtils.forceMkdir(outputFile.getParentFile()); PrintStream writer = new PrintStream(new FileOutputStream(outputFile), true, net.jangaroo.exml.api.Exmlc.OUTPUT_CHARSET); ExmlToConfigClassParser.parseFileWithHandler(sourceFile, new ExmlToMxmlHandler(exmlSourceFile, exmlModel, writer)); return outputFile; }
public ConfigClassRegistry(final ExmlConfiguration config) throws IOException { this.config = config; sourcePathInputSource = PathInputSource.fromFiles(config.getSourcePath(), new String[0], true); ParserOptions parserOptions = new CCRParserOptions(); jangarooParser = new JangarooParser(parserOptions, new StdOutCompileLog()) { @Override protected InputSource findSource(String qname) { InputSource inputSource = super.findSource(qname); if (inputSource != null) { // A regular source file (not a generated file) has been found. Use it. return inputSource; } // Just in case the requested class is a class // that is generated from an EXML file, regenerate the file before // it is too late. This will only affect generated files, so it is pretty safe. tryGenerateClass(qname); // Just in case the source was not found on the first attempt, fetch it again. return super.findSource(qname); } }; List<File> fullClassPath = new ArrayList<File>(config.getClassPath()); fullClassPath.add(config.getOutputDirectory()); InputSource classPathInputSource = PathInputSource.fromFiles(fullClassPath, new String[]{"", JangarooParser.JOO_API_IN_SWC_DIRECTORY_PREFIX}, false); jangarooParser.setUp(sourcePathInputSource, classPathInputSource); jangarooParser.setCompilableSuffixes(Collections.singletonList(Jooc.AS_SUFFIX)); exmlConfigPackageXsdGenerator = new ExmlConfigPackageXsdGenerator(); }
public ConfigClassRegistry(final ExmlConfiguration config) throws IOException { this.config = config; sourcePathInputSource = PathInputSource.fromFiles(config.getSourcePath(), new String[0], true); ParserOptions parserOptions = new CCRParserOptions(); jangarooParser = new JangarooParser(parserOptions, new StdOutCompileLog()) { @Override protected InputSource findSource(String qname) { InputSource inputSource = super.findSource(qname); if (inputSource != null) { // A regular source file (not a generated file) has been found. Use it. return inputSource; } // Just in case the requested class is a class // that is generated from an EXML file, regenerate the file before // it is too late. This will only affect generated files, so it is pretty safe. tryGenerateClass(qname); // Just in case the source was not found on the first attempt, fetch it again. return super.findSource(qname); } }; List<File> fullClassPath = new ArrayList<File>(config.getClassPath()); fullClassPath.add(config.getOutputDirectory()); InputSource classPathInputSource = PathInputSource.fromFiles(fullClassPath, new String[]{"", JangarooParser.JOO_API_IN_JAR_DIRECTORY_PREFIX}, false); jangarooParser.setUp(sourcePathInputSource, classPathInputSource); exmlConfigPackageXsdGenerator = new ExmlConfigPackageXsdGenerator(); }