Package org.rhq.enterprise.server.operation

Examples of org.rhq.enterprise.server.operation.OperationManagerLocal


    }

    @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = { "plugin.resource.metadata.test",
        "RemoveTypes" })
    public void deleteOperationDefsForRemovedType() throws Exception {
        OperationManagerLocal operationMgr = LookupUtil.getOperationManager();
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();

        OperationDefinitionCriteria criteria = new OperationDefinitionCriteria();
        criteria.addFilterResourceTypeName("ServerC");
        criteria.addFilterName("run");

        List<OperationDefinition> operationDefs = operationMgr.findOperationDefinitionsByCriteria(
            subjectMgr.getOverlord(), criteria);

        assertEquals("The operation definition should have been deleted", 0, operationDefs.size());
    }
View Full Code Here


    private void init() {
        if (this.history == null) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            Integer operationId = FacesContextUtility.getRequiredRequestParameter("opId", Integer.class);
            OperationManagerLocal operationManager = LookupUtil.getOperationManager();

            this.history = operationManager.getOperationHistoryByHistoryId(subject, operationId);
            this.parameters = new OperationParameters(this.history);
            this.results = new OperationResults((ResourceOperationHistory) history);
        }
    }
View Full Code Here

            super(view, beanName);
        }

        @Override
        public PageList<ResourceOperationHistory> fetchPage(PageControl pc) {
            OperationManagerLocal manager = LookupUtil.getOperationManager();

            PageList<ResourceOperationHistory> results;
            results = manager.findPendingResourceOperationHistories(getSubject(), getResource().getId(), pc);
            return results;
        }
View Full Code Here

    public ResourceOperationHistory getLatestCompletedResourceOperation() {
        if (latestCompletedResourceOperation == null) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            Resource resource = EnterpriseFacesContextUtility.getResource();
            OperationManagerLocal manager = LookupUtil.getOperationManager();

            latestCompletedResourceOperation = manager.getLatestCompletedResourceOperation(subject, resource.getId());
        }

        return latestCompletedResourceOperation;
    }
View Full Code Here

            super(view, beanName);
        }

        @Override
        public PageList<ResourceOperationHistory> fetchPage(PageControl pc) {
            OperationManagerLocal manager = LookupUtil.getOperationManager();

            PageList<ResourceOperationHistory> results;
            results = manager.findCompletedResourceOperationHistories(getSubject(), getResource().getId(), null, null,
                pc);
            return results;
        }
View Full Code Here

        }
    }

    private void unscheduleJobs(Subject overlord, Integer resourceId) throws ResourceNotFoundException {
        log.debug("Unscheduling jobs for resource[id=" + resourceId + "]");
        OperationManagerLocal operationManager = LookupUtil.getOperationManager();
        try {
            List<ResourceOperationSchedule> schedules = operationManager.findScheduledResourceOperations(overlord,
                resourceId);

            for (ResourceOperationSchedule schedule : schedules) {
                try {
                    /*
                     * unscheduleResourceOperation already takes care of ignoring requests to delete unknown schedules,
                     * which would happen if the following sequence occurs:
                     *
                     * - a user tries to delete a resource, gets the list of resource operation schedules - just then,
                     * one or more of the schedules completes it's last scheduled firing, and is removed - then we try
                     * to unschedule it here, except that the jobid will no longer be known
                     */
                    operationManager.unscheduleResourceOperation(overlord, schedule.getJobId().toString(), resourceId);
                } catch (UnscheduleException ise) {
                    log.warn("Failed to unschedule job [" + schedule + "] for a resource being deleted [" + resourceId
                        + "]", ise);
                }
            }
View Full Code Here

        } else {
            throw new IllegalArgumentException("OperationParameters does not support objects of type "
                + schedule.getClass().getSimpleName());
        }

        OperationManagerLocal operationManager = LookupUtil.getOperationManager();
        OperationDefinition definition;

        try {
            definition = operationManager
                .getOperationDefinitionByResourceTypeAndName(type.getId(), operationName, true);
        } catch (OperationDefinitionNotFoundException odnfe) {
            throw new PluginReloadedException("The plugin for " + type.getName()
                + " has been updated since this schedule was created, and the operation " + operationName
                + " no longer exists");
View Full Code Here

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public void prepareNodeForUpgrade(Subject subject, StorageNode storageNode) {
        int storageNodeResourceId = getResourceIdFromStorageNode(storageNode);
        OperationManagerLocal operationManager = LookupUtil.getOperationManager();

        Configuration parameters = new Configuration();
        parameters.setSimpleValue("snapshotName", String.valueOf(System.currentTimeMillis()));
        // scheduling the operation
        operationManager.scheduleResourceOperation(subject, storageNodeResourceId, "prepareForUpgrade", 0, 0, 0, 0,
            parameters, "Run by StorageNodeManagerBean.prepareNodeForUpgrade()");
    }
View Full Code Here

        @Override
        public PageList<GroupOperationHistory> fetchPage(PageControl pc) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            ResourceGroup requestGroup = EnterpriseFacesContextUtility.getResourceGroup();
            OperationManagerLocal manager = LookupUtil.getOperationManager();

            if (requestGroup == null) {
                requestGroup = resourceGroup; // request not associated with a resource - use the resource we used before
            } else {
                resourceGroup = requestGroup; // request switched the resource this UI bean is using
            }

            PageList<GroupOperationHistory> results;
            results = manager.findCompletedGroupOperationHistories(subject, resourceGroup.getId(), pc);
            return results;
        }
View Full Code Here

    private void init() {
        if (this.history == null) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            Integer operationId = FacesContextUtility.getRequiredRequestParameter("opId", Integer.class);
            OperationManagerLocal operationManager = LookupUtil.getOperationManager();

            this.history = (GroupOperationHistory) operationManager
                .getOperationHistoryByHistoryId(subject, operationId);

            this.parameters = new OperationParameters(this.history);
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.operation.OperationManagerLocal

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.