Xpand: could not find the property exception [message #519097] |
Sat, 06 March 2010 12:32 |
zakir Hussain Messages: 76 Registered: July 2009 |
Member |
|
|
Hello All,
I am executing Xpand template in multiple threads.
In each thread i am creating a new XpandExecutioncontextImpl object, fetching the XpandFacade object and then calling evaluate method on XpandFacade with an object of my object model and with an Xpand template path .
In Xpand script, i am importing my ecore model, my XpandScript internally uses lot of java extensions (which are all static methods in java code). As my application is multithreaded application, i have made all the java extension(i.e in java code) as synchronized methods, and all these java extensions returns an object or collection of objects which are part of my object model (i.e ecore)
After a call to java extension, on the return value of it, when i try to fetch the attributes of the object returned, i am getting no property found exception.
Example:
Assume my ecore is having School as a class and students as a list, and each student is having a name attribute as String...
when i invoke a java extension from my Xpand template, return value is Student, when i call name attribute in Xpand, i am getting property not found exeception.
This behaviour is not consistent................
So please suggest me how to proceed regarding this.........now i dont know what to be synchronized....
|
|
|
Re: Xpand: could not find the property exception [message #519161 is a reply to message #519097] |
Sun, 07 March 2010 15:24 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
zakir,
> In Xpand script, i am importing my ecore model, my XpandScript
> internally uses lot of java extensions (which are all static methods in
> java code). As my application is multithreaded application, i have made
> all the java extension(i.e in java code) as synchronized methods, and
> all these java extensions returns an object or collection of objects
> which are part of my object model (i.e ecore)
Do they modify shared state?
> After a call to java extension, on the return value of it, when i try to
> fetch the attributes of the object returned, i am getting no property
> found exception.
For what kind of property?
Do you create that object in the java extension?
If yes, how do you create it resp. how do you obtain the EFactory?
Sven
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
|
|
Re: Xpand: could not find the property exception [message #519269 is a reply to message #519256] |
Mon, 08 March 2010 10:39 |
zakir Hussain Messages: 76 Registered: July 2009 |
Member |
|
|
Hello Sven,
> How do you call Xpand?
XpandExecutionContext executionContext = new XpandExecutionContext(outputImpl, null, globalVarsMap, null, null);
XpandFacade xpandFacade = XpandFacade.create(executionContext);
xpandFacade.evaluate(definitionName, schoolObject, new Object[] {});
>Do you load your model form XMI? Does it refer to its ecore model by nsURI or resource URI?
No the model is not referred from XMI, instead object model is passed to the method where XpandFacade is created and it is again passed to evaluate method of XpandFacade
>Have you registered the RootPackage.eInstance?
Yes i have registered RootPackage in the following way:
MetaModel root_META_MODEL = new EmfRegistryMetaModel() {
@Override
protected EPackage[] allPackages() {
return new EPackage[] { RootPackage.eINSTANCE,
RootPackage.eINSTANCE };
}
};
executionContext.registerMetaModel(root_META_MODEL);
|
|
|
|
Powered by
FUDForum. Page generated in 0.04143 seconds