Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Unknown type... that seems to bo known
Unknown type... that seems to bo known [message #516352] Tue, 23 February 2010 16:31 Go to next message
Federico Tomassetti is currently offline Federico TomassettiFriend
Messages: 190
Registered: July 2009
Location: Dublin
Senior Member

I keep getting this error:

"Unknown type 'ManagerGeneration::ManagerCollection'"

when I generate.

But this type it is recognized in the Xpand editor (auto-completion proposes it).

I use also other types created as ManagerCollection but I have no problem with them.

ManagerCollection it is an EMF Class created using a genmodel file,

what should I check first?
I have really no idea /keine ahnung...

Federico


Re: Unknown type... that seems to bo known [message #516503 is a reply to message #516352] Wed, 24 February 2010 09:24 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Please tell us how you invoke the generator (mwe file, java code).

Sven

Federico Tomassetti schrieb:
> I keep getting this error:
>
> "Unknown type 'ManagerGeneration::ManagerCollection'"
>
> when I generate.
>
> But this type it is recognized in the Xpand editor (auto-completion
> proposes it).
>
> I use also other types created as ManagerCollection but I have no
> problem with them.
>
> ManagerCollection it is an EMF Class created using a genmodel file,
>
> what should I check first?
> I have really no idea /keine ahnung...
>
> Federico


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Unknown type... that seems to bo known [message #516806 is a reply to message #516503] Thu, 25 February 2010 09:08 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico TomassettiFriend
Messages: 190
Registered: July 2009
Location: Dublin
Senior Member

I use a WorkflowRunner

The Mwe file I use contains:

<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".." />

The mwe file used to be in the package "workflows", then I moved it to the "it.tomassetti.fvcgen.workflows". Should I update platformUri=".." to platformUri="../../../.." ?

Have I to specifiy the single metamodels?
Until now I did not and it worked flawlessly...

thank you,

Federico





Re: Unknown type... that seems to bo known [message #516839 is a reply to message #516806] Thu, 25 February 2010 10:37 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Please provide the whole mwe file.

Sven

Federico Tomassetti schrieb:
> I use a WorkflowRunner
>
> The Mwe file I use contains:
>
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".." />
>
> The mwe file used to be in the package "workflows", then I moved it to
> the "it.tomassetti.fvcgen.workflows". Should I update platformUri=".."
> to platformUri="../../../.." ?
>
> Have I to specifiy the single metamodels?
> Until now I did not and it worked flawlessly...
>
> thank you,
>
> Federico
>
>
>
>


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Unknown type... that seems to bo known [message #516843 is a reply to message #516839] Thu, 25 February 2010 10:47 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico TomassettiFriend
Messages: 190
Registered: July 2009
Location: Dublin
Senior Member

<workflow>
	<property name="verbose" value="false" />

	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".">
	</bean>
	
	<!--<component class="org.eclipse.emf.mwe.utils.DirectoryCleaner" directory="${targetDir}"/>-->
	
	<component class="it.tomassetti.mdwe.MultiDslMweReader">
		<register class="it.tomassetti.fvcgen.FvcStackSimplDslStandaloneSetup"/>
		<outputSlot value="fvcsModel" />
		<srcDir value="${modelsDir}" />
		<fileExtension value="fvcs" />
		<verbose value="${verbose}" />
	</component>
	
	<component class="it.tomassetti.mdwe.MultiTargetSetterComponent">
		<modelKey value="fvcsModel" />
		<targetKey value="targetDirs" />
		<verbose value="${verbose}" />
		<defaultTargetDir value="${targetDir}" />
	</component>
		
	<component class="it.tomassetti.fvcgen.transformation.MultiDslModelToGenModelComponent">
		<verbose value="${verbose}" />		
		<targetsSlot value="targetDirs" />
	</component>
		
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="dataBeansModel" />
		<expand value="template::BeanTemplate::main FOR dataBeansModelItem" />
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
   		<verbose value="${verbose}" />   		
	</component>
	
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="modelBeansModel" />
		<expand value="template::BeanTemplate::main FOR modelBeansModelItem" />
		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
   		<verbose value="${verbose}" />
	</component>
	
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="formBeansModel" />
		<expand value="template::BeanTemplate::main FOR formBeansModelItem" />
		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
   		<verbose value="${verbose}" />
	</component>	
	


	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="businessComponentsModel" />
		<expand value="template::BusinessComponentTemplate::mainWithoutConf FOR businessComponentsModelItem" />
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>		
   		<verbose value="${verbose}" />
	</component>
	
	<component class="it.tomassetti.mdwe.ListDericherWorkflowComponent">
		<inputSlot value="businessComponentsModel"/>
		<outputSlot value="businessComponentsModelDeriched"/>
	</component>
	
	<component class="it.tomassetti.mdwe.ListDericherWorkflowComponent">
		<inputSlot value="servicesModel"/>
		<outputSlot value="servicesModelDeriched"/>
	</component>
	
	<component class="it.tomassetti.mdwe.ListDericherWorkflowComponent">
		<inputSlot value="controllersModel"/>
		<outputSlot value="controllersModelDeriched"/>
	</component>
	
	<component class="it.tomassetti.mdwe.ListDericherWorkflowComponent">
		<inputSlot value="managersModel"/>
		<outputSlot value="managersModelDeriched"/>
	</component>
	
	<component class="org.eclipse.xpand2.Generator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<expand value="template::BusinessComponentTemplate::configuration FOR businessComponentsModelDeriched" />
		<outlet path="${targetDir}" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
			<postprocessor class="org.eclipse.xpand2.output.XmlBeautifier" />
		</outlet>
   		<prSrcPaths value="${targetDir}"/>
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
	</component>
		
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="servicesModel" />
		<expand value="template::ServiceTemplate::mainWithoutConfiguration FOR servicesModelItem" />
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>		
   		<verbose value="${verbose}" />
	</component>	
	
	<component class="org.eclipse.xpand2.Generator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<expand value="template::ServiceTemplate::configuration FOR servicesModelDeriched" />
		<outlet path="${targetDir}" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
			<postprocessor class="org.eclipse.xpand2.output.XmlBeautifier" />
		</outlet>

   		<prSrcPaths value="${targetDir}"/>
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
	</component>	
	
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="ejbModel" />
		<expand value="template::EjbTemplate::main('${ejbVersion}') FOR ejbModelItem" />
		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
	</component>
	
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="controllersModel" />
		<expand value="template::ControllerTemplate::mainWithoutConfiguration FOR controllersModelItem" />
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>		
	</component>
	
	<component class="org.eclipse.xpand2.Generator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<expand value="template::ControllerTemplate::configuration FOR controllersModelDeriched" />
		<outlet path="${targetDir}" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
			<postprocessor class="org.eclipse.xpand2.output.XmlBeautifier" />
		</outlet>

   		<prSrcPaths value="${targetDir}"/>
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
	</component>
			
	<component class="it.tomassetti.mdwe.MultiXpandMultiTargetGenerator">
		<skipOnErrors value="true" />
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>
		<inputSlot value="managersModel" />
		<expand value="template::ManagerTemplate::main FOR managersModelItem" />
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>		
	</component>

	<component class="org.eclipse.xpand2.Generator">
		<skipOnErrors value="true" />
<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="ISO-8859-1"/>		
		<expand value="template::WebConfTemplate::main(controllersModelDeriched) FOR managersModelDeriched" />
		<outlet path="${targetDir}" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
			<postprocessor class="org.eclipse.xpand2.output.XmlBeautifier" />
		</outlet>
   		<prSrcPaths value="${targetDir}"/>
   		<prDefaultExcludes value="false"/>
   		<prExcludes value=""/>
	</component>

</workflow>


The problem arises with the last Generator.
If I specify the metamodels in this way:

		<metaModel id="managers" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      		<metaModelPackage value="it.tomassetti.fvcgen.generation.ManagerGeneration.ManagerGenerationPackage"/>
    	</metaModel>
		<metaModel id="controllers" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      		<metaModelPackage value="it.tomassetti.fvcgen.generation.ControllerGeneration.ControllerGenerationPackage"/>
    	</metaModel>


The problem diseappears. Notably in all the other Generator I need not to specify the single EMF package but I use the generic

<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>


Federico

NOTE; modelsDir, verbose and other properties are not present in the mwe file but are specied when the MWE file is invoked using WorkflowRunner


[Updated on: Thu, 25 February 2010 10:48]

Report message to a moderator

Re: Unknown type... that seems to bo known [message #516942 is a reply to message #516843] Thu, 25 February 2010 14:46 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Federico Tomassetti schrieb:
>
> The problem arises with the last Generator. If I specify the metamodels
> in this way:
>
>
> <metaModel id="managers"
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage
> value=" it.tomassetti.fvcgen.generation.ManagerGeneration.ManagerGen erationPackage "/>
>
> </metaModel>
> <metaModel id="controllers"
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage
> value=" it.tomassetti.fvcgen.generation.ControllerGeneration.Control lerGenerationPackage "/>
>
> </metaModel>
>
>
> The problem diseappears. Notably in all the other Generator I need not
> to specify the single EMF package but I use the generic
>
> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>

That means that the specified EPackages are for some reason not in the
EPackage.Registry.INSTANCE at that point. Are those EPackages registered
somewhere?

Sven


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Unknown type... that seems to bo known [message #516949 is a reply to message #516942] Thu, 25 February 2010 15:11 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico TomassettiFriend
Messages: 190
Registered: July 2009
Location: Dublin
Senior Member

Well, I did nothing to explicitely insert them... but it worked.

It seems to me that they are insert automatically because for every Ecore model are generated the package interface:

public interface <MetaModelName>Package extends EPackage {
...
}


and this interface contains a field (implicitly static):

<MetaModelName>Package eINSTANCE = <<MetaModelName>PackageImpl.init();


And the method init register it:
	public static BeanGenerationPackage init() {
		if (isInited) return (BeanGenerationPackage)EPackage.Registry.INSTANCE.getEPackage(BeanGenerationPackage.eNS_URI);

		// Obtain or create and register package
		BeanGenerationPackageImpl theBeanGenerationPackage = (BeanGenerationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof BeanGenerationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new BeanGenerationPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		CommonPackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theBeanGenerationPackage.createPackageContents();

		// Initialize created meta-data
		theBeanGenerationPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theBeanGenerationPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(BeanGenerationPackage.eNS_URI, theBeanGenerationPackage);
		return theBeanGenerationPackage;
	}


I try to imagine what happened....
Classes are loaded "lazily", for some reasons the other package interfaces are loaded and as conseguence the metamodel was registered without an explicit action from me. One of these metamodels is not registered because I did not use the related package, so it was not loaded and so it did not register it.
Probably I should call the init method explicitly during initialization...

Do you think is plausible what I wrote?

Federico


Re: Unknown type... that seems to bo known [message #518105 is a reply to message #516949] Wed, 03 March 2010 05:28 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi,

Federico Tomassetti schrieb:
> Do you think is plausible what I wrote?

yes, EPackages are registered as a side effect when the generated
classes are accessed.

Sven

--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:how to import an xpand file from an xpand file?
Next Topic:Xpand workflows and parameters
Goto Forum:
  


Current Time: Thu Oct 10 00:47:26 GMT 2024

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

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

Back to the top