Interface IExtensionTracker
- All Known Implementing Classes:
ExtensionTracker
public interface IExtensionTracker
An extension tracker keeps associations between extensions and their derived objects on an extension basis.
All extensions being added in a tracker will automatically be removed when the extension is uninstalled from the registry.
Users interested in extension removal can register a handler that will let them know when an object is being removed.
This interface can be used without OSGi running.
This interface is not intended to be implemented by clients.
- Since:
- 3.1
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant for soft reference holding.static final int
Constant for strong (normal) reference holding.static final int
Constant for weak reference holding. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the tracker.Object[]
getObjects
(IExtension extension) Return all the objects that have been associated with the given extension.void
registerHandler
(IExtensionChangeHandler handler, IFilter filter) Register an extension change handler with this tracker using the given filter.void
registerObject
(IExtension extension, Object object, int referenceType) Create an association between the given extension and the given object.void
unregisterHandler
(IExtensionChangeHandler handler) Unregister the given extension change handler previously registered with this tracker.Object[]
unregisterObject
(IExtension extension) Remove all the objects associated with the given extension.void
unregisterObject
(IExtension extension, Object object) Remove an association between the given extension and the given object.
-
Field Details
-
REF_STRONG
static final int REF_STRONGConstant for strong (normal) reference holding. Value1
.- See Also:
-
REF_SOFT
static final int REF_SOFTConstant for soft reference holding. Value2
.- See Also:
-
REF_WEAK
static final int REF_WEAKConstant for weak reference holding. Value3
.- See Also:
-
-
Method Details
-
registerHandler
Register an extension change handler with this tracker using the given filter.- Parameters:
handler
- the handler to be registeredfilter
- the filter to use to choose interesting changes
-
unregisterHandler
Unregister the given extension change handler previously registered with this tracker.- Parameters:
handler
- the handler to be unregistered
-
registerObject
Create an association between the given extension and the given object. The referenceType indicates how strongly the object is being kept in memory. There is 3 possible values:REF_STRONG
,REF_SOFT
,REF_WEAK
.- Parameters:
extension
- the extensionobject
- the object to associate with the extensionreferenceType
- one of REF_STRONG, REF_SOFT, REF_WEAK- See Also:
-
unregisterObject
Remove an association between the given extension and the given object.- Parameters:
extension
- the extension under which the object has been registeredobject
- the object to unregister
-
unregisterObject
Remove all the objects associated with the given extension. Return the removed objects.- Parameters:
extension
- the extension for which the objects are removed- Returns:
- the objects that were associated with the extension
-
getObjects
Return all the objects that have been associated with the given extension. All objects registered strongly will be return unless they have been unregistered. The objects registered softly or weakly may not be returned if they have been garbage collected. Return an empty array if no associations exist.- Parameters:
extension
- the extension for which the object must be returned- Returns:
- the array of associated objects
-
close
void close()Close the tracker. All registered objects are freed and all handlers are being automatically removed.
-