Class ResourceContextEvent
java.lang.Object
org.osgi.service.resourcemonitoring.ResourceContextEvent
A Resource Context Event instance is an event sent to Resource Context
Listener instances through a call to
ResourceContextListener.notify(ResourceContextEvent)
method.
A Resource Context Event has a type among the four following ones:
RESOURCE_CONTEXT_CREATED
– A new Resource Context instance has been created.RESOURCE_CONTEXT_REMOVED
– A Resource Context instance has been deleted.BUNDLE_ADDED
– A bundle has been added in the scope of a Resource Context instance.BUNDLE_REMOVED
– A bundle has been removed from the scope of a Resource Context instance.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
A bundle has been added to eResourceContext
static final int
A bundle has been removed from aResourceContext
static final int
A newResourceContext
has been created.static final int
AResourceContext
has been removed -
Constructor Summary
ConstructorDescriptionResourceContextEvent
(int pType, ResourceContext pResourceContext) Create a new ResourceContextEvent.ResourceContextEvent
(int pType, ResourceContext pResourceContext, long pBundleId) Create a new ResourceContextEvent. -
Method Summary
-
Field Details
-
RESOURCE_CONTEXT_CREATED
public static final int RESOURCE_CONTEXT_CREATEDA newResourceContext
has been created.The
ResourceMonitoringService.createContext(String, ResourceContext)
method has been invoked.- See Also:
-
RESOURCE_CONTEXT_REMOVED
public static final int RESOURCE_CONTEXT_REMOVEDAResourceContext
has been removedThe
ResourceContext.removeContext(ResourceContext)
method has been invoked- See Also:
-
BUNDLE_ADDED
public static final int BUNDLE_ADDEDA bundle has been added to eResourceContext
The
ResourceContext.addBundle(long)
method has been invoked- See Also:
-
BUNDLE_REMOVED
public static final int BUNDLE_REMOVEDA bundle has been removed from aResourceContext
ResourceContext.removeBundle(long)
method orResourceContext.removeBundle(long, ResourceContext)
method have been invoked, or the bundle has been uninstalled- See Also:
-
-
Constructor Details
-
ResourceContextEvent
Create a new ResourceContextEvent. This constructor should be used when the type of the event is eitherRESOURCE_CONTEXT_CREATED
orRESOURCE_CONTEXT_REMOVED
.- Parameters:
pType
- event typepResourceContext
- context
-
ResourceContextEvent
Create a new ResourceContextEvent. This constructor should be used when the type of the event is eitherBUNDLE_ADDED
orBUNDLE_REMOVED
.- Parameters:
pType
- event typepResourceContext
- contextpBundleId
- bundle
-
-
Method Details
-
getType
public int getType()Retrieves the type of this Resource Context Event.- Returns:
- the type of the event. One of:
-
getContext
Retrieves the Resource Context associated to this event- Returns:
- Resource Context.
-
getBundleId
public long getBundleId()Retrieves the identifier of the bundle being added to or removed from the Resource Context.
This method returns a valid value only when
getType()
returns:- Returns:
- the bundle id or -1 (invalid value).
-
toString
-
hashCode
public int hashCode() -
equals
-