Package org.rhq.core.clientapi.agent.upgrade

Examples of org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest


                        String upgradeErrors = null;
                        if ((upgradeErrors = checkUpgradeValid(resource, request)) != null) {
                            //the resource is in its upgraded state but it's going to get reverted back to the original state
                            //in the code below. Let's use the original resource for the error message so that we don't confuse
                            //the user.
                            ResourceUpgradeRequest orig = findOriginal(request);

                            //orig should never be null, but let's be paranoid
                            if (orig != null) {
                                orig.updateResource(resource);
                            }

                            String errorString = "Upgrading the resource [" + resource + "] using these updates ["
                                + request + "] would render the inventory invalid because of the following reasons: "
                                + upgradeErrors;
View Full Code Here


        }

        ResourceUpgradeContext<ResourceComponent<T>> upgradeContext = inventoryManager.createResourceUpgradeContext(
            resource, parentResourceContext, parentResourceComponent, discoveryComponent);

        ResourceUpgradeRequest request = new ResourceUpgradeRequest(resource.getId());

        request.setTimestamp(System.currentTimeMillis());

        ResourceUpgradeReport upgradeReport = null;
        try {
            upgradeReport = inventoryManager.invokeDiscoveryComponentResourceUpgradeFacet(resource.getResourceType(),
                discoveryComponent, upgradeContext, parentResourceContainer);
        } catch (Throwable t) {
            log.error("ResourceUpgradeFacet threw an exception while upgrading resource [" + resource + "]", t);
            request.setErrorProperties(t);
        } finally {
            if (isResConfigCompacted) {
                resource.setResourceConfiguration(null);
            }
        }

        if (upgradeReport != null && upgradeReport.hasSomethingToUpgrade()) {
            request.fillInFromReport(upgradeReport);
        }

        if (request.hasSomethingToUpgrade()) {
            requests.add(request);
        }

        if (request.getUpgradeErrorMessage() != null) {
            rememberFailure(resource);
            return false;
        }

        //alright, everything went fine with the upgrade. Let's update the data of the resource
        //right now so that it starts up as if it was already upgraded. This is to ensure that
        //its children will use a parent component that behaves like the upgraded one.
        //We are going to roll back the upgraded data if the upgrade fails to sync with the server
        //later on.

        //remember the original values
        ResourceUpgradeRequest original = new ResourceUpgradeRequest(resource.getId());
        original.fillInFromResource(resource);
        originalResourceData.add(original);

        //update the resource
        request.updateResource(resource);
View Full Code Here

            //conflicting resources. These resources won't be upgraded but right now, we see
            //them as if they were.
            //For each resource, we therefore need to find the corresponding "original" and report
            //that instead of how the resource looks like right now.
            for (Resource r : duplicitSiblings) {
                ResourceUpgradeRequest fakeRequest = new ResourceUpgradeRequest(r.getId());
                fakeRequest.fillInFromResource(r);

                ResourceUpgradeRequest orig = findOriginal(fakeRequest);

                //we might not find the original, because this resource might not need an upgrade.
                //in that case, the reporting will be accurate because upgrade didn't touch the resource.
                if (orig != null) {
                    orig.updateResource(r);
                }

                //now we have the resource as it looked before the upgrade kicked in (which is in this
                //case also what it will look like after the upgrade finishes, because we're failing it).
                s.append(r).append(",\n");
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest

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.