[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.emf] Re: Design question

Brian,

It sounds like pkg B would best be implemented as a Resource. It doesn't sound
like it's a model itself - it's just the code to persist the pkg A model.

Unfortunately there isn't a tutorial, or much documentation on how to work with
resources. (The EMF book at http://www.awprofessional.com/titles/0131425420
describes these things quite well, but you pay for it.) You can look at the code
in plugin org.eclipse.emf.ecore.xmi to see the default resource implementations.
You would replace the default implementation with a resource class of your own
which will do essentially what your pkg B is doing now.

Frank.


Brian Berry wrote:

> I have a package (pkg A) which is used to represent my presentation layer
> data, ie - simple data structures containing get/set attributes required
> to paint the UI for my application.  I have another package (pkg B) of
> utility classes that read from a database certain properties in order to
> construct the objects of the type mentioned in pkg A.  Currently I have
> both pkg A and pkg B generated as an EMF model.  Should I not make an EMF
> model out of pkg B?  If I should proceed with implementing pkg B as a
> Resource as mentioned in the last reply to my original post, is there a
> tutorial or some documentation available on doing that?
>
> Frank Budinsky wrote:
>
> > Brian,
>
> > Without more specifics, its hard to answer this question. Generally,
> > persistence (data access) would be implemented in a Resource, which is not
> > modeled in EMF.
>
> > Frank.
>
> > Brian Berry wrote:
>
> > > I have some packages in my application that are to be used for database
> > > access of various objects.  Is it recommended to keep the EMF portion of
> > > my design limited to the simpler data structures as they are be auto
> > > generated or will I benefit from implementing all of my packages as an EMF
> > > model and then writing the database access code in the impl package of
> > > generated classes?