Package org.rhq.enterprise.server.operation

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


            ClassPool pool = ClassPoolFactory.getClassPoolForCurrentContextClassLoader();

            Configuration parameters = ConfigurationClassBuilder.translateParametersToConfig(pool,
                definition.getParametersConfigurationDefinition(), args);

            OperationManagerRemote operationManager = remoteClient.getProxy(OperationManagerRemote.class);

            ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(remoteClient.getSubject(),
                resourceId, definition.getName(), 0, 0, 0, 30000, parameters, "Executed from commandline");

            ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
            criteria.addFilterJobId(schedule.getJobId());
            criteria.addFilterResourceIds(resourceId);
            criteria.addSortStartTime(PageOrdering.DESC); // put most recent at top of results
            criteria.setPaging(0, 1); // only return one result, in effect the latest
            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);
                }
            }
View Full Code Here

TOP

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

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.