Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] legacy model support
[CDO] legacy model support [message #423476] Tue, 30 September 2008 22:47 Go to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
It seems like legacy model support is not available in 1.0. Will 2.0
support it, and if not, when will it be supported?
Re: [CDO] legacy model support [message #423477 is a reply to message #423476] Tue, 30 September 2008 23:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30820
Registered: July 2009
Senior Member
Tom,

Note that Eike and I have been working on
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247130, which would help
with generating hooks so that a "normal" model could support CDO too.


Tom Crockett wrote:
> It seems like legacy model support is not available in 1.0. Will 2.0
> support it, and if not, when will it be supported?
>
Re: [CDO] legacy model support [message #423478 is a reply to message #423476] Tue, 30 September 2008 23:50 Go to previous messageGo to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
Also, how does one make dynamic CDO classes (is this possible?)
Re: [CDO] legacy model support [message #423484 is a reply to message #423477] Wed, 01 October 2008 09:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6468
Registered: July 2009
Senior Member
Ed Merks schrieb:
> Tom,
>
> Note that Eike and I have been working on
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=247130, which would help
> with generating hooks so that a "normal" model could support CDO too.
On the CDO side we have:

247226: Transparently support legacy models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247226

I really hope that we can finish bug #247130 soon so that we can
continue with ours ;-)

Cheers
/Eike

>
>
> Tom Crockett wrote:
>> It seems like legacy model support is not available in 1.0. Will 2.0
>> support it, and if not, when will it be supported?
>>


Re: [CDO] legacy model support [message #423485 is a reply to message #423478] Wed, 01 October 2008 09:11 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6468
Registered: July 2009
Senior Member
Tom Crockett schrieb:
> Also, how does one make dynamic CDO classes (is this possible?)
Yes this is perfectly possible but never by directly creating instances
of CDOModelElements. Instead you have to create regular EModelElement
instances, for example by loading an EPackage from an XML file. When you
register these EPackages with the package registry of a CDOSession,
they're converted on the fly to CDOPackages and committed to the
repository together with the first change deltas that make this necessary.

Does that answer your question?

Cheers
/Eike


Re: [CDO] legacy model support [message #423501 is a reply to message #423485] Wed, 01 October 2008 14:35 Go to previous messageGo to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
Yes, I think that makes sense. So if I were using a "self populating
package registry" like below:

config.setPackageRegistry(CDOUtil.createSelfPopulatingPackag eRegistry());

Then would it only be necessary to register my dynamic package with the
EMF package registry, like so: EPackage.Registry.INSTANCE.put (uri,
myEpackageDescriptorObject)?

Eike Stepper wrote:

> Tom Crockett schrieb:
>> Also, how does one make dynamic CDO classes (is this possible?)
> Yes this is perfectly possible but never by directly creating instances
> of CDOModelElements. Instead you have to create regular EModelElement
> instances, for example by loading an EPackage from an XML file. When you
> register these EPackages with the package registry of a CDOSession,
> they're converted on the fly to CDOPackages and committed to the
> repository together with the first change deltas that make this necessary.

> Does that answer your question?

> Cheers
> /Eike
Re: [CDO] legacy model support [message #423504 is a reply to message #423501] Wed, 01 October 2008 14:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6468
Registered: July 2009
Senior Member
Tom Crockett schrieb:
> Yes, I think that makes sense. So if I were using a "self populating
> package registry" like below:
>
> config.setPackageRegistry(CDOUtil.createSelfPopulatingPackag eRegistry());

I recently renamed:
- SelfPopulatingPackageRegistry to EagerPackageRegistry
- DemandPopulatingPackageRegistry to LazyPackageRegistry

to better indicate what's happening.

And CDOSessionConfiguration has a convenience setEagerPackageRegistry()
method ;-)

>
> Then would it only be necessary to register my dynamic package with
> the EMF package registry, like so: EPackage.Registry.INSTANCE.put (uri,
> myEpackageDescriptorObject)?
Hmm, I never thought of this possibility but I currently see nothing
that could prevent it from working.
Please try it and tell me ;-)

Cheers
/Eike


>
> Eike Stepper wrote:
>
>> Tom Crockett schrieb:
>>> Also, how does one make dynamic CDO classes (is this possible?)
>> Yes this is perfectly possible but never by directly creating
>> instances of CDOModelElements. Instead you have to create regular
>> EModelElement instances, for example by loading an EPackage from an
>> XML file. When you register these EPackages with the package registry
>> of a CDOSession, they're converted on the fly to CDOPackages and
>> committed to the repository together with the first change deltas
>> that make this necessary.
>
>> Does that answer your question?
>
>> Cheers
>> /Eike
>
>


Re: [CDO] legacy model support [message #423514 is a reply to message #423504] Wed, 01 October 2008 16:28 Go to previous messageGo to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
Eike Stepper wrote:

> Tom Crockett schrieb:
>> Then would it only be necessary to register my dynamic package with
>> the EMF package registry, like so: EPackage.Registry.INSTANCE.put (uri,
>> myEpackageDescriptorObject)?
> Hmm, I never thought of this possibility but I currently see nothing
> that could prevent it from working.
> Please try it and tell me ;-)

> Cheers
> /Eike

Well, whether I do that or not, it doesn't seem to work. What I'm
currently seeing when I step through the code is that my dynamic package
shows up and has a corresponding CDOPackage created for it by the
self-populating (or eager) registry, but for some reason its "persistent"
field is set to true, so it doesn't get passed across to the server as a
new package. Then the server doesn't recognize the package, and throws an
exception. What am I doing wrong?
Re: [CDO] legacy model support [message #423521 is a reply to message #423514] Wed, 01 October 2008 18:42 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6468
Registered: July 2009
Senior Member
Tom Crockett schrieb:
> Eike Stepper wrote:
>
>> Tom Crockett schrieb:
>>> Then would it only be necessary to register my dynamic package with
>>> the EMF package registry, like so: EPackage.Registry.INSTANCE.put (uri,
>>> myEpackageDescriptorObject)?
>> Hmm, I never thought of this possibility but I currently see nothing
>> that could prevent it from working.
>> Please try it and tell me ;-)
>
>> Cheers
>> /Eike
>
> Well, whether I do that or not, it doesn't seem to work. What I'm
> currently seeing when I step through the code is that my dynamic
> package shows up and has a corresponding CDOPackage created for it by
> the self-populating (or eager) registry, but for some reason its
> "persistent" field is set to true, so it doesn't get passed across to
> the server as a new package. Then the server doesn't recognize the
> package, and throws an exception. What am I doing wrong?
Only that you're working on your 50th birthday ;-) Congratulations!

It sounds like a smal bug for this special case. Can you please file a
Bugzilla so that you can track the prgress?

Cheers
/Eike


Re: [CDO] legacy model support [message #423531 is a reply to message #423521] Wed, 01 October 2008 19:48 Go to previous messageGo to next message
Tom Crockett is currently offline Tom CrockettFriend
Messages: 54
Registered: July 2009
Member
Eike Stepper wrote:

> Tom Crockett schrieb:
>> Well, whether I do that or not, it doesn't seem to work. What I'm
>> currently seeing when I step through the code is that my dynamic
>> package shows up and has a corresponding CDOPackage created for it by
>> the self-populating (or eager) registry, but for some reason its
>> "persistent" field is set to true, so it doesn't get passed across to
>> the server as a new package. Then the server doesn't recognize the
>> package, and throws an exception. What am I doing wrong?
> Only that you're working on your 50th birthday ;-) Congratulations!

I think you may have me confused with someone else--I'm 27 ;)

> It sounds like a smal bug for this special case. Can you please file a
> Bugzilla so that you can track the prgress?

I have since made my own CDOPackageRegistry extends SessionBound, which is
a copy of SelfPopulating, but whose sessionActivated method looks like
this:

for (String key: new HashSet<String>(EPackage.Registry.INSTANCE.keySet()) {
EPackage pkg = EPackage.Registry.INSTANCE.getEPackage(key);
if (pkg.getESuperPackage() == null)
// check is to prevent IllegalArgumentException
putEPackage(pkg);

CDOPackageTypeRegistry.INSTANCE.addListener(typeListener);
}

This seems to work pretty well, because putEPackage() both creates a CDO
package if necessary and sets persisted to false. Does this seem like a
reasonable workaround?

I filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=249383
Re: [CDO] legacy model support [message #423538 is a reply to message #423531] Wed, 01 October 2008 20:55 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6468
Registered: July 2009
Senior Member
Tom Crockett schrieb:
> Eike Stepper wrote:
>
>> Tom Crockett schrieb:
>>> Well, whether I do that or not, it doesn't seem to work. What I'm
>>> currently seeing when I step through the code is that my dynamic
>>> package shows up and has a corresponding CDOPackage created for it
>>> by the self-populating (or eager) registry, but for some reason its
>>> "persistent" field is set to true, so it doesn't get passed across
>>> to the server as a new package. Then the server doesn't recognize
>>> the package, and throws an exception. What am I doing wrong?
>> Only that you're working on your 50th birthday ;-) Congratulations!
>
> I think you may have me confused with someone else--I'm 27 ;)
I just saw a TV spot about the 50th annversary of the NASA ;-)

>
>> It sounds like a smal bug for this special case. Can you please file
>> a Bugzilla so that you can track the prgress?
>
> I have since made my own CDOPackageRegistry extends SessionBound,
> which is a copy of SelfPopulating, but whose sessionActivated method
> looks like this:
>
> for (String key: new
> HashSet<String>(EPackage.Registry.INSTANCE.keySet()) {
> EPackage pkg = EPackage.Registry.INSTANCE.getEPackage(key);
> if (pkg.getESuperPackage() == null)
> // check is to prevent IllegalArgumentException
> putEPackage(pkg);
>
> CDOPackageTypeRegistry.INSTANCE.addListener(typeListener);
> }
>
> This seems to work pretty well, because putEPackage() both creates a
> CDO package if necessary and sets persisted to false. Does this seem
> like a reasonable workaround?
>
> I filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=249383
>


Previous Topic:[CDO] "Not a top level package" exception
Next Topic:Validation of model on doSave()
Goto Forum:
  


Current Time: Mon Jan 27 13:13:24 GMT 2020

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

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

Back to the top