Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] Using custom tools in standalone
[ETL] Using custom tools in standalone [message #1062539] Sat, 08 June 2013 14:04 Go to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hello

I'm using ETL to perform a transformation between 2 models.
I use ETL as a standalone, from some other java code. Everything work fine.

Now, I want to add a trace to my transformation and I was thinking of using a java class as an hashmap to link object from my models.

I need to use this map outside of ETL. From the example on how to create custom tools for ETL (http://www.eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.tools) i believe I can do what I want with such a solution, however I have no idea how to use my tool in a standalone.

Anyone knows how to call a tool from a standalone, or knows a better way to have a trace from ETL work ?

Best regards,

Christophe
Re: [ETL] Using custom tools in standalone [message #1062541 is a reply to message #1062539] Sat, 08 June 2013 14:12 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

The built-in ETL transformation trace may be of use here (module.getContext().getTransformationTrace()). If this doesn't cover your needs you'll need to add the following line of code before module.execute() to enable ETL to discover your extension point-based tools:

module.getContext().getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate());

Cheers,
Dimitris
Re: [ETL] Using custom tools in standalone [message #1062542 is a reply to message #1062541] Sat, 08 June 2013 14:50 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hi Dimitris,

Thanks for your quick answer!

It seems the built-in trace provides a trace for rules but my transformation is based on operation for most of the object. ( I couldn't use just rules due to some object having to be transformed multiple times).

Is there a way to "manually" add something in the built in trace directly in the ETL script ?

I also tried what you suggested on adding
module.getContext().getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate());
to the module before the execute. I get the following error :
java.lang.NoClassDefFoundError: org/eclipse/epsilon/etl/execute/context/IEtlContext

Maybe I did not understand something ... Here is how I did it :
The java class I wannt to use is named as following :
public class EtlTrace extends AbstractTool implements IToolNativeTypeDelegate

It's located in the same package as the standalone code I use.

Can you maybe explain a bit more what I should do to get it running ?

Thanks in advance,

Christophe
Re: [ETL] Using custom tools in standalone [message #1062543 is a reply to message #1062542] Sat, 08 June 2013 15:01 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

I'm afraid it's not advisable to modify the built-in trace. Could you perhaps put together a minimal example [1] that I can use to reproduce the error you're encountering and attach it here so that I can investigate?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] Using custom tools in standalone [message #1063145 is a reply to message #1062543] Wed, 12 June 2013 13:21 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hey dimitris,

My idea was not to modifiy the trace, but just to add manually some elements inside of it. In fact, to be more clear, I just want to create some "Transformation" object inside my ETL file and then to add them manually to the current trace. Is it possible ?

If not, then I'll try making my own trace with a custom tools. There is something I don't understand for the tool. Cant he tool be any java fil extending "abstract tool" and be placed on any folder, or does it have to be something specific on it's own folder ?
I don't really understand how to create my own tools from the example, the instruction to register any ecore file and to compile don't seem to apply to this example. Can you maybe explain a bit more how I could call this example in one of my ETL script ? (for example, it would really help me just to be able to call the tool in the standalone example).

Thanks for your help,
Christophe
Re: [ETL] Using custom tools in standalone [message #1063148 is a reply to message #1063145] Wed, 12 June 2013 13:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

I'm afraid there's no out-of-the-box support for modifying the transformation trace in ETL. To do this you'll need to use a custom tool.

Is your Java code meant to run in the context of a plugin or in a standalone Java application?

Cheers,
Dimitris
Re: [ETL] Using custom tools in standalone [message #1063158 is a reply to message #1063148] Wed, 12 June 2013 13:54 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Well, basically what I want is a trace, so I was thinking of a java class containing a "HashMap<EObject, EObject>" in which I could store the Eobjects from both of my metamodels.

I need to access this java class in the ETL file to add content to the HashMap and then I'll need to access it again after the transformation ended to do some other operation that need the trace. It's meant to run in Xtext plugin, as part of the validation process. I already use ETL inside Xtext, calling it just like in the "standalone" example from the website.
Re: [ETL] Using custom tools in standalone [message #1063161 is a reply to message #1063158] Wed, 12 June 2013 14:01 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Cristophe,

In this case you'll need to register your custom tool using the extension point provided by Epsilon (see "Declare the tool" section of [1]), and add the following line of code before you call module.execute() so that ETL can recognise the tool.

module.getContext().getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate());

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/call-java-from-epsilon/

Re: [ETL] Using custom tools in standalone [message #1063806 is a reply to message #1063161] Fri, 14 June 2013 10:43 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hi Dimitris,

Thanks to your link and your help, I've managed to create my tool and to make it work.
However, I do now have another issue:

I use Epsilon to perform a transformation between two models within Xtext. Thus, the workspace used at run time is not the same one as the one containing the tool.

This was already a problem for the standalone use of ETL, when calling the ETL file. I managed to solve it by using the "URI.create("platform:plugin/...." method to find the ETL file.

The issue I have now is that the transformation does not recognize the tool when executed from that second workspace. The error message is the following:
"Caused by: Type 'custom.trace.epsilon.ETLTrace' not found (platform:plugin/epsilon.lares/epsilon/etl/param2basic.etl@8:23)"

This of course correspond to the call to the tool. I call the tool via "var trace = Native("custom.trace.epsilon.ETLTrace").createInstance();"
This works perfectly when I'm calling it from Java code in the same workspace.

Any idea on how to call the tool in a standalone executed from some java code in another workspace ?


I know this is a bit confused and difficult to explain, if it is not clear, tell me and I'll explain again.

Thanks for your help.

Christophe

[Updated on: Fri, 14 June 2013 10:44]

Report message to a moderator

Re: [ETL] Using custom tools in standalone [message #1063894 is a reply to message #1063806] Fri, 14 June 2013 19:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

Could you please send me a minimal example [1] I can use to reproduce this?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] Using custom tools in standalone [message #1064021 is a reply to message #1063894] Mon, 17 June 2013 10:07 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hi Dimitris,

The tool is in the "custom.trace.epsilon" project.
The epsilon code and standalone code calling ETL is in the "epsilon.transfo" code.
There is two examples: one meant to be called directly - the EtlStandaloneExample - and one meant to be called from the plugin - the EtlStandalone.
This is from the EtlStandaloneExample available on the website, I just slightly modified it to add my tool inside.

The "epsilon.call.test" project is a simple call to the standalonejavaexample from another project. It works great.

The problem is with the "org.xtext.example.mydsl" projects. Those 4 projects are the basic example from Xtext. (http://www.eclipse.org/Xtext/documentation.html)

I only added inside of it the code I use to call epsilon from the validation process.

The error is that the call to the tool does not work when executed from the Xtext plugin. The error message is the following:
"Type 'custom.trace.epsilon.ETLTrace' not found (platform:plugin/epsilon.transfo/epsilon/transfo/etl/transfoMinimal.etl@7:23)"

To reproduce it, you need to launch the Xtext plugin by running it as an eclipse application.
Then, you need to create any new file in a standard java project in the second Eclipse it will open.
The extension of this file must be "mydsl". (those step on how to create the file are also explained on the Xtext documentation)

When you write anything on this file, the validation process will be called and the error will occur.

I can of course provide you more information if required.

Thank you for your help,

Best regards,
Christophe
Re: [ETL] Using custom tools in standalone [message #1064039 is a reply to message #1064021] Mon, 17 June 2013 11:41 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

In the plugin.xml file of your custom.trace.epsilon project,

class="custom.trace.epsilon.SampleTool"

should read

class="custom.trace.epsilon.ETLTrace"

instead.

Cheers,
Dimitris
Re: [ETL] Using custom tools in standalone [message #1064046 is a reply to message #1064039] Mon, 17 June 2013 11:51 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hi Dimitris,

I don't understand why the plugin still worked with such an error ...
Now it works fine, thank you!

Best regards,
Christophe
Re: [ETL] Using custom tools in standalone [message #1064048 is a reply to message #1064046] Mon, 17 June 2013 11:56 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Christophe,

In the standalone mode the class is picked up from the classpath based on its fully-qualified name (plugin.xml doesn't come into play at all). When running as a plugin it's not found as there's no tool extension with that class name.

Cheers,
Dimitris
Previous Topic:Remove tests plugin
Next Topic:EMF model - simple questions
Goto Forum:
  


Current Time: Fri Apr 19 12:36:39 GMT 2024

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

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

Back to the top