Interface IProtocolExtension


public interface IProtocolExtension
Defines the contract for protocol extensions within the system. Protocol extensions are responsible for executing network queries for data exchange such as HTTP, SNMP, WBEM, WMI, SSH, etc standards. Implementations of this interface must provide mechanisms to validate configurations, determine support for specific sources and criteria, perform protocol checks, and execute operations related to sources and criteria.
  • Method Details

    • isValidConfiguration

      boolean isValidConfiguration(IConfiguration configuration)
      Checks if the given configuration is valid for this extension. This method is intended to validate the configuration credentials to ensure they meet the expectations of the specific protocol extension.
      Parameters:
      configuration - Represents the generic configuration that's used and implemented by various protocol configurations.
      Returns:
      true if the configuration is valid, otherwise false.
    • getSupportedSources

      Set<Class<? extends Source>> getSupportedSources()
      Retrieves the set of source classes that this extension supports. These sources define the protocol query this extension uses to fetch data.
      Returns:
      A set of classes extending Source, representing the supported sources.
    • getConfigurationToSourceMapping

      Map<Class<? extends IConfiguration>,Set<Class<? extends Source>>> getConfigurationToSourceMapping()
      Provides a mapping between configuration classes and their corresponding sets of source classes.
      This method must provide a strict mapping between the configuration and the evident source to process.
      Returns:
      A map where the keys are classes extending IConfiguration representing different types of protocol configurations, and the values are sets of classes extending Source, indicating the sources that are compatible and can be utilized with each configuration type for data exchange operations.
    • getSupportedCriteria

      Set<Class<? extends Criterion>> getSupportedCriteria()
      Retrieves the set of criterion classes that this extension supports. Criteria represent specific conditions or checks that the engine execute to match connectors.
      Returns:
      A set of classes extending Criterion, representing the supported criteria.
    • checkProtocol

      Optional<Boolean> checkProtocol(TelemetryManager telemetryManager)
      Performs a protocol check based on the given telemetry manager and its strategy time. This method is used to verify if a specific protocol or condition is met for the hostname defined by the telemetry manager.
      Parameters:
      telemetryManager - The telemetry manager to use for monitoring.
      Returns:
      Optional.of(true) if the protocol check succeeds, Optional.of(false) otherwise.
    • processSource

      SourceTable processSource(Source source, String connectorId, TelemetryManager telemetryManager)
      Executes a source operation based on the given source and configuration within the telemetry manager.
      Parameters:
      source - The source to execute.
      connectorId - The unique identifier of the connector.
      telemetryManager - The telemetry manager to use for monitoring.
      Returns:
      A SourceTable object representing the result of the source execution.
    • processCriterion

      CriterionTestResult processCriterion(Criterion criterion, String connectorId, TelemetryManager telemetryManager)
      Executes a criterion check based on the given criterion and configuration within the telemetry manager.
      Parameters:
      criterion - The criterion to execute.
      connectorId - The unique identifier of the connector.
      telemetryManager - The telemetry manager to use for monitoring.
      Returns:
      A CriterionTestResult object representing the result of the criterion execution.
    • isSupportedConfigurationType

      boolean isSupportedConfigurationType(String configurationType)
      Whether the configuration type expressed in the configurationType argument is supported or not
      Parameters:
      configurationType - A string representing the type of configuration to be checked. This type is used to select the appropriate configuration constructor through the buildConfiguration method.
      Returns:
      true if the configuration type is supported otherwise false.
    • buildConfiguration

      IConfiguration buildConfiguration(String configurationType, com.fasterxml.jackson.databind.JsonNode jsonNode, UnaryOperator<char[]> decrypt) throws InvalidConfigurationException
      Creates and returns a configuration object of the specified type based on the provided JSON node. This method is designed to parse and construct a configuration instance specific to a protocol (e.g., HTTP, SNMP) using the provided JSON structure. If the provided JSON node contains valid data for constructing a configuration, an IConfiguration configuration instance is returned. If the JSON node does not contain valid data or if the specified configuration type is not supported, the InvalidConfigurationException should be thrown.
      Parameters:
      configurationType - A string representing the type of configuration to be checked. This type is used to select the appropriate configuration constructor. This type should be used when several configurations are managed by the same extension.
      jsonNode - A JsonNode containing the configuration data in JSON format. This data is parsed to construct the configuration object.
      decrypt - Decrypt function.
      Returns:
      An Optional containing the created IConfiguration object if the construction is successful and the JSON data is valid; otherwise, the InvalidConfigurationException should be thrown.
      Throws:
      InvalidConfigurationException - if the provided JsonNode is invalid and cannot be parsed.
    • getIdentifier

      String getIdentifier()
      Returns the identifier for protocol extension.
      Returns:
      The protocol identifier as a string.