Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF, GWT ELIST and serialisation(Impossible to serialize objects with EList using GWT)
EMF, GWT ELIST and serialisation [message #1831627] Tue, 25 August 2020 15:59 Go to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 60
Registered: January 2014
Member
Hi all
I start a new project using GWT (Google Window Toolkit) and EMF (like in classical project of eclipse).
I have a pb if my object contains EList it's impossible to serialize it, event if when I create the Elist I use an ArrayList<MyClass> or a BasicEList<MyClass> where MyClass is the class of the objects managed in my list and even if in MyClass there is no EList.
Can you help me, with an example?

Here is the error code obtained:
com.google.gwt.user.client.rpc.SerializationException: Type 'com.lacen.organisation.impl.RequirementImpl' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.lacen.organisation.impl.RequirementImpl@2fa144e7 (name: Fkygrdphgf)


Thanks in advance

Regards Antonio
Re: EMF, GWT ELIST and serialisation [message #1831642 is a reply to message #1831627] Wed, 26 August 2020 05:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
GWT relies on a "whitelist" to support serialization:

http://www.gwtproject.org/doc/latest/FAQ_Server.html#Does_the_GWT_RPC_system_support_the_use_of_java.io.Serializable

The URI service has this method to help generate such a whitelist:

org.eclipse.emf.ecore.resource.URIService.whiteList(WhiteList)

If you look at the type hierarchy of org.eclipse.emf.ecore.resource.URIService.WhiteList you'll see that each generated package has a sublass of this which references each class and data type in your model. Your model should have that too, assuming you've set the GenModel's Runtime Platform to GWT.

You'll need to ensure that your service is also making use of this.

It's been a extremely long time since I used GWT, so I can't offer much in the way of assistance.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF, GWT ELIST and serialisation [message #1831670 is a reply to message #1831642] Wed, 26 August 2020 09:52 Go to previous messageGo to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 60
Registered: January 2014
Member
HI Ed,

Thanks a lot for your help. My model contains the static class extending WhiteList ( Ihave GWT as target Paltform):

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static class WhiteList implements IsSerializable, EBasicWhiteList {
		/**
		 * <!-- begin-user-doc -->
		 * <!-- end-user-doc -->
		 * @generated
		 */
		protected Customer customer;

		/**
		 * <!-- begin-user-doc -->
		 * <!-- end-user-doc -->
		 * @generated
		 */
		protected Organisation organisation;

		/**
		 * <!-- begin-user-doc -->
		 * <!-- end-user-doc -->
		 * @generated
		 */
		protected Requirement requirement;



And Requirement (intreface is here too).

So, you said also "You'll need to ensure that your service is also making use of this.". What do you mean? in my declaration of service I use this:
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
	Customer greetServer(String name) throws IllegalArgumentException;

Do you want say that I must extend URIService and note RemoteService??

Sory but for me all this is not clear. I was tinking that the pb was comming from the fact that EMF generate references as EList and EList extend List and a List is not serialisable. All this is for me is too strange.

Thanks a lot for your help
Antonio
Re: EMF, GWT ELIST and serialisation [message #1831676 is a reply to message #1831670] Wed, 26 August 2020 12:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
It's probably sufficient that you use the URISerivce.WhiteList interface your your Greeting service just like the URIService does. I.e., URIService.WhiteList whiteList(URIService.WhiteList whiteList) in the interface. And a method implementation that just returns null. But I'm just guessing... (The EList implementation classes are serializeable.)

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Showing Properties of EObjects without Selection
Next Topic:Load an ecore file programmatically
Goto Forum:
  


Current Time: Tue Apr 16 20:24:11 GMT 2024

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

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

Back to the top