<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2936549675466280492</id><updated>2024-11-28T18:46:20.851-08:00</updated><category term="OSGi"/><category term="Functional Programming"/><category term="Model Driven Architecture"/><category term="Xtext DSL"/><title type='text'>Functional Modeling with EMF, Xtext, Groovy and Scala</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-7073651035190843788</id><published>2012-07-15T14:10:00.001-07:00</published><updated>2012-07-15T14:10:28.048-07:00</updated><title type='text'>Using Javassist to Create a Karaf/GoGo Shell Command Dynamically</title><content type='html'>&lt;b&gt;Karaf OSGi runtime&lt;/b&gt; provides an excellent &lt;b&gt;shell&lt;/b&gt; &lt;b&gt;console&lt;/b&gt; functionality called &lt;b&gt;Felix GoGo&lt;/b&gt; that can be extended easily using &lt;b&gt;Blueprint XML&lt;/b&gt; :&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;command-bundle xmlns=&amp;quot;&lt;a href=&quot;http://karaf.apache.org/xmlns/shell/v1.0.0&quot;&gt;http://karaf.apache.org/xmlns/shell/v1.0.0&lt;/a&gt;&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;command name=&amp;quot;process/run&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;action class=&amp;quot;com.soluvas.process.shell.ProcessRunCommand&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;argument ref=&amp;quot;processContainer&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;argument ref=&amp;quot;ksession&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;argument ref=&amp;quot;dependencyLookup&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/action&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/command&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;command name=&amp;quot;process/ls&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;action class=&amp;quot;com.soluvas.process.shell.ProcessLsCommand&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;argument ref=&amp;quot;processContainer&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/action&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/command&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;command name=&amp;quot;process/class&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;action class=&amp;quot;com.soluvas.process.shell.MakeClassCommand&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;argument ref=&amp;quot;blueprintBundleContext&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/action&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/command&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;/command-bundle&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;br&gt;A Karaf Shell Blueprint command element is equivalent to:&lt;br&gt;      	  	  	  	&lt;style type=&quot;text/css&quot;&gt;  	&lt;!--  		@page { margin: 2cm }  		P { margin-bottom: 0.21cm }  	--&gt;  	&lt;/style&gt;      &lt;p style=&quot;margin-bottom:0cm&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;bean&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;id&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;processLsCommand&amp;quot;&lt;/i&gt;&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;scope&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;prototype&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;	&lt;font color=&quot;#7f007f&quot;&gt;class&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;com.soluvas.process.shell.ProcessLsCommand&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;	&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;argument&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;ref&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;processContainer&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;/&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;bean&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;service&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;auto-export&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;interfaces&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;	&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;service-properties&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;		&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;entry&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;key&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;osgi.command.scope&amp;quot;&lt;/i&gt;&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;value&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;test&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;		&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;entry&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;key&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;osgi.command.function&amp;quot;&lt;/i&gt;&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;value&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;ls&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;	&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;/&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;service-properties&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;	&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;bean&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;class&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;org.apache.karaf.shell.console.commands.BlueprintCommand&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;		&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;property&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;name&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;blueprintContainer&amp;quot;&lt;/i&gt;&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;ref&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;blueprintContainer&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;		&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;property&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;name&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;blueprintConverter&amp;quot;&lt;/i&gt;&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;ref&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;blueprintConverter&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;		&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;property&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;name&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;actionId&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;idref&lt;/font&gt;  &lt;font color=&quot;#7f007f&quot;&gt;component-id&lt;/font&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&lt;i&gt;&amp;quot;processLsCommand&amp;quot;&lt;/i&gt;&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;/&amp;gt;&amp;lt;/&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;property&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;	&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;/&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;bean&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style=&quot;margin-bottom:0cm&quot; align=&quot;LEFT&quot;&gt;&lt;font face=&quot;Liberation Mono, monospace&quot;&gt;&lt;font style=&quot;font-size:9pt&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;lt;/&lt;/font&gt;&lt;font color=&quot;#3f7f7f&quot;&gt;service&lt;/font&gt;&lt;font color=&quot;#008080&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;      &lt;br&gt;Using the bytecode tooling library &lt;b&gt;Javassist,&lt;/b&gt; it&amp;#39;s possible (and almost quite practical) to create GoGo commands dynamically at runtime :&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;ClassPool pool = new ClassPool();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;pool.appendClassPath(new LoaderClassPath(getClass().getClassLoader()));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;CtClass helloClass = pool.makeClass(&amp;quot;cc.HelloCommand&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;helloClass.setSuperclass(pool.get(&amp;quot;org.apache.karaf.shell.console.OsgiCommandSupport&amp;quot;));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;helloClass.addInterface(pool.get(&amp;quot;org.apache.karaf.shell.console.CompletableFunction&amp;quot;));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;helloClass.addInterface(pool.get(&amp;quot;org.apache.felix.service.command.Function&amp;quot;));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;ClassFile cf = helloClass.getClassFile();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;AnnotationsAttribute attr = new AnnotationsAttribute(cf.getConstPool(), AnnotationsAttribute.visibleTag);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;Annotation annotation = new Annotation(&amp;quot;org.apache.felix.gogo.commands.Command&amp;quot;, cf.getConstPool());&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;annotation.addMemberValue(&amp;quot;scope&amp;quot;, new StringMemberValue(&amp;quot;test&amp;quot;, cf.getConstPool()));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;annotation.addMemberValue(&amp;quot;name&amp;quot;, new StringMemberValue(&amp;quot;hello&amp;quot;, cf.getConstPool()));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;annotation.addMemberValue(&amp;quot;description&amp;quot;, new StringMemberValue(&amp;quot;Hello!&amp;quot;, cf.getConstPool()));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;attr.addAnnotation(annotation);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;cf.addAttribute(attr);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;CtMethod doExecuteMethod = CtMethod.make(&amp;quot;protected Object doExecute() throws Exception { System.out.println(\&amp;quot;OMG!\&amp;quot;); return \&amp;quot;Hello!\&amp;quot;; }&amp;quot;, helloClass);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;helloClass.addMethod(doExecuteMethod);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;System.out.println(&amp;quot;Class: &amp;quot; + helloClass);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;Class clazz = helloClass.toClass(getClass().getClassLoader(), getClass().getProtectionDomain());&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;System.out.println(&amp;quot;Created &amp;quot; + clazz);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;final Object obj = clazz.newInstance();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;BlueprintCommand cmd = new BlueprintCommand() {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    @Override&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    public Action createNewAction() {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        return (Action)obj;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;};&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;Hashtable&amp;lt;String, String&amp;gt; props = new Hashtable&amp;lt;String, String&amp;gt;();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;props.put(CommandProcessor.COMMAND_SCOPE, &amp;quot;test&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;props.put(CommandProcessor.COMMAND_FUNCTION, &amp;quot;hello&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;bundleContext.registerService(new String[] { CompletableFunction.class.getName(),&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;                Function.class.getName() }, cmd, props);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;return null;&lt;/span&gt;&lt;br&gt;&lt;br&gt;  </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/7073651035190843788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/using-javassist-to-create-karafgogo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/7073651035190843788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/7073651035190843788'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/using-javassist-to-create-karafgogo.html' title='Using Javassist to Create a Karaf/GoGo Shell Command Dynamically'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-6292235528841335507</id><published>2012-07-15T00:04:00.001-07:00</published><updated>2012-07-15T01:35:14.087-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OSGi"/><title type='text'>JBoss jBPM 5.3.0.Final problem in Apache Karaf OSGi Runtime</title><content type='html'>&lt;style type=&quot;text/css&quot;&gt;
   &lt;!--    @page { margin: 2cm }    PRE { color: #008000 }    PRE.western { font-family: &quot;Droid Sans Mono&quot;, sans-serif; font-size: 8pt }    PRE.cjk { font-family: &quot;DejaVu Sans&quot;, monospace }    P { margin-bottom: 0.21cm; line-height: 120%; widows: 2; page-break-before: auto }    P.western { font-family: &quot;Ubuntu&quot;; font-size: 11pt }    P.cjk { font-size: 10pt }    H2 { margin-bottom: 0.21cm; widows: 2; page-break-before: auto }    H2.western { font-family: &quot;Arial&quot;, sans-serif; font-size: 14pt; font-style: italic }    H2.cjk { font-size: 14pt; font-style: italic }    H2.ctl { font-family: &quot;Lohit Hindi&quot;; font-size: 14pt; font-style: italic }   --&gt;   
&lt;/style&gt;      &lt;br /&gt;
&lt;h2 class=&quot;western&quot;&gt;


&lt;/h2&gt;
&lt;div class=&quot;western&quot;&gt;
EMF works, Drools works, but now cannot start the  jBPM bundle :&lt;/div&gt;
&lt;pre class=&quot;western&quot;&gt;registering api : org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl@70cf08b1 : interface org.drools.runtime.process.ProcessRuntimeFactoryService  registering compiler : org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl@70cf08b1 : interface org.drools.runtime.process.ProcessRuntimeFactoryService  registering api : org.jbpm.marshalling.impl.ProcessMarshallerFactoryServiceImpl@69c78571 : interface org.drools.marshalling.impl.ProcessMarshallerFactoryService  registering api : org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl@7442df79 : interface org.drools.compiler.ProcessBuilderFactoryService  ERROR: Bundle org.jbpm.bpmn2 [170] Error starting mvn:org.jbpm/jbpm-bpmn2/5.3.0.Final (org.osgi.framework.BundleException: Activator start error in bundle org.jbpm.bpmn2 [170].)  java.lang.NullPointerException          at org.apache.felix.framework.resolver.ResolverImpl.toStringBlame(ResolverImpl.java:1583)          at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1007)          at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:171)          at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4103)          at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)          at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)          at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)          at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)          at java.lang.ClassLoader.loadClass(ClassLoader.java:266)          at org.jbpm.osgi.bpmn2.Activator.start(Activator.java:35)          at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)          at org.apache.felix.framework.Felix.activateBundle(Felix.java:1842)          at org.apache.felix.framework.Felix.startBundle(Felix.java:1759)          at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)          at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)          at java.lang.Thread.run(Thread.java:679)  
&lt;/pre&gt;
Still not sure why...

Even doing dev:show-tree breaks Karaf :
&lt;br /&gt;
&lt;pre class=&quot;western&quot;&gt;&lt;/pre&gt;
&lt;pre class=&quot;western&quot;&gt;2012-07-15 14:10:48,870 | INFO  | l Console Thread | Console                          | 36 - org.apache.karaf.shell.console - 2.2.8 | Exception caught while executing command
java.lang.ArrayIndexOutOfBoundsException: 18
        at org.apache.karaf.shell.dev.util.Import.split(Import.java:144)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.dev.util.Import.parse(Import.java:104)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.dev.ShowBundleTree.createNodesForImports(ShowBundleTree.java:136)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.dev.ShowBundleTree.createTree(ShowBundleTree.java:128)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.dev.ShowBundleTree.doExecute(ShowBundleTree.java:58)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.dev.AbstractBundleCommand.doExecute(AbstractBundleCommand.java:61)[18:org.apache.karaf.shell.dev:2.2.8]
        at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[36:org.apache.karaf.shell.console:2.2.8]
        at org.apache.karaf.shell.console.jline.Console.run(Console.java:166)[36:org.apache.karaf.shell.console:2.2.8]
        at java.lang.Thread.run(Thread.java:679)[:1.6.0_23]&lt;/pre&gt;
&lt;pre class=&quot;western&quot;&gt;&lt;/pre&gt;
&lt;br /&gt;
JBoss BRMS claims that &lt;a href=&quot;http://docs.redhat.com/docs/en-US/JBoss_Enterprise_BRMS_Platform/5/html/BRMS_Business_Process_Management_Guide/ch13s02.html&quot;&gt;jBPM is OSGi-friendly&lt;/a&gt;. &lt;br /&gt;
&lt;a href=&quot;https://community.jboss.org/message/733337&quot;&gt;jBpm Forum Thread with exact same problem&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Bugs filed:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://issues.jboss.org/browse/JBPM-3715&quot;&gt;JBPM-3715&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://issues.apache.org/jira/browse/FELIX-3598&quot;&gt;FELIX-3598&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://issues.apache.org/jira/browse/KARAF-1648&quot;&gt;KARAF-1648 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/6292235528841335507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/jboss-jbpm-530final-problem-in-apache.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/6292235528841335507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/6292235528841335507'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/jboss-jbpm-530final-problem-in-apache.html' title='JBoss jBPM 5.3.0.Final problem in Apache Karaf OSGi Runtime'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-6018946588550634005</id><published>2012-07-15T00:02:00.001-07:00</published><updated>2012-07-15T01:35:44.033-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OSGi"/><title type='text'>Plain EMF inside Apache Karaf OSGi Runtime</title><content type='html'>      	  	  	  	&lt;style type=&quot;text/css&quot;&gt;  	&lt;!--  		@page { margin: 2cm }  		P { margin-bottom: 0.21cm; line-height: 120%; widows: 2; page-break-before: auto }  		P.western { font-family: &quot;Ubuntu&quot;; font-size: 11pt }  		P.cjk { font-size: 10pt }  		H2 { margin-bottom: 0.21cm; widows: 2; page-break-before: auto }  		H2.western { font-family: &quot;Arial&quot;, sans-serif; font-size: 14pt; font-style: italic }  		H2.cjk { font-size: 14pt; font-style: italic }  		H2.ctl { font-family: &quot;Lohit Hindi&quot;; font-size: 14pt; font-style: italic }  	--&gt;&lt;/style&gt;&lt;span style=&quot;font-weight:normal&quot;&gt;Since EMF  bundles doesn&amp;#39;t work out-of-the-box inside Karaf, and installing  Eclipse libraries wreak havoc. I think it&amp;#39;s better to simulate &amp;quot;plain  EMF&amp;quot; inside OSGi.&lt;/span&gt;  &lt;p class=&quot;western&quot;&gt;&lt;span style=&quot;font-weight:normal&quot;&gt;Required patches  are:&lt;/span&gt;&lt;/p&gt;  &lt;ol&gt;&lt;li&gt;&lt;p class=&quot;western&quot;&gt;&lt;span style=&quot;font-weight:normal&quot;&gt;&lt;b&gt;org.eclipse.emf.common&lt;/b&gt;  	:&lt;br&gt;remove Require-Bundle from MANIFEST.MF&lt;br&gt;&lt;br&gt;remove  	Bundle-Activator&lt;/span&gt;&lt;/p&gt;  	&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;western&quot;&gt;&lt;span style=&quot;font-weight:normal&quot;&gt;&lt;b&gt;org.eclipse.emf.ecore&lt;/b&gt;:&lt;br&gt;replace  	Require-Bundle with: Require-Bundle:  	org.eclipse.emf.common&lt;br&gt;&lt;br&gt;Import-Package:  	org.eclipse.emf.ecore,org.eclipse.emf.ecore.impl,org.e  &lt;br&gt;  	clipse.emf.ecore.plugin,org.eclipse.emf.ecore.resource,org.eclipse.em  &lt;br&gt;  	f.ecore.resource.impl,org.eclipse.emf.ecore.util,org.eclipse.emf.ecor  &lt;br&gt;  	e.xml.namespace,org.eclipse.emf.ecore.xml.namespace.impl,org.eclipse.  &lt;br&gt;  	emf.ecore.xml.namespace.util,org.eclipse.emf.ecore.xml.type,org.eclip  &lt;br&gt;  	se.emf.ecore.xml.type.impl,org.eclipse.emf.ecore.xml.type.internal,or  &lt;br&gt;  	g.eclipse.emf.ecore.xml.type.util,org.xml.sax,org.xml.sax.helpers,  &lt;br&gt;  	org.xml.sax.ext,org.w3c.dom,javax.xml.parsers,javax.xml.namespace,  &lt;br&gt;  	javax.xml.datatype  &lt;br&gt;&lt;br&gt;remove Bundle-Activator&lt;/span&gt;&lt;/p&gt;  	&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;western&quot;&gt;&lt;span style=&quot;font-weight:normal&quot;&gt;&lt;b&gt;org.eclipse.emf.ecore.xmi&lt;/b&gt;:&lt;br&gt;replace  	Require-Bundle with: Require-Bundle:  	org.eclipse.emf.common,org.eclipse.emf.ecore&lt;br&gt;&lt;br&gt;Import-Package:  	org.eclipse.emf.ecore.xmi,&lt;a href=&quot;http://org.eclipse.emf.ecore.xmi.im&quot;&gt;org.eclipse.emf.ecore.xmi.im&lt;/a&gt;  &lt;br&gt;  	pl,org.eclipse.emf.ecore.xmi.util,org.xml.sax,org.xml.sax.helpers,  &lt;br&gt;  	org.xml.sax.ext,org.w3c.dom,javax.xml.parsers,javax.xml.namespaceremove  	Bundle-Activator&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;/ol&gt;    </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/6018946588550634005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/plain-emf-inside-apache-karaf-osgi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/6018946588550634005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/6018946588550634005'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/plain-emf-inside-apache-karaf-osgi.html' title='Plain EMF inside Apache Karaf OSGi Runtime'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-716365648000104978</id><published>2012-07-14T21:59:00.001-07:00</published><updated>2012-07-15T01:35:44.037-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OSGi"/><title type='text'>EMF not yet runnable in Apache Karaf OSGi Runtime</title><content type='html'>My attempt at deploying &lt;b&gt;EMF&lt;/b&gt; inside &lt;b&gt;Karaf&lt;/b&gt; 2.2.8 has not yet been successful.&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;I&amp;#39;ve tried adding Import-Package instruction:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;version&amp;gt;2.3.7&amp;lt;/version&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;configuration&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;instructions&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;Import-Package&amp;gt;*, org.eclipse.emf.ecore, org.eclipse.emf.ecore.impl, org.eclipse.emf.ecore.plugin&amp;lt;/Import-Package&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/instructions&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;executions&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;execution&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;id&amp;gt;manifest&amp;lt;/id&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;phase&amp;gt;process-classes&amp;lt;/phase&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;goals&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;                &amp;lt;goal&amp;gt;manifest&amp;lt;/goal&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;/goals&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;configuration&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/execution&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/executions&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;However the mere mention of an EMF Factory :&lt;br&gt;  &lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;processCatalog = ProcessFactory.eINSTANCE.createProcessCatalog();&lt;/span&gt;&lt;br&gt;&lt;br&gt;Throws exception:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;2012-07-15 11:57:25,057 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | 9 - org.apache.aries.blueprint - 0.3.2 | Unable to start blueprint container for bundle com.soluvas.com.soluvas.process.shell&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instanciating bean mock of class class com.soluvas.process.shell.Mock&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:271)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:708)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:337)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.lang.Thread.run(Thread.java:679)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.soluvas.process.ProcessFactory&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at com.soluvas.process.shell.Mock.&amp;lt;init&amp;gt;(Mock.java:12)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)[:1.6.0_23]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:257)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:842)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:269)[9:org.apache.aries.blueprint:0.3.2]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        ... 15 more&lt;/span&gt;&lt;br&gt;&lt;br&gt;Here are the list of bundles I&amp;#39;ve installed:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;karaf@root&amp;gt; list -s&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;START LEVEL 100 , List Threshold: 50&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;   ID   State         Blueprint      Level  Symbolic name&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[  75] [Active     ] [Created     ] [   80] org.ops4j.pax.wicket.service (1.0.1)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[  79] [Resolved   ] [            ] [   80] com.google.guava (12.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[  91] [Resolved   ] [            ] [   80] org.apache.servicemix.bundles.cglib (2.2.2.1)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 136] [Active     ] [            ] [   80] tomcat-sample (0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 147] [Active     ] [            ] [   80] com.wikindonesia.place (0.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 148] [Active     ] [            ] [   80] com.wikindonesia.checkin (0.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 150] [Active     ] [            ] [   80] com.wikindonesia.cafe (0.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 151] [Active     ] [            ] [   80] org.soluvas.process (0.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 158] [Active     ] [            ] [   50] org.apache.camel.camel-core (2.10.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 159] [Active     ] [Created     ] [   50] org.apache.camel.karaf.camel-karaf-commands (2.10.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 160] [Active     ] [Created     ] [   50] org.apache.camel.camel-blueprint (2.10.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 161] [Active     ] [            ] [   80] org.apache.geronimo.specs.geronimo-annotation_1.1_spec (1.0.1)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 162] [Active     ] [            ] [   80] org.drools.core (5.4.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 163] [Active     ] [            ] [   80] org.drools.compiler (5.4.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 164] [Active     ] [            ] [   80] org.drools.templates (5.4.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 166] [Active     ] [            ] [   80] org.mvel2 (2.1.0.drools16)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 167] [Active     ] [            ] [   80] org.drools.api (5.4.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 168] [Active     ] [            ] [   80] org.jbpm.flow.core (5.3.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 169] [Active     ] [            ] [   80] org.jbpm.flow.builder (5.3.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 170] [Resolved   ] [            ] [   80] org.jbpm.bpmn2 (5.3.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 172] [Active     ] [            ] [   80] org.apache.servicemix.bundles.jaxb-xjc (2.2.4.2)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 179] [Active     ] [            ] [   80] wrap_mvn_com.sun.istack_istack-commons-runtime_2.12_Export-Package___version_2.12.0 (0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 182] [Active     ] [            ] [   80] org.apache.servicemix.specs.jaxb-api-2.2 (2.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 183] [Active     ] [            ] [   80] org.apache.servicemix.bundles.jaxb-impl (2.2.4.2)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 185] [Resolved   ] [            ] [   80] wrap_mvn_com.thoughtworks.xstream_xstream_1.4.2_Export-Package___version_1.4.2 (0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 186] [Resolved   ] [            ] [   80] wrap_mvn_com.google.protobuf_protobuf-java_2.4.1_Export-Package___version_2.4.1 (0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 187] [Resolved   ] [            ] [   80] org.drools.internalapi (5.4.0.Final)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 188] [Installed  ] [            ] [   80] wrap_mvn_antlr_antlr_2.7.7_Export-Package___version_2.7.7 (0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 189] [Resolved   ] [            ] [   80] org.apache.servicemix.bundles.antlr-runtime (3.4.0.2)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 190] [Active     ] [Failure     ] [   80] com.soluvas.com.soluvas.process.shell (1.0.0.SNAPSHOT)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 210] [Resolved   ] [            ] [   80] org.eclipse.osgi (3.7.0.v20110613)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 212] [Resolved   ] [            ] [   80] org.eclipse.core.runtime (3.7.0.v20110110)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 213] [Resolved   ] [            ] [   80] org.eclipse.emf.common (2.8.0.v20120606-0717)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 214] [Resolved   ] [            ] [   80] org.eclipse.emf.ecore (2.8.0.v20120606-0717)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 215] [Resolved   ] [            ] [   80] org.eclipse.emf.ecore.xmi (2.8.0.v20120606-0717)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 216] [Resolved   ] [            ] [   80] org.eclipse.equinox.common (3.6.0.v20110523)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 217] [Resolved   ] [            ] [   80] &lt;a href=&quot;http://org.eclipse.core.jobs&quot;&gt;org.eclipse.core.jobs&lt;/a&gt; (3.5.100.v20110404)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 218] [Resolved   ] [            ] [   80] org.eclipse.equinox.registry (3.5.0.v20100503)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 219] [Resolved   ] [            ] [   80] org.eclipse.equinox.preferences (3.4.0.v20110502)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 220] [Resolved   ] [            ] [   80] org.eclipse.core.contenttype (3.4.100.v20110423-0524)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 221] [Resolved   ] [            ] [   80] org.eclipse.equinox.app (1.3.0.v20100512)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;[ 222] [Active     ] [            ] [   80] org.soluvas.async (0.0.0)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br&gt;&lt;br&gt;Note that I&amp;#39;m also unable to start any EMF bundles:&lt;br&gt;  &lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;karaf@root&amp;gt; start 213&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.emf.common [213].&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;br&gt;But there&amp;#39;s no error log to be found.&lt;br&gt;&lt;br&gt;  </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/716365648000104978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/emf-not-yet-runnable-in-apache-karaf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/716365648000104978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/716365648000104978'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/emf-not-yet-runnable-in-apache-karaf.html' title='EMF not yet runnable in Apache Karaf OSGi Runtime'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-7663009175610429139</id><published>2012-07-14T21:39:00.001-07:00</published><updated>2012-07-15T01:35:44.041-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OSGi"/><title type='text'>How to Install EMF (Eclipse Modeling Framework) Plug-ins/Bundles on Apache Karaf OSGi Runtime</title><content type='html'>&lt;b&gt;EMF&lt;/b&gt; depends on &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;org.eclipse.core.runtime&lt;/span&gt; via &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;Require-Bundle&lt;/span&gt;, which in turn depends on &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;org.eclipse.osgi, org.eclipse.equinox.common&lt;/span&gt; etc. &lt;br&gt;  &lt;br&gt;I think there&amp;#39;s should a better way to use EMF &amp;quot;cleanly&amp;quot; in Karaf. But for now this works:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.common/3.6.0.v20110523&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.eclipse.equinox/org.eclipse.equinox.registry/3.5.0.v20100503&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.preferences/3.4.0.v20110502&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.eclipse.equinox/org.eclipse.equinox.app/1.3.0.v20100512&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi/3.7.0.v20110613&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/org.eclipse.core.runtime/3.7.0.v20110110&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/&lt;a href=&quot;http://org.eclipse.core.jobs/3.5.100.v20110404&quot;&gt;org.eclipse.core.jobs/3.5.100.v20110404&lt;/a&gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.jibx.config.3rdparty.org.eclipse/org.eclipse.core.contenttype/3.4.100.v20110423-0524&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.eclipse.emf/org.eclipse.emf.common/2.8.0.v20120606-0717&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.eclipse.emf/org.eclipse.emf.ecore/2.8.0.v20120606-0717&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;install mvn:org.eclipse.emf/org.eclipse.emf.ecore.xmi/2.8.0.v20120606-0717&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br&gt;  </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/7663009175610429139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/how-to-install-emf-eclipse-modeling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/7663009175610429139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/7663009175610429139'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/07/how-to-install-emf-eclipse-modeling.html' title='How to Install EMF (Eclipse Modeling Framework) Plug-ins/Bundles on Apache Karaf OSGi Runtime'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-3135175892143050352</id><published>2012-04-06T01:01:00.001-07:00</published><updated>2012-04-06T01:01:44.762-07:00</updated><title type='text'>Tackling Reverse Code Generation</title><content type='html'>&lt;a href=&quot;http://danieldietrich.net/reverse-code-generation/&quot;&gt;&lt;b&gt;Reverse Code Generation&lt;/b&gt; has been kindly discussed in depth by my friend &lt;b&gt;Daniel Dietrich&lt;/b&gt;&lt;/a&gt;.&lt;br&gt;&lt;br&gt;To review, the goal is to make it possible to generate 2 artifacts (generator templates and generated application) from 2 artifacts (model and prototype application).&lt;br&gt; &lt;br&gt;Given this pseudo-Java prototype application:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;public void runHello(String[] args) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  System.out.println(&amp;quot;Welcome to Hello World!&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br&gt;And this model:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;appName &amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;appTitle &amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;br&gt;&lt;br&gt;I&amp;#39;d like to generate (or perhaps, &amp;quot;reverse generate&amp;quot;) this generator template (in StringTemplate syntax):&lt;br&gt;&lt;br&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;public void run$appName$(String[] args) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;   System.out.println(&amp;quot;Welcome to $appTitle$!&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt; }&lt;/span&gt;&lt;br&gt;&lt;br&gt;You can think of the above as a representation of the &amp;quot;template&amp;quot; model too. (template is data therefore template is a model, right?)&lt;br&gt;&lt;br&gt;Now given the actual application model :&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;appName &amp;quot;Car&amp;quot;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;appTitle &amp;quot;Ultimate Car Selling&amp;quot;&lt;/span&gt;&lt;br&gt;&lt;br&gt;This model plus the &lt;i&gt;generated&lt;/i&gt; generator template would ultimately generate the final application :&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;public void runCar(String[] args) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    System.out.println(&amp;quot;Welcome to Ultimate Car Selling!&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br&gt; &lt;br&gt;&lt;b&gt;&lt;font size=&quot;4&quot;&gt;Is it Worth It?&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;My first question even if all this is possible and practical, is it worth all the hassle?&lt;br&gt;&lt;br&gt;My hunch tells me that &lt;i&gt;right now&lt;/i&gt;, at best it&amp;#39;s seldom used and at worst exotic.&lt;br&gt; &lt;br&gt;And then about limitations. It&amp;#39;s like projecting 3D onto 2D and then trying to get 3D back out of that 2D. It&amp;#39;s not just challenging, but some information is lost.&lt;br&gt;&lt;br&gt;These information can be recorded somewhere (like metadata for generated code), however if we used features like protected regions it&amp;#39;ll make it even more challenging. (some heuristics would help though)&lt;br&gt; &lt;br&gt;Then about loops and conditionals.&lt;br&gt;&lt;br&gt;&lt;font size=&quot;4&quot;&gt;&lt;b&gt;The Solution?&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;The way I think about it right now is that reverse code generation would be like a submodule inside a greater code generation task. Kinda like protected regions. So the reverse generator does not work globally, but only in specific parts of the project. And for those parts, we know that there are no loops or conditionals or complex constructs. UPCASE and down_case transformations etc. may still be practical.&lt;br&gt; &lt;br&gt;The key lies in the prototype application. The prototype needs to serve a double role:&lt;br&gt;&lt;ol&gt;&lt;li&gt;It is directly &lt;b&gt;executable/buildable&lt;/b&gt; as a project in the target platform environment&lt;br&gt;&lt;/li&gt;&lt;li&gt;It can be &lt;b&gt;extracted&lt;/b&gt; to form generator templates&lt;/li&gt; &lt;/ol&gt;&lt;p&gt;So we have to annotate the prototype app in some way. The annotations can be external (like Hibernate/JPA Persistence XML mappings) or internal (like JPA Java annotations, JAX-RS, etc.).&lt;/p&gt;&lt;p&gt;For internal annotations, there seems to be no other way than using the &lt;b&gt;comment&lt;/b&gt; capability in the target language, just like protected regions. If the target language doesn&amp;#39;t support comments, then the only possible approach is external annotations.&lt;/p&gt; &lt;p&gt;Simple syntax out of my mind:&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;/** GENERATOR: START&lt;br&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;public void run$appName$(String[] args) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;   &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;   System.out.println(&amp;quot;Welcome to $appTitle$!&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;  &lt;span style=&quot;font-family:courier new,monospace&quot;&gt; }&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;*/&lt;br&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;public void runHello(String[] args) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  System.out.println(&amp;quot;Welcome to Hello World!&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&lt;br&gt;//&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt; GENERATOR: END&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Basically we write the offending code twice, one as a template and one in the target language. It seems useless for that example but consider another example:&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;Deployment xmlns=&amp;quot;&lt;a href=&quot;http://schemas.microsoft.com/windowsphone/2009/deployment&quot;&gt;http://schemas.microsoft.com/windowsphone/2009/deployment&lt;/a&gt;&amp;quot; AppPlatformVersion=&amp;quot;7.1&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;!-- GENERATOR START&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  &amp;lt;App xmlns=&amp;quot;&amp;quot; ProductID=&amp;quot;$productId$&amp;quot;  Title=&amp;quot;$appTitle$&amp;quot;&lt;br&gt;       RuntimeType=&amp;quot;Silverlight&amp;quot; Version=&amp;quot;1.0.0.0&amp;quot;  Genre=&amp;quot;apps.normal&amp;quot;  Author=&amp;quot;$appAuthor$&amp;quot;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        Description=&amp;quot;$appDescription$&amp;quot; Publisher=&amp;quot;$appPublisher$&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;--&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  &amp;lt;App xmlns=&amp;quot;&amp;quot; ProductID=&amp;quot;{6b7a1ae6-8d4e-4f85-b08e-387df81d6e8e}&amp;quot; Title=&amp;quot;Info Bandung&amp;quot;&lt;br&gt;       RuntimeType=&amp;quot;Silverlight&amp;quot; Version=&amp;quot;1.0.0.0&amp;quot; Genre=&amp;quot;apps.normal&amp;quot;  Author=&amp;quot;Hendy Irawan&amp;quot;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       Description=&amp;quot;Woyyy, Orang Bandung kita bagi2 Info&amp;quot; Publisher=&amp;quot;Hendy Irawan&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;!-- GENERATOR END --&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;IconPath IsRelative=&amp;quot;true&amp;quot; IsResource=&amp;quot;false&amp;quot;&amp;gt;ApplicationIcon.png&amp;lt;/IconPath&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;Capabilities&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      &amp;lt;Capability Name=&amp;quot;ID_CAP_NETWORKING&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/Capabilities&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;Tasks&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      &amp;lt;DefaultTask  Name =&amp;quot;_default&amp;quot; NavigationPage=&amp;quot;MainPage.xaml&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/Tasks&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;Tokens&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;!-- GENERATOR SINGLE&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      &amp;lt;PrimaryToken TokenID=&amp;quot;$appName$Token&amp;quot; TaskName=&amp;quot;_default&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;--&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       &amp;lt;PrimaryToken TokenID=&amp;quot;InfoBandungToken&amp;quot; TaskName=&amp;quot;_default&amp;quot;&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;TemplateType5&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;          &amp;lt;BackgroundImageURI IsRelative=&amp;quot;true&amp;quot; IsResource=&amp;quot;false&amp;quot;&amp;gt;Background.png&amp;lt;/BackgroundImageURI&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;          &amp;lt;Count&amp;gt;0&amp;lt;/Count&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;!-- GENERATOR SINGLE&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;          &amp;lt;Title&amp;gt;$appTitle&amp;lt;/Title&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;--&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            &amp;lt;Title&amp;gt;Info Bandung&amp;lt;/Title&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        &amp;lt;/TemplateType5&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      &amp;lt;/PrimaryToken&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    &amp;lt;/Tokens&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  &amp;lt;/App&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;&amp;lt;/Deployment&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Doesn&amp;#39;t look too bad, does it? And I can foresee writing the reverse code generator for that is doable.&lt;br&gt; &lt;/p&gt;&lt;p&gt;And the above code (not the reverse code generator though) isn&amp;#39;t entirely imaginary. I have taken it out directly from &lt;a href=&quot;http://infobandung.codeplex.com/&quot;&gt;my &lt;b&gt;open source Windows Phone 7 project Info Bandung&lt;/b&gt;&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;What do you think?&lt;/p&gt;&lt;p&gt;&lt;br&gt; To learn &lt;b&gt;Modeling with Eclipse Modeling Framework (EMF)&lt;/b&gt;, I highly recommend the book &lt;a href=&quot;http://www.amazon.com/dp/0321331885?tag=springjavaee-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=0321331885&amp;amp;adid=00KT2CC2MX25236YJ0QX&amp;amp;&quot;&gt;&lt;b&gt;EMF: Eclipse Modeling Framework&lt;/b&gt;&lt;/a&gt;. &lt;/p&gt; </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/3135175892143050352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/04/tackling-reverse-code-generation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3135175892143050352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3135175892143050352'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/04/tackling-reverse-code-generation.html' title='Tackling Reverse Code Generation'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-4421897903385789078</id><published>2012-01-10T21:33:00.001-08:00</published><updated>2012-01-10T21:33:07.214-08:00</updated><title type='text'>Xperiencing Xtend in a Java EE 6 Web Application</title><content type='html'>&lt;div class=&quot;gmail_quote&quot;&gt;Just saying that to date I&amp;#39;m quite happy with using &lt;a href=&quot;http://xtend-lang.org/&quot;&gt;&lt;b&gt;Xtend&lt;/b&gt;&lt;/a&gt; in a regular &lt;a href=&quot;http://spring-java-ee.blogspot.com&quot;&gt;&lt;b&gt;Java EE 6 web application&lt;/b&gt;&lt;/a&gt;.&lt;br&gt; &lt;br&gt;It allows me to write this:&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    def void reindexSlugs() {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        log.debug(&amp;quot;Reindexing slugs&amp;quot;)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        slugProvider.clear&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;         val slugList = userRepo.findAllSlugs.toList&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        log.debug(&amp;quot;Reindexing slugs for {} users&amp;quot;, slugList.size)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        val slugMap = slugList.fold(new HashMap&amp;lt;String, String&amp;gt;(),&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            [map, row | map.put(String::valueOf(row.&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;get(&amp;quot;slug&amp;quot;)), String::valueOf(row.get(&amp;quot;id&amp;quot;))&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;); map ]&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;         )&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        slugProvider.batchUpdate(&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;slugMap)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        log.debug(&amp;quot;Reindexing slugs&amp;quot;)&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;    }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;br&gt;Instead of: (Xtend-generated Java)&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  public void reindexSlugs() {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      this.log.debug(&amp;quot;Reindexing slugs&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       this.slugProvider.clear();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      Iterable&amp;lt;Map&amp;lt;String,Object&amp;gt;&amp;gt; _findAllSlugs = this.userRepo.findAllSlugs();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      List&amp;lt;Map&amp;lt;String,Object&amp;gt;&amp;gt; _list = IterableExtensions.&amp;lt;Map&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;String,Object&amp;gt;&amp;gt;toList(_&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;findAllSlugs);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       final List&amp;lt;Map&amp;lt;String,Object&amp;gt;&amp;gt; slugList = _list;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      int _size = slugList.size();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      this.log.debug(&amp;quot;Reindexing slugs for {} users&amp;quot;, Integer.valueOf(_size));&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      HashMap&amp;lt;String,String&amp;gt; _hashMap = new HashMap&amp;lt;String,String&amp;gt;();&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       final Function2&amp;lt;HashMap&amp;lt;String,&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;String&amp;gt;,Map&amp;lt;String,Object&amp;gt;,&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;HashMap&amp;lt;String,String&amp;gt;&amp;gt; _function = new Function2&amp;lt;HashMap&amp;lt;String,&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;String&amp;gt;,Map&amp;lt;String,Object&amp;gt;,&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;HashMap&amp;lt;String,String&amp;gt;&amp;gt;() {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;           public HashMap&amp;lt;String,String&amp;gt; apply(final HashMap&amp;lt;String,String&amp;gt; map, final Map&amp;lt;String,Object&amp;gt; row) {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            HashMap&amp;lt;String,String&amp;gt; _xblockexpression = null;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            {&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;              Object _get = row.get(&amp;quot;slug&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;               String _valueOf = String.valueOf(_get);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;              Object _get_1 = row.get(&amp;quot;id&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;              String _valueOf_1 = String.valueOf(_get_1);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;              map.put(_valueOf, _valueOf_1);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;               _xblockexpression = (map);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;            return _xblockexpression;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;          }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;        };&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      HashMap&amp;lt;String,String&amp;gt; _fold = IterableExtensions.&amp;lt;Map&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;String,Object&amp;gt;, HashMap&amp;lt;String,String&amp;gt;&amp;gt;fold(&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;slugList, _hashMap, _function);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;       final HashMap&amp;lt;String,String&amp;gt; slugMap = _fold;&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      this.slugProvider.batchUpdate(&lt;/span&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;slugMap);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;span style=&quot;font-family:courier new,monospace&quot;&gt;      this.log.debug(&amp;quot;Reindexing slugs&amp;quot;);&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt;&lt;span style=&quot;font-family:courier new,monospace&quot;&gt;  }&lt;/span&gt;&lt;br style=&quot;font-family:courier new,monospace&quot;&gt; &lt;br&gt;I do miss Scala&amp;#39;s syntax though.&lt;b&gt; Xtend&lt;/b&gt; is more &amp;quot;&lt;b&gt;Java-compatible&amp;quot; &lt;/b&gt;and works as &lt;b&gt;CDI&lt;/b&gt; beans.&lt;br&gt; &lt;br&gt;Closure support and type inference are the two most useful features in languages like &lt;b&gt;Xtend, Scala, and Groovy.&lt;/b&gt; :)&lt;span class=&quot;HOEnZb&quot;&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;br clear=&quot;all&quot;&gt;&lt;/font&gt;&lt;/span&gt;&lt;br&gt; To learn &lt;b&gt;Modeling with Eclipse Modeling Framework (EMF)&lt;/b&gt;, I highly recommend the book &lt;a href=&quot;http://www.amazon.com/dp/0321331885?tag=springjavaee-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=0321331885&amp;amp;adid=00KT2CC2MX25236YJ0QX&amp;amp;&quot;&gt;&lt;b&gt;EMF: Eclipse Modeling Framework&lt;/b&gt;&lt;/a&gt;. &lt;br&gt; &lt;/div&gt; </content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/4421897903385789078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2012/01/xperiencing-xtend-in-java-ee-6-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/4421897903385789078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/4421897903385789078'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2012/01/xperiencing-xtend-in-java-ee-6-web.html' title='Xperiencing Xtend in a Java EE 6 Web Application'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-3438182166483128954</id><published>2011-10-05T09:17:00.000-07:00</published><updated>2011-10-05T09:17:54.252-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Xtext DSL"/><title type='text'>Generation Gap Pattern vs Protected Regions in Xtext MDD</title><content type='html'>&lt;div class=&quot;content-body wikistyle markdown-format&quot;&gt;
During the development of the awesome &lt;b&gt;&lt;a href=&quot;https://github.com/danieldietrich/xtext-protectedregions&quot;&gt;Xtext Protected Regions Support&lt;/a&gt;&lt;/b&gt; created by &lt;b&gt;&lt;a href=&quot;http://danieldietrich.net/&quot;&gt;Daniel Dietrich&lt;/a&gt;&lt;/b&gt;, Daniel asked a really interesting question:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Just interested in your opinion / your 2 cents:&lt;br /&gt;
It&#39;s best &lt;b&gt;practice to separate generated from non-generated code&lt;/b&gt; (when it comes to put it in a &lt;b&gt;versioning system&lt;/b&gt;).&lt;br /&gt;
Therefor people use the &lt;b&gt;generation gap pattern&lt;/b&gt; - the generated class is a
 base class (or s.th. similar), the manual written / generated-once 
classes implement the generated classes.&lt;br /&gt;
When using protected regions, all files (including the generated) 
have to be checked in. Some say, this ends up in a &lt;b&gt;versioning disaster&lt;/b&gt;.&lt;br /&gt;
I prefer the protected regions approach. the base classes of the ggp 
nearly double the count of classes. this is a technical vehicle which 
makes no sense for the application. but how could be avoided, that 
generated classes are checked in?&lt;br /&gt;
my only answer is, that the generated code has to be cut of the 
files. empty files will disappear, protected regions are preserved. when
 checking out files, the generator has to be started. before checking in
 files, the generated code has to be stripped (into a special dir which 
will be checked in?).&lt;br /&gt;


this sounds like a technical vehicle, too. would that make sense?&lt;/blockquote&gt;
&lt;br /&gt;
To which replied: (note that these are my opinion, and I don&#39;t claim 
to be an&lt;br /&gt;
expert, so feel free to challenge my assumptions and prove me 
wrong!) :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;content-body wikistyle markdown-format&quot;&gt;
&lt;br /&gt;
I have nothing 
against GAP. It definitely has its valid uses. So for certain problems, 
GAP is a valid solution, and is even preferable to regions.&lt;br /&gt;


About versioning, I&#39;m not sure it&#39;s a &quot;disaster&quot;. Redundant maybe, 
but dangerous? I don&#39;t think so. Avoiding to checkin generated files 
maybe preferable where the source DSL files are &quot;authoritative&quot; and the 
target files are &quot;final&quot;.&lt;br /&gt;


&lt;br /&gt;
Let me illustrate: wsdlimport. The WSDL file is an authoritative 
source. The generator is stable. Generated Java Proxy Classes are &quot;dumb&quot;
 target files. You can regenerate those anytime, no need for 
customization. And the generator is never changed so you can be sure 
generated files will actually compile and work. No need to checkin the 
Java targets.&lt;br /&gt;


&lt;br /&gt;
Xtext can be used for projects of that kind, and very easy for that.&lt;br /&gt;


&lt;br /&gt;
There are also projects that fall in the middle: need some 
customization. So you do GAP: generate the base class and the 
customizable subclass. This technique is excellent for some cases, but 
fails when:&lt;br /&gt;


&lt;ol&gt;
&lt;li&gt;You&#39;re restricted by the class hierarchy in some way.&lt;/li&gt;
&lt;li&gt;Target language doesn&#39;t support subclassing, say: XML.  Or my case, this would be yet another custom DSL.&lt;/li&gt;
&lt;/ol&gt;
There are also cases where GAP technically works, but the 
generated class structure is complex enough that separating the base 
class from the actual class makes it &quot;unnatural&quot;. I&#39;m sure you&#39;ve seen 
stuff like that. Oh, let me give a concrete example from one of my 
prototypes:&lt;br /&gt;
&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;def StringConcatenation genMainFile(String fileName) {
    val result = new StringConcatenation() 
    result.append( augmenter.beforeMainFile(fileName) )
    result.append( augmenter.aroundMainFile(fileName, [fn1 | {
        doMainFile(fn1, [ fn2 | augmenter.innerMainFile(fn2, [fn3 | {
            genImportBlock()
            genClassBlock()
            null
        }]) ])
    }]) )
    result.append( augmenter.afterMainFile(fileName) )
    result
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Mind you the above code actually works, but it&#39;s &lt;strong&gt;damn ugly&lt;/strong&gt;!
 At least with protected regions there will only be (marker) comments. 
And with most editors, comments can be folded and not so distracting, so
 it&#39;s much more bearable.&lt;br /&gt;


Some may say &quot;it&#39;s only the base class, nobody will touch it&quot;. On the contrary, you&#39;ll see those &lt;em&gt;structural methods&lt;/em&gt; on your debugging &lt;strong&gt;stack traces&lt;/strong&gt;,
 just &quot;perfect&quot; at the time when you&#39;re in deep need of clear &amp;amp; 
cohesive program structure, but oh... you&#39;re buried in nested method 
calls. :-( AspectJ/AOP/weaving also has this problem, though it&#39;s 
manageable to some extent. They only fall apart when pushed too far, so 
moderate use is OK.&lt;br /&gt;


&lt;br /&gt;
The third class is projects that require extensive customization. The
 source DSL only comprises of ~20% of the target, providing structure or
 supporting form, and gives places to fill, where these are filled by 
the programmer or some other DSL.&lt;br /&gt;


&lt;br /&gt;
In my (currently hypothetical, but hopefully realized soon) the 
Entity-&amp;gt;UI generator will not generate JSF/GWT forms/pages directly, 
but generate to an intermediate UI DSL. (you can argue this is 
Model-to-Model, not M2T, but hey, textual models are &lt;em&gt;much&lt;/em&gt; easier to inspect/hack than something buried in XML!) The UI DSL can then be processed to generate JSF or GWT.&lt;br /&gt;


&lt;br /&gt;
I&#39;m not really interested in supporting class inheritance in a UI 
DSL. In fact the &quot;class&quot; concept itself may not exist in a UI domain, it
 only matters to OO world. So protected regions is the only option, and 
thankfully Xtext supports comments by default.&lt;br /&gt;


&lt;br /&gt;
With that, it&#39;s possible to customize the generated UI DSL files right in the places where they&#39;re needed.&lt;br /&gt;


&lt;br /&gt;
Another use case that I&#39;m exploring, is two or more generators (which
 may or may not be sourcing the same model) generating to the same file,
 but in different regions. And the FSA should automagically merge them.&lt;br /&gt;


&lt;br /&gt;
And then, add to the mix that the &lt;strong&gt;generators themselves&lt;/strong&gt;
 are in constant development. That means the same source DSL when 
processed, may yield target files that are broken, uncompilable, buggy, 
etc. And the target files are needed because they form the foundation of
 yet another project, so unless the previous &quot;working&quot; target files can 
be recovered, the development of the derived project effectively stops.&lt;br /&gt;


&lt;br /&gt;
For those uses cases, would I checkin the target files? Of course.&lt;br /&gt;


&lt;br /&gt;
With all of the above said, I have nothing against GAP or un-checkin 
generated files. GAP &amp;amp; un-checkin may be common, but I believe there
 are classes of problems where they&#39;re inappropriate.&lt;br /&gt;

&lt;br /&gt;
To learn &lt;b&gt;Modeling with Eclipse Modeling Framework (EMF)&lt;/b&gt;, I highly recommend the book &lt;a href=&quot;http://www.amazon.com/dp/0321331885?tag=springjavaee-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=0321331885&amp;amp;adid=00KT2CC2MX25236YJ0QX&amp;amp;&quot;&gt;&lt;b&gt;EMF: Eclipse Modeling Framework&lt;/b&gt;&lt;/a&gt;.
&lt;br /&gt;

&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/3438182166483128954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2011/10/generation-gap-pattern-vs-protected.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3438182166483128954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3438182166483128954'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2011/10/generation-gap-pattern-vs-protected.html' title='Generation Gap Pattern vs Protected Regions in Xtext MDD'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-3313824343911905587</id><published>2011-07-12T12:08:00.000-07:00</published><updated>2011-07-12T12:11:53.543-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming"/><title type='text'>eval-ing in Clojure: Executing Data as Code</title><content type='html'>&lt;a href=&quot;http://clojure.org/&quot;&gt;&lt;b&gt;Clojure functional programming language&lt;/b&gt;&lt;/a&gt; for &lt;b&gt;JVM&lt;/b&gt; has powerful mind-bending features.&lt;br /&gt;

&lt;br /&gt;

The feature that interests me the first time is its ability to &quot;&lt;b&gt;execute data as code&lt;/b&gt;&quot;.&lt;br /&gt;

&lt;br /&gt;

As demonstrated here, were I define a function &lt;i&gt;process&lt;/i&gt; that basically executes the symbol &lt;i&gt;processor&lt;/i&gt; with whatever &lt;i&gt;params&lt;/i&gt; :&lt;br /&gt;

&lt;br /&gt;

&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
=&amp;gt; (defn process [&amp;amp; params] (eval (cons processor params)))&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
#&#39;user/process&lt;/div&gt;
&lt;br /&gt;

&amp;nbsp;Note that &lt;i&gt;processor&lt;/i&gt; symbol is &lt;b&gt;data&lt;/b&gt;, not code, let&#39;s say:&lt;br /&gt;

&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
=&amp;gt; (def processor `java.awt.Point.)&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
#&#39;user/processor&lt;/div&gt;
&lt;br /&gt;

So
 I defined processor as a quoted &quot;java.awt.Point.&quot; which is equivalent 
to &quot;new java.awt.Point()&quot; in Java. However, the expression is not 
executed, it is stored in &lt;i&gt;processor&lt;/i&gt;. &lt;br /&gt;

&lt;br /&gt;

Now I can call the &lt;i&gt;process&lt;/i&gt; function which in turn creates a new instance of Point with my provided &quot;constructor arguments&quot;:&lt;br /&gt;

&lt;br /&gt;

&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
=&amp;gt; (process 12 34)&lt;br /&gt;
#&amp;lt; Point java.awt.Point[x=12,y=34] &amp;gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
The
 reason why I quoted &quot;constructor arguments&quot; above, is because I can 
define processor to any other function, not necessarily &quot;constructors&quot;:&lt;br /&gt;

&lt;br /&gt;

&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
=&amp;gt; (def processor `Math/min)&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
#&#39;user/processor&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
=&amp;gt; (process 12 34)&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
12&lt;/div&gt;
&lt;br /&gt;

Which is the same as:&lt;br /&gt;

&lt;br /&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;=&amp;gt; (eval (list processor 12 34))&lt;/span&gt;&lt;br /&gt;

&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;12&lt;/span&gt;&lt;br /&gt;

&lt;br /&gt;

&quot;So it&#39;s just eval,&quot; you say. How is it different to eval()-ing expressions in strings like JSR-223?&lt;br /&gt;

&lt;br /&gt;

Well,
 in Clojure (or any Lisp dialect) it&#39;s not eval-ing an arbitrary string,
 but evaluating a data structure which is defined in Clojure itself. In 
other words, the internal representation of code corresponds exactly to 
the external representation. This characteristic is known as &lt;a href=&quot;http://en.wikipedia.org/wiki/Homoiconicity&quot;&gt;homoiconicity&lt;/a&gt;.&lt;br /&gt;

&lt;br /&gt;

In other &lt;i&gt;programming languages&lt;/i&gt;, the structure of the is known as its &lt;b&gt;Abstract Syntax Tree (AST)&lt;/b&gt;. Well, in &lt;b&gt;Clojure&lt;/b&gt;,
 the &quot;AST&quot; can be defined, read, and evaluated, in Clojure data&#39;s own 
data structures, without needing &quot;parsing&quot; and transient storage 
(strings).&lt;br /&gt;

</content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/3313824343911905587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2011/07/eval-ing-in-clojure-executing-data-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3313824343911905587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/3313824343911905587'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2011/07/eval-ing-in-clojure-executing-data-as.html' title='eval-ing in Clojure: Executing Data as Code'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2936549675466280492.post-4847049574430700439</id><published>2011-06-23T09:17:00.000-07:00</published><updated>2011-06-23T09:17:39.329-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Model Driven Architecture"/><title type='text'>Brand New Functional Programming &amp; EMF Modeling Blog!</title><content type='html'>Welcome to my new &lt;b&gt;Functional Programming &amp;amp; Modeling with EMF Blog&lt;/b&gt;!&lt;br /&gt;
&lt;br /&gt;
As its name says, I&#39;ll discuss topics such as:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Modeling aka Model Driven Architecture (MDA) aka Model Driven Software Development (MDSD) aka Model Driven Engineering (MDE)&lt;/b&gt; ;-)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Functional Programming, lambdas, closures&lt;/b&gt; and &lt;b&gt;modern programming &lt;/b&gt;techniques&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Domain Specific Languages (DSLs)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Code generation&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Working with &lt;a href=&quot;http://www.amazon.com/dp/0321331885?tag=springjavaee-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=0321331885&amp;amp;adid=00KT2CC2MX25236YJ0QX&amp;amp;&quot;&gt;&lt;b&gt;Eclipse Modeling Framework (EMF) Toolkit&lt;/b&gt;&lt;/a&gt; and its projects such as &lt;b&gt;Xtext/Xtend/Xbase, Ecore Tools, CDO&lt;/b&gt;, &lt;b&gt;Texo, Teneo&lt;/b&gt;, etc.&lt;/li&gt;
&lt;/ol&gt;
Be prepared for extreme &quot;dogfooding&quot; ! ;-)&lt;br /&gt;
&lt;br /&gt;
I also have a blog about programming using Eclipse RCP: &lt;a href=&quot;http://eclipsedriven.blogspot.com/&quot;&gt;Eclipse Driven Rich Application Development&lt;/a&gt; that may interest you. &lt;br /&gt;
&lt;br /&gt;
To learn &lt;b&gt;Modeling with Eclipse Modeling Framework (EMF)&lt;/b&gt;, I highly recommend &lt;a href=&quot;http://www.amazon.com/dp/0321331885?tag=springjavaee-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=0321331885&amp;amp;adid=00KT2CC2MX25236YJ0QX&amp;amp;&quot;&gt;&lt;b&gt;EMF: Eclipse Modeling Framework&lt;/b&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://emfmodeling.blogspot.com/feeds/4847049574430700439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://emfmodeling.blogspot.com/2011/06/brand-new-functional-programming-emf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/4847049574430700439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2936549675466280492/posts/default/4847049574430700439'/><link rel='alternate' type='text/html' href='http://emfmodeling.blogspot.com/2011/06/brand-new-functional-programming-emf.html' title='Brand New Functional Programming &amp; EMF Modeling Blog!'/><author><name>Hendy</name><uri>http://www.blogger.com/profile/05192845149798446052</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>