Package org.rhq.core.domain.operation

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


    {
        for (int j = 0; j < 3; j++)
        {
            for (int l = 0; l < 5; l++)
            {
                OperationHistory history = historyBean.addOperationHistory(operations[l], configurations[j], resources[j], resourceTypes[j]);
                assert history != null : "History should not be null";
                operationIds.add(history.getJobId());
            }
        }

        for (int l = 0; l < 2; l++)
        {
            OperationHistory history = historyBean.addOperationHistory(
                    operations[l],
                    singleConfiguration,
                    singleResource,
                    singleResourceType);

            assert history != null : "History should not be null";
            operationIds.add(history.getJobId());
        }

    }
View Full Code Here


    //@Test(dependsOnMethods = {"testAddOperationHistory"})
    public void testGetOperationHistory()
    {
        for (HistoryJobId operationId : operationIds)
        {
            OperationHistory history = historyBean.getHistory(operationId.toString());
            assert history != null : "History should not be null";
        }
    }
View Full Code Here

    public OperationHistory addOperationHistory(String operationName,
                                                Configuration parameters,
                                                Resource resource,
                                                ResourceType resourceType)
    {
        OperationHistory operationHistory = null;
        OperationDefinition operationDefinition = getOperationDefinition(operationName, resourceType);
        if (operationDefinition != null)
        {
            int id = jobNameId.incrementAndGet();
            String jobName = operationDefinition.getName() + "-" + id;
            operationHistory =
                    new ResourceOperationHistory(jobName,
                            "",
                            resource.getName(),
                            operationDefinition,
                            parameters,
                            resource,
                            null); //GroupOperationHistory
            operationHistory.setId(id);
            addToMaps(operationHistory, resource, resourceType);
        }
        return operationHistory;
    }
View Full Code Here

    public void setHistoryBean(OperationHistoryManager historyBean) {
        this.historyBean = historyBean;
    }

    public void operationSucceeded(String jobId, Configuration results, long invocationTime, long completionTime) {
        OperationHistory history = this.historyBean.getHistory(jobId);
        history.setStatus(OperationRequestStatus.SUCCESS);
        if (history instanceof ResourceOperationHistory) {
            if (results != null)
                results.setId(history.getId());
            ((ResourceOperationHistory) history).setResults(results);
        }
    }
View Full Code Here

        }
    }

    public void operationFailed(String jobId, Configuration results, ExceptionPackage error, long invocationTime,
        long completionTime) {
        OperationHistory operationHistory = this.historyBean.getHistory(jobId);
        operationHistory.setStatus(OperationRequestStatus.FAILURE);
        if (operationHistory instanceof ResourceOperationHistory) {
            if (results != null)
                results.setId(operationHistory.getId());
            ((ResourceOperationHistory) operationHistory).setResults(results);
        }
        if (error != null) {
            if (error.getExceptionName().equals(UnsupportedOperationException.class.getName()))
                operationHistory.setErrorMessage("The '" + operationHistory.getOperationDefinition().getName()
                    + "' operation is not supported by Embedded Jopr: " + error.getMessage());
            else
                operationHistory.setErrorMessage(error.getStackTraceString());
        } else {
            operationHistory.setErrorMessage("Failed for an unknown reason at " + new Date(completionTime));
        }
    }
View Full Code Here

            operationHistory.setErrorMessage("Failed for an unknown reason at " + new Date(completionTime));
        }
    }

    public void operationTimedOut(String jobId, long invocationTime, long timeoutTime) {
        OperationHistory history = this.historyBean.getHistory(jobId);
        if (history.getStatus() == OperationRequestStatus.INPROGRESS) {
            history.setStatus(OperationRequestStatus.FAILURE);
            history.setErrorMessage("Timed Out");
        }
    }
View Full Code Here

            initSelectedOperationInfo();
            return "missingParams";
        }
        else
        {
            OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(),
                    this.selectedOperationParameters, this.currentResource, resourceType);
            // Null this out as soon as we're done with it, so it won't carry over to the next request.
            this.selectedOperationParameters = null;
            ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
            String jobId = newOperationHistory.getJobId().toString();
            try
            {
                resourceManager.invokeOperation(this.currentResource, operationDef, newOperationHistory.getParameters(),
                        jobId);
                this.facesMessages.add("The #0 operation has been invoked. See the operation history below for the results once the operation has completed.",
                        operationDef.getDisplayName());
            }
            catch (RuntimeException e)
            {
                newOperationHistory.setStatus(OperationRequestStatus.FAILURE);
                newOperationHistory.setErrorMessage(e.toString());
                this.facesMessages.add(FacesMessage.SEVERITY_FATAL, "Failed to invoke operation: #0", e);
            }
            initHistories();
            // Auto-select the operation history, so its results will be displayed in the
            // "Selected Operation History Item" panel.
            selectOperationHistory(newOperationHistory.getId());
            return "success";
        }
    }
View Full Code Here

TOP

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

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.