Package org.apache.twill.filesystem

Examples of org.apache.twill.filesystem.Location.createNew()


    }

    //Get the library zip, copy it to temp dir, unzip it
    String libFile = Platform.libraryResource();
    Location libZip = dir.append(libFile);
    libZip.createNew();
    copyResourceFileToDir(libFile, libZip);
    unzipFile(libZip);

    //Create directory structure to place the Stream Engine Config Files
    Location workDir = dir.append("work");
View Full Code Here


    return queryDir;
  }

  private Location createFile(Location dir, String name) throws IOException {
    Location file = dir.append(name);
    file.createNew();
    return file;
  }

  private void writeToLocation(Location loc, String content) throws IOException {
    CharStreams.write(content, CharStreams.newWriterSupplier(Locations.newOutputSupplier(loc), Charsets.UTF_8));
View Full Code Here

      }

      Location jarInHDFS = location.append(flowName);
      //Delete any existing JAR with the same flowName.
      jarInHDFS.delete();
      jarInHDFS.createNew();

      //Copy the JAR to HDFS.
      ByteStreams.copy(Locations.newInputSupplier(program.getJarLocation()), Locations.newOutputSupplier(jarInHDFS));
      //Start the Flow.
      deployClient.startFlow(program, userArgs);
View Full Code Here

      Location eventFile = StreamUtils.createStreamLocation(partitionDirectory, fileNamePrefix,
                                                            fileSequence, StreamFileType.EVENT);
      Location indexFile = StreamUtils.createStreamLocation(partitionDirectory, fileNamePrefix,
                                                            fileSequence, StreamFileType.INDEX);
      // The creation should succeed, as it's expected to only have one process running per fileNamePrefix.
      if (!eventFile.createNew() || !indexFile.createNew()) {
        throw new IOException("Failed to create new file at " + eventFile.toURI() + " and " + indexFile.toURI());
      }

      LOG.debug("New stream file created at {}", eventFile.toURI());
      return new StreamDataFileWriter(createOutputSupplier(eventFile), createOutputSupplier(indexFile), indexInterval);
View Full Code Here

  public void create(String name, @Nullable Properties props) throws Exception {
    Location streamLocation = streamBaseLocation.append(name);
    Locations.mkdirsIfNotExists(streamLocation);

    Location configLocation = streamBaseLocation.append(name).append(CONFIG_FILE_NAME);
    if (!configLocation.createNew()) {
      // Stream already exists
      return;
    }

    Properties properties = (props == null) ? new Properties() : props;
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.