|
|
|
|
Re: [CDO] legacy model support [message #423485 is a reply to message #423478] |
Wed, 01 October 2008 09:11 |
|
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
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] legacy model support [message #423504 is a reply to message #423501] |
Wed, 01 October 2008 14:59 |
|
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
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] legacy model support [message #423521 is a reply to message #423514] |
Wed, 01 October 2008 18:42 |
|
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
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] legacy model support [message #423538 is a reply to message #423531] |
Wed, 01 October 2008 20:55 |
|
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
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.04280 seconds