Class Knowledge
java.lang.Object
org.gcube.informationsystem.discovery.knowledge.Knowledge
A singleton class that manages the discovery and validation of model knowledge
from various
RegistrationProviders.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ModelKnowledgeThe aggregated knowledge from all registered models.static org.slf4j.LoggerThe logger for this class.protected Map<String,ModelKnowledge> A map of model knowledge, keyed by model name.protected Map<String,RegistrationProvider> A map of registration providers, keyed by model name. -
Method Summary
Modifier and TypeMethodDescriptionvoiddiscover()Discovers and builds the knowledge base from all availableRegistrationProviders found viaServiceLoader.Returns the aggregated knowledge from all registered models.static KnowledgeReturns the singleton instance of theKnowledgeclass.static KnowledgegetInstance(boolean forceRediscover) Returns the singleton instance of theKnowledgeclass, with an option to force re-discovery.getModelKnowledge(String modelName) Returns the knowledge for a specific model by name.Returns the knowledge for a specific model.voidvalidateModelKnowledge(String modelName) Validates the discovered knowledge for a specific model by name.voidValidates the discovered knowledge for a specific model.
-
Field Details
-
logger
public static org.slf4j.Logger loggerThe logger for this class. -
allKnowledge
The aggregated knowledge from all registered models. -
modelKnowledges
A map of model knowledge, keyed by model name. -
registrationProviders
A map of registration providers, keyed by model name.
-
-
Method Details
-
getInstance
Returns the singleton instance of theKnowledgeclass.- Returns:
- The singleton instance.
- Throws:
Exception- if an error occurs during discovery.
-
getInstance
Returns the singleton instance of theKnowledgeclass, with an option to force re-discovery.- Parameters:
forceRediscover-trueto force re-discovery of all models.- Returns:
- The singleton instance.
- Throws:
Exception- if an error occurs during discovery.
-
getAllKnowledge
Returns the aggregated knowledge from all registered models.- Returns:
- The
ModelKnowledgefor all models.
-
getModelKnowledge
Returns the knowledge for a specific model.- Parameters:
rp- TheRegistrationProviderfor the model.- Returns:
- The
ModelKnowledgefor the specified model.
-
getModelKnowledge
Returns the knowledge for a specific model by name.- Parameters:
modelName- The name of the model.- Returns:
- The
ModelKnowledgefor the specified model.
-
validateModelKnowledge
Validates the discovered knowledge for a specific model.- Parameters:
rp- TheRegistrationProviderfor the model to validate.- Throws:
Exception- if the validation fails.
-
validateModelKnowledge
Validates the discovered knowledge for a specific model by name.- Parameters:
modelName- The name of the model to validate.- Throws:
Exception- if the validation fails.
-
discover
Discovers and builds the knowledge base from all availableRegistrationProviders found viaServiceLoader.- Throws:
Exception- if an error occurs during discovery.
-