org.apache.shindig.gadgets.render
Class DefaultRpcServiceLookup

java.lang.Object
  extended by org.apache.shindig.gadgets.render.DefaultRpcServiceLookup
All Implemented Interfaces:
RpcServiceLookup

public class DefaultRpcServiceLookup
extends Object
implements RpcServiceLookup

Simple storage for holding the various services offered by containers. This storage is keyed by container, and within each container, the services are stored, keyed by, the endpoint url. Here is a json structure that shows how data is stored: { container1 : { "http://.../endpoint1" : ["system.listMethods", "people.get", "people.create", "people.delete"], ... }, "http://.../endpoint2" : { "system.listMethods", "cache.invalidate"], ... } }, container 2 : ..... }


Constructor Summary
DefaultRpcServiceLookup(DefaultServiceFetcher fetcher, Long duration)
           
 
Method Summary
 com.google.common.collect.Multimap<String,String> getServicesFor(String container, String host)
          This result map is a map of the form { endpoint1 -> [services]}, endpoint2 -> [services]} Services are described using the names expected as a result of JSON-RPC call to system.listMethods When a gadget is rendered the container data is mapped into gadgets.config and used to initialize osapi, which typically results in output that looks like { "osapi.services" : { "http://.../endpoint1" : ["system.listMethods", "people.get", "people.create", "people.delete"], ...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRpcServiceLookup

@Inject
public DefaultRpcServiceLookup(DefaultServiceFetcher fetcher,
                                      Long duration)
Parameters:
fetcher - RpcServiceFetcher to retrieve services available from endpoints
duration - in seconds service definitions should remain in the cache
Method Detail

getServicesFor

public com.google.common.collect.Multimap<String,String> getServicesFor(String container,
                                                                        String host)
Description copied from interface: RpcServiceLookup
This result map is a map of the form { endpoint1 -> [services]}, endpoint2 -> [services]} Services are described using the names expected as a result of JSON-RPC call to system.listMethods When a gadget is rendered the container data is mapped into gadgets.config and used to initialize osapi, which typically results in output that looks like { "osapi.services" : { "http://.../endpoint1" : ["system.listMethods", "people.get", "people.create", "people.delete"], ... }, "http://.../endpoint2" : { "system.listMethods", "cache.invalidate"], ... } }}

Specified by:
getServicesFor in interface RpcServiceLookup
Parameters:
container - Syndicator param identifying the container for whom we want services
host - Host for which gadget is being rendered, used to do substitution in endpoints
Returns:
Map of Services, by endpoint for the given container.


Copyright © 2007-2012. All Rights Reserved.