Class ResourceContextEvent
- java.lang.Object
-
- org.osgi.service.resourcemonitoring.ResourceContextEvent
-
public class ResourceContextEvent extends java.lang.ObjectA Resource Context Event instance is an event sent to Resource Context Listener instances through a call toResourceContextListener.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.
- Version:
- 1.0
- Author:
- $Id: 69b1502e23de440d1e52e477197574150e865c26 $
-
-
Field Summary
Fields Modifier and Type Field Description static intBUNDLE_ADDEDA bundle has been added to eResourceContextstatic intBUNDLE_REMOVEDA bundle has been removed from aResourceContextstatic intRESOURCE_CONTEXT_CREATEDA newResourceContexthas been created.static intRESOURCE_CONTEXT_REMOVEDAResourceContexthas been removed
-
Constructor Summary
Constructors Constructor Description ResourceContextEvent(int pType, ResourceContext pResourceContext)Create a new ResourceContextEvent.ResourceContextEvent(int pType, ResourceContext pResourceContext, long pBundleId)Create a new ResourceContextEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object var0)longgetBundleId()Retrieves the identifier of the bundle being added to or removed from the Resource Context.ResourceContextgetContext()Retrieves the Resource Context associated to this eventintgetType()Retrieves the type of this Resource Context Event.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
RESOURCE_CONTEXT_CREATED
public static final int RESOURCE_CONTEXT_CREATED
A newResourceContexthas been created.The
ResourceMonitoringService.createContext(String, ResourceContext)method has been invoked.- See Also:
- Constant Field Values
-
RESOURCE_CONTEXT_REMOVED
public static final int RESOURCE_CONTEXT_REMOVED
AResourceContexthas been removedThe
ResourceContext.removeContext(ResourceContext)method has been invoked- See Also:
- Constant Field Values
-
BUNDLE_ADDED
public static final int BUNDLE_ADDED
A bundle has been added to eResourceContextThe
ResourceContext.addBundle(long)method has been invoked- See Also:
- Constant Field Values
-
BUNDLE_REMOVED
public static final int BUNDLE_REMOVED
A 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:
- Constant Field Values
-
-
Constructor Detail
-
ResourceContextEvent
public ResourceContextEvent(int pType, ResourceContext pResourceContext)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
public ResourceContextEvent(int pType, ResourceContext pResourceContext, long pBundleId)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 Detail
-
getType
public int getType()
Retrieves the type of this Resource Context Event.- Returns:
- the type of the event. One of:
-
getContext
public ResourceContext 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object var0)
- Overrides:
equalsin classjava.lang.Object
-
-