protected boolean setSigner(final String clazzFile) {
   NotesContext ctx = NotesContext.getCurrent();
   NSFComponentModule module = ctx.getRunningModule();
   RuntimeFileSystem fs = module.getRuntimeFileSystem();
   NSFResource res = fs.getResource(clazzFile);
   if ((res != null) && ((res instanceof RuntimeFileSystem.NSFFile))) {
     ctx.setSignerSessionRights(clazzFile);
     return true;
   }
   return false;
 }
  /**
   * @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);
    //

  }
  /**
   * Registers the definitions at the XPage Scheduler.
   *
   * @param req
   * @param res
   * @throws SchedulerException
   */
  private void registerTransponder(final ServletRequest req, final ServletResponse res) {

    // the root of the definition is the META-INF/services file which MUST have a valid signature

    String clazzFile = "META-INF/services/" + TransponderData.class.getName();
    if (!setSigner(clazzFile)) return;

    NotesContext ctx = NotesContext.getCurrent();
    NSFComponentModule module = ctx.getRunningModule();

    String signer = null;
    try {
      Session signerSession = ctx.getSessionAsSigner();
      signer = signerSession.getEffectiveUserName();
    } catch (NotesException e) {
    }
    // here wo do some security checks (I like signers!)
    if (signer == null) {
      log_.severe("!!! The file " + module.getDatabasePath() + "/" + clazzFile + " is not signed!");
      TransponderRegistry.unRegister(module.getDatabasePath());

    } else {
      List<TransponderData> defs = ServiceLocator.findServices(TransponderData.class, Scope.NONE);
      // everything must be signed by the SAME user!!! - check it after loading all services
      if (ctx.getSessionAsSigner() == null) {
        log_.severe(
            "!!! One or more classes listed in "
                + module.getDatabasePath()
                + "/"
                + clazzFile
                + " are not properly signed!");
        TransponderRegistry.unRegister(module.getDatabasePath());
      } else {
        TransponderRegistry.register(module.getDatabasePath(), defs);
      }
    }
  }