Package com.google.gxp.compiler.fs

Examples of com.google.gxp.compiler.fs.FileRef


                                                     long compilationVersion) {
    Set<FileRef> result = Sets.newHashSet();
    for (FileRef sourceFileRef : sourceFileRefs) {
      for (OutputLanguage language : outputLanguages) {
        String suffix = language.getSuffix(compilationVersion);
        FileRef outputFileRef = sourceFileRef.removeExtension().addSuffix(suffix);
        result.add(outputFileRef);
      }
    }
    return result;
  }
View Full Code Here


  }

  private static final String PATH_PREFIX = "/com/google/gxp/compiler/schema/";

  private void add(FileSystem fs, String fnam, String nsUri, String... contentTypeNames) {
    FileRef ref = fs.parseFilename(PATH_PREFIX).join(fnam);
    addSchemaPromise(ref, nsUri, contentTypeNames);
  }
View Full Code Here

   * Delete the gxp file with the given name
   */
  protected final boolean deleteFile(String name) {
    String pkgDir = getPackage().replace('.', '/');
    String sourceName = "/" + pkgDir + "/" + name + ".gxp";
    FileRef fileRef = fs.parseFilename(sourceName);

    return fileRef.delete();
  }
View Full Code Here

  protected final void compileNoHeader(String... lines) throws Exception {
    compileNoHeader(Joiner.on("\n").join(lines));
  }

  protected final void compileNoHeader(String contents) throws Exception {
    FileRef gxpFile = createFileNoHeader(getTemplateBaseName(), contents);
    compileFiles(gxpFile);
  }
View Full Code Here

   * declarations on the first line, and will end with the corresponding close
   * tag. There will also be an xmlns declaration, "my", for the call namespace
   * of the generated template.
   */
  protected final void compile(String snippet) throws Exception {
    FileRef gxpFile = createFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }
View Full Code Here

    FileRef gxpFile = createFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }

  protected final void compileInterface(String snippet) throws Exception {
    FileRef gxpFile = createInterfaceFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }
View Full Code Here

    SourceEntityResolver entityResolver = new FileSystemEntityResolver(sourcePathFs);
    Parser parser = new Parser(BuiltinSchemaFactory.INSTANCE,
                               SaxXmlParser.INSTANCE,
                               entityResolver);

    FileRef fileRef = addFileToSourceFs(createSourceFileName(), s);
    return parser.parse(fileRef);
  }
View Full Code Here

    assertElementExists(HTML_NS, "img");
  }

  private FileRef addFileToSourceFs(String path, String content)
      throws IOException {
    FileRef fileRef = sourcePathFs.parseFilename(path);
    OutputStream out = fileRef.openOutputStream();
    try {
      Writer outW = new OutputStreamWriter(out, "UTF-8");
      outW.write(content);
      outW.flush();
    } finally {
View Full Code Here

  private void testCodeGenPath(String gxpSource,
                               AlertSink alertSink,
                               OutputLanguage... outputLanguages)
      throws Exception {
    // Create source file.
    FileRef gxpFileRef = fs.parseFilename("inmemory/gxp/test/Main.gxp");
    Writer gxpFile = gxpFileRef.openWriter(Charsets.US_ASCII);
    gxpFile.write(gxpSource);
    gxpFile.close();

    // Compile it.
    SchemaFactory schemaFactory = BuiltinSchemaFactory.INSTANCE;
View Full Code Here

        builder, DefaultAlertPolicy.INSTANCE, Severity.INFO);
    return filter;
  }

  private String getCodeFor(String systemFilename) throws IOException {
    FileRef fileRef = fs.parseFilename(systemFilename);
    String code = new String(ByteStreams.toByteArray(fileRef.openInputStream()));
    return code;
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.fs.FileRef

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.