T - the parent resource component type for this component. This means you can nest a hierarchy of resource
components that mimic the resource type hierarchy as defined in a plugin deployment descriptor.public class ResourceContext<T extends ResourceComponent<?>> extends Object
ResourceComponent objects will have access - it will have all the information that
the resource components needs during their lifetime.
This context class is currently designed to be an immutable object. Instances of this context object are to be created by the plugin container only.
| Constructor and Description |
|---|
ResourceContext(org.rhq.core.domain.resource.Resource resource,
T parentResourceComponent,
ResourceContext<?> parentResourceContext,
ResourceDiscoveryComponent<T> resourceDiscoveryComponent,
SystemInfo systemInfo,
File temporaryDirectory,
File baseDataDirectory,
String pluginContainerName,
EventContext eventContext,
OperationContext operationContext,
ContentContext contentContext,
AvailabilityContext availabilityContext,
InventoryContext inventoryContext,
PluginContainerDeployment pluginContainerDeployment)
Deprecated.
as of RHQ 4.9.
|
ResourceContext(org.rhq.core.domain.resource.Resource resource,
T parentResourceComponent,
ResourceContext<?> parentResourceContext,
ResourceDiscoveryComponent<T> resourceDiscoveryComponent,
SystemInfo systemInfo,
File temporaryDirectory,
File baseDataDirectory,
String pluginContainerName,
EventContext eventContext,
OperationContext operationContext,
ContentContext contentContext,
AvailabilityContext availabilityContext,
InventoryContext inventoryContext,
PluginContainerDeployment pluginContainerDeployment,
ComponentInvocationContext componentInvocationContext)
Creates a new
ResourceContext object. |
| Modifier and Type | Method and Description |
|---|---|
AvailabilityCollectorRunnable |
createAvailabilityCollectorRunnable(AvailabilityFacet availChecker,
long interval)
|
AvailabilityContext |
getAvailabilityContext()
Returns an
AvailabilityContext that allows the plugin to access the availability functionality provided by the
plugin container. |
ComponentInvocationContext |
getComponentInvocationContext()
Return the
ComponentInvocationContext object which plugins can use to determine if the component
invocation has been interrupted. |
ContentContext |
getContentContext()
Returns a
ContentContext that allows the plugin to access the content functionality provided by the
plugin container. |
File |
getDataDirectory()
Directory where plugins can store persisted data that survives plugin container restarts.
|
EventContext |
getEventContext()
|
File |
getFutureChildResourceDataDirectory(String childResourceKey)
The data directory of a child to be created for the resource this context is associated with.
|
InventoryContext |
getInventoryContext()
Returns an
InventoryContext that allows the plugin to access inventory related functionality provided by the
plugin container. |
ProcessInfo |
getNativeProcess()
Returns the information on the native operating system process in which the managed resource is running.
|
List<ProcessScanResult> |
getNativeProcessesForType()
Scans the current list of running processes and returns information on all processes that may contain resources
of the
same type as this resource. |
OperationContext |
getOperationContext()
Returns an
OperationContext that allows the plugin to access the operation functionality provided by the
plugin container. |
T |
getParentResourceComponent()
The parent of the resource component that is associated with this context.
|
protected ResourceContext<?> |
getParentResourceContext()
Returns the resource context of the parent resource or null if there is no parent resource.
|
org.rhq.core.domain.configuration.Configuration |
getPluginConfiguration()
Returns the resource's plugin configuration.
|
PluginContainerDeployment |
getPluginContainerDeployment()
Indicates where the plugin container (and therefore where the plugins) are deployed and running.
|
String |
getPluginContainerName()
The name of the plugin container in which the resource component is running.
|
File |
getResourceDataDirectory()
The data directory of the resource this context is associated with.
|
String |
getResourceDetails()
Returns the
String representation of the underlying resource. |
String |
getResourceKey()
The
resource key of the resource this context is associated with. |
org.rhq.core.domain.resource.ResourceType |
getResourceType()
The
resource type of the resource this context is associated with. |
SystemInfo |
getSystemInformation()
Returns a
SystemInfo object that contains information about the platform/operating system that the
resource is running on. |
File |
getTemporaryDirectory()
A temporary directory for plugin use that is destroyed at plugin container shutdown.
|
String |
getVersion()
The
version of the resource this context is associated with. |
@Deprecated public ResourceContext(org.rhq.core.domain.resource.Resource resource, T parentResourceComponent, ResourceContext<?> parentResourceContext, ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory, File baseDataDirectory, String pluginContainerName, EventContext eventContext, OperationContext operationContext, ContentContext contentContext, AvailabilityContext availabilityContext, InventoryContext inventoryContext, PluginContainerDeployment pluginContainerDeployment)
ResourceContext object with a default ComponentInvocationContext.public ResourceContext(org.rhq.core.domain.resource.Resource resource,
T parentResourceComponent,
ResourceContext<?> parentResourceContext,
ResourceDiscoveryComponent<T> resourceDiscoveryComponent,
SystemInfo systemInfo,
File temporaryDirectory,
File baseDataDirectory,
String pluginContainerName,
EventContext eventContext,
OperationContext operationContext,
ContentContext contentContext,
AvailabilityContext availabilityContext,
InventoryContext inventoryContext,
PluginContainerDeployment pluginContainerDeployment,
ComponentInvocationContext componentInvocationContext)
ResourceContext object.
NOTE: The plugin container is responsible for instantiating these objects; plugin writers should never
have to actually create context objects.resource - the resource whose ResourceComponent
will be given this context object of the pluginparentResourceComponent - the parent component of the context's associated resource component (or null if parent resource is null)parentResourceContext - the resource context of the parent resource (or null if parent resource is null)resourceDiscoveryComponent - the discovery component that can be used to detect other resources of the same
type as this resource (may be null)systemInfo - information about the system on which the plugin and its plugin container are
runningtemporaryDirectory - a temporary directory for plugin use that is destroyed at plugin container shutdownbaseDataDirectory - a directory where plugins can store persisted data that survives plugin container restartspluginContainerName - the name of the plugin container in which the discovery component is running.
Components can be assured this name is unique across all plugin
containers/agents running in the RHQ environment.eventContext - an EventContext, if the resource supports one or more types of
Events, or null otherwiseoperationContext - an OperationContext the plugin can use to interoperate with the
operation managercontentContext - a ContentContext the plugin can use to interoperate with the content
manageravailabilityContext - a AvailabilityContext the plugin can use to interoperate with the
plugin container inventory managerpluginContainerDeployment - indicates where the plugin container is runningcomponentInvocationContext - a ComponentInvocationContext the plugin can use to determine if the
current component invocation has been canceled or timed out.public String getResourceKey()
resource key of the resource this context is associated with. This resource
key is unique across all of the resource's siblings. That is to say, this resource key is unique among all
children of the parent.public org.rhq.core.domain.resource.ResourceType getResourceType()
resource type of the resource this context is associated with.public String getVersion()
version of the resource this context is associated with.public File getResourceDataDirectory()
public File getFutureChildResourceDataDirectory(String childResourceKey)
public T getParentResourceComponent()
protected ResourceContext<?> getParentResourceContext()
(This method is protected to be able to share that information with the ResourceUpgradeContext
but at the same time to not pollute the ResourceContext public API with data that doesn't belong
to it).
public SystemInfo getSystemInformation()
SystemInfo object that contains information about the platform/operating system that the
resource is running on. With this object, you can natively obtain things such as the operating system name, its
hostname,and other things. Please refer to the javadoc on SystemInfo for more details on the types of
information you can access.public org.rhq.core.domain.configuration.Configuration getPluginConfiguration()
public ProcessInfo getNativeProcess()
null.
The returned ProcessInfo always has a fresh snapshot of non static data: it's whether newly created
or got refreshed in order to determine if the process was still running.public List<ProcessScanResult> getNativeProcessesForType()
same type as this resource. More specifically, this method will scan all the
processes and try to match them up with the PIQL queries associated with
this resource's type.ResourceType.getProcessScans()public File getTemporaryDirectory()
File.createTempFile(String, String, File) API when writing to
this directory.public File getDataDirectory()
public String getPluginContainerName()
public PluginContainerDeployment getPluginContainerDeployment()
PluginContainerDeployment for more information on what the return value means.public EventContext getEventContext()
EventContext, if the resource supports one or more types of
Events, or null otherwisepublic OperationContext getOperationContext()
OperationContext that allows the plugin to access the operation functionality provided by the
plugin container.public ContentContext getContentContext()
ContentContext that allows the plugin to access the content functionality provided by the
plugin container.public AvailabilityContext getAvailabilityContext()
AvailabilityContext that allows the plugin to access the availability functionality provided by the
plugin container.public InventoryContext getInventoryContext()
InventoryContext that allows the plugin to access inventory related functionality provided by the
plugin container.@Deprecated public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet availChecker, long interval)
public ComponentInvocationContext getComponentInvocationContext()
ComponentInvocationContext object which plugins can use to determine if the component
invocation has been interrupted.ComponentInvocationContext objectCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.