Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtend/mwe2] Disable model validation
[Xtend/mwe2] Disable model validation [message #762656] Thu, 08 December 2011 13:05 Go to next message
Soenke Brightside is currently offline Soenke BrightsideFriend
Messages: 41
Registered: January 2011
Member
Hi,

I try to read a model within a mwe2 workflow without validation. My reader component looks like this:

	component = org.eclipse.xtext.mwe.Reader {
		path = modelPath
		validate = {
			validateAll = false
			stopOnError = false
		}
		register = ttt.exchange.export.graphml.GraphMLGeneratorSetup {}
		loadResource = {
			slot = "model"
		}
	}


Unfortunately it does't work. The workflow stops with errors (i removed some errors):

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'ttt.PremisePackage'
47   [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\Dokumente und Einstellungen\Admin\Desktop\indigo_paradise_dev_ide\workspace\ttt.exchange.graphml.xtend\src-gen
251  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow ttt.ttt.exchange.export.graphml.GraphMLGenerator: 
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@1bdbfec{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.0/@children.0/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@1bdbfec{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.0/@children.0/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
java.lang.RuntimeException: Problems running workflow ttt.ttt.exchange.export.graphml.GraphMLGenerator: 
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@15c929a{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.11/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@15c929a{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.11/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/Flight_Study_HighLift.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:99)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: java.lang.RuntimeException: 
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@1bdbfec{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.0/@children.0/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@1bdbfec{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.0/@children.0/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
[ERROR]: The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set(Element: ERROR:The required feature 'value' of 'registry.impl.ValueImpl@9cd8db{file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt#//@projects.0/@children.1/@children.12/@parameters.0/@value}' must be set (file:/C:/Dokumente%20und%20Einstellungen/Admin/Desktop/indigo_paradise_dev_ide/workspace/ttt.exchange.graphml.xtend/model/Aeronautics/ttt.ttt line : null); Reported by: -UNKNOWN-)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.handleIssues(Mwe2Bridge.java:56)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:48)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
	... 5 more


Is there any way to disable the validation?

[Updated on: Thu, 08 December 2011 13:09]

Report message to a moderator

Re: [Xtend/mwe2] Disable model validation [message #762661 is a reply to message #762656] Thu, 08 December 2011 13:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
hi,

yes just set a 'nullvalidator' in the component

component = Reader {
...
validate = NullValidator {}
}


public class NullValidator extends org.eclipse.xtext.mwe.Validator.Disabled {

}


~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 08 December 2011 13:14]

Report message to a moderator

Re: [Xtend/mwe2] Disable model validation [message #762669 is a reply to message #762661] Thu, 08 December 2011 13:37 Go to previous messageGo to next message
Soenke Brightside is currently offline Soenke BrightsideFriend
Messages: 41
Registered: January 2011
Member
Thank you. Now no errors are printed.
But now i get a BasicIndexOutOfBoundsException:

java.lang.RuntimeException: Problems running workflow ttt.exchange.export.graphml.GraphMLGenerator: index=0, size=0
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:99)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
	at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:352)
	at ttt.exchange.export.graphml.GraphMLGenerator.doGenerate(GraphMLGenerator.java:32)
	at org.eclipse.xtext.generator.GeneratorComponent.invoke(GeneratorComponent.java:115)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
	... 5 more


I get this exception only with the NullValidator - even with a valid model.

[Updated on: Thu, 08 December 2011 13:37]

Report message to a moderator

Re: [Xtend/mwe2] Disable model validation [message #762673 is a reply to message #762669] Thu, 08 December 2011 13:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
The Validator does resolving, so if you do not use it you have to care about resolving yourself e.g. use ecoreutil.resolveall

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend/mwe2] Disable model validation [message #762718 is a reply to message #762673] Thu, 08 December 2011 14:46 Go to previous messageGo to next message
Soenke Brightside is currently offline Soenke BrightsideFriend
Messages: 41
Registered: January 2011
Member
Ok i solved it:
public class NullValidator extends org.eclipse.xtext.mwe.Validator{
	@Override
	public void validate(ResourceSet resourceSet, Registry registry, Issues issues) {
		List<Resource> resources = Lists.newArrayList(resourceSet.getResources());
		for (Resource resource : resources) {
			try {
				resource.load(null);
			} catch (IOException e) {
				throw new WorkflowInterruptedException("Couldn't load resource (" + resource.getURI() + ")", e);
			}
		}
	}
}

Anyway i don't know if that code is clean or just a "workaround". Is that solution OK?

[Updated on: Thu, 08 December 2011 14:47]

Report message to a moderator

Re: [Xtend/mwe2] Disable model validation [message #762722 is a reply to message #762718] Thu, 08 December 2011 14:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
The clean solution is to validate! Wink

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend/mwe2] Disable model validation [message #762727 is a reply to message #762722] Thu, 08 December 2011 14:55 Go to previous message
Soenke Brightside is currently offline Soenke BrightsideFriend
Messages: 41
Registered: January 2011
Member
I preach it all the time but they do not listen, so i have to work sometimes with a invalid model. And for this step no valid model needed.

[Updated on: Thu, 08 December 2011 14:56]

Report message to a moderator

Previous Topic:com.google.collect missing from Require-Bundles in xtext 2.2?
Next Topic:Inserting copyright information in generated code
Goto Forum:
  


Current Time: Mon Mar 08 10:13:42 GMT 2021

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

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

Back to the top