Class DataRoutingServiceFactory

java.lang.Object
com.illumon.iris.db.v2.routing.DataRoutingServiceFactory

public class DataRoutingServiceFactory extends Object
Entry point for DataRoutingService access and implementation. This class encapsulates implementation details and provides system defaults.
  • Field Details

  • Constructor Details

    • DataRoutingServiceFactory

      public DataRoutingServiceFactory()
  • Method Details

    • getDefault

      public static DataRoutingService getDefault()
      Returns:
      the routing service instance defined by the Global configuration instance.
    • createDefault

      @VisibleForTesting @NotNull public static DataRoutingService createDefault(@NotNull com.fishlib.configuration.Configuration configuration)
      Create a new DataRoutingService of the type indicated by the given Configuration.
      Parameters:
      configuration - the Configuration governing defaults
      Returns:
      a new instance of a DataRoutingService implementation
    • getK8sDataRoutingService

      public static DataRoutingService getK8sDataRoutingService()
    • getRemoteDataRoutingService

      @NotNull public static WritableDataRoutingService getRemoteDataRoutingService()
      Get a remote data routing service implementation (this will be grpc).
      Returns:
      a remote implementation of WritableDataRoutingService
    • getKvEtcdDataRoutingService

      public static WritableDataRoutingService getKvEtcdDataRoutingService(@NotNull com.fishlib.configuration.Configuration configuration)
      Create a DataRoutingService that connects directly to etcd, according to the given configuration.
      Parameters:
      configuration - the configuration to use
      Returns:
      a new WritableDataRoutingService instance
    • getKvEtcdDataRoutingService

      public static WritableDataRoutingService getKvEtcdDataRoutingService(@NotNull com.fishlib.configuration.Configuration configuration, boolean allowParseErrors)
      Create a DataRoutingService that connects directly to etcd, according to the given configuration. If allowParseErrors is true, parse errors in the existing data will be ignored. This allows import and export when errors are somehow persisted.
      Parameters:
      configuration - the configuration to use
      allowParseErrors - if true, allow errors in the existing routing file
      Returns:
      a new WritableDataRoutingService instance
    • reset

      @TestUseOnly public static void reset()
      For testing only.
    • fromConfiguration

      public static DataRoutingService fromConfiguration(@NotNull com.fishlib.configuration.Configuration configuration)
      Create a YAML based DataRoutingService instance as dictated by the given configuration. The configuration will be used to determine a file to parse.
      Parameters:
      configuration - the configuration to use
      Returns:
      a new DataRoutingService
    • fromFilename

      public static DataRoutingService fromFilename(@NotNull String filename) throws IOException
      Create a YAML based DataRoutingService instance from the named file or resource. This disambiguates the constructors.
      Parameters:
      filename - the name of the file to parse
      Returns:
      a new DataRoutingService
      Throws:
      IOException - if the file cannot be read
      DataRoutingConfigurationException - if the complete configuration can't be parsed with the new configuration included
    • fromFilename

      public static DataRoutingService fromFilename(@NotNull String filename, @NotNull Collection<DataImportServiceConfig> disConfigs) throws IOException
      Create a YAML based DataRoutingService instance from the named file or resource and provided additional dises.
      Parameters:
      filename - the name of the file to parse
      disConfigs - the DataImportServiceConfigs to add in
      Returns:
      a new DataRoutingService
      Throws:
      IOException - if the file cannot be read
      DataRoutingConfigurationException - if the complete configuration can't be parsed with the new configuration included
    • fromString

      public static DataRoutingService fromString(@NotNull String ymlString)
      Create YAML based a DataRoutingService from an existing yml String. This allows storage and parsing to be independent.
      Parameters:
      ymlString - the string to parse
      Returns:
      a new DataRoutingService
      Throws:
      DataRoutingConfigurationException - if the complete configuration can't be parsed with the new configuration included
    • fromString

      public static DataRoutingService fromString(@NotNull String ymlString, @NotNull Collection<DataImportServiceConfig> disConfigs)
      Create YAML based a DataRoutingService from an existing yml String and collection of DIS configs.
      Parameters:
      ymlString - the string to parse
      disConfigs - the DataImportServiceConfigs to add in
      Returns:
      a new DataRoutingService
      Throws:
      DataRoutingConfigurationException - if the complete configuration can't be parsed with the new configuration included