Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Calling EOL from Java
Calling EOL from Java [message #442964] Fri, 31 July 2009 09:52 Go to next message
No real name is currently offline No real name
Messages: 92
Registered: July 2009
Member
Hi all,

I'm currently playing with running Epsilon (specifically an EOL file) from
Java, using the org.eclipse.epsilon.examples.standalone examples provided
by Epsilon as a starting point, and I've just come into a little stumbling
point.

I find that when I call a specific EOL operation (as per the example in
org.eclipse.epsilon.examples.standalone.eol), it successfully executes
only when the EOL operation definition does not make calls to other EOL
operations. A code snippet is below:

-- overriden method of EpsilonStandaloneExample in
org.eclipse.epsilon.examples.standalone
protected Object execute(IEolExecutableModule module) throws
EolRuntimeException {
...
// get third operation defined in the EOL file, and execute it
EolOperation operation = module.getDeclaredOperations().get(3);
operation.execute(null, parameters, module.getContext());
...
}

Am I doing something wrong or I need to somehow explicitly load all used
operations first?

Any pointers would be greatly appreciated.

Best,

Edd
Re: Calling EOL from Java [message #443168 is a reply to message #442964] Fri, 31 July 2009 10:08 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Edd,

You should call the prepare() method of the module before executing the
operation (module.execute() does this by default):

EolOperation operation = module.getDeclaredOperations().get(3);
module.prepare();
operation.execute(null, parameters, module.getContext());

Cheers,
Dimitris

Edward Turner wrote:
> Hi all,
>
> I'm currently playing with running Epsilon (specifically an EOL file)
> from Java, using the org.eclipse.epsilon.examples.standalone examples
> provided by Epsilon as a starting point, and I've just come into a
> little stumbling point.
>
> I find that when I call a specific EOL operation (as per the example in
> org.eclipse.epsilon.examples.standalone.eol), it successfully executes
> only when the EOL operation definition does not make calls to other EOL
> operations. A code snippet is below:
>
> -- overriden method of EpsilonStandaloneExample in
> org.eclipse.epsilon.examples.standalone
> protected Object execute(IEolExecutableModule module) throws
> EolRuntimeException {
> ...
> // get third operation defined in the EOL file, and execute it
> EolOperation operation = module.getDeclaredOperations().get(3);
> operation.execute(null, parameters, module.getContext());
> ...
> }
>
> Am I doing something wrong or I need to somehow explicitly load all used
> operations first?
>
> Any pointers would be greatly appreciated.
>
> Best,
>
> Edd
>
Re: Calling EOL from Java [message #443458 is a reply to message #443168] Fri, 31 July 2009 10:48 Go to previous message
No real name is currently offline No real name
Messages: 92
Registered: July 2009
Member
> Hi Edd,
Hia Dimitris, thanks for your swift reply!

> You should call the prepare() method of the module before executing the
> operation (module.execute() does this by default):

> EolOperation operation = module.getDeclaredOperations().get(3);
> module.prepare();
> operation.execute(null, parameters, module.getContext());
Great -- yes that was the solution.

Just a note, this didn't work straight off because
org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExa mple defines
the variable,

protected IEolExecutableModule module;

.. and the interface, IEolExecutableModule does not require definition of
the prepare() method. Instead of adding this method to the interface, I
just changed the example so that module is defined (in
org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExa mple) as:

protected EolModule module;

And so then, calling prepare() is fine.

Anyway -- many thanks for your help.


> Cheers,
> Dimitris

Cheers,

Edd
Re: Calling EOL from Java [message #572071 is a reply to message #442964] Fri, 31 July 2009 10:08 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Edd,

You should call the prepare() method of the module before executing the
operation (module.execute() does this by default):

EolOperation operation = module.getDeclaredOperations().get(3);
module.prepare();
operation.execute(null, parameters, module.getContext());

Cheers,
Dimitris

Edward Turner wrote:
> Hi all,
>
> I'm currently playing with running Epsilon (specifically an EOL file)
> from Java, using the org.eclipse.epsilon.examples.standalone examples
> provided by Epsilon as a starting point, and I've just come into a
> little stumbling point.
>
> I find that when I call a specific EOL operation (as per the example in
> org.eclipse.epsilon.examples.standalone.eol), it successfully executes
> only when the EOL operation definition does not make calls to other EOL
> operations. A code snippet is below:
>
> -- overriden method of EpsilonStandaloneExample in
> org.eclipse.epsilon.examples.standalone
> protected Object execute(IEolExecutableModule module) throws
> EolRuntimeException {
> ...
> // get third operation defined in the EOL file, and execute it
> EolOperation operation = module.getDeclaredOperations().get(3);
> operation.execute(null, parameters, module.getContext());
> ...
> }
>
> Am I doing something wrong or I need to somehow explicitly load all used
> operations first?
>
> Any pointers would be greatly appreciated.
>
> Best,
>
> Edd
>
Re: Calling EOL from Java [message #572099 is a reply to message #443168] Fri, 31 July 2009 10:48 Go to previous message
No real name is currently offline No real name
Messages: 92
Registered: July 2009
Member
> Hi Edd,
Hia Dimitris, thanks for your swift reply!

> You should call the prepare() method of the module before executing the
> operation (module.execute() does this by default):

> EolOperation operation = module.getDeclaredOperations().get(3);
> module.prepare();
> operation.execute(null, parameters, module.getContext());
Great -- yes that was the solution.

Just a note, this didn't work straight off because
org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExa mple defines
the variable,

protected IEolExecutableModule module;

.. and the interface, IEolExecutableModule does not require definition of
the prepare() method. Instead of adding this method to the interface, I
just changed the example so that module is defined (in
org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExa mple) as:

protected EolModule module;

And so then, calling prepare() is fine.

Anyway -- many thanks for your help.


> Cheers,
> Dimitris

Cheers,

Edd
Previous Topic:Calling EOL from Java
Next Topic:Problem running ETL using Epsilon/ANT
Goto Forum:
  


Current Time: Mon Apr 21 09:00:24 EDT 2014

Powered by FUDForum. Page generated in 0.02755 seconds