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
FieldsModifier and TypeFieldDescriptionstatic final intA bundle has been added to eResourceContextstatic final intA bundle has been removed from aResourceContextstatic final intA newResourceContexthas been created.static final intAResourceContexthas been removed -
Constructor Summary
ConstructorsConstructorDescriptionResourceContextEvent(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 newResourceContexthas been created.The
ResourceMonitoringService.createContext(String, ResourceContext)method has been invoked.- See Also:
-
RESOURCE_CONTEXT_REMOVED
public static final int RESOURCE_CONTEXT_REMOVEDAResourceContexthas been removedThe
ResourceContext.removeContext(ResourceContext)method has been invoked- See Also:
-
BUNDLE_ADDED
public static final int BUNDLE_ADDEDA bundle has been added to eResourceContextThe
ResourceContext.addBundle(long)method has been invoked- See Also:
-
BUNDLE_REMOVED
public static final int BUNDLE_REMOVEDA bundle has been removed from aResourceContextResourceContext.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_CREATEDorRESOURCE_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_ADDEDorBUNDLE_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
-