Home » Modeling » EMF » [CDO] Transient references and views
|
Re: [CDO] Transient references and views [message #489468 is a reply to message #489464] |
Sat, 03 October 2009 15:33 |
|
This is a multi-part message in MIME format.
--------------020208050804070605000404
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hi Anders,
Setting a transient feature should also be possible in a read-only view,
because of this code from CDOObjectImpl:
| @Override
*public **void *dynamicSet(*int *dynamicFeatureID, Object value)
{
EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID);
*if *(eStructuralFeature.isTransient())
{
eSettings[dynamicFeatureID] = value;
}
*else*
{
eStore().set(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX, value);
*if *(eIsCaching())
{
eSettings[dynamicFeatureID] = value;
}
}
}|
Or are you talking about TRANSIENT objects?
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Anders Forsell schrieb:
> Hello,
>
> I have an application which currently can work "standalone" or
> connected to a CDO repository.
>
> When the application is in "standalone" mode it uses the CDO enabled
> generated model but without connecting to a repository (using XMI
> resources in the ResourceSet).
>
> To make use of CDO transactions to solve threading problems in
> standalone mode I am thinking of using a CDO memory repository with a
> JVM connection (to the same application process).
>
> In the CDO "Gastro" example a nice pattern is used where a read-only
> global view is accessible from the application. Changes to the model
> is done by opening short-lived transactions that are committed and
> closed when done.
>
> A problem to use this approach for us is that we have many transient
> references in our model, and as far as I understand the CDO view will
> always have null values for these (I cannot set them because the view
> is read-only). Thus, it seems I have to come with another way of
> referencing these objects so that they are accessible from the view
> (GUI elements).
>
> Did I understand this correct?
>
> ---
> Anders
>
--------------020208050804070605000404
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Anders,<br>
<br>
Setting a transient feature should also be possible in a read-only
view, because of this code from CDOObjectImpl:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff"> </font><font
color="#646464">@Override</font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>public </b></font><font
color="#7f0055"><b>void </b></font><font color="#000000">dynamicSet</font><font
color="#000000">(</font><font color="#7f0055"><b>int </b></font><font
color="#000000">dynamicFeatureID, Object value </font><font
color="#000000">)</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#000000"> EStructuralFeature eStructuralFeature =&am p;nbsp;eDynamicFeature </font><font
color="#000000">(</font><font color="#000000">dynamicFeatureID</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>if </b></font><font
color="#000000">(</font><font color="#000000">eStructuralFeature.isTransient</font><font
color="#000000">())</font><br>
<font color="#ffffff"> </font ><font color="#000000">{</font><br>
<font color="#ffffff"> </font><font color="#000000">eSettings</font><font
color="#000000">[</font><font color="#000000">dynamicFeatureID</font><font
color="#000000">] </font><font color="#000000">= value;</font><br>
<font color="#ffffff"> </font ><font color="#000000">}</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>else</b></font><br>
<font color="#ffffff"> </font ><font color="#000000">{</font><br>
<font color="#ffffff"> </font><font color="#000000">eStore</font><font
color="#000000">()</font><font color="#000000">.set</font><font
color="#000000">(</font><font color="#000000"> this, eStructuralFeature, InternalEObject. EStore.NO_INDEX, value </font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>if </b></font><font
color="#000000">(</font><font color="#000000">eIsCaching</font><font
color="#000000">())</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font><font color="#000000">eSettings</font><font
color="#000000">[</font><font color="#000000">dynamicFeatureID</font><font
color="#000000">] </font><font color="#000000">= value;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"> </font ><font color="#000000">}</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --><br>
Or are you talking about TRANSIENT objects?<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<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>
Anders Forsell schrieb:
<blockquote cite="mid:ha7i0r$9hm$1@build.eclipse.org" type="cite">Hello,
<br>
<br>
I have an application which currently can work "standalone" or
connected to a CDO repository.
<br>
<br>
When the application is in "standalone" mode it uses the CDO enabled
generated model but without connecting to a repository (using XMI
resources in the ResourceSet).
<br>
<br>
To make use of CDO transactions to solve threading problems in
standalone mode I am thinking of using a CDO memory repository with a
JVM connection (to the same application process).
<br>
<br>
In the CDO "Gastro" example a nice pattern is used where a read-only
global view is accessible from the application. Changes to the model is
done by opening short-lived transactions that are committed and closed
when done.
<br>
<br>
A problem to use this approach for us is that we have many transient
references in our model, and as far as I understand the CDO view will
always have null values for these (I cannot set them because the view
is read-only). Thus, it seems I have to come with another way of
referencing these objects so that they are accessible from the view
(GUI elements).
<br>
<br>
Did I understand this correct?
<br>
<br>
---
<br>
Anders
<br>
<br>
</blockquote>
</body>
</html>
--------------020208050804070605000404--
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Transient references and views [message #489470 is a reply to message #489468] |
Sat, 03 October 2009 15:39 |
Anders Forsell Messages: 127 Registered: July 2009 |
Senior Member |
|
|
Thanks Eike,
I thought I tried it but it must have been for a non-transient feature.
Then I just need to come up with a pattern of delegating the
non-transient feature getter/setter to always use the global view
instead of the transaction.
---
Anders
Eike Stepper wrote:
> Hi Anders,
>
> Setting a transient feature should also be possible in a read-only view,
> because of this code from CDOObjectImpl:
>
> | @Override
> *public **void *dynamicSet(*int *dynamicFeatureID, Object value)
> {
> EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID);
> *if *(eStructuralFeature.isTransient())
> {
> eSettings[dynamicFeatureID] = value;
> }
> *else*
> {
> eStore().set(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX, value);
> *if *(eIsCaching())
> {
> eSettings[dynamicFeatureID] = value;
> }
> }
> }|
>
>
> Or are you talking about TRANSIENT objects?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Anders Forsell schrieb:
>> Hello,
>>
>> I have an application which currently can work "standalone" or
>> connected to a CDO repository.
>>
>> When the application is in "standalone" mode it uses the CDO enabled
>> generated model but without connecting to a repository (using XMI
>> resources in the ResourceSet).
>>
>> To make use of CDO transactions to solve threading problems in
>> standalone mode I am thinking of using a CDO memory repository with a
>> JVM connection (to the same application process).
>>
>> In the CDO "Gastro" example a nice pattern is used where a read-only
>> global view is accessible from the application. Changes to the model
>> is done by opening short-lived transactions that are committed and
>> closed when done.
>>
>> A problem to use this approach for us is that we have many transient
>> references in our model, and as far as I understand the CDO view will
>> always have null values for these (I cannot set them because the view
>> is read-only). Thus, it seems I have to come with another way of
>> referencing these objects so that they are accessible from the view
>> (GUI elements).
>>
>> Did I understand this correct?
>>
>> ---
>> Anders
>>
|
|
|
Re: [CDO] Transient references and views [message #489473 is a reply to message #489470] |
Sat, 03 October 2009 15:56 |
|
Anders Forsell schrieb:
> Thanks Eike,
>
> I thought I tried it but it must have been for a non-transient feature.
Well, the code snippet does not cover modification of many-valued
features. Maybe you can demonstrate the behaviour in a test case?
>
> Then I just need to come up with a pattern of delegating the
> non-transient feature getter/setter to always use the global view
> instead of the transaction.
That sounds strange. I still wonder why a view/transaction is related to
this at all. Are you talking about TRANSIENT objects?
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> ---
> Anders
>
>
>
> Eike Stepper wrote:
>> Hi Anders,
>>
>> Setting a transient feature should also be possible in a read-only
>> view, because of this code from CDOObjectImpl:
>>
>> | @Override
>> *public **void *dynamicSet(*int *dynamicFeatureID, Object value)
>> {
>> EStructuralFeature eStructuralFeature =
>> eDynamicFeature(dynamicFeatureID);
>> *if *(eStructuralFeature.isTransient())
>> {
>> eSettings[dynamicFeatureID] = value;
>> }
>> *else*
>> {
>> eStore().set(this, eStructuralFeature,
>> InternalEObject.EStore.NO_INDEX, value);
>> *if *(eIsCaching())
>> {
>> eSettings[dynamicFeatureID] = value;
>> }
>> }
>> }|
>>
>>
>> Or are you talking about TRANSIENT objects?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Anders Forsell schrieb:
>>> Hello,
>>>
>>> I have an application which currently can work "standalone" or
>>> connected to a CDO repository.
>>>
>>> When the application is in "standalone" mode it uses the CDO enabled
>>> generated model but without connecting to a repository (using XMI
>>> resources in the ResourceSet).
>>>
>>> To make use of CDO transactions to solve threading problems in
>>> standalone mode I am thinking of using a CDO memory repository with
>>> a JVM connection (to the same application process).
>>>
>>> In the CDO "Gastro" example a nice pattern is used where a read-only
>>> global view is accessible from the application. Changes to the model
>>> is done by opening short-lived transactions that are committed and
>>> closed when done.
>>>
>>> A problem to use this approach for us is that we have many transient
>>> references in our model, and as far as I understand the CDO view
>>> will always have null values for these (I cannot set them because
>>> the view is read-only). Thus, it seems I have to come with another
>>> way of referencing these objects so that they are accessible from
>>> the view (GUI elements).
>>>
>>> Did I understand this correct?
>>>
>>> ---
>>> Anders
>>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Transient references and views [message #489474 is a reply to message #489473] |
Sat, 03 October 2009 17:17 |
Anders Forsell Messages: 127 Registered: July 2009 |
Senior Member |
|
|
Eike Stepper wrote:
> Anders Forsell schrieb:
>> Thanks Eike,
>>
>> I thought I tried it but it must have been for a non-transient feature.
> Well, the code snippet does not cover modification of many-valued
> features. Maybe you can demonstrate the behaviour in a test case?
I'll do some more tests to see if it is possible or not, but at least it
seems like you have thought about it in the code snippet.
>
>> Then I just need to come up with a pattern of delegating the
>> non-transient feature getter/setter to always use the global view
>> instead of the transaction.
> That sounds strange. I still wonder why a view/transaction is related to
> this at all. Are you talking about TRANSIENT objects?
Sorry, my mistake in not thinking clear. Of course, I have to transfer
the value of the transient features from the transaction at commit time
to the global view.
If it is possible to set transient features on the view, in my setup
it's a matter of reading the transient features values from the
transaction and setting the corresponding on the view (since I'm within
the same process). I'll have to come up with a way of doing this
generically, otherwise I believe I cannot easily utilize the global view
pattern.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>> ---
>> Anders
>>
>>
>>
>> Eike Stepper wrote:
>>> Hi Anders,
>>>
>>> Setting a transient feature should also be possible in a read-only
>>> view, because of this code from CDOObjectImpl:
>>>
>>> | @Override
>>> *public **void *dynamicSet(*int *dynamicFeatureID, Object value)
>>> {
>>> EStructuralFeature eStructuralFeature =
>>> eDynamicFeature(dynamicFeatureID);
>>> *if *(eStructuralFeature.isTransient())
>>> {
>>> eSettings[dynamicFeatureID] = value;
>>> }
>>> *else*
>>> {
>>> eStore().set(this, eStructuralFeature,
>>> InternalEObject.EStore.NO_INDEX, value);
>>> *if *(eIsCaching())
>>> {
>>> eSettings[dynamicFeatureID] = value;
>>> }
>>> }
>>> }|
>>>
>>>
>>> Or are you talking about TRANSIENT objects?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Anders Forsell schrieb:
>>>> Hello,
>>>>
>>>> I have an application which currently can work "standalone" or
>>>> connected to a CDO repository.
>>>>
>>>> When the application is in "standalone" mode it uses the CDO enabled
>>>> generated model but without connecting to a repository (using XMI
>>>> resources in the ResourceSet).
>>>>
>>>> To make use of CDO transactions to solve threading problems in
>>>> standalone mode I am thinking of using a CDO memory repository with
>>>> a JVM connection (to the same application process).
>>>>
>>>> In the CDO "Gastro" example a nice pattern is used where a read-only
>>>> global view is accessible from the application. Changes to the model
>>>> is done by opening short-lived transactions that are committed and
>>>> closed when done.
>>>>
>>>> A problem to use this approach for us is that we have many transient
>>>> references in our model, and as far as I understand the CDO view
>>>> will always have null values for these (I cannot set them because
>>>> the view is read-only). Thus, it seems I have to come with another
>>>> way of referencing these objects so that they are accessible from
>>>> the view (GUI elements).
>>>>
>>>> Did I understand this correct?
>>>>
>>>> ---
>>>> Anders
>>>>
|
|
| | | | |
Goto Forum:
Current Time: Sun Apr 28 03:00:45 GMT 2024
Powered by FUDForum. Page generated in 0.03062 seconds
|