Top Description Fields Methods
org.osgi.service.resourcemonitoring

public Interface ResourceMonitoringService

Imports
org.osgi.service.resourcemonitoring.monitor.CPUMonitor, .DiskStorageMonitor, .MemoryMonitor, .SocketMonitor, .ThreadMonitor

It manages the Resource Context instances. It is available through the OSGi service registry. This service holds the existing Resource Context instances. Resource Context instances are created by calling the createContext(String, ResourceContext) method.
Author
$Id: 71758040cb5746f9763dc3421f177c6009532a8c $
Version
1.0

Field Summary

Modifier and TypeField and Description
public static final String
FRAMEWORK_CONTEXT_NAME

The name of the special, optional resource context, representing the whole OSGi framework.

public static final String
RES_TYPE_CPU

The name of the CPU resource type, used to monitor and control the CPU time used by a resource context.

public static final String
RES_TYPE_DISK_STORAGE

The name of the disk storage resource type, used to monitor and control the size of the persistent storage used by a resource context.

public static final String
RES_TYPE_MEMORY

The name of the memory resource type, used to monitor and control the size of the java heap used by a resource context.

public static final String
RES_TYPE_SOCKET

The name of the socket resource type, used to monitor and control the number of existing sockets used by a resource context.

public static final String
RES_TYPE_THREADS

The name of the threads resource type, used to monitor and control the number of threads created by a resource context.

public static final String
SYSTEM_CONTEXT_NAME

The name of the Resource Context associated with System bundle (bundle 0).

Method Summary

Modifier and TypeMethod and Description
public ResourceContext

Returns:

A new ResourceContext instance.
createContext
(String
The name identifying the context. Names must be unique within the framework instance.
name
,
ResourceContext
If a template is provided, the new resource context will inherit all resource monitoring settings (enabled monitors, thresholds) from the template.
template
)

Creates a new ResourceContext.

public ResourceContext

Returns:

An existing ResourceContext with the specified name, or null if such a context doesn't exist
getContext
(String
The resource context name
name
)

Returns the context with the specified resource context name.

public ResourceContext

Returns:

the ResourceContext associated to bundle b or null if the bundle b does not belong to a Resource Context.
getContext
(long
bundle identifier
bundleId
)

Returns the ResourceContext associated to the provided bundle id.

public String[]

Returns:

An array containing the names of all resource types that this ResourceMonitoringService implementation supports.
getSupportedTypes
()

Returns a list with the supported resource type names.

public ResourceContext[]

Returns:

An array of ResourceContext objects, or an empty array, if no contexts have been created.
listContext
()

Lists all available resource contexts.

Field Detail

FRAMEWORK_CONTEXT_NAMEback to summary
public static final String FRAMEWORK_CONTEXT_NAME

The name of the special, optional resource context, representing the whole OSGi framework.

RES_TYPE_CPUback to summary
public static final String RES_TYPE_CPU

The name of the CPU resource type, used to monitor and control the CPU time used by a resource context. ResourceMonitoringService implementations must create CPUMonitor instances for this resource type.

RES_TYPE_DISK_STORAGEback to summary
public static final String RES_TYPE_DISK_STORAGE

The name of the disk storage resource type, used to monitor and control the size of the persistent storage used by a resource context. ResourceMonitoringService implementations must create DiskStorageMonitor instances for this resource type.

RES_TYPE_MEMORYback to summary
public static final String RES_TYPE_MEMORY

The name of the memory resource type, used to monitor and control the size of the java heap used by a resource context. ResourceMonitoringService implementations must create MemoryMonitor instances for this resource type.

RES_TYPE_SOCKETback to summary
public static final String RES_TYPE_SOCKET

The name of the socket resource type, used to monitor and control the number of existing sockets used by a resource context. ResourceMonitoringService implementations must create SocketMonitor instances for this resource type.

RES_TYPE_THREADSback to summary
public static final String RES_TYPE_THREADS

The name of the threads resource type, used to monitor and control the number of threads created by a resource context. ResourceMonitoringService implementations must create ThreadMonitor instances for this resource type.

SYSTEM_CONTEXT_NAMEback to summary
public static final String SYSTEM_CONTEXT_NAME

The name of the Resource Context associated with System bundle (bundle 0).

Method Detail

createContextback to summary
public ResourceContext createContext(String name, ResourceContext template)

Creates a new ResourceContext.

A ResourceContextEvent with type ResourceContextEvent#RESOURCE_CONTEXT_CREATED will be sent.

Parameters
name:String

The name identifying the context. Names must be unique within the framework instance.

template:ResourceContext

If a template is provided, the new resource context will inherit all resource monitoring settings (enabled monitors, thresholds) from the template.

Returns:ResourceContext

A new ResourceContext instance.

Exceptions
IllegalArgumentException:
if a problem occurred, for example if the name is already used.
getContextback to summary
public ResourceContext getContext(String name)

Returns the context with the specified resource context name.

Parameters
name:String

The resource context name

Returns:ResourceContext

An existing ResourceContext with the specified name, or null if such a context doesn't exist

getContextback to summary
public ResourceContext getContext(long bundleId)

Returns the ResourceContext associated to the provided bundle id.

Parameters
bundleId:long

bundle identifier

Returns:ResourceContext

the ResourceContext associated to bundle b or null if the bundle b does not belong to a Resource Context.

getSupportedTypesback to summary
public String[] getSupportedTypes()

Returns a list with the supported resource type names.

Returns:String[]

An array containing the names of all resource types that this ResourceMonitoringService implementation supports.

listContextback to summary
public ResourceContext[] listContext()

Lists all available resource contexts. The list will contain the special FRAMEWORK_CONTEXT_NAME context and the SYSTEM_CONTEXT_NAME context, if it is supported.

Returns:ResourceContext[]

An array of ResourceContext objects, or an empty array, if no contexts have been created.