java.lang.Object
org.gcube.informationsystem.discovery.knowledge.Knowledge

public class Knowledge extends Object
A singleton class that manages the discovery and validation of model knowledge from various RegistrationProviders.
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • logger

      public static org.slf4j.Logger logger
      The logger for this class.
    • allKnowledge

      protected ModelKnowledge allKnowledge
      The aggregated knowledge from all registered models.
    • modelKnowledges

      protected Map<String,ModelKnowledge> modelKnowledges
      A map of model knowledge, keyed by model name.
    • registrationProviders

      protected Map<String,RegistrationProvider> registrationProviders
      A map of registration providers, keyed by model name.
  • Method Details

    • getInstance

      public static Knowledge getInstance() throws Exception
      Returns the singleton instance of the Knowledge class.
      Returns:
      The singleton instance.
      Throws:
      Exception - if an error occurs during discovery.
    • getInstance

      public static Knowledge getInstance(boolean forceRediscover) throws Exception
      Returns the singleton instance of the Knowledge class, with an option to force re-discovery.
      Parameters:
      forceRediscover - true to force re-discovery of all models.
      Returns:
      The singleton instance.
      Throws:
      Exception - if an error occurs during discovery.
    • getAllKnowledge

      public ModelKnowledge getAllKnowledge()
      Returns the aggregated knowledge from all registered models.
      Returns:
      The ModelKnowledge for all models.
    • getModelKnowledge

      public ModelKnowledge getModelKnowledge(RegistrationProvider rp)
      Returns the knowledge for a specific model.
      Parameters:
      rp - The RegistrationProvider for the model.
      Returns:
      The ModelKnowledge for the specified model.
    • getModelKnowledge

      public ModelKnowledge getModelKnowledge(String modelName)
      Returns the knowledge for a specific model by name.
      Parameters:
      modelName - The name of the model.
      Returns:
      The ModelKnowledge for the specified model.
    • validateModelKnowledge

      public void validateModelKnowledge(RegistrationProvider rp) throws Exception
      Validates the discovered knowledge for a specific model.
      Parameters:
      rp - The RegistrationProvider for the model to validate.
      Throws:
      Exception - if the validation fails.
    • validateModelKnowledge

      public void validateModelKnowledge(String modelName) throws Exception
      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

      public void discover() throws Exception
      Discovers and builds the knowledge base from all available RegistrationProviders found via ServiceLoader.
      Throws:
      Exception - if an error occurs during discovery.