Package net.sourceforge.javautil.classloader.boot

Examples of net.sourceforge.javautil.classloader.boot.EntryPoint$ExitPoint


    this.addArgument("class", Class.class, "The main, entry point type or runnable class");
    this.addOption("cl", String.class, "Use the class loader from the groovy environment using the name specified", "");
  }

  public Object execute(GroovyCLIContext ctx, CommandLineArgumentsStandard arguments) {
    EntryPoint point = (EntryPoint) ctx.getUI().getDomain().getVariable("entry");
    EntryPointType type = (EntryPointType) ctx.getUI().getDomain().getVariable("epcli");
   
    ClassLoader original = null;
    PassedOption cl = arguments.getOption("cl");
    if (cl != null && ctx.getUI().getDomain().getVariable((String) cl.getValue()) instanceof ClassLoader) {
      original = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader((ClassLoader)ctx.getUI().getDomain().getVariable((String) cl.getValue()));
    }
   
    String mainClass = (String) arguments.getArgument(0).getValue();
   
    try {
      point.boot(ClassCache.getFor(ReflectionUtil.getClass(mainClass)), type, mainClass);
      return new ExecutionResults(mainClass, null);
    } catch (Throwable e) {
      return new ExecutionResults(mainClass, e);
    } finally {
      if (original != null) Thread.currentThread().setContextClassLoader(original);
View Full Code Here

TOP

Related Classes of net.sourceforge.javautil.classloader.boot.EntryPoint$ExitPoint

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.