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 Description protected java.util.Set<IConnectorListener>
listeners
-
Constructor Summary
Constructors Constructor 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 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.
-
-
-
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 connectorincludeInDefaultViews
- 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 interfaceIRegistrySourceConnector
- Returns:
- unique identifier of the connector
-
includeSpecificationsInDefaultViews
public boolean includeSpecificationsInDefaultViews()
- Specified by:
includeSpecificationsInDefaultViews
in interfaceIRegistrySourceConnector
- 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 interfaceIRegistrySourceConnector
- 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 interfaceIRegistrySourceConnector
- 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
-
-