Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using My own Java Code in ETL
Using My own Java Code in ETL [message #638547] Thu, 11 November 2010 10:42 Go to next message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
I need to use a Java method to create some metadata in an ETL script. Is it possible to call Java methods, or register them in a similar way to Native methods?

I want to use a static method, FormulaResolver.resolveAllFormulas(ctx) (that exists elsewhere) to do this. But may equally require the use of an instance.

My code would be something like the following;

var ctx := a.`context`;
FormulaResolver.resolveAllFormulas(ctx);
constantDecls.addAll(ctx.getConstantDecls());

cheers, Andy
Re: Using My own Java Code in ETL [message #638559 is a reply to message #638547] Thu, 11 November 2010 10:59 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen Zschaler
Messages: 223
Registered: July 2009
Senior Member
Dear Andy,

This should not be a problem at all, using EOL Native types and tools.
You may want to look at the corresponding sections in the Epsilon book.
There are also some examples on the Epsilon web site.

Best regards,

Steffen

On 11/11/2010 15:42, Andy wrote:
> I need to use a Java method to create some metadata in an ETL script.
> Is it possible to call Java methods, or register them in a similar way
> to Native methods?
> I want to use a static method, FormulaResolver.resolveAllFormulas(ctx)
> (that exists elsewhere) to do this. But may equally require the use of
> an instance.
>
> My code would be something like the following;
>
> var ctx := a.`context`;
> FormulaResolver.resolveAllFormulas(ctx);
> constantDecls.addAll(ctx.getConstantDecls());
>
> cheers, Andy
Re: Using My own Java Code in ETL [message #638773 is a reply to message #638559] Fri, 12 November 2010 09:48 Go to previous messageGo to next message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
The following worked well thanks. I was originally searching the website using phrases such as 'user-defined' native types, and didn't pick up that I should use EOL native types as an example.

The tool plug-in code was as follows:

package org.eventb.codegen.epsilon.tools;

import org.eventb.emf.core.EventBNamedCommentedComponentElement;

public class FormulaResolverTool {

public void resolveAllFormulas(EventBNamedCommentedComponentElement el) {
FormulaResolver.resolveAllFormulas(el);
}

}

The ETL to invoke this was:

var fr = new Native("org.eventb.codegen.epsilon.tools.FormulaResolverTool ");
fr.resolveAllFormulas(ctx);
Re: Using My own Java Code in ETL [message #638802 is a reply to message #638773] Fri, 12 November 2010 10:55 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Great! Thanks for letting us know!

Cheers,
Dimitris

On 12/11/2010 16:48, Andy wrote:
> The following worked well thanks. I was originally searching the website
> using phrases such as 'user-defined' native types, and didn't pick up
> that I should use EOL native types as an example.
>
> The tool plug-in code was as follows:
>
> package org.eventb.codegen.epsilon.tools;
>
> import org.eventb.emf.core.EventBNamedCommentedComponentElement;
>
> public class FormulaResolverTool {
>
> public void resolveAllFormulas(EventBNamedCommentedComponentElement el) {
> FormulaResolver.resolveAllFormulas(el);
> }
>
> }
>
> The ETL to invoke this was:
>
> var fr = new
> Native("org.eventb.codegen.epsilon.tools.FormulaResolverTool ");
> fr.resolveAllFormulas(ctx);
>
Previous Topic:how to access classes that extends other classes
Next Topic:[Flock] equivalent() not working
Goto Forum:
  


Current Time: Mon Apr 21 05:40:21 EDT 2014

Powered by FUDForum. Page generated in 0.01565 seconds