IBM Worklight - How to import Worklight code into Eclipse? - eclipse

I am looking for information on how to import existing Worklight code into a Worklight-enabled Eclipse environment.
In addition to importing a project, it seems that it is also possible to import an app and an adapter. What subcomponents would an app and an adapter have to consist of to make them importable and re-usable? Are there any examples of such importable components on the web?
I am aware of this discussion on the IBM support page but am looking for more detail.

The below will export and import both apps and adapters belonging to the same project.
Export
- In Eclipse, right-click a project and choose Export... choose to export the project as a zip file.
Import
- In Eclipse, right-click the Project Explorer view and choose Import... choose to import an existing project (your zip file).
An app is contained in the appName folder within the apps folder. And adapter is contained in the adapterName folder within the adapters folder.
There are no mechanisms to export and import the CODE of an adapter or application. You will need to copy-paste the files/folders manually and likely change many references in your files as many locations have different values based on the project name you've used.
Such an approach is highly not recommend by Worklight.
Starting Worklight 6.1, the training modules also contain a portion about how to import projects.

Related

How to import ATG CRS module in eclipse and customize

I am new to ATG and i installed ATG CRS 11.2 using CIM and it is installed properly and i am able to access the site but i want to import the CRS module in eclipse and customize the existing code for my learning purpose.
I tried the ways given on net, install atg plugin and trying to import but it is not importing.
Please explain the steps to do same.
Thanks
The Oracle A-Team have an article Building Oracle ATG Commerce With Maven. They have created a sample github project which uses CRS 11.2 as the basis for the project. You should be able to import this as a Maven project within Eclipse.
Create a new Java Project in Eclipse
Using windows browser, go to the location where your Java Project is created.
Open the Java Project folder, you will find .classpath and .project files there.
Now, go to your ATG_ROOT folder, and find the folder CommerceReferenceStore/Store
Copy-paste your .project and .classpath files here.
Edit the .project file and replace the project name by CommerceReferenceStore.Store.
CRS also has some other (nested) modules. Do the same for the nested modules you want to import in eclipse.
Re-open eclipse, Go to File -> Import -> Other -> Existing Projects into your workspace.
Browse to your ATG_ROOT directory and select the Store folder
Check on "Search for Nested Projects"
It will populate a list of all the projects, which you can now import.
For customizing CRS, it is not recommended to modify the existing CRS
code. You can create a new module, and layer it on top of CRS to
customize it. For more details on creating a new module above CRS, and
doing an assemble-deploy via CIM, you can follow this article provided
below. It has 3 small parts which can get your task done!
Here is the article:
http://learnoracleatg.blogspot.in/2016/12/create-and-deploy-new-atg-module-on-local-from-scratch-part-1.html

Flex/Eclipse Way of saving the list of projects in a workspace

I am developing a few flex applications along with several common libraries using FlashBuilder 4.5. The applications links to the libraries. I work as part of a team. So I have a workspace into which I import all the projects (application and libraries) . Each project is in source control (git). So the workspace often has Application A, Application B,... Application X
Library 1, Library 2, Library 3, and many more. The libraries are often used by many of the applications. So it is useful to have a workspace where all this in it at the same time.
I would like a way of storing in source control the list of projects in the workspace. So this way, the whole team has the same projects in the workspace. The only way I know is to save the [workspace].metadata.plugins\org.eclipse.core.resources
in source control - which is a bad idea for various reasons (namely 1.tree etc keep getting regenerated).
Currently if I import all the projects, because I have the libraries linked, when I open an application it correctly opens all the related projects. But I need this functionality for importing.
Is there a construct in Flex, or some better way in Eclipse that allows this?
Essentially I want to group a bunch of projects together - that I can import in one go - that has exactly what the entire team ought to have imported into their workspaces.
You can use Team Project Sets to import a set of projects.
Use 'File > Export > Team > Team Project Set' to create a project set file.
Other people can than import the project set using 'File > Import > Team > Team Project Set'.
See the Eclipse help for more details.

Getting imported files from sample java program to new program

I'm trying to make a small java program revolving around Google Calendars. I've never worked with java before but I was able to get Google's sample code working. In Eclipse, I simply used Import -> Maven, and then made some small changes to the code so that it worked on my Calendar.
Ok, great, now I want to write my own code. I started a new project and imported the Google Calendar API. At the very beginning, there are several import actions:
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
.
.
.
It turns out that I'm missing the second and third files. How do I find these files and how to do import them to the new project?
Please note: I ultimately don't want to rely on importing the Google Calendar API or anything similar, as I will be using another non-java program to run and control this one.
Here's what I tried:
I go back to the sample code, expand Maven Dependencies and find:
google-oauth-client-jetty-1.19.0.jar
google-oauth-client-java6-1.19.0.jar
I see that these files are in:
C:\******\.m2\repository\com\google\oauth-client\google-oauth-client-jetty\1.19.0
C:\******\.m2\repository\com\google\oauth-client\google-oauth-client-java6\1.19.0
I tried to add these with Import -> Java EE -> App Client JAR file
Didn't work, do I need to change the file name or import name? Maybe these aren't the correct files anyway.
I also tried to add these by creating a lib folder in my project folder and add the JAR files directly there.
I guess from your question your project is just an Eclipse project rather than a Maven project. Obviously Maven automatically add the required jars of the dependencies stated in pom.xml for example google-oauth-client-java6-1.19.0.jar is a dependency of google-oauth-client-jetty-1.19.0.jar.
To add external jar to your project in Eclipse you need to select the project then from the Project menu select Properties. On the properties popup click on the Java Build Path, you have two options depending where the jars are stored, if you are referring to the maven .m2 directory then choose 'Add External Jars' otherwise if you added them to a lib folder in the project choose Add Jars

Import a project into another imported project

I found this statement in the help of a project that I want to import it named "storm-
election"
This is a simple demo app based on the storm-starter project. https://github.com/nathanmarz/storm-starter.
So, I imported storm-starter project successfully. How can I import storm-election project?
Can I import a project on another imported project ?
Eclipse 4.5 (starting from Mars M5) will include a mechanism that allows to nested projects under their parent one.
You can already give it a try by accessing the latest snapshot build of Eclipse Platform (which is a subset of the IDE, but which contains the change) http://download.eclipse.org/eclipse/downloads/drops4/N20150124-1500/ , when Mars M5 is ready, you'll be able to access from http://eclipse.org/downloads a full featured IDE which also contains this feature.
Reference https://bugs.eclipse.org/bugs/show_bug.cgi?id=427768
You cannot create a project under any project, like you create folder(s) under folder, folder(s) under project, file(s) under project and file(s) under folder.
All projects in a workspace are siblings no child and parent relationship exists between projects.
I am not able to see storm-election project in the link provided, but you can import this project in the same way as you imported storm-starter project.

Importing a existing Web Application , into Eclipse

I need to import a existing Web Application , into Eclipse .
Please see the Structure of my Web Application as shown in the below figure .
http://imageshack.us/f/220/structurek.jpg/
From Eclipse IDE , while using import What option i need to select that is should i use
Existing projects into Eclipse
Archive File
File System
please see this image
http://imageshack.us/f/850/eclipseo.jpg/
Import existing projects into Eclipse works only for projects that were created in Eclipse.
And you're definitely not dealing with an Archive File here.
Import from the File System just copies the resources but does not actually create an Eclipse project for you.
What I would advise you, is to create a new Dynamic Web Project, configuring all the required facets, and then just copy all the contents of your existing app to the WebContent folder, either by drag'n'dropping it into the Project Explorer or by using Import from the File System, overwriting all the contents.
So far, there seems to be no other way to do it in Eclipse. However you may check out the similar post. The user #RC recommends using ant task for this process, but I'm more than sure that it won't configure all the required facets for you. It may work for some simple Java projects, but surely not enough for Java EE projects.