|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IResourceRegistry
The interface to the resource registry that controls access to shared resources. A reference to the registry is
obtained by calling Spot.getInstance().getResourceRegistry().
The resource registry is used to control access to shared resources. First, resources that are to be made
available are registered with the resource registry by calling register(String, IResource)
. Then
an application that wants to use a resource asks the registry for a handle to it by calling
getResource(String, ResourceSharingScheme)
. A list of registered resources can be obtained by
calling getResourceNames()
.
When requesting access to a resource the requestor must specify their intended or required usage by
nominating a ResourceSharingScheme
.
See IResource
for information about implementing a shared resource.
Method Summary | |
---|---|
IResourceHandle |
adjustLock(IResourceHandle handle,
ResourceSharingScheme scheme)
Attempt to change the ResourceSharingScheme associated with the handle. |
IResourceHandle |
getResource(String resourceName,
ResourceSharingScheme scheme)
Request access to a resource. |
String[] |
getResourceNames()
|
void |
register(String resourceName,
IResource resource)
Inform the registry of a resource that is available for sharing. |
void |
unlock(IResourceHandle handle)
Notify the registry that that access to the resource, as defined by the specified handle, is no longer required. |
Method Detail |
---|
void register(String resourceName, IResource resource) throws ResourceSharingException
resourceName
- The name of the resourceresource
- The resource object
ResourceSharingException
- If the resource has already been registered.String[] getResourceNames()
IResourceHandle getResource(String resourceName, ResourceSharingScheme scheme) throws ResourceSharingException, ResourceUnavailableException
resourceName
- The name of the resource.scheme
- The scheme that defines the intended or required usage.
ResourceSharingException
- If the resource is unknown or there is some other problem
ResourceUnavailableException
- If the resource is currently unavailablevoid unlock(IResourceHandle handle) throws ResourceSharingException
handle
- The handle being unlocked
ResourceSharingException
IResourceHandle adjustLock(IResourceHandle handle, ResourceSharingScheme scheme) throws ResourceUnavailableException
ResourceSharingScheme
associated with the handle. Returns a
handle that has the new lock status (which might or might not be the same handle passed
as the input parameter). If the existence of other locks make the change impossible,
throw ResourceUnavailableException
.
handle
- The handle to adjust the lock ofscheme
- The required resource sharing scheme
ResourceUnavailableException
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |