Portlet Factory, Version 6.1.2


 

Redirecting service provider references

Essentially, a Service Mapping Registry file works by identifying conditions under which a Service Provider reference need to be replaced by or swapped with another Service Provider reference and providing the model ID of the replacement Service Provider. For example, a Service Consumer builder call might refer to a Service Provider model named services\myDataServices.model in the WEB-INF\models folder in the web application project. A second Service Provider model named services\myDataServices_stub.model, built as a stub by using the stub generating features in the Service Definition builder call of the first Service Provider model, could exist in the project and be referenced by the Service Provider model.

For the convenience of the developer, a Service Mapping Registry file could be configured so that at regeneration time, the stub provider is always used but at runtime, the real Service Provider, which relies on live data, would be used. To set up this configuration, the following XML instructions must exist in an XML Service Mapping Registry file stored in the web application project in the WEB-INF\config\service_mappings folder.

<ForService name="services/myDataServices" when="regen-time"> 
<UseStub /> 
</ForService>  

In this case, the Service Consumer builder would reference the services/myDataServices model as the Service Provider. At regen-time, WebSphere Portlet Factory would know to swap out the myDataServices Service Provider model and use the stub model referenced in the myDataServices model's Service Definition builder call.

Parent topic: Using data services


Library | Support |