Package javax.tools

Examples of javax.tools.FileObject.toUri()


                    MODULE_DEV_FILENAME);
            OutputStream output = sourceFile.openOutputStream();
            new TemplateProcessor().process(MODULE_DEV_TEMPLATE, model, output);
            output.flush();
            output.close();
            System.out.println("Written GWT dev module to " + sourceFile.toUri().toString());
        } catch (IOException e) {
            throw new RuntimeException("Failed to create file", e);
        }
    }
View Full Code Here


      CharSequence relativeName, Element... originatingElements)
      throws IOException {
    validateName(relativeName);
    FileObject fo = _fileManager.getFileForOutput(
        location, pkg.toString(), relativeName.toString(), null);
    URI uri = fo.toUri();
    if (_createdFiles.contains(uri)) {
      throw new FilerException("Resource already created : " + location + '/' + pkg + '/' + relativeName); //$NON-NLS-1$
    }

    _createdFiles.add(uri);
View Full Code Here

  private ConfigurationMetadata mergeManualMetadata(ConfigurationMetadata metadata) {
    try {
      FileObject manualMetadata = this.processingEnv.getFiler().getResource(
          StandardLocation.CLASS_PATH, "",
          "META-INF/additional-spring-configuration-metadata.json");
      if (!"file".equals(manualMetadata.toUri().getScheme())) {
        // We only want local files, not any classpath jars
        return metadata;
      }
      InputStream inputStream = manualMetadata.openInputStream();
      try {
View Full Code Here

        //create classpath roots (classoutput, sourceoutput, source path, or current dir
        String classpath = "";
        try
        {
            FileObject f = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", "d");
            classpath = new File(new URL(f.toUri().toString()).toURI()).getParentFile().getAbsolutePath() + File.separatorChar;
            classpathURLs.add(new URL("file:/"+classpath));
        }
        catch (Exception e1)
        {
            try
View Full Code Here

        catch (Exception e1)
        {
            try
            {
                FileObject f = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", "d");
                classpath = new File(new URL(f.toUri().toString()).toURI()).getParentFile().getAbsolutePath() + File.separatorChar;
                classpathURLs.add(new URL("file:/"+classpath));
            }
            catch (Exception e2)
            {
                try
View Full Code Here

            catch (Exception e2)
            {
                try
                {
                    FileObject f = processingEnv.getFiler().getResource(StandardLocation.SOURCE_PATH, "", "d");
                    classpath = new File(new URL(f.toUri().toString()).toURI()).getParentFile().getAbsolutePath() + File.separatorChar;
                    classpathURLs.add(new URL("file:/"+classpath));
                }
                catch (Exception e3)
                {
                }
View Full Code Here

      }
      catch (Exception e) {
        throw UNRESOLVED_ASSET.failure(path).initCause(e);
      }
      if (src != null) {
        URI uri = src.toUri();
        context.info("Found asset " + path + " on source path " + uri);
        try {
          String scheme = uri.getScheme();
          if (scheme == null) {
            uri = new URI("file:" + uri);
View Full Code Here

                FileObject scriptFile = owner.application.getProcessingContext().createResource(StandardLocation.CLASS_OUTPUT, key, elements);
                Writer writer = null;
                try {
                  writer = scriptFile.openWriter();
                  writer.append(content);
                  log.info("Generated template script " + path.getCanonical() + " as " + scriptFile.toUri() +
                      " with originating elements " + Arrays.asList(elements));
                }
                finally {
                  Tools.safeClose(writer);
                }
View Full Code Here

      try {
        FileObject classFile = owner.application.getProcessingContext().createSourceFile(resolvedPath.getName(), elements);
        writer = classFile.openWriter();
        emitClass(provider, template, elements, writer);
        classCache.put(path, classFile);
        log.info("Generated template class " + path + " as " + classFile.toUri() +
            " with originating elements " + Arrays.asList(elements));
      }
      catch (IOException e) {
        e.printStackTrace();
        throw TemplateMetaModel.CANNOT_WRITE_TEMPLATE_CLASS.failure(e, elements[0], path);
View Full Code Here

      try {
        FileObject file = getContext().getResource(StandardLocation.SOURCE_OUTPUT, "juzu", "metamodel.ser");
        in = file.openInputStream();
        ObjectInputStream ois = new ObjectInputStream(in);
        state = (MetaModelState<P, M>)ois.readObject();
        log.info("Loaded model from " + file.toUri());
      }
      catch (Exception e) {
        log.info("Created new meta model");
        MetaModelState<P, M> metaModel = new MetaModelState<P, M>(getPluginType(), createMetaModel());
        metaModel.init(getContext());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.