Package org.quartz

Examples of org.quartz.JobExecutionException


      pvs.addPropertyValues(context.getScheduler().getContext());
      pvs.addPropertyValues(context.getMergedJobDataMap());
      bw.setPropertyValues(pvs, true);
    }
    catch (SchedulerException ex) {
      throw new JobExecutionException(ex);
    }
    executeInternal(context);
  }
View Full Code Here


              (Exception) ex.getTargetException() : ex;
          throw (JobExecutionException) BeanUtils.instantiateClass(
              oldJobExecutionExceptionConstructor, new Object[] {errorMessage, jobEx, Boolean.FALSE});
        }
        else {
          throw new JobExecutionException(errorMessage, ex.getTargetException());
        }
      }
      catch (Exception ex) {
        String errorMessage = getInvocationFailureMessage();
        logger.warn(errorMessage, ex);
        if (oldJobExecutionExceptionConstructor != null) {
          throw (JobExecutionException) BeanUtils.instantiateClass(
              oldJobExecutionExceptionConstructor, new Object[] {errorMessage, ex, Boolean.FALSE});
        }
        else {
          throw new JobExecutionException(errorMessage, ex);
        }
      }
    }
View Full Code Here

      pvs.addPropertyValues(context.getScheduler().getContext());
      pvs.addPropertyValues(context.getMergedJobDataMap());
      bw.setPropertyValues(pvs, true);
    }
    catch (SchedulerException ex) {
      throw new JobExecutionException(ex);
    }
    executeInternal(context);
  }
View Full Code Here

  public void execute(JobExecutionContext context) throws JobExecutionException {
    try {
      this.delegate.run();
    }
    catch (Exception ex) {
      throw new JobExecutionException(ex);
    }
  }
View Full Code Here

        try {
            contextMap = feedKnowledgeBase(task, knowledgeBase);
        } catch (ThrottlingException e) {
            String msg = "Error in feeding knowledge base.";
            log.error(msg, e);
            throw new JobExecutionException(msg, e);
        }

        // invoke the rule.
        RuleInvoker ruleInvoker = task.getRuleInvoker();
        try {
            //updating the rule. this is important if we are having more than one managers running
            ruleInvoker.updateRules();
            ruleInvoker.invoke(knowledgeBase);
            log.info("Throttling rules executed successfully");
        } catch (ThrottlingException e) {
            String msg = "Error in invoking the throttling rule invoker.";
            log.error(msg, e);
            throw new JobExecutionException(msg, e);
        }
        // now persist the access validation information
        for (int tenantId : contextMap.keySet()) {
            ThrottlingDataContext dataContext = contextMap.get(tenantId);
            try {
                ValidationInfoManager.persistValidationDetails(dataContext);
            } catch (ThrottlingException e) {
                String msg = "Error in persisting validation details. Tenant id: " + tenantId + ".";
                log.error(msg, e);
                throw new JobExecutionException(msg, e);
            }
        }
    }
View Full Code Here

                // Execute Autoscaler task
                ((ServiceRequestsInFlightAutoscaler) task).execute();
            }

        } catch (Exception e) {
            throw new JobExecutionException(e);
        }

    }
View Full Code Here

        if (EntitlementUtil.getOwnedEntitlementNames().isEmpty()) {
            setupSecurity();
        }

        if (!(task instanceof SyncTask)) {
            throw new JobExecutionException("Task " + taskId + " isn't a SyncTask");
        }

        final SyncTask syncTask = (SyncTask) this.task;

        ConnectorFacadeProxy connector;
        try {
            connector = connInstanceLoader.getConnector(syncTask.getResource());
        } catch (Exception e) {
            final String msg = String.format("Connector instance bean for resource %s and connInstance %s not found",
                    syncTask.getResource(), syncTask.getResource().getConnector());

            throw new JobExecutionException(msg, e);
        }

        final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());

        if (accountIdMap == null) {
            throw new JobExecutionException("Invalid account id mapping for resource " + syncTask.getResource());
        }

        LOG.debug("Execute synchronization with token {}", syncTask.getResource().getSyncToken() != null
                ? syncTask.getResource().getSyncToken().getValue()
                : null);

        final List<SyncResult> results = new ArrayList<SyncResult>();

        actions.beforeAll(syncTask);

        try {
            final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();

            final ConflictResolutionAction conflictResolutionAction = syncPolicy != null
                    && syncPolicy.getSpecification() != null
                    ? ((SyncPolicySpec) syncPolicy.getSpecification()).getConflictResolutionAction()
                    : ConflictResolutionAction.IGNORE;

            if (syncTask.isFullReconciliation()) {
                connector.getAllObjects(ObjectClass.ACCOUNT, new SyncResultsHandler() {

                    @Override
                    public boolean handle(final SyncDelta delta) {
                        try {
                            results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
                            return true;
                        } catch (JobExecutionException e) {
                            LOG.error("Reconciliation failed", e);
                            return false;
                        }
                    }
                }, connector.getOperationOptions(syncTask.getResource()));
            } else {
                connector.sync(syncTask.getResource().getSyncToken(), new SyncResultsHandler() {

                    @Override
                    public boolean handle(final SyncDelta delta) {
                        try {

                            results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
                            return true;
                        } catch (JobExecutionException e) {
                            LOG.error("Synchronization failed", e);
                            return false;
                        }
                    }
                }, connector.getOperationOptions(syncTask.getResource()));
            }

            if (!dryRun && !syncTask.isFullReconciliation()) {
                try {
                    ExternalResource resource = resourceDAO.find(syncTask.getResource().getName());
                    resource.setSyncToken(connector.getLatestSyncToken());
                    resourceDAO.save(resource);

                } catch (Exception e) {
                    throw new JobExecutionException("While updating SyncToken", e);
                }
            }
        } catch (Exception e) {
            throw new JobExecutionException("While syncing on connector", e);
        }

        actions.afterAll(syncTask, results);

        final String result = createReport(results, syncTask.getResource().getSyncTraceLevel(), dryRun);
View Full Code Here

    @Override
    public void execute(final JobExecutionContext context) throws JobExecutionException {
        task = taskDAO.find(taskId);
        if (task == null) {
            throw new JobExecutionException("Task " + taskId + " not found");
        }

        TaskExec execution = new TaskExec();
        execution.setStartDate(new Date());
        execution.setTask(task);
View Full Code Here

        }
    }

    protected String executeWithSecurityContext(final boolean dryRun) throws JobExecutionException {
        if (!(task instanceof SyncTask)) {
            throw new JobExecutionException("Task " + taskId + " isn't a SyncTask");
        }
        final SyncTask syncTask = (SyncTask) this.task;

        Connector connector;
        try {
            connector = connFactory.getConnector(syncTask.getResource());
        } catch (Exception e) {
            final String msg = String.format("Connector instance bean for resource %s and connInstance %s not found",
                    syncTask.getResource(), syncTask.getResource().getConnector());

            throw new JobExecutionException(msg, e);
        }

        UMapping uMapping = syncTask.getResource().getUmapping();
        if (uMapping != null && uMapping.getAccountIdItem() == null) {
            throw new JobExecutionException("Invalid user account id mapping for resource " + syncTask.getResource());
        }
        RMapping rMapping = syncTask.getResource().getRmapping();
        if (rMapping != null && rMapping.getAccountIdItem() == null) {
            throw new JobExecutionException("Invalid role account id mapping for resource " + syncTask.getResource());
        }
        if (uMapping == null && rMapping == null) {
            return "No mapping configured for both users and roles: aborting...";
        }

        LOG.debug("Execute synchronization with token {}", syncTask.getResource().getUsyncToken());

        final List<SyncResult> results = new ArrayList<SyncResult>();

        final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();
        final ConflictResolutionAction resAct = syncPolicy == null || syncPolicy.getSpecification() == null
                ? ConflictResolutionAction.IGNORE
                : ((SyncPolicySpec) syncPolicy.getSpecification()).getConflictResolutionAction();

        // Prepare handler for SyncDelta objects
        final SyncopeSyncResultHandler handler =
                (SyncopeSyncResultHandler) ((DefaultListableBeanFactory) ApplicationContextProvider.
                getApplicationContext().getBeanFactory()).createBean(
                SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
        handler.setConnector(connector);
        handler.setActions(actions);
        handler.setDryRun(dryRun);
        handler.setResAct(resAct);
        handler.setResults(results);
        handler.setSyncTask(syncTask);

        actions.beforeAll(handler);
        try {
            if (syncTask.isFullReconciliation()) {
                if (uMapping != null) {
                    connector.getAllObjects(ObjectClass.ACCOUNT, handler,
                            connector.getOperationOptions(uMapping.getItems()));
                }
                if (rMapping != null) {
                    connector.getAllObjects(ObjectClass.GROUP, handler,
                            connector.getOperationOptions(rMapping.getItems()));
                }
            } else {
                if (uMapping != null) {
                    connector.sync(ObjectClass.ACCOUNT, syncTask.getResource().getUsyncToken(), handler,
                            connector.getOperationOptions(uMapping.getItems()));
                }
                if (rMapping != null) {
                    connector.sync(ObjectClass.GROUP, syncTask.getResource().getRsyncToken(), handler,
                            connector.getOperationOptions(rMapping.getItems()));
                }
            }

            if (!dryRun && !syncTask.isFullReconciliation()) {
                try {
                    ExternalResource resource = resourceDAO.find(syncTask.getResource().getName());
                    if (uMapping != null) {
                        resource.setUsyncToken(connector.getLatestSyncToken(ObjectClass.ACCOUNT));
                    }
                    if (rMapping != null) {
                        resource.setRsyncToken(connector.getLatestSyncToken(ObjectClass.GROUP));
                    }
                    resourceDAO.save(resource);
                } catch (Exception e) {
                    throw new JobExecutionException("While updating SyncToken", e);
                }
            }
        } catch (Exception e) {
            throw new JobExecutionException("While syncing on connector", e);
        }

        try {
            setRoleOwners(handler);
        } catch (Exception e) {
View Full Code Here

public class SampleJob extends AbstractTaskJob {

    @Override
    protected String doExecute(final boolean dryRun) throws JobExecutionException {
        if (!(task instanceof SchedTask)) {
            throw new JobExecutionException("Task " + taskId + " isn't a SchedTask");
        }
        final SchedTask schedTask = (SchedTask) this.task;

        LOG.info("SampleJob {}running [SchedTask {}]", (dryRun
                ? "dry "
View Full Code Here

TOP

Related Classes of org.quartz.JobExecutionException

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.