Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOView omits ETypes in Ecore models
[CDO] CDOView omits ETypes in Ecore models [message #755678] Wed, 09 November 2011 09:58 Go to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi,

I just got started with CDO, running v4.0 (Indigo).
This is my cdo-server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>
    <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
        <!-- negotiator type="challenge" description="/temp/users.db"/ -->
    </acceptor>

    <repository name="repo">
        <property name="overrideUUID" value=""/>
        <property name="supportingAudits" value="true"/>
	<property name="supportingEcore" value="true"/>

	<store type="db">
            <mappingStrategy type="horizontal">
                <property name="qualifiedNames" value="false"/>
                <property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
                <property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
            </mappingStrategy>
            
            <dbAdapter name="derby-embedded"/>
                <dataSource class="org.apache.derby.jdbc.EmbeddedDataSource"
                databaseName="/temp/cdodb1"
                createDatabase="create"/>
        </store>
    </repository>
    
</cdoServer>

As you can see, I enabled "supportingEcore".
"overrideUUID" is set to "" because I also use CDO Dawn framework.
Creating/importing an Ecore model (in legacy mode) works, but showing the resource in a CDOView (like Dawn does), all ETypes of EStructuralFeatures are gone.

As Frontend I use the Eclipse CDO Explorer perspective.
These are the steps I do:
- connect to repository
- enable legacy mode
- open transaction
- create or import a .ecore resource
- commit transaction (by clicking save)
- switch to "Dawn Explorer" which automatically creates a new View
- open the ecore model from the created View which now has all ETypes unset
Strangely, showing the resource in the transaction view now shows the ETypes, but the View never does.

I don't think it has anything to do with Dawn because the View created by Dawn is also visible in CDO Session View and opening the resource from there has the same effect.

Is there anything I'm doing wrong?

Regards,
Tim
Re: [CDO] CDOView omits ETypes in Ecore models [message #755940 is a reply to message #755678] Thu, 10 November 2011 09:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Tim,<br>
<br>
Sorry for the delay. Comments below...<br>
<br>
<br>
<br>
Am 09.11.2011 10:58, schrieb Tim Schaefer:
<blockquote cite="mid:j9di3l$ii2$1@news.eclipse.org" type="cite">Hi,
<br>
<br>
I just got started with CDO, running v4.0 (Indigo).
<br>
This is my cdo-server.xml:
<br>
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;cdoServer&gt;
<br>
   &lt;acceptor type="tcp" listenAddr="0.0.0.0" port="2036"&gt;
<br>
       &lt;!-- negotiator type="challenge"
description="/temp/users.db"/ --&gt;
<br>
   &lt;/acceptor&gt;
<br>
<br>
   &lt;repository name="repo"&gt;
<br>
       &lt;property name="overrideUUID" value=""/&gt;
<br>
       &lt;property name="supportingAudits" value="true"/&gt;
<br>
    &lt;property name="supportingEcore" value="true"/&gt;
<br>
<br>
    &lt;store type="db"&gt;
<br>
           &lt;mappingStrategy type="horizontal"&gt;
<br>
               &lt;property name="qualifiedNames"
value="false"/&gt;
<br>
               &lt;property name="toManyReferences"
value="ONE_TABLE_PER_REFERENCE"/&gt;
<br>
               &lt;property name="toOneReferences"
value="LIKE_ATTRIBUTES"/&gt;
<br>
           &lt;/mappingStrategy&gt;
<br>
                      &lt;dbAdapter name="derby-embedded"/&gt;
<br>
               &lt;dataSource
class="org.apache.derby.jdbc.EmbeddedDataSource"
<br>
               databaseName="/temp/cdodb1"
<br>
               createDatabase="create"/&gt;
<br>
       &lt;/store&gt;
<br>
   &lt;/repository&gt;
<br>
   &lt;/cdoServer&gt;
<br>
<br>
As you can see, I enabled "supportingEcore".
<br>
</blockquote>
Ok.<br>
<br>
<blockquote cite="mid:j9di3l$ii2$1@news.eclipse.org" type="cite">"overrideUUID"
is set to "" because I also use CDO Dawn framework.
<br>
</blockquote>
Ok.<br>
<br>
<blockquote cite="mid:j9di3l$ii2$1@news.eclipse.org" type="cite">Creating/importing
an Ecore model (in legacy mode) works, but showing the resource in
a CDOView (like Dawn does), all ETypes of EStructuralFeatures are
gone.
<br>
<br>
As Frontend I use the Eclipse CDO Explorer perspective.
<br>
These are the steps I do:
<br>
- connect to repository
<br>
- enable legacy mode
<br>
- open transaction
<br>
- create or import a .ecore resource
<br>
- commit transaction (by clicking save)
<br>
- switch to "Dawn Explorer" which automatically creates a new View
<br>
</blockquote>
I tried with a normal (I mean no Dawn involved) view first and I see
that the view is *not* in legacy mode although I've set the default
on the session's popup menu. I must say I'm not very happy with our
control over the legacy mode property. Some infos:<br>
<br>
- Legacy mode is currently an immutable boolean property on CDOView<br>
- To avoid a openXyz() method explosion in CDOSession we decided to
control the legacy mode value through a thread local variable in
CDOUtil (which may have been a poor decision)<br>
- The UI uses the popup menu of a session to control the legacy mode
for views/transactions *to be opened* (this decision is maybe even
worse as we can hardly control on what exact thread it happens)<br>
<br>
If you open a bugzilla we can try to change:<br>
1) Make legacy mode enabled in all views/transactions by default<br>
2) Add a setter to disable/enable it at any point in time per
view/transaction<br>
3) Deprecate the thread local var solution in CDOUtil<br>
4) Change the way legacy mode is controlled via the UI (ideas?)<br>
<br>
Martin, what do you think?<br>
<br>
Tim, can you please check if the view that makes problems really has
legacy mode enabled? You can use the Introspector view (Net4j Debug
category) for this purpose:<br>
<br>
<img src="http://www.eclipse.org/forums/index.php?t=getfile&amp;id=6090" alt=""><br>
<br>
<br>
<blockquote cite="mid:j9di3l$ii2$1@news.eclipse.org" type="cite">-
open the ecore model from the created View which now has all
ETypes unset
<br>
</blockquote>
This I couldn't even test for the reasons given above. Let clarify
that first ;-)<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a><br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<br>
<blockquote cite="mid:j9di3l$ii2$1@news.eclipse.org" type="cite">Strangely,
showing the resource in the transaction view now shows the ETypes,
but the View never does.
<br>
<br>
I don't think it has anything to do with Dawn because the View
created by Dawn is also visible in CDO Session View and opening
the resource from there has the same effect.
<br>
<br>
Is there anything I'm doing wrong?
<br>
<br>
Regards,
<br>
Tim
<br>
</blockquote>
</body>
</html>
  • Attachment: fbadbijf.png
    (Size: 17.94KB, Downloaded 165 times)


Re: [CDO] CDOView omits ETypes in Ecore models [message #755944 is a reply to message #755678] Thu, 10 November 2011 09:31 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Sorry for the HTML tags that you can (must) see of my other post in the web forum. The forum software is a mess ;-(

Cheers
/Eike

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



Am 09.11.2011 10:58, schrieb Tim Schaefer:
> Hi,
>
> I just got started with CDO, running v4.0 (Indigo).
> This is my cdo-server.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cdoServer>
> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
> <!-- negotiator type="challenge" description="/temp/users.db"/ -->
> </acceptor>
>
> <repository name="repo">
> <property name="overrideUUID" value=""/>
> <property name="supportingAudits" value="true"/>
> <property name="supportingEcore" value="true"/>
>
> <store type="db">
> <mappingStrategy type="horizontal">
> <property name="qualifiedNames" value="false"/>
> <property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
> <property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
> </mappingStrategy>
> <dbAdapter name="derby-embedded"/>
> <dataSource class="org.apache.derby.jdbc.EmbeddedDataSource"
> databaseName="/temp/cdodb1"
> createDatabase="create"/>
> </store>
> </repository>
> </cdoServer>
>
> As you can see, I enabled "supportingEcore".
> "overrideUUID" is set to "" because I also use CDO Dawn framework.
> Creating/importing an Ecore model (in legacy mode) works, but showing the resource in a CDOView (like Dawn does), all
> ETypes of EStructuralFeatures are gone.
>
> As Frontend I use the Eclipse CDO Explorer perspective.
> These are the steps I do:
> - connect to repository
> - enable legacy mode
> - open transaction
> - create or import a .ecore resource
> - commit transaction (by clicking save)
> - switch to "Dawn Explorer" which automatically creates a new View
> - open the ecore model from the created View which now has all ETypes unset
> Strangely, showing the resource in the transaction view now shows the ETypes, but the View never does.
>
> I don't think it has anything to do with Dawn because the View created by Dawn is also visible in CDO Session View and
> opening the resource from there has the same effect.
>
> Is there anything I'm doing wrong?
>
> Regards,
> Tim


Re: [CDO] CDOView omits ETypes in Ecore models [message #755980 is a reply to message #755944] Thu, 10 November 2011 11:35 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Eike,

legacy mode is enabled for the View in question (see attached screenshot), so the problem must be somewhere else.
  • Attachment: legacy.png
    (Size: 27.43KB, Downloaded 178 times)
Re: [CDO] CDOView omits ETypes in Ecore models [message #756157 is a reply to message #755980] Fri, 11 November 2011 10:06 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
I just found out that it's not a problem of View. Closing the transaction and opening a new one doesn't show the ETypes aswell...
Seems to me that the ETypes are not serialized correctly and the transaction that initially showed the types had them cached or something...
Any ideas?

edit: I found out why the ETypes are not persisted:
The method EMFUtil.isPersistent(EStructuralFeature) is called for every feature of an EObject to be persisted:
public static boolean isPersistent(EStructuralFeature feature)
  {
    if (feature == ECLASS_ESUPER_TYPES || feature == ETYPED_ELEMENT_ETYPE || feature == EOPERATION_EEXCEPTIONS)
    {
      // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
      return false;
    }
    ...
  }

Looks like this was added to solve some other bug.

[Updated on: Fri, 11 November 2011 11:24]

Report message to a moderator

Re: [CDO] CDOView omits ETypes in Ecore models [message #756171 is a reply to message #756157] Fri, 11 November 2011 11:39 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Tim, Eike,

comments below...

> If you open a bugzilla we can try to change:
> 1) Make legacy mode enabled in all views/transactions by default

No, I wouldn't do that. We decided that users must enable legacy to make
them aware of the fact that they are using it. If legacy is always
enabled users could more easily fall into the trap that they did forget
regenerating there objects for CDO.
I think enabling legacy by default would even make our work harder,
because for every problem that occurs in the future we always have to
consider that legacy might be involved (Legacy might lead to side
effects where throw exceptions do not reveal that it is involved).

> 2) Add a setter to disable/enable it at any point in time per
view/transaction

I am also not sure that this is a good idea. At least not if we do not
add some logic to the setter.
For example if a users has legacy enabled and has some resources
containing legacy objects, it wouldn't make sense to disable legacy on
this resource, because he could not make changes to the resource any
more. So, disabling legacy should at least be prohibited if the view
contains legacy objects.


Am 11.11.2011 11:06, schrieb Tim Schaefer:
> I just found out that it's not a problem of View. Closing the
> transaction and opening a new one doesn't show the ETypes aswell...
> Seems to me that the ETypes are not serialized correctly and the
> transaction that initially showed the types had them cached or something...
> Any ideas?

I think the problem occurs when the resource is loaded and the legacy
objects are initalized. It seems that setting the ETypes is somehow
ignored. The database looks good to me. The reference is stored
correctly in the store.

The reason why you see the correct values in the initial transaction is
that when creating an object there, you are working with the legacy
object and all values are set correctly though the UI. All values are
set at the EMF NATIVE object as it would happen without CDO.

Tim, please file a bugzilla, there we can also discuss potential changes
of the way legacy can be enabled/disabled.

Cheers,

Martin
Re: [CDO] CDOView omits ETypes in Ecore models [message #756173 is a reply to message #756171] Fri, 11 November 2011 11:52 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Martin,

you probably wrote the last post while I updated my last one.

The method I mentioned is called to build a list of features to persist in the database.
I debugged parts of the commit procedure and it seemed to me that
ETYPED_ELEMENT_ETYPE is ignored (because of the mentioned method) and thus not stored in the database.
Maybe I'm wrong, but if not, legacy mode is not to blame for this issue.
So, maybe EMFUtil.isPersistent() should be revisited?

Regards,
Tim
Re: [CDO] CDOView omits ETypes in Ecore models [message #756289 is a reply to message #756173] Fri, 11 November 2011 19:26 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Am 11.11.2011 12:52, schrieb Tim Schaefer:
> Hi Martin,
>
> you probably wrote the last post while I updated my last one.

No, I did not see it, because I am using NNTP. It seems that edits done
in the Forum are not reflected in the newsgroup, so I could not see it.

>
> The method I mentioned is called to build a list of features to persist
> in the database.
> I debugged parts of the commit procedure and it seemed to me that
> ETYPED_ELEMENT_ETYPE is ignored (because of the mentioned method) and
> thus not stored in the database.
> Maybe I'm wrong, but if not, legacy mode is not to blame for this issue.
> So, maybe EMFUtil.isPersistent() should be revisited?

You are right, the value is not stored. However, if you set the
reference after the import and save it then, it will be stored
correctly. This was one of the tests I made and that's why I saw the
reference in the database. So it seems that there is something wrong
with the import.

I filed bug 363613 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=363613)

Cheers,

Martin

----
http://www.mftech.org
http://www.mftech.org/blog


>
> Regards,
> Tim
Re: [CDO] CDOView omits ETypes in Ecore models [message #756301 is a reply to message #756289] Fri, 11 November 2011 20:27 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Martin,

Martin Fluegge wrote on Fri, 11 November 2011 20:26

You are right, the value is not stored. However, if you set the
reference after the import and save it then, it will be stored
correctly. This was one of the tests I made and that's why I saw the
reference in the database. So it seems that there is something wrong
with the import.

that doesn't work for me. Confused
It doesn't matter if I import a resource from filesystem or create a new one.
Setting the type (after resource creation) in the CDOEditor and saving does not store it in the database either.
I think your suspicion the import functionality is making the trouble is wrong.

Regards,
Tim
Re: [CDO] CDOView omits ETypes in Ecore models [message #756330 is a reply to message #756171] Sat, 12 November 2011 06:01 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 11.11.2011 12:39, schrieb Martin Flügge:
> Hi Tim, Eike,
>
> comments below...
>
>> If you open a bugzilla we can try to change:
>> 1) Make legacy mode enabled in all views/transactions by default
> No, I wouldn't do that. We decided that users must enable legacy to make
> them aware of the fact that they are using it. If legacy is always
> enabled users could more easily fall into the trap that they did forget
> regenerating there objects for CDO.
> I think enabling legacy by default would even make our work harder,
> because for every problem that occurs in the future we always have to
> consider that legacy might be involved (Legacy might lead to side
> effects where throw exceptions do not reveal that it is involved).
Okay, I agree. Just yesterday it happened to me that I accidentally deployed a wrong model and I was happy to get a
LegacyModeNotEnabledException ;-)

>
>> 2) Add a setter to disable/enable it at any point in time per
> view/transaction
>
> I am also not sure that this is a good idea. At least not if we do not
> add some logic to the setter.
> For example if a users has legacy enabled and has some resources
> containing legacy objects, it wouldn't make sense to disable legacy on
> this resource, because he could not make changes to the resource any
> more. So, disabling legacy should at least be prohibited if the view
> contains legacy objects.
We can add this sanity check but we should definitely get rid of this thread local variable approach as it's just too
hard to get right in UIs or other multi-threaded scenarios. I've submitted this bug:

363637: Remove thread dependencies from legacy mode control
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363637

Cheers
/Eike

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


Re: [CDO] CDOView omits ETypes in Ecore models [message #756448 is a reply to message #756330] Sun, 13 November 2011 13:15 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Martin, Eike,

please have a short look at the attached test case.
It shows that the ETypes are missing although legacy mode is enabled and the resource is created (and not imported from filesystem).

May I open a bugzilla on this?


Regards,
Tim
Re: [CDO] CDOView omits ETypes in Ecore models [message #756465 is a reply to message #756448] Sun, 13 November 2011 17:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 13.11.2011 14:15, schrieb Tim Schaefer:
> Hi Martin, Eike,
>
> please have a short look at the attached test case.
> It shows that the ETypes are missing although legacy mode is enabled and the resource is created (and not imported from filesystem).
>
> May I open a bugzilla on this?
Yes, please file a bugzilla. I'll be with a customer the entire next week but maybe Martin has some spare time to look
at it ;-)

Cheers
/Eike

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


Re: [CDO] CDOView omits ETypes in Ecore models [message #756473 is a reply to message #756465] Sun, 13 November 2011 19:42 Go to previous message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Ok, I filed bug 363661 https://bugs.eclipse.org/bugs/show_bug.cgi?id=363661
Bug 363613 should be closed I think.

Looking forward to the fix Smile

Thank you so far

Regards,
Tim

[Updated on: Sun, 13 November 2011 19:43]

Report message to a moderator

Previous Topic:EMF Generator Model not displayed - ??
Next Topic:Class-scope operations
Goto Forum:
  


Current Time: Fri Apr 26 12:26:55 GMT 2024

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

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

Back to the top