Class orion.ServiceTracker
Simplifies the use of services within a service registry.
Defined in: </shared/eclipse/e4/orion/I201302221257/plugins/org.eclipse.orion.client.core/web/orion/serviceTracker.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.ServiceTracker(serviceRegistry, serviceName)
A ServiceTracker tracks matching services in 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, serviceName)
A ServiceTracker tracks matching services in the given service registry. Matching services are those
whose
objectClass
property contains the given serviceName
. 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} serviceName
- The service name 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.
{Deferred|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
- {orion.serviceregistry.Service} service
- Returns:
- {Deferred|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.
- {orion.serviceregistry.Service} service
- The service object for the removed service.