com.ibm.mashups.enabler.io
Interface DynamicResolver


public DynamicResolver

This provides a system plugin point where extensions can be registered to provide immediate resolution of IO requests for data that can be retrieved from the client. It allows circumvention of remote requests to serve data that is already available in the system. It also allows an completely extensible URL naming system such that URLs passed to IO requests can take on formats besides typical ones such as http or https. Extension formats and schemes can be handled by custom plugins to allow an arbitrary mapping of resources on the client to URLs that can be serviced through normal IO requests. The service can be retrieved using the following code:
var dynamicResolver = com.ibm.mashups.services.ServiceManager.getService(
    com.ibm.mashups.enabler.io.DynamicResolver.SERVICE_NAME);


Field Summary
 String SERVICE_NAME
           The service name to be used to fetch the service from the ServiceManager
 
Method Summary
 void register(String id, Function matcher, Function resolver, Boolean first)
           Registers a plugin for immediate request resolution.
 void unregister(String id)
           Unregisters a plugin by its registered id.
 

Field Detail

SERVICE_NAME

String SERVICE_NAME
The service name to be used to fetch the service from the ServiceManager

Method Detail

register

void register(String id,
              Function matcher,
              Function resolver,
              Boolean first)
Registers a plugin for immediate request resolution.

Parameters:
id - the id of the plugin
matcher - the function that returns a validation result to verify if the plugin can resolve the current request. Function format: Function(String url).
This function must return a "truthy" value to indicate that it can resolve this request, or a "falsy" value if it cannot. Whatever this function returns will be passed into the plugin's resolver function as the second argument.
resolver - the function that resolves the current request and passes the response data back to the caller. Function format: Function(String url, Anything validationResult).
This function must return the data for the response.
first - optional argument to specify if this plugin should take precedence over all existing plugins if set to true. If it is false the plugin will take lowest precedence of existing plugins. Default is false.

unregister

void unregister(String id)
Unregisters a plugin by its registered id.

Parameters:
id - the id of the plugin to unregister


Copyright IBM Corp. 2010 All Rights Reserved.