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 usingIRegistrySourceConnectors.When running as an OSGi plug-in, the generated query specifications registered through extensions are automatically loaded into the registry by the
ExtensionBasedQuerySpecificationLoaderclass.- Since:
- 1.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedQuerySpecificationRegistry()Hidden constructor for singleton instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDelayedSourceConnector(IRegistrySourceConnector connector)When the registry adds itself as a listener to connectors, it must send all specification providers to the registry.booleanaddSource(IRegistrySourceConnector connector)Cannot register connectors with the same identifier twice.IRegistryViewcreateView()Creates a view which contains query specification entries that indicate their inclusion in default views.IRegistryViewcreateView(IRegistryViewFactory factory)Creates a view which is instantiated by the factory and is connected to the registry.IRegistryViewcreateView(IRegistryViewFilter filter)Creates a view which contains registered query specifications that are considered relevant by the passed filter.IDefaultRegistryViewgetDefaultView()Returns a default view instance that contains query specification entries that indicate their inclusion in default views.static IQuerySpecificationRegistrygetInstance()protected IQuerySpecificationRegistrygetInternalRegistry()booleanremoveSource(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, whenExtensionBasedQuerySpecificationLoaderis 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:IQuerySpecificationRegistryCannot register connectors with the same identifier twice. No change occurs if the identifier is already used.- Specified by:
addSourcein 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:IQuerySpecificationRegistryRemoves the connector if it was registered. No change occurs if the identifier of the connector was not used before.- Specified by:
removeSourcein 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:IQuerySpecificationRegistryReturns 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:
getDefaultViewin interfaceIQuerySpecificationRegistry- Returns:
- the default view instance
-
createView
public IRegistryView createView()
Description copied from interface:IQuerySpecificationRegistryCreates 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:
createViewin interfaceIQuerySpecificationRegistry- Returns:
- a new view instance
-
createView
public IRegistryView createView(IRegistryViewFilter filter)
Description copied from interface:IQuerySpecificationRegistryCreates 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:
createViewin interfaceIQuerySpecificationRegistry- Returns:
- a new filtered view instance
-
createView
public IRegistryView createView(IRegistryViewFactory factory)
Description copied from interface:IQuerySpecificationRegistryCreates 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:
createViewin interfaceIQuerySpecificationRegistry- Returns:
- a new view instance
-
-