コード例 #1
0
ファイル: Launch.java プロジェクト: beomyeol/reef
 /**
  * @param args command line arguments, as passed to main()
  * @return Configuration object.
  */
 private static Configuration parseCommandLine(final String[] args)
     throws IOException, BindException {
   final JavaConfigurationBuilder confBuilder = Tang.Factory.getTang().newConfigurationBuilder();
   final CommandLine cl = new CommandLine(confBuilder);
   cl.registerShortNameOfClass(Local.class);
   cl.registerShortNameOfClass(NumCycles.class);
   cl.registerShortNameOfClass(Delay.class);
   cl.registerShortNameOfClass(SuspendClientControl.Port.class);
   cl.processCommandLine(args);
   return confBuilder.build();
 }
コード例 #2
0
ファイル: Launch.java プロジェクト: beomyeol/reef
 private static Configuration cloneCommandLineConfiguration(final Configuration commandLineConf)
     throws InjectionException, BindException {
   final Injector injector = Tang.Factory.getTang().newInjector(commandLineConf);
   final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
   cb.bindNamedParameter(
       NumCycles.class, String.valueOf(injector.getNamedInstance(NumCycles.class)));
   cb.bindNamedParameter(Delay.class, String.valueOf(injector.getNamedInstance(Delay.class)));
   cb.bindNamedParameter(
       SuspendClientControl.Port.class,
       String.valueOf(injector.getNamedInstance(SuspendClientControl.Port.class)));
   return cb.build();
 }
コード例 #3
0
 public static void main(String[] argv) throws IOException, BindException, InjectionException {
   @SuppressWarnings("unchecked")
   JavaConfigurationBuilder cb =
       Tang.Factory.getTang()
           .newConfigurationBuilder(
               (Class<? extends ExternalConstructor<?>>[]) new Class[] {FileParser.class});
   CommandLine cl = new CommandLine(cb);
   cl.processCommandLine(
       argv, Target.class, ClassHierarchyIn.class, ConfigurationIn.class, ConfigurationOut.class);
   ValidateConfiguration bip =
       Tang.Factory.getTang().newInjector(cb.build()).getInstance(ValidateConfiguration.class);
   bip.validatePlan();
 }
コード例 #4
0
ファイル: Client.java プロジェクト: gwsshs22/reef
  public static LauncherStatus run(
      final Class<? extends Task> failTaskClass,
      final Configuration runtimeConfig,
      final int timeOut)
      throws BindException, InjectionException {

    final Configuration driverConfig =
        DriverConfiguration.CONF
            .set(
                DriverConfiguration.GLOBAL_LIBRARIES,
                EnvironmentUtils.getClassLocation(Driver.class))
            .set(DriverConfiguration.DRIVER_IDENTIFIER, failTaskClass.getSimpleName())
            .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, Driver.AllocatedEvaluatorHandler.class)
            .set(DriverConfiguration.ON_TASK_RUNNING, Driver.RunningTaskHandler.class)
            .set(DriverConfiguration.ON_CONTEXT_ACTIVE, Driver.ActiveContextHandler.class)
            .set(DriverConfiguration.ON_DRIVER_STARTED, Driver.StartHandler.class)
            .build();

    final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
    cb.addConfiguration(driverConfig);
    cb.bindNamedParameter(Driver.FailTaskName.class, failTaskClass.getSimpleName());

    return TestDriverLauncher.getLauncher(runtimeConfig).run(cb.build(), timeOut);
  }