org.rhq.core.pc.upgrade
Class ResourceUpgradeDelegate

java.lang.Object
  extended by org.rhq.core.pc.upgrade.ResourceUpgradeDelegate

public class ResourceUpgradeDelegate
extends Object

This is a helper class to InventoryManager that takes care of resource upgrade. Note that this class is not thread-safe in any manner. This class must not call (explicitly or implicitly anywhere in its outgoing call chain) any other plugin container manager other than the InventoryManager. This is because this delegate is called within the Inventory Manager's initialize method and hence many other managers are not yet initialized themselves yet.

Author:
Lukas Krejci

Constructor Summary
ResourceUpgradeDelegate(InventoryManager inventoryManager)
           
 
Method Summary
 void disable()
          Disables all future operations of the delegate.
 boolean enabled()
          Is the delegate enabled? In another words has the resource upgrade phase finished in the IventoryManager#initialize() method?
 boolean hasUpgradeFailed(org.rhq.core.domain.resource.Resource resource)
          Tells whether given resource had a upgrade failure during the processAndQueue(ResourceContainer) invocation.
 boolean hasUpgradeFailedInChildren(org.rhq.core.domain.resource.Resource parentResource, org.rhq.core.domain.resource.ResourceType childrenResourceType)
          Tells whether at least one of the children with given resource type of the given parent resource had an upgrade failure during processAndQueue(ResourceContainer) invocation.
 boolean hasUpgradeMergeFailed()
           
 boolean processAndQueue(ResourceContainer resourceContainer)
          Asks the resource's discovery component to upgrade the resource.
 void sendRequests()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUpgradeDelegate

public ResourceUpgradeDelegate(InventoryManager inventoryManager)
Method Detail

enabled

public boolean enabled()
Is the delegate enabled? In another words has the resource upgrade phase finished in the IventoryManager#initialize() method?


disable

public void disable()
Disables all future operations of the delegate.


processAndQueue

public boolean processAndQueue(ResourceContainer resourceContainer)
                        throws PluginContainerException
Asks the resource's discovery component to upgrade the resource. The resource will be updated with the data from the upgrade. I.e. when the resource is activated after it was queued for upgrade, it will actually start with the upgraded data.

If later on the upgrade fails to finish due to communication error with server or the server doesn't approve some upgrades for whatever reason, the resources will be restarted with the original data.

Parameters:
resourceContainer -
Returns:
true if the resource was queued for upgrade with no problems, false if there was some problem upgrading and the resource container was deactivated as a results of that.
Throws:
PluginContainerException - on error

hasUpgradeMergeFailed

public boolean hasUpgradeMergeFailed()
Returns:
true if sendRequests() threw an exception, false otherwise

hasUpgradeFailed

public boolean hasUpgradeFailed(org.rhq.core.domain.resource.Resource resource)
Tells whether given resource had a upgrade failure during the processAndQueue(ResourceContainer) invocation.

Parameters:
resource - the resource to test
Returns:
true if there was an error upgrading this resource, false otherwise

hasUpgradeFailedInChildren

public boolean hasUpgradeFailedInChildren(org.rhq.core.domain.resource.Resource parentResource,
                                          org.rhq.core.domain.resource.ResourceType childrenResourceType)
Tells whether at least one of the children with given resource type of the given parent resource had an upgrade failure during processAndQueue(ResourceContainer) invocation.

Returns:
true if at least one of the children of given type failed to upgrade, false otherwise

sendRequests

public void sendRequests()
                  throws Throwable
Throws:
Throwable


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.