Adding worklight adapter programmatically - ibm-mobilefirst

I am creating application which should be plugin upgradable.
Problem is that every plugin should consist of some client code and there should also be some sort of adapter which will fetch data to application from 3rd party site/api/... So my problem is how do I add new adapter to server programmatically when someone deploy new plugin?? Is it possible? Or is there better architectonic approach?

Using Worklight Studio (plug-in for Eclipse), you cannot programmatically add adapters.
If you are using Worklight 6.2, you can explore the newly released Worklight CLI, which is a command line interface to create projects, applications, adapters, environments, etc... perhaps you could devise a way to intergrate this into a build a system of your own that will fit your needs.
Training module: Using CLI to create, build, and manage Worklight project artifacts
User documentation: Command Line Interface for IBM Worklight Developers

Related

MobileFirst 7.1 - MobileWebApp and DesktopBrowserApp Environment

We are using MobileFirst 7.1.0.0-MFPF-IF201703150904 version. We have built a hybrid mobile application for iPhone and Android. In the backend, we have all Java Adapters.
Recently we have decided to extend the scope and add MobileWeb and DesktopBrowser Application. To achieve that I have created the new environment in eclipse studio and tried to test the new environments. I found this error "errorMsg":"Unsupported environment"
I found this article where the same issue is discussed. The article states a workaround would be to use JavaScript adapters.
My question is how can we create these environments now, we only have Java adapters in the backend. Do we need to replicate all the adapters in JavaScript? Is there any other way to achieve this?

Can IBM Worklight Mobile build faster

Currently I am using Eclipse. Can I use another IDE or a customized configuration for Eclipse to build for my project faster? I want to increase my production time.
Worklight 6.2 and above provide a command line interface which you can use instead of Eclipse.
With some development effort you could also take the CLI and hook it to other IDEs that provide pluggability options.
You can read more about the CLI, here:
For Worklight 6.2: Command Line Interface for IBM Worklight Developers
For MobilFirst 6.3 and above: Using CLI to create, build, and manage MobileFirst project artifacts

Migrate a 5.0.6 studio project into Worklight 6.1 studio

Is it possible to migrate a WL 5.0.6 project into WL 6.1 studio. The project uses dojo, and Cordova. Initial results are obviously that dojo is not found, and for the java based Cordova code it is not able to find ::import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;
Apprecaite any suggestions of steps tpo accomplish this migration, or perhaps the best appraoch is to create a new 6.1 project and manually move in the logic from the 5.0.6 project.
Thanks for any helpful advice.
I cannot imagine for a Worklight 5.0.6-based app with Dojo and Cordova plug-in, to properly migrate to Worklight 6.1.0.x
As you mention, Dojo library is missing, which makes sense. Dojo library is a separate entity from the Worklight project. You will need to import it as well.
Worklight 5.0.6 is based on some very olden version of Cordova 2. Worklight 6.1.0.x uses Cordova 3.1.
In Cordova 3, the structure of config.xml as well as the way you call a Cordova plug-in has changed (if memory serves me right), so I suggest that here too you will consult with the Getting Started training module for creating Cordova plug-ins (also check out the sample project) and verify that in the migrated project you now follow these changes. I believe the migration process should update the config.xml file, but not any code you write... this is not something Worklight can do for you (as this is user-code).
As for the error mesage, I suspect this very much relates to 2 above; take a look at the sample project and see how the Java class (or .m and .h files for iOS) of the Cordova plug-in is done; pay attention to the imports and alike. Compare the two...

IBM Worklight - Deploy all adapters at once

I have total 35 (and increasing) Worklight Adapters in my Worklight Hybrid App.
Now every time I power on my Mac, I need to deploy all those work light adapters ONE-BY-ONE
Is there any method by which I can deploy awl the adapters in single shot. As of now, I am unable to find out the way.
Anyone else faced the similar problem?
I am using:
Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 2
Build id: 20130225-0426
If that matters.
A Deploy All Adapters action is not available in Worklight Studio, but sounds like a rather useful feature for cases like yours. Feel free to submit a feature request.
After you power on the computer, open Eclipse and start the Worklight Development Server, and then visit Worklight Console, the apps and adapters are not available? I find it highly unlikely that you will need to re-deploy all of your adapters...
A possible workaround for it will be to enhance the Ant script that deploys apps and adapters, to deploy them all using a loop. Also see:
Ant tasks for building and deploying applications and adapters

Cloudfondry Eclipse plugin add existent app

I have an existent deployed spring app up on cloudfoundry, deployed from one PC. Now I set up Eclipse with my project on another PC and I added my existent cloudfoundry deployment via the Cloudfoundry Eclipse plugin. The problem is that the CF Server with my deployed app is not sync-ed with my local eclipse project, so I cannot deploy any changes from my project.
Is there any way of doing this sync after I add my Cloudfoundry Server?
Thanks
The cloudfoundry deployment approach will not automatically (dynamically) maintain synchronization between your two eclipse environments. You might use a source control approach where you push your version from one eclipse environment to github and use that as the synchronization mechanism by cloning it and importing the project into one or the other eclipse environments.