/**
   * @param wj
   * @param signer
   * @param newInstance
   * @throws InstantiationException
   */
  private void execScheduleDefinition(final NSFJobGroup jobGroups, final WorkerJob wj)
      throws IllegalAccessException, InstantiationException {
    // TODO Auto-generated method stub

    if (wj == null) {
      throw new UnsupportedOperationException("Direct invoke not yet supported!");
    }
    NotesContext ctx = NotesContext.getCurrent();

    for (NSFJobFactory jobFactory : jobGroups.getJobFactores()) {
      if (wj != null) {
        if (!wj.isRunning()) {
          return;
        }
      }
      try {
        NSFJob job = jobFactory.createJob();
        if (wj != null) {
          wj.setInnerJob(job);
        }

        job.run();
      } catch (InterruptedException e) {
        // if IE is thrown, quit
        e.printStackTrace();
        return;

      } finally {
        if (wj != null) {
          wj.setInnerJob(null);
        }
      }
    }
  }
  /**
   * @param req
   * @param res
   * @throws ServletException
   * @throws JobExecutionException
   */
  protected void invoke(final ServletRequest req, final ServletResponse res) {

    String clazzName = req.getParameter(NSFJobGroup.class.getName());

    NotesContext ctx = NotesContext.getCurrent();
    NSFComponentModule moduleCurrent = ctx.getModule();

    WorkerJob wj = WorkerJob.getInstance();
    try {

      String clazzFile = "WEB-INF/classes/" + clazzName.replace('.', '/') + ".class";
      // ctx.setSignerSessionRights(clazzFile);

      Class<?> clazz = moduleCurrent.getModuleClassLoader().loadClass(clazzName);

      if (NSFJobGroup.class.isAssignableFrom(clazz)) {
        execScheduleDefinition((NSFJobGroup) clazz.newInstance(), wj);
      } else {
        throw new ClassCastException(
            "Class '" + clazzName + "' is not a instance of '" + NSFJobGroup.class.getName() + "'");
      }
    } catch (Exception e) {
      e.printStackTrace();
      log_.log(Level.SEVERE, "Error while executing jobGroup: " + clazzName, e);
    }

    // } catch (JobExecutionException jex) {
    // HttpRequestJob outerJob = HttpRequestJob.getInstance();
    // if (outerJob != null) {
    // outerJob.setJobExecutionException(jex);
    // }
    // throw new ServletException("Error while executing class: " + clazzName, jex);
    // } catch (Exception iex) {
    // throw new ServletException("Could not instantiate class: " + clazzName, iex);
    //

  }