Examples of FileSource


Examples of ch.grengine.source.FileSource

            throws CompileException {
        if (source instanceof TextSource) {
            TextSource textSource = (TextSource)source;
            return cu.addSource(textSource.getId(), textSource.getText());
        } else if (source instanceof FileSource) {
            FileSource fileSource = (FileSource)source;
            return cu.addSource(fileSource.getFile());
        } else if (source instanceof UrlSource) {
            UrlSource urlSource = (UrlSource)source;
            return cu.addSource(urlSource.getUrl());
        } else {
            throw new CompileException("Don't know how to compile source " + source + ".", sources);
View Full Code Here

Examples of ch.hortis.sonar.model.FileSource

      highlight( file, failuresForFile, files );
    }
  }

  private void highlight( File toHighlight, List<RuleFailure> failuresForFile, List<File> snapshotFiles ) {
    FileSource source = toHighlight.getFileSource();
    if ( source != null ) {
      processCssAndFooter( source );
      highlightLines( toHighlight, failuresForFile, snapshotFiles );
    }
  }
View Full Code Here

Examples of ch.hortis.sonar.model.FileSource

  }

  private void highlightLines( File toHighlight, List<RuleFailure> failuresForFile, List<File> snapshotFiles ) {
    StringBuffer highlightedSource = new StringBuffer( 32768 );
    Set<Integer> highlightedLines = new HashSet<Integer>();
    FileSource fileSource = toHighlight.getFileSource();
   
    String[] lines = fileSource.getSource().split( "\\n" );
    for (String line1 : lines) {
      String line = line1.trim();
      if ( line.length() == 0 ) continue;
      Matcher sourceLineMatcher = getSourceLineMatcher( line );
      if ( sourceLineMatcher.find() ) {
        int lineNumber = Integer.parseInt( sourceLineMatcher.group( 1 ) );
        int sourceCodeStart = sourceLineMatcher.end( 0 );
        List<RuleFailure> failuresForGivenLine = getFailuresForGivenLine( toHighlight, failuresForFile, lineNumber );
        if ( failuresForGivenLine.size() > 0 ) {
          line = highlightLine( toHighlight, failuresForGivenLine, line, sourceCodeStart, lineNumber );
          highlightedLines.add( lineNumber );
        }
        line = replaceLineHrefs( snapshotFiles, line );
      }
      highlightedSource.append( line ).append( "\n" );
    }
    fileSource.setSource( highlightedSource.toString() );
    if ( highlightedLines.size() > 0 ) {
      addTooltipActivators( fileSource, highlightedLines );
    }
  }
View Full Code Here

Examples of com.addthis.meshy.service.file.FileSource

        if (args[0].equals("client") && args.length > 2) {
            try (Meshy more = new MeshyClient(args[1], Integer.parseInt(args[2]))) {
                if (args.length > 3) {
                    String cmd = args[3];
                    if (cmd.equals("ls") && args.length > 4) {
                        FileSource fileSource = new FileSource(more, new String[]{args[4]});
                        fileSource.waitComplete();
                        for (FileReference file : fileSource.getFileList()) {
                            System.out.println(file.getHostUUID() + " " + file.name + " \t " + file.size + " \t " + new Date(file.lastModified));
                        }
                    } else if (cmd.equals("cat") && args.length > 5) {
                        StreamSource source = null;
                        String uuid = args[4];
                        String file = args[5];
                        if (args.length > 6) {
                            int buffer = 0;
                            Map<String, String> params = null;
                            params = new HashMap<>();
                            for (int i = 6; i < args.length; i++) {
                                String kv[] = Strings.splitArray(args[i], "=");
                                if (kv[0].equals("--buffer")) {
                                    buffer = Integer.parseInt(kv[1]);
                                } else {
                                    params.put(kv[0], kv[1]);
                                }
                            }
                            source = new StreamSource(more, uuid, file, params, buffer);
                        } else {
                            source = new StreamSource(more, uuid, file, 0);
                        }
                        try (InputStream in = source.getInputStream()) {
                            byte[] buffer = new byte[4096];
                            int read = 0;
                            while ((read = in.read(buffer)) >= 0) {
                                if (read == 0) {
                                    continue;
                                }
                                if (read < 0) {
                                    break;
                                }
                                System.out.write(buffer, 0, read);
                            }
                        }
                        source.waitComplete();
                    } else if (cmd.equals("peer")) {
                        HostSource hostSource = new HostSource(more);
                        for (int i = 4; i < args.length; i++) {
                            hostSource.addPeer(args[i]);
                        }
                        hostSource.sendRequest();
                        hostSource.waitComplete();
                        for (HostNode node : hostSource.getHostList()) {
                            System.out.println(node.uuid + " \t " + node.address);
                        }
                    } else if (cmd.equals("madcat") && args.length > 5) {
                    /* usage: madcat <readers> <bufferSize> <filematch> */
                        int threads = Integer.parseInt(args[4]);
                        final int bufferSize = Integer.parseInt(args[5]);
                        final String fileMatch[] = {args[6]};
                        final DecimalFormat number = new DecimalFormat("#,###");
                        final AtomicLong totalBytes = new AtomicLong(0);
                        final AtomicLong readBytes = new AtomicLong(0);
                        final AtomicLong lastEmit = new AtomicLong(JitterClock.globalTime());
                        final FileSource fs = new FileSource(more, fileMatch, new DupFilter());
                        fs.waitComplete();
                        final Iterator<FileReference> fsIter = fs.getFileList().iterator();
                        final HashMap<FileReference, Long> perfData = new HashMap<>();
                        final AtomicInteger open = new AtomicInteger(0);

                        class SourceReader extends Thread {

View Full Code Here

Examples of com.github.sommeri.less4j.LessSource.FileSource

  private static final String file = "src/test/resources/less-source/level-1/level-2/source.less";

  @Test
  public void lastModifiedPropagation() throws FileNotFound, CannotReadFile {
    FileSource main = new FileSource(new File(file));
    FileSource firstImport = main.relativeSource("imported-1.less");
    FileSource secondImport = firstImport.relativeSource("../imported-2.less");
   
    long mainModified = setLastModified(main, 1364590362375L);
    long firstModified = setLastModified(firstImport, 1364590418644L);
    long secondModified = setLastModified(secondImport, 1364590474913L);
   
    main.getContent();
    assertModified(main, mainModified, mainModified);

    firstImport.getContent();
    assertModified(main, mainModified, firstModified);
    assertModified(firstImport, firstModified, firstModified);
   
    secondImport.getContent();
    assertModified(main, mainModified, secondModified);
    assertModified(firstImport, firstModified, secondModified);
    assertModified(secondImport, secondModified, secondModified);
  }
View Full Code Here

Examples of com.github.tomakehurst.wiremock.common.FileSource

        client = new WireMock(wireMockApp);
    }

    private MappingsLoader makeDefaultMappingsLoader() {
        FileSource mappingsFileSource = fileSource.child("mappings");
        if (mappingsFileSource.exists()) {
            return new JsonFileMappingsLoader(mappingsFileSource);
        } else {
            return new NoOpMappingsLoader();
        }
    }
View Full Code Here

Examples of com.google.jstestdriver.FileSource

    browsers.addSlave(slave);
    BrowserQueryResponseHandler handler =
        new BrowserQueryResponseHandler(null, null, browsers, streamedResponses);
    List<FileResult> fileResults = new LinkedList<FileResult>();

    fileResults.add(new FileResult(new FileSource("/test/filename1.js", "filename1.js", 123, -1), true, ""));
    fileResults.add(new FileResult(new FileSource("/test/filename2.js", "filename2.js", 456, -1), true, ""));
    fileResults.add(new FileResult(new FileSource("/test/filename3.js", "filename3.js", 789, -1), true, ""));
    slave.createCommand("awaitingResponse");
    slave.dequeueCommand();
    slave.createCommand("BrowserCommand");
    Response response = new Response();
View Full Code Here

Examples of com.google.jstestdriver.FileSource

        continue;
      }
      // TODO(corysmith): This is a problematic optimization.
      // If a client connects with unknown schemes and causes a reset, this will mess up miserably.
      // Must fix.
      FileSource fileSource = file.toFileSource(prefix, schemes);
      if (!(fileSource.getFileSrc().startsWith("http") || fileSource.getFileSrc().startsWith(
          "/test"))) {
        logger.debug("Unknown FileSource [{}], bail out on writing", fileSource.getFileSrc());
        // better safe than sorry.
        break;
      }
      logger.trace("Writing " + fileSource.getFileSrc());
      String fileJson = gson.toJson(fileSource).replace("\\", "\\\\");
      writer.writeScript(format("jstestdriver.manualResourceTracker.startResourceLoad('%s')",
          fileJson));
      if (fileSource.getFileSrc().endsWith(".css")) {
        writer.writeStyleSheet(fileSource.getFileSrc());
      } else {
        writer.writeExternalScript(fileSource.getFileSrc());
      }
      writer.writeScript(format("jstestdriver.manualResourceTracker.finishResourceLoad('%s')",
          fileJson));
    }
  }
View Full Code Here

Examples of com.sun.enterprise.util.io.FileSource

  ///////////////////////////////////////////////////////////////////////////
 
  private final File setAppDirDirectory() throws IASDeploymentException
  {
    FileSource fileSource = request.getFileSource();

    if(!fileSource.exists())
    {
      String msg = localStrings.getString("enterprise.deployment.backend.file_source_does_not_exist", fileSource );
      throw new IASDeploymentException( msg );
    }

    assert fileSource.isDirectory();
    File appDirectory = fileSource.getFile();

    return appDirectory;
  }
View Full Code Here

Examples of com.sun.enterprise.util.io.FileSource

                File parent = new File(getInstanceEnv().getApplicationRepositoryPath());
                appDirectory = new File(parent, getAppName());
                appDirectory.mkdirs();
            }
            else if(isDirectory()) {
                FileSource fileSource = request.getFileSource();
               
                if(!fileSource.exists()) {
                    String msg = localStrings.getString(
                    "enterprise.deployment.backend.file_source_does_not_exist",
                    fileSource.toString() );
                    throw new IASDeploymentException( msg );
                }
               
                assert fileSource.isDirectory();
                appDirectory = fileSource.getFile();
            }
            else {
                String msg = localStrings.getString(
                "enterprise.deployment.backend.deployment_not_dir_or_archive");
                throw new IASDeploymentException( msg );
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.