org.eclipse.viatra.query.runtime.registry.connector

## Class AbstractRegistrySourceConnector

- java.lang.Object
- - org.eclipse.viatra.query.runtime.registry.connector.AbstractRegistrySourceConnector

- All Implemented Interfaces:
    IRegistrySourceConnector
  Direct Known Subclasses:
    QueryGroupProviderSourceConnector, SpecificationMapSourceConnector

      public abstract class AbstractRegistrySourceConnector
      extends java.lang.Object
      implements IRegistrySourceConnector

  Abstract registry source connector implementation that stores the identifier and listener set.
  Since:
    1.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<IConnectorListener>` | `listeners`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractRegistrySourceConnector(java.lang.String identifier, boolean includeInDefaultViews)` Creates an instance of the connector with the given identifier.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addListener(IConnectorListener listener)` Add a listener to get updates on changes in the query specifications available from the connector.
    `java.lang.String` | `getIdentifier()` The connector must return the same identifier every time it is invoked!
    `boolean` | `includeSpecificationsInDefaultViews()`
    `void` | `removeListener(IConnectorListener listener)` Removes an already registered listener and stops sending updates.
    `protected abstract void` | `sendQuerySpecificationsToListener(IConnectorListener listener)` Subclasses should send add notifications for each specification in the connector to the given listener.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### listeners

          protected java.util.Set<IConnectorListener> listeners

  - ### Constructor Detail

    - #### AbstractRegistrySourceConnector

          public AbstractRegistrySourceConnector(java.lang.String identifier,
                                                 boolean includeInDefaultViews)

      Creates an instance of the connector with the given identifier. The identifier should be unique if you want to add it to a registry as a source.
      Parameters:
        `identifier` - of the newly created connector
        `includeInDefaultViews` - true if the specifications in the connector should be included in default views

  - ### Method Detail

    - #### getIdentifier

          public java.lang.String getIdentifier()

      Description copied from interface: `IRegistrySourceConnector`
      The connector must return the same identifier every time it is invoked!
      Specified by:
        `getIdentifier` in interface `IRegistrySourceConnector`
      Returns:
        unique identifier of the connector

    - #### includeSpecificationsInDefaultViews

          public boolean includeSpecificationsInDefaultViews()

      Specified by:
        `includeSpecificationsInDefaultViews` in interface `IRegistrySourceConnector`
      Returns:
        true if the specifications of the connector should be included in default views

    - #### addListener

          public void addListener(IConnectorListener listener)

      Description copied from interface: `IRegistrySourceConnector`
      Add a listener to get updates on changes in the query specifications available from the connector. When the listener is added, the connector is expected to call the listener with each existing query specification.
      Specified by:
        `addListener` in interface `IRegistrySourceConnector`
      Parameters:
        `listener` - that should be added

    - #### removeListener

          public void removeListener(IConnectorListener listener)

      Description copied from interface: `IRegistrySourceConnector`
      Removes an already registered listener and stops sending updates. The connector is not required to send any updates before returning from this method, but should not send any events after this method returns.
      Specified by:
        `removeListener` in interface `IRegistrySourceConnector`
      Parameters:
        `listener` - that should be removed

    - #### sendQuerySpecificationsToListener

          protected abstract void sendQuerySpecificationsToListener(IConnectorListener listener)

      Subclasses should send add notifications for each specification in the connector to the given listener.
      Parameters:
        `listener` - that should receive the notifications