Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Setting IUserInput from Workflow(Adapting ant input management to EOL)
Setting IUserInput from Workflow [message #1838942] Wed, 10 March 2021 00:12 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

In our project, we use Apache ant to drive Epsilon workflows. We want to run these workflows in a scripted manner for testing as well as interactively.
We are using Epsilon's context independent input facility in our eol scripts, but this facility does not allow a scripting interface.
We see that the intended response would be to subclass Epsilon's IUserInput.

However, we have the question of how we can call IEolContext.setUserInput(IUserInput userInput) from within ant, when we call eol. There does not seem to be and exposed reference to.

As an aside, Apache ant, as the driver for Epsilon workflow, also offers a means to obtain input, which includes PropertyFileInputHandler for automation.

Our eventual aim would be to write an adapter as a subclass to the ant's InputHandler to use Epsilon's IUserInput for input gathered from ant as well.
Re: Setting IUserInput from Workflow [message #1838943 is a reply to message #1838942] Wed, 10 March 2021 00:50 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

It seems we need to be able to call EolEngine.getContext(), so we would need some access to the engine for this purpose.
Re: Setting IUserInput from Workflow [message #1838951 is a reply to message #1838943] Wed, 10 March 2021 10:43 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Joern,

To achieve this, you need to create a custom implementation of the Host interface [1] (or extend DefaultHost [2]), implement its configureUserInput method (as in [3]) to set the desirable user input object to Epsilon modules, and before you run your ANT project programmatically, call HostManager.getSupportedHosts().add(myhost). Would this work for your use-case?

Best,
Dimitris

[1] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.workflow/ant/org/eclipse/epsilon/workflow/tasks/hosts/Host.java
[2] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.workflow/ant/org/eclipse/epsilon/workflow/tasks/hosts/DefaultHost.java
[3] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.workflow/src/org/eclipse/epsilon/workflow/tasks/hosts/EclipseHost.java#n144
Re: Setting IUserInput from Workflow [message #1838953 is a reply to message #1838951] Wed, 10 March 2021 10:50 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Yes, that would work well. It also means that the control is in the right place, so the architecture seems sensible. Is there something we can contribute to this effort? Maybe write an article that describes the feature? I am not sure how easily we would be able to contribute a quality code patch at short notice, as we are not set up for Epsilon development yet.

Best wishes,
JG
Re: Setting IUserInput from Workflow [message #1838954 is a reply to message #1838951] Wed, 10 March 2021 10:52 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Hi,
Yes that would work, and given that this is an externally visible interface, we will be able to write that ourselves.
Thanks for the tip!
Re: Setting IUserInput from Workflow [message #1838955 is a reply to message #1838954] Wed, 10 March 2021 10:58 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

That's great - and a brief article in Markdown [1, 2] we could publish under [3] would be more than welcome!

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/manage-the-epsilon-website-locally/
[2] https://git.eclipse.org/c/www.eclipse.org/epsilon.git/tree/mkdocs/docs/doc/articles/picto-xtext/index.md (example)
[3] https://www.eclipse.org/epsilon/doc/articles/#workflow-ant-tasks
Re: Setting IUserInput from Workflow [message #1840167 is a reply to message #1838955] Thu, 08 April 2021 03:19 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

I have just started on the implementation of this and am surprised, as both Host and DefaultHost are not actually accessible through the plugin classloader, but bundled into the task library. Is the intended design? If so, how am I meant to shape the bundle that does this extension?

I see two ways to do this:


  1. Move the Host classes onto the plugin class path.
  2. Use some sort of extra-classpath directive to allow the build to proceed.


The second option sounds messy, the first is outside my control. Rock and a hard place. I could build a feature patch to patch Epsilon over, but Tycho is buggy with feature patches...

Seems I am stuck without greater effort. Any other ideas?

w.r.t. article, I am waiting on this.




Re: Setting IUserInput from Workflow [message #1840168 is a reply to message #1838942] Thu, 08 April 2021 04:10 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

And this is why I am not able to work a patch feature: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389698
Re: Setting IUserInput from Workflow [message #1840177 is a reply to message #1838942] Thu, 08 April 2021 06:29 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

I have now checked out the org.eclipse.epsilon.workflow plugin and split it such a way that the Host interface and its children are outside the task library and inside the plugin library, so other classes can be derived. This fails, because of the dependency on org.apache.tools.ant. This only concerns two methods, as shown below. Any advice on if/how this could be refactored to extend this?

	public void addStopCapabilities(Project project, IEolModule module);
	public IModel createModel(String type) throws BuildException;


Maybe we can instead use an extensionPoint with IUserInput that is called from the EclipseHost code? There can only ever be one for the workflow plugin, so a singleton should be fine.

/*******************************************************************************
 * Copyright (c) 2012 The University of York.
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 * 
 * Contributors:
 *     Dimitrios Kolovos - initial API and implementation
 ******************************************************************************/
package org.eclipse.epsilon.workflow.tasks.hosts;

import java.io.File;
import java.util.List;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.eclipse.epsilon.eol.IEolModule;
import org.eclipse.epsilon.eol.models.IModel;

public interface Host {
	
	public boolean isRunning();
	
	public void initialise();
	
	public void addNativeTypeDelegates(IEolModule module);
	
	public void addStopCapabilities(Project project, IEolModule module);

	public boolean supportsDebugging();
	
	public Object debug(IEolModule module, File file) throws Exception;
	
	public void configureUserInput(IEolModule module, boolean isGui);

	public IModel createModel(String type) throws BuildException;

	public <T> List<T> getExtensionsOfType(Class<T> klazz) throws Exception;

}

[Updated on: Thu, 08 April 2021 06:33]

Report message to a moderator

Re: Setting IUserInput from Workflow [message #1840186 is a reply to message #1840177] Thu, 08 April 2021 09:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

How about creating a custom ANT task that sets the desired host (HostManager.getInstance().getHost()) at the start of the workflow? e.g.

<project default="main">
  <target name="main">
    <customHostSettingTask/>
    <epsilon.loadModel ...>
    ...
  </target>
</project>


Best,
Dimitris
Re: Setting IUserInput from Workflow [message #1840189 is a reply to message #1840186] Thu, 08 April 2021 11:23 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

I think there are a two obstacles to this approach:

1. This does not solve the problem that the Host interface is still on the classplath of the AntRunner and hence it is not possible to create an extension by depending on the bundle or plugin.
2. The implementations of Host would need to be exposed to the classloader of that task. This would require a callback and hence an extension point anyway.

Further it does not seem straightforward when the desired outcome is to set an IUserInput for a workflow. An extension point seems the adequate means to do that. It is the Eclipse way of allowing IoC. And the documentation mentions this feature, but it does not mention the Host concept. So to keep changes minimal, only documented features should be exposed.

I have been able to integrate the source of workflow @ tag 2.2 in my build and will see if I can get the extension point to build. I will let you know how I go.

Best,
JG



Re: Setting IUserInput from Workflow [message #1840252 is a reply to message #1840189] Fri, 09 April 2021 18:53 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Yes, you're right. An extension point for IUserInput sounds like the most sensible way forward.

Best,
Dimitris
Re: Setting IUserInput from Workflow [message #1840588 is a reply to message #1840252] Tue, 20 April 2021 01:47 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Hi!

I am a fair bit through working this change out and have found what seems an inconsistency.

The spec states:

"To abstract away from the different runtime environments and enable the user to specify user interaction statements uniformly and regardless of the runtime context, EOL provides the IUserInput interface that can be realized in different ways according to the execution environment and attached to the runtime context via the IEolContext.setUserInput(IUserInput userInput) method."

But the callgraph for JFaceUserInput shows that its constructor demands a PrettyPrinterManager, and in its current implementation that manager is stateful and preloaded with an EOL PrettyPrinter which in turn uses the context's 'toString()' methods to visualize.

All of this is only interesting because as part of the refactor, I would like to allow creation of IUserInputs in ant via types. The current design of JFaceUserInput would mean that they can only be created within an ExecutableModuleTask, because this is the only place where they have meaning.

Because it feels like the Implementation of JFaceUserInput is a mistake, I leave this part of the design out, but I would be happy for some advice on this. Alternatively, all IUserInputs should receive the context if it is assumed that communication will always happen on context.

[Updated on: Tue, 20 April 2021 01:48]

Report message to a moderator

Re: Setting IUserInput from Workflow [message #1840852 is a reply to message #1840588] Mon, 26 April 2021 19:08 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Jörn,

Let's continue our direct discussion on user input in ANT and we can report on the outcome here.

Best,
Dimitris
Previous Topic:etl in multithreaded standalone application
Next Topic:Model to text transformations
Goto Forum:
  


Current Time: Sat Apr 27 07:46:09 GMT 2024

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

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

Back to the top