Class ResourceContextEvent
- java.lang.Object
-
- org.osgi.service.resourcemonitoring.ResourceContextEvent
-
public class ResourceContextEvent extends java.lang.Object
A 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 int
BUNDLE_ADDED
A bundle has been added to eResourceContext
static int
BUNDLE_REMOVED
A bundle has been removed from aResourceContext
static int
RESOURCE_CONTEXT_CREATED
A newResourceContext
has been created.static int
RESOURCE_CONTEXT_REMOVED
AResourceContext
has 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 boolean
equals(java.lang.Object var0)
long
getBundleId()
Retrieves the identifier of the bundle being added to or removed from the Resource Context.ResourceContext
getContext()
Retrieves the Resource Context associated to this eventint
getType()
Retrieves the type of this Resource Context Event.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
RESOURCE_CONTEXT_CREATED
public static final int RESOURCE_CONTEXT_CREATED
A newResourceContext
has 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
AResourceContext
has 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 eResourceContext
The
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 aResourceContext
ResourceContext.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_CREATED
orRESOURCE_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_ADDED
orBUNDLE_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:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object var0)
- Overrides:
equals
in classjava.lang.Object
-
-