SunSPOT API V5.0


com.sun.spot.service
Class ServiceRegistry

java.lang.Object
  extended by com.sun.spot.service.ServiceRegistry

public class ServiceRegistry
extends Object

Global service registry for all SPOT-related services.

Author:
Ron Goldman

Method Summary
 void add(IService serviceInstance)
          Add a new service to the registery.
static ServiceRegistry getInstance()
          Get the globally unique service registry instance.
 IService lookup(Class serviceInterface)
          Lookup a matching service.
 IService lookup(Class serviceInterface, String name)
          Lookup a matching service with a specified service name.
 IService[] lookupAll(Class serviceInterface)
          Lookup all matching services.
 IService[] lookupAll(Class serviceInterface, String name)
          Lookup all matching services with a specified service name.
 void remove(IService serviceInstance)
          Remove a service from the registery.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceRegistry getInstance()
Get the globally unique service registry instance.

Returns:
the service registry instance

add

public void add(IService serviceInstance)
Add a new service to the registery.

Parameters:
serviceInstance - the new service instance to add

remove

public void remove(IService serviceInstance)
Remove a service from the registery.

Parameters:
serviceInstance - the service instance to remove

lookupAll

public IService[] lookupAll(Class serviceInterface)
Lookup all matching services.

Parameters:
serviceInterface - the desired type of service
Returns:
an array of all matching services

lookup

public IService lookup(Class serviceInterface)
Lookup a matching service. Returns the first service found that implements serviceInterface. Subsequent calls may return another service instance.

Parameters:
serviceInterface - the desired type of service
Returns:
a matching service

lookupAll

public IService[] lookupAll(Class serviceInterface,
                            String name)
Lookup all matching services with a specified service name.

Parameters:
serviceInterface - the desired type of service
name - the desired service name
Returns:
an array of all matching services

lookup

public IService lookup(Class serviceInterface,
                       String name)
Lookup a matching service with a specified service name. Returns the first service found that implements serviceInterface. Subsequent calls may return another service instance.

Parameters:
serviceInterface - the desired type of service
name - the desired service name
Returns:
a matching service

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.