Top Description Fields Methods
org.osgi.service.resourcemonitoring

public Interface ResourceMonitorFactory<T>

Type Parameters
<T>
The type for the Resource.

A Resource Monitor Factory is a service that provides Resource Monitor instances of a specific resource type (for example, CPUMonitor, MemoryMonitor...) for every Resource Context. Every Resource Monitor Factory service is registered with the RESOURCE_TYPE_PROPERTY mandatory property. This property indicates which type of Resource Monitor a Resource Monitor Factory is able to create. The type can also be retrieved through a call to getType(). The type MUST be unique (two Resource Monitor Factory instances MUST not have the same type).
Author
$Id: 18d6e38893b8bef39ab3658af7635d997d4c7e4c $
Version
1.0

Field Summary

Modifier and TypeField and Description
public static final String
RESOURCE_TYPE_PROPERTY

Resource type property.

Method Summary

Modifier and TypeMethod and Description
public ResourceMonitor<T>

Returns:

a ResourceMonitor instance
createResourceMonitor
(ResourceContext
ResourceContext instance associated with the newly created ResourceMonitor instance
resourceContext
)

Creates a new ResourceMonitor instance.

public String

Returns:

factory type
getType
()

Returns the type of ResourceMonitor instance this factory is able to create.

Field Detail

RESOURCE_TYPE_PROPERTYback to summary
public static final String RESOURCE_TYPE_PROPERTY

Resource type property. The value is of type String. For example, ResourceMonitoringService#RES_TYPE_CPU

Method Detail

createResourceMonitorback to summary
public ResourceMonitor<T> createResourceMonitor(ResourceContext resourceContext) throws ResourceMonitorException

Creates a new ResourceMonitor instance. This instance is associated with the ResourceContext instance provided as argument ( ResourceContext#addResourceMonitor(ResourceMonitor) is called by the factory). The newly ResourceMonitor instance is disabled. It can be enabled by calling ResourceMonitor#enable().

Parameters
resourceContext:ResourceContext

ResourceContext instance associated with the newly created ResourceMonitor instance

Returns:ResourceMonitor<T>

a ResourceMonitor instance

Exceptions
ResourceMonitorException:
If the factory is unable to create a ResourceMonitor For example, when a ResourceMonitor of this type already exists for this ResourceContext
getTypeback to summary
public String getType()

Returns the type of ResourceMonitor instance this factory is able to create.

Returns:String

factory type