Package org.apache.twill.filesystem

Examples of org.apache.twill.filesystem.LocalLocationFactory


    // Note: It's a little bit hacky based on the uri schema to create the LocationFactory, refactor it later.
    URI appDir = URI.create(System.getenv(EnvKeys.TWILL_APP_DIR));

    try {
      if ("file".equals(appDir.getScheme())) {
        return new LocalLocationFactory().create(appDir);
      }

      if ("hdfs".equals(appDir.getScheme())) {
        if (UserGroupInformation.isSecurityEnabled()) {
          return new HDFSLocationFactory(FileSystem.get(appDir, conf)).create(appDir);
View Full Code Here


    printOutput(makeInstall.getInputStream());
    if (makeInstall.waitFor() != 0) {
      throw new RuntimeException("Failed to compile SQL Library. Make process exited with exit value " +
                                   makeInstall.exitValue());
    }
    Location target = new LocalLocationFactory().create(System.getProperty("user.dir") + "/tigon-sql/target");
    target.mkdirs();
    target.append("classes").mkdirs();
    ProcessBuilder createTarBuilder = new ProcessBuilder("tar",
                                                         "cvfz", "target/classes/" + Platform.libraryResource(),
                                                         "bin", "lib", "include", "cfg").redirectErrorStream(true);
View Full Code Here

      dataIngestionPortsMap.put(Constants.TCP_INGESTION_PORT_PREFIX + inputName, tcpPort);
    }

    // Setup temporary directory structure
    tmpFolder = Files.createTempDir();
    LocationFactory locationFactory = new LocalLocationFactory(tmpFolder);

    Location baseDir = locationFactory.create("baseDir");
    baseDir.mkdirs();

    InputFlowletConfiguration inputFlowletConfiguration = new LocalInputFlowletConfiguration(baseDir, spec);
    Location binDir = inputFlowletConfiguration.createStreamEngineProcesses();
View Full Code Here

    this.dir = dir;
  }

  public void generateBinaries() throws Exception {
    Location rootTmpDir = Locations.getParent(Locations.getParent(dir));
    Location shell = new LocalLocationFactory(new File("/")).create("/").append("bin").append("sh");

    ExternalProgramExecutor copyGSEXIT = new ExternalProgramExecutor("Copy GSEXIT", dir, shell, "-c",
                                                                     "cp ../../bin/gsexit ./GSEXIT");
    copyGSEXIT.startAndWait();
    LOG.info("Copying GSEXIT: {}", copyGSEXIT);
View Full Code Here

    }

    @Provides
    @Singleton
    private LocalLocationFactory providesLocalLocationFactory(CConfiguration cConf) {
      return new LocalLocationFactory(new File(cConf.get(Constants.CFG_LOCAL_DATA_DIR)));
    }
View Full Code Here

      public InputStream getInput() throws IOException {
        return program.getJarLocation().getInputStream();
      }
    }, tempJar);

    final Location jarLocation = new LocalLocationFactory().create(tempJar.toURI());
    return Programs.createWithUnpack(jarLocation, programDir);
  }
View Full Code Here

    return new PrivateModule() {
      @Override
      protected void configure() {
        bind(LocationFactory.class)
          .annotatedWith(Names.named("program.location.factory"))
          .toInstance(new LocalLocationFactory(new File(System.getProperty("user.dir"))));
        bind(ProgramFactory.class).in(Scopes.SINGLETON);
        expose(ProgramFactory.class);
      }
    };
  }
View Full Code Here

  private final LocationFactory locationFactory;
  private final ProgramRunnerFactory programRunnerFactory;

  @Inject
  public DeployClient(CConfiguration cConf, ProgramRunnerFactory programRunnerFactory) {
    this.locationFactory = new LocalLocationFactory(new File(cConf.get(Constants.CFG_LOCAL_DATA_DIR)));
    this.programRunnerFactory = programRunnerFactory;
  }
View Full Code Here

      deployedJar.delete(true);
    }
  }

  public static Location createAppJar(Class<?> appClass) {
    LocalLocationFactory lf = new LocalLocationFactory();
    return lf.create(JarFinder.getJar(appClass, AppFabricClient.getManifestWithMainClass(appClass)));
  }
View Full Code Here

   * that load classes from all the ProgramClassLoader and the URLClassLoader as described above.
   */
  public ClassLoader makeClassLoader(final ClassLoader parent)
    throws MalformedURLException {

    final LocationFactory lf = new LocalLocationFactory();
    final List<ClassLoader> classLoaders = Lists.newArrayList();
    final List<URL> urls = Lists.newArrayList();
    for (final String classPath : localClasspaths) {
      final URI uri = new File(classPath).toURI();
      if (classPath.endsWith(".jar")) {
        classLoaders.add(AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
          @Override
          public ClassLoader run() {
            try {
              File expandDir = Files.createTempDir();
              jarExpandDirs.add(expandDir);
              return ClassLoaders.newProgramClassLoader(
                BundleJarUtil.unpackProgramJar(lf.create(uri), expandDir),
                ApiResourceListHolder.getResourceList(), parent);
            } catch (IOException e) {
              throw Throwables.propagate(e);
            }
          }
View Full Code Here

TOP

Related Classes of org.apache.twill.filesystem.LocalLocationFactory

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.