Home » Modeling » EMF » CDO Notification problems
|
Re: CDO Notification problems [message #426537 is a reply to message #426536] |
Mon, 12 January 2009 16:58 |
Simon Mc Duff Messages: 596 Registered: July 2009 |
Senior Member |
|
|
Hi Marc,
About the CDOSessionInvalidationEvent problems. CDOSession doesn't have
any EObject attach to it. So it is normal that you cannot refresh your
view after receiving an event from it.
If you want to refresh your viewer when EObject are modified you should
add and adapter to the view and you should receieve the following:
CDOViewInvalidationEvent.
About the other problem, can you create a bugzilla ? I will look at it
as soon as possible.
Simon
Marc Gendron wrote:
> Hi all,
>
> I have two problems with notifications/events in CDO. For both of problem I
> use this model:
> class A
> List of C
>
> class B extends A
> List of D
>
> class C
>
> class D
>
>
> The first problem is when I add a D object in the list of a B object and I
> commit on my Client1, I get the wrong feature in the notification object on
> my Client 2 . When I get a Add notification and I use the method
> getFeature(), I receive feature that represent the list of C of the class A.
>
> In second, I register a Listener on the CDOSession object. When I receive a
> CDOSessionInvalidationEvent, the model has not yet been changed. I use this
> event to refresh my TreeViewers. In consequence, the model is not refresh in
> the TreeViewer.
>
>
> This is the code that initiat the CDO transaction for both problems :
>
> //////////////////////////////////////////
>
> private void connect() {
> OMPlatform.INSTANCE.setDebugging(true);
> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>
> IManagedContainer container = ContainerUtil.createContainer();
> Net4jUtil.prepareContainer(container);
> TCPUtil.prepareContainer(container);
> CDOUtil.prepareContainer(container);
> container.activate();
>
> cdoConnector = TCPUtil.getConnector(container, serverName + ":"
> + String.valueOf(serverPort));
>
> cdoConnector.connect(10000);
>
> CDOSessionConfiguration configuration = CDOUtil
> .createSessionConfiguration();
> configuration.setConnector(cdoConnector);
> configuration.setRepositoryName(repositoryName);
> configuration.setEagerPackageRegistry();
>
> cdoSession = configuration.openSession();
>
> cdoTransaction = cdoSession.openTransaction();
>
> cdoTransaction.options().addChangeSubscriptionPolicy(
> CDOAdapterPolicy.ALL);
>
> cdoResource = cdoTransaction.getOrCreateResource(resourceName);
>
> cdoSession.addListener(getListener());
>
> private Listener listener;
> }
> private Listener getListener() {
> if (listener == null)
> listener = new Listener();
> return listener;
> }
>
> private class Listener implements IListener {
> @Override
> public void notifyEvent(IEvent event) {
> if (event instanceof CDOSessionInvalidationEvent) {
> Iterator<CDOIDAndVersion> iId = ((CDOSessionInvalidationEvent) event)
> .getDirtyOIDs().iterator();
> final List<Object> lst = new ArrayList<Object>();
> while (iId.hasNext()) {
> CDOIDAndVersion id = iId.next();
> CDOObject object = cdoTransaction.getObject(id.getID());
> lst.add(object);
> }
> Runnable runnable = new Runnable() {
> @Override
> public void run() {
> getSite().getSelectionProvider().setSelection(
> new InvalidationSelection(lst));
> }
> };
> Display.getDefault().syncExec(runnable);
> }
> }
> }
> //////////////////////////
>
> Thanks in adavance,
>
> Marc
>
>
|
|
|
Re: CDO Notification problems [message #426538 is a reply to message #426537] |
Mon, 12 January 2009 17:02 |
Simon Mc Duff Messages: 596 Registered: July 2009 |
Senior Member |
|
|
I look quickly.. and we already add testcases for that specific case.
It will be nice if you could attach the .ecore .. so it could be faster
to debug!
Thank you
Simon
Simon McDuff wrote:
>
> Hi Marc,
>
> About the CDOSessionInvalidationEvent problems. CDOSession doesn't have
> any EObject attach to it. So it is normal that you cannot refresh your
> view after receiving an event from it.
>
> If you want to refresh your viewer when EObject are modified you should
> add and adapter to the view and you should receieve the following:
> CDOViewInvalidationEvent.
>
>
> About the other problem, can you create a bugzilla ? I will look at it
> as soon as possible.
>
>
> Simon
>
>
>
> Marc Gendron wrote:
>> Hi all,
>>
>> I have two problems with notifications/events in CDO. For both of
>> problem I
>> use this model:
>> class A
>> List of C
>>
>> class B extends A
>> List of D
>>
>> class C
>>
>> class D
>>
>>
>> The first problem is when I add a D object in the list of a B object
>> and I
>> commit on my Client1, I get the wrong feature in the notification
>> object on
>> my Client 2 . When I get a Add notification and I use the method
>> getFeature(), I receive feature that represent the list of C of the
>> class A.
>>
>> In second, I register a Listener on the CDOSession object. When I
>> receive a
>> CDOSessionInvalidationEvent, the model has not yet been changed. I use
>> this
>> event to refresh my TreeViewers. In consequence, the model is not
>> refresh in
>> the TreeViewer.
>>
>>
>> This is the code that initiat the CDO transaction for both problems :
>>
>> //////////////////////////////////////////
>>
>> private void connect() {
>> OMPlatform.INSTANCE.setDebugging(true);
>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>
>> IManagedContainer container = ContainerUtil.createContainer();
>> Net4jUtil.prepareContainer(container);
>> TCPUtil.prepareContainer(container);
>> CDOUtil.prepareContainer(container);
>> container.activate();
>>
>> cdoConnector = TCPUtil.getConnector(container, serverName + ":"
>> + String.valueOf(serverPort));
>>
>> cdoConnector.connect(10000);
>>
>> CDOSessionConfiguration configuration = CDOUtil
>> .createSessionConfiguration();
>> configuration.setConnector(cdoConnector);
>> configuration.setRepositoryName(repositoryName);
>> configuration.setEagerPackageRegistry();
>>
>> cdoSession = configuration.openSession();
>>
>> cdoTransaction = cdoSession.openTransaction();
>>
>> cdoTransaction.options().addChangeSubscriptionPolicy(
>> CDOAdapterPolicy.ALL);
>>
>> cdoResource = cdoTransaction.getOrCreateResource(resourceName);
>>
>> cdoSession.addListener(getListener());
>>
>> private Listener listener;
>> }
>> private Listener getListener() {
>> if (listener == null)
>> listener = new Listener();
>> return listener;
>> }
>>
>> private class Listener implements IListener {
>> @Override
>> public void notifyEvent(IEvent event) {
>> if (event instanceof CDOSessionInvalidationEvent) {
>> Iterator<CDOIDAndVersion> iId = ((CDOSessionInvalidationEvent) event)
>> .getDirtyOIDs().iterator();
>> final List<Object> lst = new ArrayList<Object>();
>> while (iId.hasNext()) {
>> CDOIDAndVersion id = iId.next();
>> CDOObject object = cdoTransaction.getObject(id.getID());
>> lst.add(object);
>> }
>> Runnable runnable = new Runnable() {
>> @Override
>> public void run() {
>> getSite().getSelectionProvider().setSelection(
>> new InvalidationSelection(lst));
>> }
>> };
>> Display.getDefault().syncExec(runnable);
>> }
>> }
>> }
>> //////////////////////////
>>
>> Thanks in adavance,
>>
>> Marc
>>
>>
|
|
|
Re: CDO Notification problems [message #426540 is a reply to message #426538] |
Mon, 12 January 2009 17:44 |
Marc Gendron Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Hi Simon,
Thank you for your help. The CDOViewInvalidationEvent work just fine.
I'm not use to work with your development environment. I'm not sure were
exactly you want that I attached me ecore file. Is it on buzilla? If yes
what, is the Id of the bug you want that I attach my files?
Again, Thank you.
Marc
"Simon McDuff" <smcduff@hotmail.com> wrote in message
news:gkft7f$3d3$1@build.eclipse.org...
> I look quickly.. and we already add testcases for that specific case.
>
> It will be nice if you could attach the .ecore .. so it could be faster
> to debug!
>
> Thank you
>
> Simon
>
>
> Simon McDuff wrote:
> >
> > Hi Marc,
> >
> > About the CDOSessionInvalidationEvent problems. CDOSession doesn't have
> > any EObject attach to it. So it is normal that you cannot refresh your
> > view after receiving an event from it.
> >
> > If you want to refresh your viewer when EObject are modified you should
> > add and adapter to the view and you should receieve the following:
> > CDOViewInvalidationEvent.
> >
> >
> > About the other problem, can you create a bugzilla ? I will look at it
> > as soon as possible.
> >
> >
> > Simon
> >
> >
> >
> > Marc Gendron wrote:
> >> Hi all,
> >>
> >> I have two problems with notifications/events in CDO. For both of
> >> problem I
> >> use this model:
> >> class A
> >> List of C
> >>
> >> class B extends A
> >> List of D
> >>
> >> class C
> >>
> >> class D
> >>
> >>
> >> The first problem is when I add a D object in the list of a B object
> >> and I
> >> commit on my Client1, I get the wrong feature in the notification
> >> object on
> >> my Client 2 . When I get a Add notification and I use the method
> >> getFeature(), I receive feature that represent the list of C of the
> >> class A.
> >>
> >> In second, I register a Listener on the CDOSession object. When I
> >> receive a
> >> CDOSessionInvalidationEvent, the model has not yet been changed. I use
> >> this
> >> event to refresh my TreeViewers. In consequence, the model is not
> >> refresh in
> >> the TreeViewer.
> >>
> >>
> >> This is the code that initiat the CDO transaction for both problems :
> >>
> >> //////////////////////////////////////////
> >>
> >> private void connect() {
> >> OMPlatform.INSTANCE.setDebugging(true);
> >> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> >> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
> >>
> >> IManagedContainer container = ContainerUtil.createContainer();
> >> Net4jUtil.prepareContainer(container);
> >> TCPUtil.prepareContainer(container);
> >> CDOUtil.prepareContainer(container);
> >> container.activate();
> >>
> >> cdoConnector = TCPUtil.getConnector(container, serverName + ":"
> >> + String.valueOf(serverPort));
> >>
> >> cdoConnector.connect(10000);
> >>
> >> CDOSessionConfiguration configuration = CDOUtil
> >> .createSessionConfiguration();
> >> configuration.setConnector(cdoConnector);
> >> configuration.setRepositoryName(repositoryName);
> >> configuration.setEagerPackageRegistry();
> >>
> >> cdoSession = configuration.openSession();
> >>
> >> cdoTransaction = cdoSession.openTransaction();
> >>
> >> cdoTransaction.options().addChangeSubscriptionPolicy(
> >> CDOAdapterPolicy.ALL);
> >>
> >> cdoResource = cdoTransaction.getOrCreateResource(resourceName);
> >>
> >> cdoSession.addListener(getListener());
> >>
> >> private Listener listener;
> >> }
> >> private Listener getListener() {
> >> if (listener == null)
> >> listener = new Listener();
> >> return listener;
> >> }
> >>
> >> private class Listener implements IListener {
> >> @Override
> >> public void notifyEvent(IEvent event) {
> >> if (event instanceof CDOSessionInvalidationEvent) {
> >> Iterator<CDOIDAndVersion> iId = ((CDOSessionInvalidationEvent)
event)
> >> .getDirtyOIDs().iterator();
> >> final List<Object> lst = new ArrayList<Object>();
> >> while (iId.hasNext()) {
> >> CDOIDAndVersion id = iId.next();
> >> CDOObject object = cdoTransaction.getObject(id.getID());
> >> lst.add(object);
> >> }
> >> Runnable runnable = new Runnable() {
> >> @Override
> >> public void run() {
> >> getSite().getSelectionProvider().setSelection(
> >> new InvalidationSelection(lst));
> >> }
> >> };
> >> Display.getDefault().syncExec(runnable);
> >> }
> >> }
> >> }
> >> //////////////////////////
> >>
> >> Thanks in adavance,
> >>
> >> Marc
> >>
> >>
|
|
|
Re: CDO Notification problems [message #426541 is a reply to message #426540] |
Mon, 12 January 2009 17:44 |
Simon Mc Duff Messages: 596 Registered: July 2009 |
Senior Member |
|
|
Marc Gendron wrote:
> Hi Simon,
>
> Thank you for your help. The CDOViewInvalidationEvent work just fine.
>
Perfect!
> I'm not use to work with your development environment. I'm not sure were
> exactly you want that I attached me ecore file. Is it on buzilla? If yes
> what, is the Id of the bug you want that I attach my files?
>
Yes please open a new bugzilla. The id is unknown.. until you create a
new one :-)
> Again, Thank you.
>
> Marc
>
> "Simon McDuff" <smcduff@hotmail.com> wrote in message
> news:gkft7f$3d3$1@build.eclipse.org...
>> I look quickly.. and we already add testcases for that specific case.
>>
>> It will be nice if you could attach the .ecore .. so it could be faster
>> to debug!
>>
>> Thank you
>>
>> Simon
>>
>>
>> Simon McDuff wrote:
>>> Hi Marc,
>>>
>>> About the CDOSessionInvalidationEvent problems. CDOSession doesn't have
>>> any EObject attach to it. So it is normal that you cannot refresh your
>>> view after receiving an event from it.
>>>
>>> If you want to refresh your viewer when EObject are modified you should
>>> add and adapter to the view and you should receieve the following:
>>> CDOViewInvalidationEvent.
>>>
>>>
>>> About the other problem, can you create a bugzilla ? I will look at it
>>> as soon as possible.
>>>
>>>
>>> Simon
>>>
>>>
>>>
>>> Marc Gendron wrote:
>>>> Hi all,
>>>>
>>>> I have two problems with notifications/events in CDO. For both of
>>>> problem I
>>>> use this model:
>>>> class A
>>>> List of C
>>>>
>>>> class B extends A
>>>> List of D
>>>>
>>>> class C
>>>>
>>>> class D
>>>>
>>>>
>>>> The first problem is when I add a D object in the list of a B object
>>>> and I
>>>> commit on my Client1, I get the wrong feature in the notification
>>>> object on
>>>> my Client 2 . When I get a Add notification and I use the method
>>>> getFeature(), I receive feature that represent the list of C of the
>>>> class A.
>>>>
>>>> In second, I register a Listener on the CDOSession object. When I
>>>> receive a
>>>> CDOSessionInvalidationEvent, the model has not yet been changed. I use
>>>> this
>>>> event to refresh my TreeViewers. In consequence, the model is not
>>>> refresh in
>>>> the TreeViewer.
>>>>
>>>>
>>>> This is the code that initiat the CDO transaction for both problems :
>>>>
>>>> //////////////////////////////////////////
>>>>
>>>> private void connect() {
>>>> OMPlatform.INSTANCE.setDebugging(true);
>>>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>>>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>>>
>>>> IManagedContainer container = ContainerUtil.createContainer();
>>>> Net4jUtil.prepareContainer(container);
>>>> TCPUtil.prepareContainer(container);
>>>> CDOUtil.prepareContainer(container);
>>>> container.activate();
>>>>
>>>> cdoConnector = TCPUtil.getConnector(container, serverName + ":"
>>>> + String.valueOf(serverPort));
>>>>
>>>> cdoConnector.connect(10000);
>>>>
>>>> CDOSessionConfiguration configuration = CDOUtil
>>>> .createSessionConfiguration();
>>>> configuration.setConnector(cdoConnector);
>>>> configuration.setRepositoryName(repositoryName);
>>>> configuration.setEagerPackageRegistry();
>>>>
>>>> cdoSession = configuration.openSession();
>>>>
>>>> cdoTransaction = cdoSession.openTransaction();
>>>>
>>>> cdoTransaction.options().addChangeSubscriptionPolicy(
>>>> CDOAdapterPolicy.ALL);
>>>>
>>>> cdoResource = cdoTransaction.getOrCreateResource(resourceName);
>>>>
>>>> cdoSession.addListener(getListener());
>>>>
>>>> private Listener listener;
>>>> }
>>>> private Listener getListener() {
>>>> if (listener == null)
>>>> listener = new Listener();
>>>> return listener;
>>>> }
>>>>
>>>> private class Listener implements IListener {
>>>> @Override
>>>> public void notifyEvent(IEvent event) {
>>>> if (event instanceof CDOSessionInvalidationEvent) {
>>>> Iterator<CDOIDAndVersion> iId = ((CDOSessionInvalidationEvent)
> event)
>>>> .getDirtyOIDs().iterator();
>>>> final List<Object> lst = new ArrayList<Object>();
>>>> while (iId.hasNext()) {
>>>> CDOIDAndVersion id = iId.next();
>>>> CDOObject object = cdoTransaction.getObject(id.getID());
>>>> lst.add(object);
>>>> }
>>>> Runnable runnable = new Runnable() {
>>>> @Override
>>>> public void run() {
>>>> getSite().getSelectionProvider().setSelection(
>>>> new InvalidationSelection(lst));
>>>> }
>>>> };
>>>> Display.getDefault().syncExec(runnable);
>>>> }
>>>> }
>>>> }
>>>> //////////////////////////
>>>>
>>>> Thanks in adavance,
>>>>
>>>> Marc
>>>>
>>>>
>
>
|
|
|
Re: CDO Notification problems [message #426543 is a reply to message #426541] |
Mon, 12 January 2009 19:12 |
Marc Gendron Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Hi Simon,
I tried to reproduce the bug with a more simple model. It appears to be only
when we have multiple super types.
This is the bug link : https://bugs.eclipse.org/bugs/show_bug.cgi?id=260764
If you have any questions, ask me.
Thank you
Marc
"Simon McDuff" <smcduff@hotmail.com> wrote in message
news:gkfvlt$dm0$1@build.eclipse.org...
>
>
>
>
> Marc Gendron wrote:
> > Hi Simon,
> >
> > Thank you for your help. The CDOViewInvalidationEvent work just fine.
> >
>
> Perfect!
>
> > I'm not use to work with your development environment. I'm not sure were
> > exactly you want that I attached me ecore file. Is it on buzilla? If yes
> > what, is the Id of the bug you want that I attach my files?
> >
>
> Yes please open a new bugzilla. The id is unknown.. until you create a
> new one :-)
>
> > Again, Thank you.
> >
> > Marc
> >
> > "Simon McDuff" <smcduff@hotmail.com> wrote in message
> > news:gkft7f$3d3$1@build.eclipse.org...
> >> I look quickly.. and we already add testcases for that specific case.
> >>
> >> It will be nice if you could attach the .ecore .. so it could be faster
> >> to debug!
> >>
> >> Thank you
> >>
> >> Simon
> >>
> >>
> >> Simon McDuff wrote:
> >>> Hi Marc,
> >>>
> >>> About the CDOSessionInvalidationEvent problems. CDOSession doesn't
have
> >>> any EObject attach to it. So it is normal that you cannot refresh your
> >>> view after receiving an event from it.
> >>>
> >>> If you want to refresh your viewer when EObject are modified you
should
> >>> add and adapter to the view and you should receieve the following:
> >>> CDOViewInvalidationEvent.
> >>>
> >>>
> >>> About the other problem, can you create a bugzilla ? I will look at it
> >>> as soon as possible.
> >>>
> >>>
> >>> Simon
> >>>
> >>>
> >>>
> >>> Marc Gendron wrote:
> >>>> Hi all,
> >>>>
> >>>> I have two problems with notifications/events in CDO. For both of
> >>>> problem I
> >>>> use this model:
> >>>> class A
> >>>> List of C
> >>>>
> >>>> class B extends A
> >>>> List of D
> >>>>
> >>>> class C
> >>>>
> >>>> class D
> >>>>
> >>>>
> >>>> The first problem is when I add a D object in the list of a B object
> >>>> and I
> >>>> commit on my Client1, I get the wrong feature in the notification
> >>>> object on
> >>>> my Client 2 . When I get a Add notification and I use the method
> >>>> getFeature(), I receive feature that represent the list of C of the
> >>>> class A.
> >>>>
> >>>> In second, I register a Listener on the CDOSession object. When I
> >>>> receive a
> >>>> CDOSessionInvalidationEvent, the model has not yet been changed. I
use
> >>>> this
> >>>> event to refresh my TreeViewers. In consequence, the model is not
> >>>> refresh in
> >>>> the TreeViewer.
> >>>>
> >>>>
> >>>> This is the code that initiat the CDO transaction for both problems :
> >>>>
> >>>> //////////////////////////////////////////
> >>>>
> >>>> private void connect() {
> >>>> OMPlatform.INSTANCE.setDebugging(true);
> >>>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> >>>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
> >>>>
> >>>> IManagedContainer container = ContainerUtil.createContainer();
> >>>> Net4jUtil.prepareContainer(container);
> >>>> TCPUtil.prepareContainer(container);
> >>>> CDOUtil.prepareContainer(container);
> >>>> container.activate();
> >>>>
> >>>> cdoConnector = TCPUtil.getConnector(container, serverName + ":"
> >>>> + String.valueOf(serverPort));
> >>>>
> >>>> cdoConnector.connect(10000);
> >>>>
> >>>> CDOSessionConfiguration configuration = CDOUtil
> >>>> .createSessionConfiguration();
> >>>> configuration.setConnector(cdoConnector);
> >>>> configuration.setRepositoryName(repositoryName);
> >>>> configuration.setEagerPackageRegistry();
> >>>>
> >>>> cdoSession = configuration.openSession();
> >>>>
> >>>> cdoTransaction = cdoSession.openTransaction();
> >>>>
> >>>> cdoTransaction.options().addChangeSubscriptionPolicy(
> >>>> CDOAdapterPolicy.ALL);
> >>>>
> >>>> cdoResource = cdoTransaction.getOrCreateResource(resourceName);
> >>>>
> >>>> cdoSession.addListener(getListener());
> >>>>
> >>>> private Listener listener;
> >>>> }
> >>>> private Listener getListener() {
> >>>> if (listener == null)
> >>>> listener = new Listener();
> >>>> return listener;
> >>>> }
> >>>>
> >>>> private class Listener implements IListener {
> >>>> @Override
> >>>> public void notifyEvent(IEvent event) {
> >>>> if (event instanceof CDOSessionInvalidationEvent) {
> >>>> Iterator<CDOIDAndVersion> iId = ((CDOSessionInvalidationEvent)
> > event)
> >>>> .getDirtyOIDs().iterator();
> >>>> final List<Object> lst = new ArrayList<Object>();
> >>>> while (iId.hasNext()) {
> >>>> CDOIDAndVersion id = iId.next();
> >>>> CDOObject object = cdoTransaction.getObject(id.getID());
> >>>> lst.add(object);
> >>>> }
> >>>> Runnable runnable = new Runnable() {
> >>>> @Override
> >>>> public void run() {
> >>>> getSite().getSelectionProvider().setSelection(
> >>>> new InvalidationSelection(lst));
> >>>> }
> >>>> };
> >>>> Display.getDefault().syncExec(runnable);
> >>>> }
> >>>> }
> >>>> }
> >>>> //////////////////////////
> >>>>
> >>>> Thanks in adavance,
> >>>>
> >>>> Marc
> >>>>
> >>>>
> >
> >
|
|
|
Goto Forum:
Current Time: Thu Apr 25 10:30:08 GMT 2024
Powered by FUDForum. Page generated in 0.04296 seconds
|