Package org.rhq.core.clientapi.agent.bundle

Examples of org.rhq.core.clientapi.agent.bundle.BundleAgentService


                    resourceDeploy.getId(), history);

                // get a connection to the agent and tell it to purge the bundle from the file system
                Subject overlord = subjectManager.getOverlord();
                AgentClient agentClient = agentManager.getAgentClient(overlord, resourceDeploy.getResource().getId());
                BundleAgentService bundleAgentService = agentClient.getBundleAgentService();
                BundlePurgeRequest request = new BundlePurgeRequest(resourceDeploy);
                BundlePurgeResponse results = bundleAgentService.purge(request);
                if (!results.isSuccess()) {
                    String errorMessage = results.getErrorMessage();
                    failedToPurge.put(resourceDeploy, errorMessage);
                }
            } catch (Exception e) {
View Full Code Here


    private BundleResourceDeployment scheduleBundleResourceDeployment(Subject subject, BundleDeployment deployment,
        Resource bundleTarget, boolean isCleanDeployment, boolean isRevert) throws Exception {

        int bundleTargetResourceId = bundleTarget.getId();
        AgentClient agentClient = agentManager.getAgentClient(subjectManager.getOverlord(), bundleTargetResourceId);
        BundleAgentService bundleAgentService = agentClient.getBundleAgentService();

        // The BundleResourceDeployment record must exist in the db before the agent request because the agent may try
        // to add History to it during immediate deployments. So, create and persist it (requires a new trans).
        BundleResourceDeployment resourceDeployment = bundleManager.createBundleResourceDeploymentInNewTrans(
            subjectManager.getOverlord(), deployment.getId(), bundleTargetResourceId);

        if (null != bundleTarget.getResourceType().getResourceTypeBundleConfiguration()) {

            // Ask the agent to schedule the request. The agent should add history as needed.
            try {
                BundleScheduleRequest request = bundleManager.getScheduleRequest(subject, resourceDeployment.getId(),
                    isCleanDeployment, isRevert);

                // add the deployment request history (in a new trans)
                BundleResourceDeploymentHistory history = new BundleResourceDeploymentHistory(subject.getName(),
                    AUDIT_ACTION_DEPLOYMENT_REQUESTED, deployment.getName(), null,
                    BundleResourceDeploymentHistory.Status.SUCCESS, "Requested deployment time: "
                        + request.getRequestedDeployTimeAsString(), null);
                bundleManager.addBundleResourceDeploymentHistoryInNewTrans(subjectManager.getOverlord(),
                    resourceDeployment.getId(), history);

                BundleScheduleResponse response = bundleAgentService.schedule(request);

                if (!response.isSuccess()) {
                    // Handle Schedule Failures. This may include deployment failures for immediate deployment request
                    bundleManager.setBundleResourceDeploymentStatusInNewTransaction(subject,
                        resourceDeployment.getId(), BundleDeploymentStatus.FAILURE);
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.agent.bundle.BundleAgentService

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.