// Path: indexer/ai/src/main/java/com/google/cloudsearch/exceptions/InvalidConfigException.java
// public class InvalidConfigException extends Exception {
//         public InvalidConfigException(String e){
//             super(e);
//         }
// }
// 
// Path: indexer/ai/src/main/java/com/google/cloudsearch/ai/AISkillDriver.java
// public class AISkillDriver {
// 
//     private static AISkillSet skillSet;
//     private static Logger log = Logger.getLogger(AISkillDriver.class.getName());
// 
//     /**
//      * Initialize the Driver
//      * @param aiConfigName  File path of the Configuration
//      * @param schemaName    File path of CloudSearch Schema
//      * @throws Exception    Throws Exception if skill setup fails
//      */
//     public static void initialize(String aiConfigName, String schemaName) throws Exception {
//         JSONParser parser = new JSONParser();
//         JSONObject schema = (JSONObject) parser.parse(new FileReader(schemaName));
//         JSONObject aiConfig = (JSONObject) parser.parse(new FileReader(aiConfigName));
//         skillSet = new AISkillSet(aiConfig, schema);
//         for(AISkill skill : skillSet.getSkills()) {
//             skill.setupSkill();
//         }
//     }
// 
//     /**
//      * Populates the structured Data by executing the skills.
//      * @param structuredData    Multimap for storing the structured data.
//      * @param contentOrURI      CloudStorage URI or File content in String format.
//      */
//     public static void populateStructuredData(String contentOrURI, Multimap<String, Object> structuredData) {
//         List<AISkill> skillList = (List<AISkill>) skillSet.getSkills();
//         if(skillList == null) {
//             log.error("No skills Specified. Initialize the driver before calling populateStructuredData.");
//             return;
//         }
//         skillList.forEach(skill -> {
//             skill.executeSkill(contentOrURI, structuredData);
//         });
//     }
// 
//     /**
//      * Handles skill shutdown.
//      */
//     public static void closeSkillDriver() throws NullPointerException {
//         List<AISkill> skillList = (List<AISkill>) skillSet.getSkills();
//         if(skillList == null) {
//             log.error("AISkill List is not initialized. Call AISkillDriver.initialize() before calling closeSkillDriver()");
//             return;
//         }
//         skillList.forEach(skill -> {
//             skill.shutdownSkill();
//         });
//     }
// }


import com.google.api.client.http.ByteArrayContent;
import com.google.api.services.cloudsearch.v1.model.Item;
import com.google.cloudsearch.exceptions.InvalidConfigException;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.primitives.Longs;
import com.google.enterprise.cloudsearch.sdk.CheckpointCloseableIterable;
import com.google.enterprise.cloudsearch.sdk.CheckpointCloseableIterableImpl;
import com.google.enterprise.cloudsearch.sdk.RepositoryException;
import com.google.enterprise.cloudsearch.sdk.config.ConfigValue;
import com.google.enterprise.cloudsearch.sdk.config.Configuration;
import com.google.enterprise.cloudsearch.sdk.indexing.Acl;
import com.google.enterprise.cloudsearch.sdk.indexing.IndexingItemBuilder;
import com.google.enterprise.cloudsearch.sdk.indexing.IndexingService;
import com.google.enterprise.cloudsearch.sdk.indexing.template.ApiOperation;
import com.google.enterprise.cloudsearch.sdk.indexing.template.Repository;
import com.google.enterprise.cloudsearch.sdk.indexing.template.RepositoryContext;
import com.google.enterprise.cloudsearch.sdk.indexing.template.RepositoryDoc;
import com.google.cloudsearch.ai.AISkillDriver;
import javax.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.logging.Logger;
import java.util.stream.IntStream;
import com.opencsv.*;
package com.google.com.covid;


public class LocalRepository implements Repository {

    private static Logger log = Logger.getLogger(LocalRepository.class.getName());
    private List<String> allFileNames = new ArrayList<String>();
    private String aiConfigName = null;
    private String schemaName = null;
// Path: indexer/ai/src/main/java/com/google/cloudsearch/exceptions/InvalidConfigException.java
// public class InvalidConfigException extends Exception {
//         public InvalidConfigException(String e){
//             super(e);
//         }
// }
// 
// Path: indexer/ai/src/main/java/com/google/cloudsearch/ai/AISkillDriver.java
// public class AISkillDriver {
// 
//     private static AISkillSet skillSet;
//     private static Logger log = Logger.getLogger(AISkillDriver.class.getName());
// 
//     /**
//      * Initialize the Driver
//      * @param aiConfigName  File path of the Configuration
//      * @param schemaName    File path of CloudSearch Schema
//      * @throws Exception    Throws Exception if skill setup fails
//      */
//     public static void initialize(String aiConfigName, String schemaName) throws Exception {
//         JSONParser parser = new JSONParser();
//         JSONObject schema = (JSONObject) parser.parse(new FileReader(schemaName));
//         JSONObject aiConfig = (JSONObject) parser.parse(new FileReader(aiConfigName));
//         skillSet = new AISkillSet(aiConfig, schema);
//         for(AISkill skill : skillSet.getSkills()) {
//             skill.setupSkill();
//         }
//     }
// 
//     /**
//      * Populates the structured Data by executing the skills.
//      * @param structuredData    Multimap for storing the structured data.
//      * @param contentOrURI      CloudStorage URI or File content in String format.
//      */
//     public static void populateStructuredData(String contentOrURI, Multimap<String, Object> structuredData) {
//         List<AISkill> skillList = (List<AISkill>) skillSet.getSkills();
//         if(skillList == null) {
//             log.error("No skills Specified. Initialize the driver before calling populateStructuredData.");
//             return;
//         }
//         skillList.forEach(skill -> {
//             skill.executeSkill(contentOrURI, structuredData);
//         });
//     }
// 
//     /**
//      * Handles skill shutdown.
//      */
//     public static void closeSkillDriver() throws NullPointerException {
//         List<AISkill> skillList = (List<AISkill>) skillSet.getSkills();
//         if(skillList == null) {
//             log.error("AISkill List is not initialized. Call AISkillDriver.initialize() before calling closeSkillDriver()");
//             return;
//         }
//         skillList.forEach(skill -> {
//             skill.shutdownSkill();
//         });
//     }
// }


// Path: connector/src/main/java/com/google/com/covid/LocalRepository.java
import com.google.api.client.http.ByteArrayContent;
import com.google.api.services.cloudsearch.v1.model.Item;
import com.google.cloudsearch.exceptions.InvalidConfigException;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.primitives.Longs;
import com.google.enterprise.cloudsearch.sdk.CheckpointCloseableIterable;
import com.google.enterprise.cloudsearch.sdk.CheckpointCloseableIterableImpl;
import com.google.enterprise.cloudsearch.sdk.RepositoryException;
import com.google.enterprise.cloudsearch.sdk.config.ConfigValue;
import com.google.enterprise.cloudsearch.sdk.config.Configuration;
import com.google.enterprise.cloudsearch.sdk.indexing.Acl;
import com.google.enterprise.cloudsearch.sdk.indexing.IndexingItemBuilder;
import com.google.enterprise.cloudsearch.sdk.indexing.IndexingService;
import com.google.enterprise.cloudsearch.sdk.indexing.template.ApiOperation;
import com.google.enterprise.cloudsearch.sdk.indexing.template.Repository;
import com.google.enterprise.cloudsearch.sdk.indexing.template.RepositoryContext;
import com.google.enterprise.cloudsearch.sdk.indexing.template.RepositoryDoc;
import com.google.cloudsearch.ai.AISkillDriver;
import javax.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.logging.Logger;
import java.util.stream.IntStream;
import com.opencsv.*;

package com.google.com.covid;


public class LocalRepository implements Repository {

    private static Logger log = Logger.getLogger(LocalRepository.class.getName());
    private List<String> allFileNames = new ArrayList<String>();
    private String aiConfigName = null;
    private String schemaName = null;
    private AISkillDriver skillDriver = null;