© 2006-2007 ETH Zurich

org.ximtec.igesture.tool.locator
Class Locator

java.lang.Object
  extended by org.ximtec.igesture.tool.locator.Locator

public class Locator
extends Object

Implementation of the locator pattern. A locator provides access to services which can be started and stopped. A default locator is available trough a singleton.

Version:
1.0, Mar 2008
Author:
Ueli Kurmann, igesture@uelikurmann.ch, Beat Signer, signer@inf.ethz.ch

Constructor Summary
Locator()
           
 
Method Summary
 void addService(Service service)
          Registers a new service.
static Locator getDefault()
          Returns a default locator (singleton).
 Service getService(String identifier)
          Retrieves a specific service.
<T> T
getService(String identifier, Class<T> type)
          Retrieves a specific service a casts it to the provided class type.
 List<Service> getServices()
          Returns all registered services.
 GestureDevice<?,?> getSharedDevice(String identifier)
           
 void removeService(Service service)
          Removes a service based on its unique identifier.
 void setSharedDevice(String identifier, GestureDevice<?,?> device)
           
 void startAll()
          Starts all registered services.
 void stopAll()
          Stops all registered services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Locator

public Locator()
Method Detail

addService

public void addService(Service service)
Registers a new service. The service's name can later be used to retrieve a specific service.

Parameters:
service - the service to be registered.

getService

public Service getService(String identifier)
Retrieves a specific service.

Parameters:
identifier - the identifier of the service to be retrieved.
Returns:
service for a given specifier.

getService

public <T> T getService(String identifier,
                        Class<T> type)
Retrieves a specific service a casts it to the provided class type.

Parameters:
identifier - the identifier of the service to be retrieved.
type - the class type the returned service should be automatically casted to.
Returns:
service for a given identifier.

getServices

public List<Service> getServices()
Returns all registered services.

Returns:
all registered services.

removeService

public void removeService(Service service)
Removes a service based on its unique identifier.

Parameters:
service - the service to be removed.

startAll

public void startAll()
Starts all registered services.


stopAll

public void stopAll()
Stops all registered services.


getDefault

public static Locator getDefault()
Returns a default locator (singleton).

Returns:
the default locator.

setSharedDevice

public void setSharedDevice(String identifier,
                            GestureDevice<?,?> device)

getSharedDevice

public GestureDevice<?,?> getSharedDevice(String identifier)

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.