Class orion.ServiceTracker
Simplifies the use of services within a service registry.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.core/web/orion/serviceTracker.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.ServiceTracker(serviceRegistry, objectClass)
Creates a
ServiceTracker against the given service registry. |
Method Attributes | Method Name and Description |
---|---|
addingService(serviceRef)
Called to customize a service object being added to this ServiceTracker.
|
|
close()
Stops tracking services.
|
|
Returns service references to the services that are being tracked.
|
|
onClose()
Called when this ServiceTracker has been closed.
|
|
onOpen()
Called when this ServiceTracker has been opened.
|
|
onServiceAdded(serviceRef, service)
Called when a service is being added to this ServiceTracker.
|
|
open()
Begins tracking services.
|
|
removedService(serviceRef, service)
Called when a service has been removed from this ServiceTracker.
|
Class Detail
orion.ServiceTracker(serviceRegistry, objectClass)
Creates a
ServiceTracker
against the given service registry.
The returned ServiceTracker
will track services whose objectClass
property contains the
given objectClass
parameter.
After creating a ServiceTracker
, it can then be #opened to begin tracking services.
The #addingService and #removedService methods can be overridden to customize the service objects being tracked.
- Parameters:
- {orion.serviceregistry.ServiceRegistry} serviceRegistry
- The service registry to track services of.
- {String} objectClass
- The objectClass of services to be tracked.
Method Detail
{Object}
addingService(serviceRef)
Called to customize a service object being added to this ServiceTracker. Subclasses may override this method.
The default implementation returns the result of calling orion.serviceregistry.ServiceRegistry#getService
passing the service reference.
- Parameters:
- {orion.serviceregistry.ServiceReference} serviceRef
- The reference to the service being added.
- Returns:
- {Object} The service object to be tracked for the given service reference. If
null
is returned, the service reference will not be tracked.
close()
Stops tracking services.
{orion.serviceregistry.ServiceReference[]}
getServiceReferences()
Returns service references to the services that are being tracked.
- Returns:
- {orion.serviceregistry.ServiceReference[]} References to all services that are being tracked by this ServiceTracker.
onClose()
Called when this ServiceTracker has been closed. Subclasses can override this method.
onOpen()
Called when this ServiceTracker has been opened. Subclasses can override this method.
{orion.Promise|undefined}
onServiceAdded(serviceRef, service)
Called when a service is being added to this ServiceTracker. Subclasses can override this method to take part
in the service's
'serviceAdded'
phase.
- Parameters:
- {orion.serviceregistry.ServiceReference} serviceRef
- The service reference for the service that is being added.
- {Object} service
- The service implementation object that is being added.
- Returns:
- {orion.Promise|undefined} This method can optionally return a deferred. If it does, the returned deferred
will be added to the service's
serviceAdded
listener queue; in other words, the returned deferred must resolve before any calls to the service's methods can proceed.
open()
Begins tracking services.
removedService(serviceRef, service)
Called when a service has been removed from this ServiceTracker. Subclasses may override this method.
The default implementation does nothing.
- Parameters:
- {orion.serviceregistry.ServiceReference} serviceRef
- The reference to the removed service.
- {Object} service
- The service implementation object for the removed service.