Friday, October 29, 2010

Create Elicpse Plug-in Project programmatically

Today I decide to build a wizzard for custom project plugin creation.
I found after a few search this link that was very usefull.

Tuesday, October 26, 2010

How to run Java class from Xpand Template

1 install eclipse (helios) software :
  • mwe2
  • xpand

2 create a new Xpand project (use wizzard)
Then, add dependencies :
  •  org.eclipse.emf.mwe2.launch,
  •  org.eclipse.xtext

3 get an emf model
       See Vogel Lars tutorial to do your own model

4 create an mwe2 workflow (use wizzard)
Add components
  •  (EMF) reader
  •  (Xpand2) generator

I create a workflow called "engine.mwe2" in frk.generator package module frk.generator.engine

1 import org.eclipse.emf.mwe.utils.*
2 var targetDir = "src-gen"
3 Workflow {
4      component = Reader {
5               modelSlot ="mymodel"
6               uri="src/MyFirst.app"
7               firstElementOnly = true
8       }
9
10       component = org.eclipse.xpand2.Generator {
11               metaModel = org.eclipse.xtend.typesystem.emf.EmfMetaModel
12              {
13                      metaModelPackage="app.AppPackage"
14              }
15              expand = "frk::template::Root::root FOR mymodel"
16              outlet = {
17                      path = "${targetDir}"
18                      overwrite = true
19              }
20              fileEncoding = "ISO-8859-1"
21      }
22}


4 : EMF reader component
10 : Generator calling Xpand

5 create a Java Class
package frk.xtend;

public class CreatePluginProject {

       public static void createPluginProjectMeth(String name) {
               System.out.println("project created "  + name);
       }

       public static String createPluginProjectMethString(
String name)
{
               System.out.println("project " + name + " created from
method ");
               return "a string";
       }
}

6 create an Xtend extension

createPluginProjectMeth(String name): 
JAVA
frk.xtend.CreatePluginProject.createPluginProjectMeth(java.lang.String);
String createPluginProjectMethString(String name): 
JAVA
frk.xtend.CreatePluginProject.createPluginProjectMethString(java.lang.String);
7 create an Xpand template
In the package frk.template I create Root.xpt



1<IMPORT app>
2<EXTENSION frk::xtend::createProject>
3
4<DEFINE root FOR app::App>
5<createPluginProjectMethString("AAA")>
6<ENDDEFINE>

2 : Add the xtend declaration
5 : call the Java method via xtend


Finally, run the workflow and it should work.

Monday, October 4, 2010

OSGI and Declarative service

A few weeks ago I was interested in equinox and I discovered Declararative Service. The main idea of DS is to allow to use non OSGI source code to build OSGI organization.
To do this eclipse DS rely on  component.xml definition file. This file describe what is provided and what is consume in terms of “Interfaces”. Then the equinow framework does the rest.

Sunday, October 3, 2010

xpand oaw migration to mwe

I finally migrate my generator from oaw to mwe.
I Found the ekkes-corner site very usefull ekkes-corner and this one precisely

Build xpand generator for EMF

I finally build an xpand generator with my EMF editor. I currently use an oaw generator and i will convert it soon in mwe (with eclipse Helios)

Eclipse : editing my own model using EMF

I tried to build a small prototype with an eCore model.(I'm using UML tools on galileo to view diagram)


My goal is to build an EMF editor that allow me to use MD on it (for generating equinox plugin representing service).
It's simple to have an emf editor ( see Lars Vogel EMF tutorial)

Choosing an UML modeler for MD approach

We were working a study to be able to choose a modeler. The result : RSM wins ( see RSA now after rebranding). For the moment, we think that is the tool which is fit best our needs.
We have many business user that are not used to work with UML modeler, so we need a mature one. We saw a lot of good tools as EA from Sparx System, Magic Draw or Topcased but only one wins.
A good entry point for UML modeling

Equinox as service support

After many studies we choose Equinox OSGI for service support and a MOM for infrastructure distribution.