Class QuerySpecificationRegistry
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.registry.QuerySpecificationRegistry
-
- All Implemented Interfaces:
IQuerySpecificationRegistry
public class QuerySpecificationRegistry extends java.lang.Object implements IQuerySpecificationRegistry
Registry for query specifications that can be accessed using fully qualified names through views. Additional query specifications can be added usingIRegistrySourceConnector
s.When running as an OSGi plug-in, the generated query specifications registered through extensions are automatically loaded into the registry by the
ExtensionBasedQuerySpecificationLoader
class.- Since:
- 1.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QuerySpecificationRegistry()
Hidden constructor for singleton instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDelayedSourceConnector(IRegistrySourceConnector connector)
When the registry adds itself as a listener to connectors, it must send all specification providers to the registry.boolean
addSource(IRegistrySourceConnector connector)
Cannot register connectors with the same identifier twice.IRegistryView
createView()
Creates a view which contains query specification entries that indicate their inclusion in default views.IRegistryView
createView(IRegistryViewFactory factory)
Creates a view which is instantiated by the factory and is connected to the registry.IRegistryView
createView(IRegistryViewFilter filter)
Creates a view which contains registered query specifications that are considered relevant by the passed filter.IDefaultRegistryView
getDefaultView()
Returns a default view instance that contains query specification entries that indicate their inclusion in default views.static IQuerySpecificationRegistry
getInstance()
protected IQuerySpecificationRegistry
getInternalRegistry()
boolean
removeSource(IRegistrySourceConnector connector)
Removes the connector if it was registered.
-
-
-
Method Detail
-
getInstance
public static IQuerySpecificationRegistry getInstance()
- Returns:
- the singleton query specification registry instance
-
getInternalRegistry
protected IQuerySpecificationRegistry getInternalRegistry()
- Returns:
- the internal registry after adding delayed source connectors
-
addDelayedSourceConnector
protected void addDelayedSourceConnector(IRegistrySourceConnector connector)
When the registry adds itself as a listener to connectors, it must send all specification providers to the registry. However, whenExtensionBasedQuerySpecificationLoader
is triggered during the activation of the plugin, the individual query specification classes cannot be loaded yet. To avoid this, the connector of the loader is delayed until needed.- Parameters:
connector
- that should be delayed before adding to the registry
-
addSource
public boolean addSource(IRegistrySourceConnector connector)
Description copied from interface:IQuerySpecificationRegistry
Cannot register connectors with the same identifier twice. No change occurs if the identifier is already used.- Specified by:
addSource
in interfaceIQuerySpecificationRegistry
- Parameters:
connector
- cannot be null- Returns:
- false if a connector with the given identifier has already been added, true otherwise
-
removeSource
public boolean removeSource(IRegistrySourceConnector connector)
Description copied from interface:IQuerySpecificationRegistry
Removes the connector if it was registered. No change occurs if the identifier of the connector was not used before.- Specified by:
removeSource
in interfaceIQuerySpecificationRegistry
- Parameters:
connector
- cannot be null- Returns:
- false if a registered connector with the given identifier was not found, true if it was successfully removed
-
getDefaultView
public IDefaultRegistryView getDefaultView()
Description copied from interface:IQuerySpecificationRegistry
Returns a default view instance that contains query specification entries that indicate their inclusion in default views. If there are entries with the same FQN, only the last added will be included in the view to avoid duplicate FQNs.- Specified by:
getDefaultView
in interfaceIQuerySpecificationRegistry
- Returns:
- the default view instance
-
createView
public IRegistryView createView()
Description copied from interface:IQuerySpecificationRegistry
Creates a view which contains query specification entries that indicate their inclusion in default views. This view will also be incrementally updated on registry changes and accepts listeners to notify on changes.- Specified by:
createView
in interfaceIQuerySpecificationRegistry
- Returns:
- a new view instance
-
createView
public IRegistryView createView(IRegistryViewFilter filter)
Description copied from interface:IQuerySpecificationRegistry
Creates a view which contains registered query specifications that are considered relevant by the passed filter. This view will also be incrementally updated on registry changes and accepts listeners to notify on changes.- Specified by:
createView
in interfaceIQuerySpecificationRegistry
- Returns:
- a new filtered view instance
-
createView
public IRegistryView createView(IRegistryViewFactory factory)
Description copied from interface:IQuerySpecificationRegistry
Creates a view which is instantiated by the factory and is connected to the registry. This view will also be incrementally updated on registry changes and accepts listeners to notify on changes.- Specified by:
createView
in interfaceIQuerySpecificationRegistry
- Returns:
- a new view instance
-
-