Class SpecificationMapSourceConnector
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.registry.connector.AbstractRegistrySourceConnector
-
- org.eclipse.viatra.query.runtime.registry.connector.SpecificationMapSourceConnector
-
- All Implemented Interfaces:
IRegistrySourceConnector
public class SpecificationMapSourceConnector extends AbstractRegistrySourceConnector
A simple connector implementation that allows users to simply add and remove specifications. These changes are propagated to listeners (e.g. the registry). Note that duplicate FQNs are not allowed in a given connector.- Since:
- 1.3
-
-
Field Summary
-
Fields inherited from class org.eclipse.viatra.query.runtime.registry.connector.AbstractRegistrySourceConnector
listeners
-
-
Constructor Summary
Constructors Constructor Description SpecificationMapSourceConnector(java.lang.String identifier, boolean includeInDefaultViews)
Creates an instance of the connector with the given identifier.SpecificationMapSourceConnector(java.lang.String identifier, java.util.Set<IQuerySpecificationProvider> specificationProviders, boolean includeInDefaultViews)
Creates an instance of the connector with the given identifier and fills it up with the given specification providers.SpecificationMapSourceConnector(java.lang.String identifier, SpecificationMapSourceConnector connector, boolean includeInDefaultViews)
Creates an instance of the connector with the given identifier and fills it up with the specification providers from the givenSpecificationMapSourceConnector
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addQuerySpecificationProvider(IQuerySpecificationProvider provider)
Adds a query specification to the connector.java.util.Set<java.lang.String>
getQuerySpecificationFQNs()
boolean
hasQuerySpecificationFQN(java.lang.String fullyQualifiedName)
void
removeQuerySpecificationProvider(java.lang.String fullyQualifiedName)
Remove a specification that has been added with the given FQN.protected void
sendQuerySpecificationsToListener(IConnectorListener listener)
Subclasses should send add notifications for each specification in the connector to the given listener.-
Methods inherited from class org.eclipse.viatra.query.runtime.registry.connector.AbstractRegistrySourceConnector
addListener, getIdentifier, includeSpecificationsInDefaultViews, removeListener
-
-
-
-
Constructor Detail
-
SpecificationMapSourceConnector
public SpecificationMapSourceConnector(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
-
SpecificationMapSourceConnector
public SpecificationMapSourceConnector(java.lang.String identifier, java.util.Set<IQuerySpecificationProvider> specificationProviders, boolean includeInDefaultViews)
Creates an instance of the connector with the given identifier and fills it up with the given specification providers. The identifier should be unique if you want to add it to a registry as a source.- Parameters:
identifier
- of the newly created connectorspecificationProviders
- the initial set of specifications in the connectorincludeInDefaultViews
- true if the specifications in the connector should be included in default views
-
SpecificationMapSourceConnector
public SpecificationMapSourceConnector(java.lang.String identifier, SpecificationMapSourceConnector connector, boolean includeInDefaultViews)
Creates an instance of the connector with the given identifier and fills it up with the specification providers from the givenSpecificationMapSourceConnector
. The identifier should be unique if you want to add it to a registry as a source.- Parameters:
identifier
- of the newly created connectorconnector
- that contains the specifications to copy into the new instanceincludeInDefaultViews
- true if the specifications in the connector should be included in default views
-
-
Method Detail
-
addQuerySpecificationProvider
public void addQuerySpecificationProvider(IQuerySpecificationProvider provider)
Adds a query specification to the connector. If you have anIQuerySpecification
object, useSingletonQuerySpecificationProvider
.- Parameters:
provider
- to add to the connector- Throws:
java.lang.IllegalArgumentException
- if the connector already contains a specification with the same FQN
-
removeQuerySpecificationProvider
public void removeQuerySpecificationProvider(java.lang.String fullyQualifiedName)
Remove a specification that has been added with the given FQN.- Parameters:
fullyQualifiedName
-- Throws:
java.util.NoSuchElementException
- if the connector does not contain a specification with the given FQN
-
getQuerySpecificationFQNs
public java.util.Set<java.lang.String> getQuerySpecificationFQNs()
- Returns:
- the immutable copy of the set of FQNs for the added query specifications
-
hasQuerySpecificationFQN
public boolean hasQuerySpecificationFQN(java.lang.String fullyQualifiedName)
- Parameters:
fullyQualifiedName
- that is checked- Returns:
- true if a specification with the given FQN exists in the connector, false otherwise
-
sendQuerySpecificationsToListener
protected void sendQuerySpecificationsToListener(IConnectorListener listener)
Description copied from class:AbstractRegistrySourceConnector
Subclasses should send add notifications for each specification in the connector to the given listener.- Specified by:
sendQuerySpecificationsToListener
in classAbstractRegistrySourceConnector
- Parameters:
listener
- that should receive the notifications
-
-