All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.streamsets.pipeline.api.ConfigIssueContext Maven / Gradle / Ivy

The newest version!
/*
 * Copyright contributors to the StreamSets project
 * StreamSets Inc., an IBM Company 2024
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.streamsets.pipeline.api;

import org.slf4j.Logger;

/**
 * Interface for creating {@link ConfigIssue} instances. This interface is available in all Context objects for
 * configurable components.
 *
 * It's currently parametrized to provide backward compatibility for Stage class.
 */
public interface ConfigIssueContext {
  /**
   * Creates a configuration issue for the given ConfigDef.
   *
   * This method can be used only at initialization time.
   *
   * @param configGroup Configuration group of the service configuration, if applicable.
   * @param configName Configuration name of the service configuration, if applicable.
   * @param errorCode ErrorCode for the issue.
   * @param args Arguments for the ErrorCode message.
   * @return Configuration issue to report back.
   */
  public ConfigIssue createConfigIssue(String configGroup, String configName, ErrorCode errorCode, Object... args);

  /**
   * Creates a configuration issue for the given ConfigDef.
   *
   * This method can be used only at initialization time.
   *
   * @param configGroup Configuration group of the service configuration, if applicable.
   * @param configName Configuration name of the service configuration, if applicable.
   * @param errorCode ErrorCode for the issue.
   * @param logger Logger to print the details of the issue.
   * @param args Arguments for the ErrorCode message.
   * @return Configuration issue to report back.
   */
  public default ConfigIssue createConfigIssue(
      String configGroup,
      String configName,
      ErrorCode errorCode,
      Logger logger,
      Object... args
  ) {
    return createConfigIssue(configGroup, configName, errorCode, args);
  }

  /**
   * Creates a configuration issue for the given ConfigDef.
   *
   * This method can be used only at initialization time.
   *
   * @param configGroup Configuration group of the service configuration, if applicable.
   * @param configName Configuration name of the service configuration, if applicable.
   * @param errorCodeRetriever ErrorCodeRetriever for the issue.
   * @param throwable Throwable that caused the issue.
   * @param logger Logger to print the details of the issue.
   * @param args Arguments for the ErrorCode message.
   * @return Configuration issue to report back.
   */
  public default ConfigIssue createConfigIssue(
      String configGroup,
      String configName,
      ErrorCodeRetriever errorCodeRetriever,
      Throwable throwable,
      Logger logger,
      Object... args
  ) {
    return createConfigIssue(configGroup, configName, errorCodeRetriever.getDefaultErrorCode(), args);
  }

  /**
   * Creates a configuration issue for the given ConfigDef.
   *
   * This method can be used only at initialization time.
   *
   * @param configGroup Configuration group of the service configuration, if applicable.
   * @param configName Configuration name of the service configuration, if applicable.
   * @param errorCodeRetriever ErrorCodeRetriever for the issue.
   * @param throwable Throwable that caused the issue.
   * @param args Arguments for the ErrorCode message.
   * @return Configuration issue to report back.
   */
  public default ConfigIssue createConfigIssue(
      String configGroup,
      String configName,
      ErrorCodeRetriever errorCodeRetriever,
      Throwable throwable,
      Object... args
  ) {
    return createConfigIssue(configGroup, configName, errorCodeRetriever.getDefaultErrorCode(), args);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy