Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Client-/Server Architecture with Server-Side EMF Model(Building a Client-/Server-Architecture with keeping the EMF Model on Server-Side only.)
Client-/Server Architecture with Server-Side EMF Model [message #1006706] Fri, 01 February 2013 13:58 Go to next message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
Hello everybody,

I have a more high-level question related to modeling in a client-/server architecture which I would just like to post here in the hope of smart hints and suggestions...

I need to build a classic 3-tier client-/server business application with a database, a business model, and a GUI. The database and the business model both run on the server part, while the GUI runs on the client part as an RCP application or - additionally - on another server machine as a RAP application to which clients connect via Webbrowser. I would now like to use EMF to model and generate source code for my business model. For example, suppose there are three classes modeled and generated in the business model: A Car, a BMW, and a Mercedes. The latter two extend the Car. The GUI consist of a tabular editor which allows to modify the attributes of the individual business objects (e.g. the color, price, etc.). However, the displaying and editing should work generically at GUI level, i.e. GUI elements do not know the specifics of a Car, BMW, or Mercedes instance, but access all of them as instances of Business Objects. Such a Business Object has some generic methods to retrieve all available attributes and to retrieve and set values for those attributes, e.g.:

List<String> getAttributes()
Object getAttributeValue(String attributeName)
void setAttributeValue(String attributeName, Object newValue)

This allows for easy extending the business model on server-side only (e.g. adding a new attribute to the Car class) without the need of changing the generically implemented client. It will just retrieve all available attributes including the new one and display and edit them via the generic methods.

Looking at EMF, I was thinking of using the eGet() and eSet() methods of EObject which is implemented by all modelled and generated model classes. However, the complete business model still needs to be available to the client side class loader as the actual values are stored within the particular business model classes Car, BMW, and Mercedes.

What I am looking for is to only keep the actual attribute values somehow generically in the objects at client side and when sending them to the server side (e.g. on a dedicated commit) write them to the underlying business object class instances that are only known on server-side and from there persist them to the database.

I was looking at CDO, but with that, the EMF model also lives on the client side. So far, I'm not completely sure if my requirement is just a little weired, or if I missed something, ...

Do you guys have any hint, idea, comment to the described scenario?

Thanks for any suggestions...

Best Regards
Timo
Re: Client-/Server Architecture with Server-Side EMF Model [message #1006710 is a reply to message #1006706] Fri, 01 February 2013 14:17 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Timo, my 2cts from a CDO perspective,

The idea is pretty cool, and a classic problem of model extendibility. Unfortunately, this problems will force you to deal with interpretation of a generic attribute.
which is

attribute[0] => "Rear-view-mirror tagged: Objects In The Rear View Mirror May Appear Closer Than They Are"

You will need to maintain this mapping of attributes which are generic to the actually modelled specific attributes of a Car. so this mapping
will have to be maintained either in 1) runtime (For converting client to server) or 2) when upgrading your meta-model with specific attributes,
and migrating your data.
For 1) I doubt this is actually supported in CDO now, perhaps a custom transaction/commit handler would do the trick?
For 2) Currently in CDO the only viable option for migration, is really spitting out your data first and storing in to the v2 of your meta-model.
I think maintaining this mapping in runtime, is harder to realize, then in controlled fixed and planned migration intervals.

Cheers Christophe
Re: Client-/Server Architecture with Server-Side EMF Model [message #1006714 is a reply to message #1006706] Fri, 01 February 2013 14:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Timo,

Comments below.


On 01/02/2013 2:58 PM, Timo Rohrberg wrote:
> Hello everybody,
>
> I have a more high-level question related to modeling in a
> client-/server architecture which I would just like to post here in
> the hope of smart hints and suggestions...
>
> I need to build a classic 3-tier client-/server business application
> with a database, a business model, and a GUI. The database and the
> business model both run on the server part, while the GUI runs on the
> client part as an RCP application or - additionally - on another
> server machine as a RAP application to which clients connect via
> Webbrowser. I would now like to use EMF to model and generate source
> code for my business model. For example, suppose there are three
> classes modeled and generated in the business model: A Car, a BMW, and
> a Mercedes. The latter two extend the Car. The GUI consist of a
> tabular editor which allows to modify the attributes of the individual
> business objects (e.g. the color, price, etc.). However, the
> displaying and editing should work generically at GUI level, i.e. GUI
> elements do not know the specifics of a Car, BMW, or Mercedes
> instance, but access all of them as instances of Business Objects.
> Such a Business Object has some generic methods to retrieve all
> available attributes and to retrieve and set values for those
> attributes, e.g.:
>
> List<String> getAttributes()
> Object getAttributeValue(String attributeName)
> void setAttributeValue(String attributeName, Object newValue)
Perhaps that's unnecessary given that EMF provides much the same
thing... I.e., you can use ReflectiveItemProviderAdapter factory and
will will produce a properties view for any EObject.
>
> This allows for easy extending the business model on server-side only
> (e.g. adding a new attribute to the Car class) without the need of
> changing the generically implemented client. It will just retrieve all
> available attributes including the new one and display and edit them
> via the generic methods.
>
> Looking at EMF, I was thinking of using the eGet() and eSet() methods
> of EObject which is implemented by all modelled and generated model
> classes. However, the complete business model still needs to be
> available to the client side class loader as the actual values are
> stored within the particular business model classes Car, BMW, and
> Mercedes.
It's possible to use dynamic EMF. I.e., you could send the client a
serialized version of the Ecore model, and that can be used to
deserialize instances sent to the client from the server. As an example
of this, try using "Create Dynamic Instance..." from the context menu of
the EClass for Mercedes.
>
> What I am looking for is to only keep the actual attribute values
> somehow generically in the objects at client side and when sending
> them to the server side (e.g. on a dedicated commit) write them to the
> underlying business object class instances that are only known on
> server-side and from there persist them to the database.
>
> I was looking at CDO, but with that, the EMF model also lives on the
> client side.
Yes.
> So far, I'm not completely sure if my requirement is just a little
> weired, or if I missed something, ...
I'm not sure if CDO can deal with a dynamic model in the client side
that corresponds to a generated model on the server side. It should be
possible in principle, but I doubt that's been implemented in practice.
>
> Do you guys have any hint, idea, comment to the described scenario?
I think dynamic Ecore might be a good fit..

Build metamodels with dynamic EMF
<http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/>
Discover the Eclipse Modeling Framework (EMF) and Its Dynamic
Capabilities <http://www.devx.com/Java/Article/29093/0/page/1>


>
> Thanks for any suggestions...
>
> Best Regards
> Timo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Client-/Server Architecture with Server-Side EMF Model [message #1006719 is a reply to message #1006714] Fri, 01 February 2013 14:50 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 01.02.2013 15:29, schrieb Ed Merks:
>
>> I was looking at CDO, but with that, the EMF model also lives on the client side.
> Yes.
Yes, a CDO client, i.e., CDOSession + CDOView/CDOTransaction, instantiates EObjects. But a CDO client can be embedded in
a CDO server, i.e., IRepository. Infact that's often the case, especially with web applications such as RAP applications.

>> So far, I'm not completely sure if my requirement is just a little weired, or if I missed something, ...
> I'm not sure if CDO can deal with a dynamic model in the client side that corresponds to a generated model on the
> server side. It should be possible in principle, but I doubt that's been implemented in practice.
CDO features DynamicCDOObjects. But once the dynamic meta model, i.e., an EPackage that has been constructed dynamically
at runtime, is committed to the repository, it is immutable and cannot be changed thereafter. At least not under the
registered nsURI.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Client-/Server Architecture with Server-Side EMF Model [message #1006748 is a reply to message #1006706] Fri, 01 February 2013 16:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Timo,
And to bring another solution stack to the table... You can also consider the EMF Texo project:
http://wiki.eclipse.org/Texo#Benefits_of_using_Texo

See for a blog of running it all client-server:
http://martintaal.wordpress.com/2012/08/30/taking-emf-to-the-third-tier-the-texo-json-resource/

gr. Martin

On 02/01/2013 02:58 PM, Timo Rohrberg wrote:
> Hello everybody,
>
> I have a more high-level question related to modeling in a client-/server architecture which I would just like to post
> here in the hope of smart hints and suggestions...
>
> I need to build a classic 3-tier client-/server business application with a database, a business model, and a GUI. The
> database and the business model both run on the server part, while the GUI runs on the client part as an RCP application
> or - additionally - on another server machine as a RAP application to which clients connect via Webbrowser. I would now
> like to use EMF to model and generate source code for my business model. For example, suppose there are three classes
> modeled and generated in the business model: A Car, a BMW, and a Mercedes. The latter two extend the Car. The GUI
> consist of a tabular editor which allows to modify the attributes of the individual business objects (e.g. the color,
> price, etc.). However, the displaying and editing should work generically at GUI level, i.e. GUI elements do not know
> the specifics of a Car, BMW, or Mercedes instance, but access all of them as instances of Business Objects. Such a
> Business Object has some generic methods to retrieve all available attributes and to retrieve and set values for those
> attributes, e.g.:
>
> List<String> getAttributes()
> Object getAttributeValue(String attributeName)
> void setAttributeValue(String attributeName, Object newValue)
>
> This allows for easy extending the business model on server-side only (e.g. adding a new attribute to the Car class)
> without the need of changing the generically implemented client. It will just retrieve all available attributes
> including the new one and display and edit them via the generic methods.
>
> Looking at EMF, I was thinking of using the eGet() and eSet() methods of EObject which is implemented by all modelled
> and generated model classes. However, the complete business model still needs to be available to the client side class
> loader as the actual values are stored within the particular business model classes Car, BMW, and Mercedes.
>
> What I am looking for is to only keep the actual attribute values somehow generically in the objects at client side and
> when sending them to the server side (e.g. on a dedicated commit) write them to the underlying business object class
> instances that are only known on server-side and from there persist them to the database.
>
> I was looking at CDO, but with that, the EMF model also lives on the client side. So far, I'm not completely sure if my
> requirement is just a little weired, or if I missed something, ...
>
> Do you guys have any hint, idea, comment to the described scenario?
>
> Thanks for any suggestions...
>
> Best Regards
> Timo


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Client-/Server Architecture with Server-Side EMF Model [message #1006756 is a reply to message #1006748] Fri, 01 February 2013 16:53 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
... and to confuse you even more, additionally, you could use the EMF Client framework to generate UIs of your business models at run time.
But not sure if that will work on RAP, too.
Re: Client-/Server Architecture with Server-Side EMF Model [message #1006764 is a reply to message #1006756] Fri, 01 February 2013 17:24 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 01.02.2013 17:53, schrieb Erdal Karaca:
> .. and to confuse you even more, additionally, you could use the EMF Client framework to generate UIs of your business
> models at run time.
> But not sure if that will work on RAP, too.
I think that ECP runs on RAP. Jonas?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Client-/Server Architecture with Server-Side EMF Model [message #1007001 is a reply to message #1006764] Sun, 03 February 2013 18:32 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,
yes EMF Client Platform 1.0 works on RAP.
EMF Client Platform does not generate any code. It interprets the model
at runtime to build a default UI. This UI can be customized. The good
thing is you can change your model anytime without breaking the default UI
Regards
Jonas

Am 01.02.2013 18:24, schrieb Eike Stepper:
> Am 01.02.2013 17:53, schrieb Erdal Karaca:
>> .. and to confuse you even more, additionally, you could use the EMF
>> Client framework to generate UIs of your business models at run time.
>> But not sure if that will work on RAP, too.
> I think that ECP runs on RAP. Jonas?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
Re: Client-/Server Architecture with Server-Side EMF Model [message #1007077 is a reply to message #1006748] Mon, 04 February 2013 10:59 Go to previous messageGo to next message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
Hello Martin,

thanks to you (and also all the others) for your answers. These are all really valuable information which might guide us to a working solution based on current technology - which is great!

From reading the available information about Texo, it already appears to me a possible solution. But what I don't get so far is the following: Once I have EMF-Objects (i.e. instances of EObject) available at GUI-level via the JSONTexoResource, will those objects have all the nice behavior of EMF-Objects, such as notification etc.?

Thanks for any further answer...

Best Regards
Timo
Re: Client-/Server Architecture with Server-Side EMF Model [message #1007084 is a reply to message #1007077] Mon, 04 February 2013 11:45 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Timo,
Yes, on the client you have standard EMF and EMF generated code. The JSONTexoResource implements standard EMF resoure
behavior.

gr. Martin

On 02/04/2013 11:59 AM, Timo Rohrberg wrote:
> Hello Martin,
>
> thanks to you (and also all the others) for your answers. These are all really valuable information which might guide us
> to a working solution based on current technology - which is great!
>
> From reading the available information about Texo, it already appears to me a possible solution. But what I don't get
> so far is the following: Once I have EMF-Objects (i.e. instances of EObject) available at GUI-level via the
> JSONTexoResource, will those objects have all the nice behavior of EMF-Objects, such as notification etc.?
>
> Thanks for any further answer...
>
> Best Regards
> Timo


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[Teneo] QuickStart Tutorial fails to create tables
Next Topic:How to implement an interface in Ecore Model Editor
Goto Forum:
  


Current Time: Fri Mar 29 08:56:01 GMT 2024

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

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

Back to the top