Package com.google.gwt.dev.resource

Examples of com.google.gwt.dev.resource.Resource


    TreeLogger logger = TreeLogger.NULL;
    compilerContext.getOptions().setEnforceStrictSourceResources(strictResources);
    compilerContext.getOptions().setEnforceStrictPublicResources(strictResources);
    ModuleDef emptyModule = ModuleDefLoader.loadFromClassPath(
        logger, compilerContext, "com.google.gwt.dev.cfg.testdata.merging.Empty");
    Resource sourceFile =
        emptyModule.findSourceFile("com/google/gwt/dev/cfg/testdata/merging/client/InOne.java");
    Resource publicFile = emptyModule.findPublicFile("Public.java");
    if (strictResources) {
      // Empty.gwt.xml did not register any source or public paths and the strictResource setting is
      // blocking the implicit addition of any default entries. So these resource searches should
      // fail.
      assertNull(sourceFile);
View Full Code Here


  public MockClassPathEntry(String pathRoot) {
    this.pathRoot = pathRoot;
  }

  public void addResource(String resourcePath) {
    Resource old = resourceMap.get(resourcePath);
    Assert.assertNull(
        "resource already exists; use updateResource() to replace", old);
    resourceMap.put(resourcePath, createMockResource(resourcePath));
  }
View Full Code Here

  public String getLocation() {
    return pathRoot;
  }

  public void removeResource(String resourcePath) {
    Resource old = resourceMap.get(resourcePath);
    Assert.assertNotNull(
        "resource does not already exists; use addResource() to add it first",
        old);
    resourceMap.remove(resourcePath);
  }
View Full Code Here

    assertNull(oracle.getResource("com/google/gwt/i18n/client/DoesntExist.java"));
  }

  private void readAndAssertResource(ResourceOracleImpl oracle, String path, String expectedPackage)
      throws IOException {
    Resource res = oracle.getResource(path);
    assertNotNull(res);
    BufferedReader rdr = null;
    try {
      InputStream is = res.openContents();
      assertNotNull(is);
      rdr = new BufferedReader(new InputStreamReader(is));
      // Skip lines until package line is found.
      String line = rdr.readLine();
      while (line != null && !line.startsWith("package")) {
View Full Code Here

  public void testInlineAccrossFiles() throws Exception {
    recordFileNamesProp.setValue("true");
    recordLineNumbersProp.setValue("true");
    inline = true;

    Resource someClassJavaResource = new MockJavaResource("test.SomeClass") {
      @Override
      public CharSequence getContent() {
        return Joiner.on('\n').join(
            "package test;",
            "public class SomeClass {",
View Full Code Here

    URL foundResource = null;
    try {
      // Look for the requested file on the public path.
      //
      ModuleDef moduleDef = getModuleDef(logger, moduleName);
      Resource publicResource = moduleDef.findPublicFile(partialPath);
      if (publicResource != null) {
        foundResource = publicResource.getURL();
      }

      if (foundResource == null) {
        // Look for public generated files
        File shellDir = getShellWorkDirs().getShellPublicGenDir(moduleDef);
View Full Code Here

    }

    String partialPath = path.substring(moduleContext.length());

    // Try to get the resource from the application's public path
    Resource publicResource = moduleDef.findPublicFile(partialPath);
    if (publicResource != null) {
      return publicResource.getURL();
    }

    // Otherwise try the path in the shell's public generated directory
    File shellDir = workDirs.getShellPublicGenDir(moduleDef);
    File requestedFile = new File(shellDir, partialPath);
View Full Code Here

  private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
      ResourceOracle resourceOracle, String templatePath)
      throws UnableToCompleteException {

    Resource resource = resourceOracle.getResourceMap().get(templatePath);
    if (null == resource) {
      logger.die("Unable to find resource: " + templatePath);
    }

    Document doc = null;
    try {
      String content = designTime.getTemplateContent(templatePath);
      if (content == null) {
        content = Util.readStreamAsString(resource.openContents());
      }
      doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
          content, resource.getPath());
    } catch (SAXParseException e) {
      logger.die(
          "Error parsing XML (line " + e.getLineNumber() + "): "
              + e.getMessage(), e);
    }
View Full Code Here

   {
      try
      {
         String resourceName =
               bundleType_.getQualifiedSourceName().replace('.', '/') + ".cmd.xml";
         Resource resource = resourceMap_.get(resourceName);
         if (resource == null)
            return null;

         Object result = XPathFactory.newInstance().newXPath().evaluate(
               xpath,
               new InputSource(resource.getLocation()),
               XPathConstants.NODESET);
         return (NodeList) result;
      }
      catch (Exception e)
      {
View Full Code Here

    return getResourceMap().get(pathName);
  }

  @Override
  public InputStream getResourceAsStream(String pathName) {
    Resource resource = getResource(pathName);
    if (resource == null) {
      return null;
    }
    try {
      return resource.openContents();
    } catch (IOException e) {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.resource.Resource

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.