Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » resource load with special epackage
resource load with special epackage [message #431832] Mon, 27 July 2009 22:12 Go to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Hello,

i load a model with resource.load(fileURI), now i wanna load a second
model, with a different(or a new initialized) epackage, the old one is
somewhere saved, but i want to initialize a new one. How can i clear the
cache from the first loading? Is it possible? A new resource is on this
way created: Resource resource = new XMIResourceImpl(fileURI); , but the
contents of every iteration have the same EPackage.

Greetings
Jörg
Re: resource load with special epackage [message #431876 is a reply to message #431832] Tue, 28 July 2009 15:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Jörg,

While loading, the namespace URI of a package is looked up in
ResourceSet.getPackageRegistry so you could register a different package
in there...


Jörg wrote:
> Hello,
>
> i load a model with resource.load(fileURI), now i wanna load a second
> model, with a different(or a new initialized) epackage, the old one is
> somewhere saved, but i want to initialize a new one. How can i clear the
> cache from the first loading? Is it possible? A new resource is on this
> way created: Resource resource = new XMIResourceImpl(fileURI); , but the
> contents of every iteration have the same EPackage.
>
> Greetings
> Jörg
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: resource load with special epackage [message #431941 is a reply to message #431876] Thu, 30 July 2009 09:19 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
This is exactly, what i have done, but he calls the xyzPackage.init() in
the first run anyway. In the second xyzPackage.init() isn't called and
it use the old package from the first loading, even if i change the
nsURI. It would help a lot, if he calls every time xyzPackage.init()
when the method resource.load() is executed. Is it possible to give this
behaviour to resource.load()?

Ed Merks schrieb:
> Jörg,
>
> While loading, the namespace URI of a package is looked up in
> ResourceSet.getPackageRegistry so you could register a different package
> in there...
>
>
> Jörg wrote:
>> Hello,
>>
>> i load a model with resource.load(fileURI), now i wanna load a second
>> model, with a different(or a new initialized) epackage, the old one is
>> somewhere saved, but i want to initialize a new one. How can i clear the
>> cache from the first loading? Is it possible? A new resource is on this
>> way created: Resource resource = new XMIResourceImpl(fileURI); , but the
>> contents of every iteration have the same EPackage.
>>
>> Greetings
>> Jörg
>>
EMF Meta Tooling [message #431942 is a reply to message #431832] Thu, 30 July 2009 09:26 Go to previous messageGo to next message
Anshu Jain is currently offline Anshu JainFriend
Messages: 4
Registered: July 2009
Junior Member
Hello All,

Recently I have been involved in working on a Rich Client Application
which is based on an EMF model, and the entire application is really about
building this EMF model.

After several iterations starting with Code from PDE Editor, moving to
multiple base classes, I eventually decided to create a simple UI
Metamodel which can model Views and Wizards for any domain mode, and then
written some code to render forms based view based on the application
model.

The existing available implementations/snippets of Forms for EMF were more
generic form based editors, which would need to be extended for
modification. I decided to take the approach of a simple UI metamodel
(based on EMF ofcourse) which can be instantiated for any EMF Class, and
then be edited using a simple tree and properties editor. This UI
Metamodel can then be rendered by my engine in the target Runtime.

I am of course getting driven towards extending this metamodel to include
the explorer and actions. In some sense a high level Metatooling for an
EMF Domain Model. Based on what I know of E4, and of IMP, they are much
more broader in the goals, and thus much more detailed tool metamodels.
Here assuming that I have in my scope applications which just need to work
on EMF metamodels, I want to keep the abstractions, at much higher level.
For e.g. my UI Metamodel is nothing more than specifying types and some
attributes of the controls (most of which are deduced in the
initialization of the model itself). It does not allow people to declare
layouts, and lower level details.

1. Am i doing redundant work? If yes, where should I look?

2. If No, do you think there is a need for such a high level EMF based
tooling platform, which goes beyong the generated editors of EMF..(we
already have IMP project..but I think it is much broader scope, and i have
limited knowledge) and does it makes sense to contributed something like
this..?
Re: resource load with special epackage [message #431948 is a reply to message #431941] Thu, 30 July 2009 13:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Jörg,

Comments below.

Jörg wrote:
> This is exactly, what i have done, but he calls the xyzPackage.init()
> in the first run anyway. In the second xyzPackage.init() isn't called
> and it use the old package from the first loading, even if i change
> the nsURI.
Packages register themselves in EPackage.Registry.INSTANCE, but
ResourceSet.getPackageRegistry() can override those registrations.
> It would help a lot, if he calls every time xyzPackage.init() when the
> method resource.load() is executed. Is it possible to give this
> behaviour to resource.load()?
If you register things in the registry local to the resource set, you
should have enough control without changing the global registration
behavior. Programmatic changes to the global registry should be avoided
because they affect all clients in the JVM...
>
> Ed Merks schrieb:
>> Jörg,
>>
>> While loading, the namespace URI of a package is looked up in
>> ResourceSet.getPackageRegistry so you could register a different
>> package in there...
>>
>>
>> Jörg wrote:
>>> Hello,
>>>
>>> i load a model with resource.load(fileURI), now i wanna load a second
>>> model, with a different(or a new initialized) epackage, the old one is
>>> somewhere saved, but i want to initialize a new one. How can i clear
>>> the
>>> cache from the first loading? Is it possible? A new resource is on this
>>> way created: Resource resource = new XMIResourceImpl(fileURI); , but
>>> the
>>> contents of every iteration have the same EPackage.
>>>
>>> Greetings
>>> Jörg
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Meta Tooling [message #431949 is a reply to message #431942] Thu, 30 July 2009 13:49 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Anshu,

Comments below.

Anshu Jain wrote:
> Hello All,
>
> Recently I have been involved in working on a Rich Client Application
> which is based on an EMF model, and the entire application is really
> about building this EMF model.
> After several iterations starting with Code from PDE Editor, moving to
> multiple base classes, I eventually decided to create a simple UI
> Metamodel which can model Views and Wizards for any domain mode, and
> then written some code to render forms based view based on the
> application model.
> The existing available implementations/snippets of Forms for EMF were
> more generic form based editors, which would need to be extended for
> modification. I decided to take the approach of a simple UI metamodel
> (based on EMF ofcourse) which can be instantiated for any EMF Class,
> and then be edited using a simple tree and properties editor. This UI
> Metamodel can then be rendered by my engine in the target Runtime.
Cool.
> I am of course getting driven towards extending this metamodel to
> include the explorer and actions. In some sense a high level
> Metatooling for an EMF Domain Model. Based on what I know of E4, and
> of IMP, they are much more broader in the goals, and thus much more
> detailed tool metamodels. Here assuming that I have in my scope
> applications which just need to work on EMF metamodels, I want to keep
> the abstractions, at much higher level. For e.g. my UI Metamodel is
> nothing more than specifying types and some attributes of the controls
> (most of which are deduced in the initialization of the model itself).
> It does not allow people to declare layouts, and lower level details.
>
> 1. Am i doing redundant work? If yes, where should I look?
It does sound closely related to the new presentation modeling framework
project http://www.eclipse.org/pmf/
>
> 2. If No, do you think there is a need for such a high level EMF based
> tooling platform, which goes beyong the generated editors of EMF..(we
> already have IMP project..but I think it is much broader scope, and i
> have limited knowledge) and does it makes sense to contributed
> something like this..?
Yes, I think we do need something like this. It would be good to
contact the committers listed in the PMF proposal.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF generics and Rational Rose
Next Topic:Getter/Setter methods when dynamically build the model
Goto Forum:
  


Current Time: Thu Mar 28 13:32:10 GMT 2024

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

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

Back to the top