org.rhq.core.pc.util
Class DiscoveryComponentProxyFactory

java.lang.Object
  extended by org.rhq.core.pc.util.DiscoveryComponentProxyFactory

public class DiscoveryComponentProxyFactory
extends Object

Factory that can build discovery component proxies. These proxies wrap timeouts around discovery component method invocations. Note that if a discovery component invocation times out, the resource type will be blacklisted by this factory. Any further attempt to retrieve a proxy for that resource type's discovery component will fail.

Author:
John Mazzitelli, Ian Springer

Constructor Summary
DiscoveryComponentProxyFactory()
           
 
Method Summary
 void addResourceTypeToBlacklist(org.rhq.core.domain.resource.ResourceType type)
           
 void clearResourceTypeBlacklist()
           
<T> T
getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType type, ResourceDiscoveryComponent component, long timeout, Class<T> componentInterface, ResourceContainer parentResourceContainer)
          Same as getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType, org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent, long, org.rhq.core.pc.inventory.ResourceContainer) except this lets you provide the interface of the discovery component you want to talk to.
 ResourceDiscoveryComponent getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType type, ResourceDiscoveryComponent component, long timeout, ResourceContainer parentResourceContainer)
          Given a discovery component instance, this returns that component wrapped in a proxy that provides the ability for invocations to that component to timeout after a certain time limit expires.
 HashSet<org.rhq.core.domain.resource.ResourceType> getResourceTypeBlacklist()
           
 void initialize()
           
 boolean isResourceTypeBlacklisted(org.rhq.core.domain.resource.ResourceType type)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveryComponentProxyFactory

public DiscoveryComponentProxyFactory()
Method Detail

getDiscoveryComponentProxy

public <T> T getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType type,
                                        ResourceDiscoveryComponent component,
                                        long timeout,
                                        Class<T> componentInterface,
                                        ResourceContainer parentResourceContainer)
                             throws PluginContainerException,
                                    BlacklistedException
Same as getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType, org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent, long, org.rhq.core.pc.inventory.ResourceContainer) except this lets you provide the interface of the discovery component you want to talk to. For example, use this to talk to the ClassLoaderFacet of a discovery component.

Throws:
PluginContainerException
BlacklistedException

getDiscoveryComponentProxy

public ResourceDiscoveryComponent getDiscoveryComponentProxy(org.rhq.core.domain.resource.ResourceType type,
                                                             ResourceDiscoveryComponent component,
                                                             long timeout,
                                                             ResourceContainer parentResourceContainer)
                                                      throws PluginContainerException,
                                                             BlacklistedException
Given a discovery component instance, this returns that component wrapped in a proxy that provides the ability for invocations to that component to timeout after a certain time limit expires. This allows the plugin container to make calls into the plugin discovery component and not deadlock if that plugin misbehaves and never returns (or takes too long to return).

Parameters:
type - the resource type that is to be discovered by the given discovery component
component - the discovery component to be wrapped in a timer proxy
timeout - the time, in milliseconds, that invocations can take to invoke discovery component methods
parentResourceContainer -
Returns:
the discovery component wrapped in a proxy that should be used to make calls to the component
Throws:
PluginContainerException - if this method failed to create the proxy
BlacklistedException - if the resource type's discovery component has been blacklisted and not allowed to be invoked anymore

initialize

public void initialize()

shutdown

public void shutdown()

getResourceTypeBlacklist

public HashSet<org.rhq.core.domain.resource.ResourceType> getResourceTypeBlacklist()

clearResourceTypeBlacklist

public void clearResourceTypeBlacklist()

isResourceTypeBlacklisted

public boolean isResourceTypeBlacklisted(org.rhq.core.domain.resource.ResourceType type)

addResourceTypeToBlacklist

public void addResourceTypeToBlacklist(org.rhq.core.domain.resource.ResourceType type)


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