Package org.rhq.core.domain.operation

Examples of org.rhq.core.domain.operation.ResourceOperationHistory


        }

        try {
            Subject superuser = LookupUtil.getSubjectManager().getOverlord();
            OperationManagerLocal operationManager = LookupUtil.getOperationManager();
            ResourceOperationHistory history = null;

            history = (ResourceOperationHistory) operationManager.getOperationHistoryByJobId(superuser, jobId);

            // I think this will only ever occur if the server-side timed this out but the long running
            // operation finally got back to us afterwards. We will still go ahead and
            // persist the failure data because, obviously, the operation really didn't time out.
            // I think, in reality, this condition will never occur (since the server-side will only ever
            // timeout ridiculously long-lived operations, which is typically only when an agent shutdown occurred).
            if (history.getStatus() != OperationRequestStatus.INPROGRESS) {
                LOG.debug("Was told an operation was canceled but, curiously, it was not in progress: " + "job-id=["
                    + jobId + "], op-history=[" + history + "]");
            }

            if (error != null) {
                history.setErrorMessage(error.getStackTraceString());
            } else {
                history.setErrorMessage("Operation was canceled at " + new Date(completionTime));
            }

            history.setResults(result);
            history.setStatus(OperationRequestStatus.CANCELED);

            operationManager.updateOperationHistory(superuser, history);
            operationManager.checkForCompletedGroupOperation(history.getId());
        } catch (Exception e) {
            LOG.error("Failed to update history from canceled operation, jobId=[" + jobId + "]. Cause: " + e, e);
            LOG.error("The canceled operation [" + jobId + "] had an error of: "
                + ((error != null) ? error.getStackTraceString() : "?"));
        }
View Full Code Here


        }

        try {
            Subject superuser = LookupUtil.getSubjectManager().getOverlord();
            OperationManagerLocal operationManager = LookupUtil.getOperationManager();
            ResourceOperationHistory history = null;

            history = (ResourceOperationHistory) operationManager.getOperationHistoryByJobId(superuser, jobId);

            // I think this will only ever occur if the server-side timed this out but the long running
            // operation finally got back to us afterwards. We will still go ahead and
            // persist the failure data because, obviously, the operation really didn't time out.
            // I think, in reality, this condition will never occur (since the server-side will only ever
            // timeout ridiculously long-lived operations, which is typically only when an agent shutdown occurred).
            if (history.getStatus() != OperationRequestStatus.INPROGRESS) {
                LOG.debug("Was told an operation failed but, curiously, it was not in progress: " + "job-id=[" + jobId
                    + "], op-history=[" + history + "]");
            }

            if (error != null) {
                history.setErrorMessage(error.getStackTraceString());
            } else {
                history.setErrorMessage("Failed for an unknown reason at " + new Date(completionTime));
            }

            history.setResults(result);
            history.setStatus(OperationRequestStatus.FAILURE);

            operationManager.updateOperationHistory(superuser, history);
            operationManager.checkForCompletedGroupOperation(history.getId());
        } catch (Exception e) {
            LOG.error("Failed to update history from failed operation, jobId=[" + jobId + "]. Cause: " + e, e);
            LOG.error("The failed operation [" + jobId + "] had an error of: "
                + ((error != null) ? error.getStackTraceString() : "?"));
        }
View Full Code Here

            + getFromStartToEndTimestampString(invocationTime, completionTime));

        try {
            Subject superuser = LookupUtil.getSubjectManager().getOverlord();
            OperationManagerLocal operationManager = LookupUtil.getOperationManager();
            ResourceOperationHistory history;

            history = (ResourceOperationHistory) operationManager.getOperationHistoryByJobId(superuser, jobId);

            // I think this will only ever occur if the server-side timed this out but the long running
            // operation finally got back to us afterwards. We will still go ahead and
            // persist the success data because, obviously, the operation really didn't time out.
            // I think, in reality, this condition will never occur (since the server-side will only ever
            // timeout ridiculously long-lived operations, which is typically only when an agent shutdown occurred).
            if (history.getStatus() != OperationRequestStatus.INPROGRESS) {
                LOG.debug("Was told an operation succeeded but, curiously, it was not in progress: " + "job-id=["
                    + jobId + "], op-history=[" + history + "]");
            }

            history.setErrorMessage(null);
            history.setResults(result);
            history.setStatus(OperationRequestStatus.SUCCESS);
            operationManager.updateOperationHistory(superuser, history);
            operationManager.checkForCompletedGroupOperation(history.getId());
        } catch (Exception e) {
            LOG.error("Failed to update history from successful operation, jobId=[" + jobId + "]. Cause: " + e, e);
            LOG.error("The successful operation [" + jobId + "] had results of: " + result);
        }
    }
View Full Code Here

        Configuration parameters = schedule.getParameters();
        if (parameters != null) {
            parameters = parameters.deepCopy(false); // we need a copy to avoid constraint violations upon delete
        }

        ResourceOperationHistory history;
        history = new ResourceOperationHistory(jobName, jobGroup, schedule.getSubject().getName(), op, parameters,
            schedule.getResource(), groupHistory);

        // persist the results of the initial create
        ResourceOperationHistory persisted;
        persisted = (ResourceOperationHistory) operationManager.updateOperationHistory(schedule.getSubject(), history);
        history.setId(persisted.getId()); // we need this - this enables the server to successfully update the group history later

        return persisted;
    }
View Full Code Here

        criteria.addFilterJobId(jobId);
        criteria.fetchOperationDefinition(true);
        criteria.fetchParameters(true);
        criteria.fetchResults(true);

        ResourceOperationHistory history;
        List<ResourceOperationHistory> list = operationManager.findResourceOperationHistoriesByCriteria(
            schedule.getSubject(), criteria);
        if (list == null || list.isEmpty()) {
            return null;
        }
View Full Code Here

            // for the security check, can the user who scheduled the operation in the first
            // place still have the authority to execute it against the resource in question
            operationManager.getResourceOperationSchedule(schedule.getSubject(), jobDetail);

            ResourceOperationHistory resourceHistory = null;
            if (triggerTimes==1) { // On 1st fire use the already provided history.
                resourceHistory = findOperationHistory(jobDetail.getName(),jobDetail.getGroup(),operationManager, schedule);
                if (resourceHistory.getStartedTime()>0) {
                    resourceHistory=null;
                }
            }
            if (resourceHistory==null) {
                resourceHistory = createOperationHistory(jobDetail.getName(),
View Full Code Here

                    CoreGUI.getErrorHandler()
                        .handleError(MSG.view_operationHistoryDetails_error_fetchFailure(), caught);
                }

                public void onSuccess(PageList<ResourceOperationHistory> result) {
                    ResourceOperationHistory resourceOperationHistory = result.get(0);

                    if (showResourceField) {
                        Resource resource = resourceOperationHistory.getResource();
                        String url = LinkManager.getResourceLink(resource.getId());
                        disambiguatedResourceName = LinkManager.getHref(url, resource.getName());
                    }

                    displayDetails(resourceOperationHistory);
View Full Code Here

        });
    }

    @Override
    protected ResourceOperationHistory createOperationHistory() {
        return new ResourceOperationHistory(null, null, null, null, null, null, null);
    }
View Full Code Here

        criteria.setPaging(0, 1);
        criteria.fetchOperationDefinition(true);
        criteria.fetchParameters(true);
        criteria.fetchResults(true);

        ResourceOperationHistory history = null;

        int i = 0;

        while(history == null && i < maxIntervals) {
            Thread.sleep(intervalDuration);
View Full Code Here

            criteria.fetchOperationDefinition(true);
            criteria.fetchParameters(true);
            criteria.fetchResults(true);

            int retries = 10;
            ResourceOperationHistory history = null;
            while (history == null && retries-- > 0) {
                Thread.sleep(1000);
                PageList<ResourceOperationHistory> histories = operationManager
                    .findResourceOperationHistoriesByCriteria(remoteClient.getSubject(), criteria);
                if (histories.size() > 0 && histories.get(0).getStatus() != OperationRequestStatus.INPROGRESS) {
                    history = histories.get(0);
                }
            }

            Configuration result = (history != null ? history.getResults() : null);

            Object returnResults = ConfigurationClassBuilder.translateResults(pool,
                definition.getResultsConfigurationDefinition(), result);

            return returnResults;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.operation.ResourceOperationHistory

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.