Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] disabling ceckout observer
[EMFStore] disabling ceckout observer [message #1403983] Mon, 28 July 2014 22:19 Go to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
I had to implement a checkout observer to do some operations after checking out a project. However, I'd like to be able to disable this checkout observer for some specific checkouts.

I am wondering if there's any way I can tell EMFStore to avoid running observer after a specific check out?
Re: [EMFStore] disabling ceckout observer [message #1404169 is a reply to message #1403983] Wed, 30 July 2014 08:03 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Roza,

I don't know if I understand your question correctly, but could you not
just do nothing in your observer in this case?

Cheers,
Maximilian

Am 29.07.2014 00:19, schrieb Roza Ghamari:
> I had to implement a checkout observer to do some operations after
> checking out a project. However, I'd like to be able to disable this
> checkout observer for some specific checkouts.
>
> I am wondering if there's any way I can tell EMFStore to avoid running
> observer after a specific check out?


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] disabling ceckout observer [message #1429061 is a reply to message #1404169] Mon, 22 September 2014 19:00 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
Sorry for getting back to you with delay. I would like to be able to control the call of my checkout observer from the checkout api. Something similar to disabling the notification or passing properties with the notification to all listeners.

for instance a checkout api like:

checkout (String project name, ESServer server, Properties observerProps)

where these properties are passed to the observers. So for example I can put a property like

("disableMyProp", true)


Is there any way to do this right now?
Re: [EMFStore] disabling ceckout observer [message #1429415 is a reply to message #1429061] Tue, 23 September 2014 07:45 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Am 22.09.2014 21:00, schrieb Roza Ghamari:
> Sorry for getting back to you with delay. I would like to be able to
> control the call of my checkout observer from the checkout api.
> Something similar to disabling the notification or passing properties
> with the notification to all listeners.
>
> for instance a checkout api like:
>
> checkout (String project name, ESServer server, Properties observerProps)
>
> where these properties are passed to the observers. So for example I can
> put a property like
>
> ("disableMyProp", true)
>
>
> Is there any way to do this right now?
This is currently not possible and I am not sure if this is something
that is generally useful for all users of EMFStore. Maybe you can store
your properties in your own data structure and access them in your
observers?

Cheers,
Maximilian

--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] disabling ceckout observer [message #1429854 is a reply to message #1429415] Tue, 23 September 2014 20:55 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
The problem is it is not a property of the data in the project. It really depends on the check out, for the same project we sometimes need the checkout observer to run and sometimes it shouldn't run. That is why I would like to be able to control it with checkout API. But maybe, I can make the observer a singleton and set some properties for the observer before calling checkout.
Re: [EMFStore] disabling ceckout observer [message #1430503 is a reply to message #1429854] Wed, 24 September 2014 12:51 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
OK, I see. Maybe you could also unregister and register the observer as
needed based on the property prior to calling checkout and wrap this
behavior into a helper facade class.
You can do this with the Observer Bus which is not part of the API but
can be accessed by downcasting ESWorkspaceProvider to
ESWorkspaceProviderImpl. The ObserverBus is a notification bus where all
Observers of events are notified by events pushed by EMFStore based on
the interface they implement such as ESCheckoutObserver.

Best regards,
Maximilian

Am 23.09.2014 22:55, schrieb Roza Ghamari:
> The problem is it is not a property of the data in the project. It
> really depends on the check out, for the same project we sometimes need
> the checkout observer to run and sometimes it shouldn't run. That is why
> I would like to be able to control it with checkout API. But maybe, I
> can make the observer a singleton and set some properties for the
> observer before calling checkout.


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] disabling ceckout observer [message #1444385 is a reply to message #1430503] Tue, 14 October 2014 02:43 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
I see this can resolve the issue when we want to disable our own observer,
but for instance I would like to disable the ECP observer, however, I don't have any access to the instance of the observer, hence I cannot remove the observer r access to instance of it.

org.eclipse.emf.ecp.emfstore.internal.ui.observer.CheckoutObserver

Re: [EMFStore] disabling ceckout observer [message #1445294 is a reply to message #1444385] Wed, 15 October 2014 08:37 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
Messages: 89
Registered: March 2011
Member
Hi Roza,

well, it's a bit clumsy, but it is possible to unregister observers with
the internal, even if you don't have an instance at hand.
I think it's best to illustrate this with an example:

@Test
public void testUnregisterViaNotify() {
final C observer = new C() {
public String fourtyTwo() {
return "42";
}
};
getObserverBus().register(observer);
C proxy = getObserverBus().notify(C.class);
proxy.fourtyTwo();
List<Result> observerCallResults =
((ObserverCall) proxy).getObserverCallResults();

// observer should have been notified
assertEquals(1, observerCallResults.size());

for (final Result result : observerCallResults) {
final ESObserver obs = result.getObserver();
getObserverBus().unregister(obs);
}

proxy = getObserverBus().notify(C.class);
proxy.fourtyTwo();
observerCallResults = ((ObserverCall) proxy).getObserverCallResults();

// no observers of type C left anymore
assertEquals(0, observerCallResults.size());
}


Hope this helps.

Cheers,
Edgar

> I see this can resolve the issue when we want to disable our own observer,
> but for instance I would like to disable the ECP observer, however, I
> don't have any access to the instance of the observer, hence I cannot
> remove the observer r access to instance of it.
>
> org.eclipse.emf.ecp.emfstore.internal.ui.observer.CheckoutObserver
>
>


--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] disabling ceckout observer [message #1446354 is a reply to message #1445294] Thu, 16 October 2014 18:31 Go to previous message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
thanks veyr much edgar, definitely a good trick. I tried it on my side and worked.
Previous Topic:[EMFStore] [ECP] Problem in deleting project
Next Topic:[EMFStore] Working with multiple usersessions
Goto Forum:
  


Current Time: Tue Mar 19 07:09:46 GMT 2024

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

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

Back to the top