View Javadoc

1   package de.mxro.service;
2   
3   import de.mxro.fn.Success;
4   import delight.async.Operation;
5   import delight.async.callbacks.SimpleCallback;
6   import delight.async.callbacks.ValueCallback;
7   
8   public interface ServiceRegistry {
9   
10  	/**
11  	 * <p>Seeks first match in registry of service which provides the provided
12  	 * interface of type clazz (e.g. service can be cast to clazz).
13  	 * <p>Subscribe as a user to this service
14  	 * 
15  	 * @param clazz
16  	 * @return
17  	 */
18  	public <InterfaceType> void subscribe(Class<InterfaceType> clazz, ValueCallback<InterfaceType> callback);
19  
20  	public <InterfaceType> Operation<InterfaceType> subscribe(Class<InterfaceType> clazz);
21  	
22  	/**
23  	 * Release a subscription for this service.
24  	 * @param service
25  	 */
26  	public void unsubscribe(Object service, SimpleCallback callback);
27  	
28  	
29  	public Operation<Success> unsubscribe(Object service);
30  	
31  	public void register(Service service);
32  	
33  
34  	
35  }