Monday 15 April 2013

ibm mobilefirst - Sharing code between Worklight Adapters -


In most cases, I've done the Verlachla adapter implementation very trivial, with some lines of JavaScript.

On the existing project, using WL 5.0.6, we have many adapters, each of which has several processes. Our special backends require some general reasoning to set up and interpret responses. The Shared Library seems ideal for refactoring the common code for execution, as far as I can see that there is no "library" concept in the adapter environment, unless we want to drop in Java.

Is there a pattern for the code to be reused between the adapter?

I think that you are right There is currently no way to import custom javascript libraries.

Using the "load (xyz.js)" function, Mozilla Rhino is a way to include / load javascript files in the engine, but it is not uncommon for your widescreen adapter.

But I have noticed that it will make your virtualized adapter undeployable. If you deploy another * .js file inside an adapter, you will receive the following error message:

  Adapter Deployment Failed: The process was not implemented in the 'getstories' adapter's javascript file   

It seems that the warklight server can handle only one javascript file per adapter.

No comments:

Post a Comment