public OperationsDelegate() {
    SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
    overlord = subjectManager.getOverlord();

    resourceGroupManager = LookupUtil.getResourceGroupManager();
    bundleManager = LookupUtil.getBundleManager();
  }
  @Override
  public void execute(JobExecutionContext context) throws JobExecutionException {
    BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
    SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

    Subject overlord = subjectManager.getOverlord();

    PageList<BundleDeployment> deployments =
        bundleManager.findBundleDeploymentsByCriteria(overlord, getCriteriaFromContext(context));

    if (deployments.size() > 0) {
      BundleDeployment bundleDeployment = deployments.get(0);
      SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
      JobDetail jobDetail = context.getJobDetail();

      BundleDeploymentStatus bundleDeploymentStatus =
          bundleManager.determineBundleDeploymentStatus(bundleDeployment.getId());
      if (bundleDeploymentStatus.isTerminal()) {
        // delete this job, we've assigned a final status
        try {
          context.setResult(bundleDeploymentStatus); // Return status to possible listeners
          scheduler.deleteJob(jobDetail.getName(), jobDetail.getGroup());
        } catch (SchedulerException e) {
          throw new JobExecutionException(
              "Could not delete the bundle deployment completion check job for "
                  + bundleDeployment
                  + ".",
              e);
        }
      } else {
        // try again in 10s
        try {
          Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000L);
          // just need a trigger name unique for this job
          trigger.setName(String.valueOf(System.currentTimeMillis()));
          scheduler.scheduleJob(trigger);
        } catch (SchedulerException e) {
          throw new JobExecutionException(
              "Could not schedule the bundle deployment completion check job for "
                  + bundleDeployment
                  + ".",
              e);
        }
      }
    }
  }