Examples of ProgramClassLoader


Examples of co.cask.cdap.common.lang.jar.ProgramClassLoader

                                                         ClassLoader parentClassLoader) throws IOException {
    // TODO: Unify the creation of FilterClassLoader, see CDAP-6
    Predicate<String> predicate = Predicates.in(Sets.newHashSet(apiResourceList));
    ClassLoader filterParent = Objects.firstNonNull(Thread.currentThread().getContextClassLoader(),
                                                    ClassLoaders.class.getClassLoader());
    return new ProgramClassLoader(unpackedJarDir, new CombineClassLoader(new FilterClassLoader(predicate, filterParent),
                                                                         ImmutableList.of(parentClassLoader)));
  }
View Full Code Here

Examples of co.cask.cdap.common.lang.jar.ProgramClassLoader

    // deploy dataset modules
    ApplicationSpecification specification = input.getSpecification();
    File unpackedLocation = Files.createTempDir();
    try {
      BundleJarUtil.unpackProgramJar(input.getArchive(), unpackedLocation);
      ProgramClassLoader classLoader = ClassLoaders.newProgramClassLoader(unpackedLocation,
                                                                          ApiResourceListHolder.getResourceList(),
                                                                          this.getClass().getClassLoader());
      for (Map.Entry<String, String> moduleEntry : specification.getDatasetModules().entrySet()) {
        // note: using app class loader to load module class
        @SuppressWarnings("unchecked")
        Class<?> clazz = classLoader.loadClass(moduleEntry.getValue());
        String moduleName = moduleEntry.getKey();
        try {
          // note: we can deploy module or create module from Dataset class
          // note: it seems dangerous to instantiate dataset module here, but this will be fine when we move deploy into
          //       isolated user's environment (e.g. separate yarn container)
View Full Code Here

Examples of co.cask.cdap.common.lang.jar.ProgramClassLoader

    this.appFabricClient = new AppFabricClient(httpHandler, serviceHttpHandler, locationFactory);

    try {
      File tempDir = tempFolder.newFolder();
      BundleJarUtil.unpackProgramJar(deployedJar, tempDir);
      ProgramClassLoader classLoader = ClassLoaders.newProgramClassLoader
        (tempDir, ApiResourceListHolder.getResourceList(), this.getClass().getClassLoader());
      this.dataSetInstantiator = new DataSetInstantiator(datasetFramework, configuration,
                                                         new DataSetClassLoader(classLoader),
                                                         // todo: collect metrics for datasets outside programs too
                                                         null, null);
View Full Code Here

Examples of co.cask.tigon.lang.jar.ProgramClassLoader

    }
  }

  public Program createProgram(File jarPath, String classToLoad, File jarUnpackDir) throws Exception {
    expandJar(jarPath, jarUnpackDir);
    ProgramClassLoader classLoader = ClassLoaders.newProgramClassLoader(jarUnpackDir,
                                                                        ApiResourceListHolder.getResourceList());
    Class<?> clz = classLoader.loadClass(classToLoad);
    if (!(clz.newInstance() instanceof Flow)) {
      throw new Exception("Expected Flow class");
    }
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(classLoader);
View Full Code Here

Examples of co.cask.tigon.lang.jar.ProgramClassLoader

  public static ProgramClassLoader newProgramClassLoader(File unpackedJarDir,
                                                         Iterable<String> apiResourceList) throws IOException {
    Predicate<String> predicate = Predicates.in(Sets.newHashSet(apiResourceList));
    ClassLoader filterParent = Objects.firstNonNull(Thread.currentThread().getContextClassLoader(),
                                                    ClassLoaders.class.getClassLoader());
    return new ProgramClassLoader(unpackedJarDir, new FilterClassLoader(predicate, filterParent));
  }
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.