// Path: src/java/com/google/cloud/bigquery/dwhassessment/extractiontool/dumper/DataEntityManager.java
// public interface DataEntityManager extends Closeable {
// 
//   /**
//    * Get the output stream for an entity.
//    *
//    * @param name The name of the output entity.
//    */
//   OutputStream getEntityOutputStream(String name) throws IOException;
// 
//   /**
//    * Indicate whether the data entity allows resumable processing.
//    *
//    * @return true if some progress can be retained after the writing is interrupted.
//    */
//   boolean isResumable();
// 
//   /**
//    * Get the absolute path of a file given its name.
//    *
//    * @param name The name of the file.
//    */
//   Path getAbsolutePath(String name);
// }


import com.google.cloud.bigquery.dwhassessment.extractiontool.dumper.DataEntityManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
/*
 * Copyright 2021 Google LLC
 *
 * 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
 *
 *     https://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.google.cloud.bigquery.dwhassessment.extractiontool.db;


/** Interface to manage SQL scripts. */
public interface ScriptManager {

  /**
   * Executes a script against a DB connection and writes the output to a stream.
   *
   * @param connection The JDBC connection to the database.
   * @param dryRun Whether to just perform a dry run, which just logs out the action to perform.
   * @param sqlTemplateRenderer A template renderer to apply on the SQL script before execution.
   * @param scriptName The name of the script. This is not a file name. The interpretation of the
   *     name is left to the implementation but can also map to several files (e.g., an SQL file and
   *     a schema definition file).
   * @param dataEntityManager The data entity manager to use to write the output.
   * @param chunkRows The maximum number of rows (records) in one output file.
   * @param startingChunkNumber The starting chunk number for this run (as continued from previous
   *     run, if specified).
   */
  void executeScript(
      Connection connection,
      boolean dryRun,
      SqlTemplateRenderer sqlTemplateRenderer,
      String scriptName,
// Path: src/java/com/google/cloud/bigquery/dwhassessment/extractiontool/dumper/DataEntityManager.java
// public interface DataEntityManager extends Closeable {
// 
//   /**
//    * Get the output stream for an entity.
//    *
//    * @param name The name of the output entity.
//    */
//   OutputStream getEntityOutputStream(String name) throws IOException;
// 
//   /**
//    * Indicate whether the data entity allows resumable processing.
//    *
//    * @return true if some progress can be retained after the writing is interrupted.
//    */
//   boolean isResumable();
// 
//   /**
//    * Get the absolute path of a file given its name.
//    *
//    * @param name The name of the file.
//    */
//   Path getAbsolutePath(String name);
// }


// Path: src/java/com/google/cloud/bigquery/dwhassessment/extractiontool/db/ScriptManager.java
import com.google.cloud.bigquery.dwhassessment.extractiontool.dumper.DataEntityManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;

/*
 * Copyright 2021 Google LLC
 *
 * 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
 *
 *     https://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.google.cloud.bigquery.dwhassessment.extractiontool.db;


/** Interface to manage SQL scripts. */
public interface ScriptManager {

  /**
   * Executes a script against a DB connection and writes the output to a stream.
   *
   * @param connection The JDBC connection to the database.
   * @param dryRun Whether to just perform a dry run, which just logs out the action to perform.
   * @param sqlTemplateRenderer A template renderer to apply on the SQL script before execution.
   * @param scriptName The name of the script. This is not a file name. The interpretation of the
   *     name is left to the implementation but can also map to several files (e.g., an SQL file and
   *     a schema definition file).
   * @param dataEntityManager The data entity manager to use to write the output.
   * @param chunkRows The maximum number of rows (records) in one output file.
   * @param startingChunkNumber The starting chunk number for this run (as continued from previous
   *     run, if specified).
   */
  void executeScript(
      Connection connection,
      boolean dryRun,
      SqlTemplateRenderer sqlTemplateRenderer,
      String scriptName,
      DataEntityManager dataEntityManager,