Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.emf.ecp.changebroker.internal
Class ChangeBrokerImpl

    java.lang.Object
      org.eclipse.emf.ecp.changebroker.internal.ChangeBrokerImpl

All Implemented Interfaces:
  ChangeBroker, NotificationReceiver

    public class ChangeBrokerImpl

extends Object
implements ChangeBroker, NotificationReceiver

Implementation of a `ChangeBroker`. Registers itself as a `NotificationReceiver` at all `providers`. Once it gets notified it forwards the notification to all of the brokers notification receivers, as applicable.

Author:
  Jonas, jfaltermeier

Constructor Summary
`ChangeBrokerImpl()` Default constructor.

Method Summary
`void` | `addNotificationProvider(NotificationProvider provider)` Adds a notification provider.
`void` | `continueNotification()` Notifying the `EMFObservers` is started again if `ChangeBroker.stopNotification()` was called beforehand.
`void` | `continueNotification(Object blocker)` Removes a `blocker`.
`Set<NotificationProvider>` | `getNotificationProviders()` For testing purposes.
`Set<EMFObserver>` | `getRegisteredObservers()` For testing purposes.
`void` | `notify(org.eclipse.emf.common.notify.Notification notification)` Called whenever there is a new `Notification` meant for the receiver.
`void` | `removeNotificationProvider(NotificationProvider provider)` Removes a notification provider.
`void` | `stopNotification()` Stops notifying all `EMFObservers`.
`void` | `stopNotification(Object blocker)` Stops notifying all `EMFObservers`.
`void` | `subscribe(EMFObserver observer)` Adds an `EMFObserver` that will receive all notifications.
`void` | `subscribeToEClass(EMFObserver observer, org.eclipse.emf.ecore.EClass eClass)` Adds an `EMFObserver` that will receive notifications of notifiers with the given EClass.
`void` | `subscribeToFeature(EMFObserver observer, org.eclipse.emf.ecore.EStructuralFeature feature)` Adds an `EMFObserver` that will receive notifications when the given EStructuralFeautre is effected.
`void` | `subscribeToTree(EMFObserver observer, org.eclipse.emf.ecore.EClass eClass)` Adds an `EMFObserver` that will receive notifications of notifiers with the given EClass or which are contained (either direct or indirect) in an EObject of the given EClass.
`void` | `unsubsribe(EMFObserver receiver)` Removes an observer.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChangeBrokerImpl

    public ChangeBrokerImpl()

  Default constructor.

Method Detail

### addNotificationProvider

    public void addNotificationProvider(NotificationProvider provider)

  Adds a notification provider.

  Parameters:
    `provider` - the provider

### removeNotificationProvider

    public void removeNotificationProvider(NotificationProvider provider)

  Removes a notification provider.

  Parameters:
    `provider` - the provider

### notify

    public void notify(org.eclipse.emf.common.notify.Notification notification)

  Called whenever there is a new `Notification` meant for the receiver.

  Specified by:
    `notify` in interface `NotificationReceiver`
  Parameters:
    `notification` - the notification
  See Also:
    `EMFObserver.handleNotification(org.eclipse.emf.common.notify.Notification)`

### subscribe

    public void subscribe(EMFObserver observer)

  Adds an `EMFObserver` that will receive all notifications. Does nothing if already registered.

  Specified by:
    `subscribe` in interface `ChangeBroker`
  Parameters:
    `observer` - the observer
  See Also:
    `ChangeBroker.subscribe(org.eclipse.emf.ecp.changebroker.spi.EMFObserver)`

### subscribeToEClass

    public void subscribeToEClass(EMFObserver observer,
                                  org.eclipse.emf.ecore.EClass eClass)

  Adds an `EMFObserver` that will receive notifications of notifiers with the given EClass. Does nothing if already registered.

  Specified by:
    `subscribeToEClass` in interface `ChangeBroker`
  Parameters:
    `observer` - the observer
    `eClass` - the required EClass of the notifier
  See Also:
    `ChangeBroker.subscribeToEClass(org.eclipse.emf.ecp.changebroker.spi.EMFObserver, org.eclipse.emf.ecore.EClass)`

### subscribeToTree

    public void subscribeToTree(EMFObserver observer,
                                org.eclipse.emf.ecore.EClass eClass)

  Adds an `EMFObserver` that will receive notifications of notifiers with the given EClass or which are contained (either direct or indirect) in an EObject of the given EClass. Does nothing if already registered.

  Specified by:
    `subscribeToTree` in interface `ChangeBroker`
  Parameters:
    `observer` - the observer
    `eClass` - the required EClass of the notifier or of one of its parents
  See Also:
    `ChangeBroker.subscribeToTree(org.eclipse.emf.ecp.changebroker.spi.EMFObserver, org.eclipse.emf.ecore.EClass)`

### subscribeToFeature

    public void subscribeToFeature(EMFObserver observer,
                                   org.eclipse.emf.ecore.EStructuralFeature feature)

  Adds an `EMFObserver` that will receive notifications when the given EStructuralFeautre is effected. Does nothing if already registered.

  Specified by:
    `subscribeToFeature` in interface `ChangeBroker`
  Parameters:
    `observer` - the observer
    `feature` - the feature to receive changes for
  See Also:
    `ChangeBroker.subscribeToFeature(org.eclipse.emf.ecp.changebroker.spi.EMFObserver, org.eclipse.emf.ecore.EStructuralFeature)`

### unsubsribe

    public void unsubsribe(EMFObserver receiver)

  Removes an observer. Does nothing if receiver is not registered.

  Specified by:
    `unsubsribe` in interface `ChangeBroker`
  Parameters:
    `receiver` - the receiver
  See Also:
    `ChangeBroker.unsubsribe(org.eclipse.emf.ecp.changebroker.spi.EMFObserver)`

### stopNotification

    public void stopNotification()

  Stops notifying all `EMFObservers`. `ReadOnlyEMFObservers` will still be notified.

  Specified by:
    `stopNotification` in interface `ChangeBroker`
  See Also:
    `ChangeBroker.stopNotification()`

### continueNotification

    public void continueNotification()

  Notifying the `EMFObservers` is started again if `ChangeBroker.stopNotification()` was called beforehand. Has no effect if the notification process has been `blocked` or if `ChangeBroker.stopNotification()` wasn't called before.

  Specified by:
    `continueNotification` in interface `ChangeBroker`
  See Also:
    `ChangeBroker.continueNotification()`

### getNotificationProviders

    public Set<NotificationProvider> getNotificationProviders()

  For testing purposes.

  Returns:
    all registered providers

### getRegisteredObservers

    public Set<EMFObserver> getRegisteredObservers()

  For testing purposes.

  Returns:
    all registered observers

### stopNotification

    public void stopNotification(Object blocker)

  Stops notifying all `EMFObservers`. `ReadOnlyEMFObservers` will still be notified. The notifications will we blocked until `ChangeBroker.continueNotification(Object)` has been called with all blocking elements. Using the same blocker multiple times has no effect.

  Specified by:
    `stopNotification` in interface `ChangeBroker`
  Parameters:
    `blocker` - the key object used to block all notifications
  See Also:
    `ChangeBroker.stopNotification(java.lang.Object)`

### continueNotification

    public void continueNotification(Object blocker)

  Removes a `blocker`. When all blockers have been removed the notification process will continue. This method calls `ChangeBroker.continueNotification()` internally in all cases, even if the given blocker object was not used as a blocker beforehand.

  Specified by:
    `continueNotification` in interface `ChangeBroker`
  Parameters:
    `blocker` - the blocker object to remove.
  See Also:
    `ChangeBroker.continueNotification(java.lang.Object)`

Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2015. All Rights Reserved.