Package co.cask.tigon.lang.jar

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


  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

Related Classes of co.cask.tigon.lang.jar.ProgramClassLoader

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.