Skip to main content


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 15:42 Go to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
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 15:59 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
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 14:48 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
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 15:55 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
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: Fri Apr 19 10:59:28 GMT 2024

Powered by FUDForum. Page generated in 0.02110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top