// Path: ooso/src/main/java/fr/d2si/ooso/mapper_wrapper/MapperWrapperInfo.java
// public class MapperWrapperInfo {
//     private long id;
//     private List<ObjectInfoSimple> batch;
//     private String mapperLogicInBase64;
//     private JobInfo jobInfo;
// 
//     public MapperWrapperInfo() {
//     }
// 
//     public MapperWrapperInfo(List<ObjectInfoSimple> batch, long id, String mapperLogicInBase64, JobInfo jobInfo) {
//         this.batch = batch;
//         this.id = id;
//         this.mapperLogicInBase64 = mapperLogicInBase64;
//         this.jobInfo = jobInfo;
//     }
// 
//     public List<ObjectInfoSimple> getBatch() {
//         return batch;
//     }
// 
//     public void setBatch(List<ObjectInfoSimple> batch) {
//         this.batch = batch;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getMapperLogicInBase64() {
//         return mapperLogicInBase64;
//     }
// 
//     public void setMapperLogicInBase64(String mapperLogicInBase64) {
//         this.mapperLogicInBase64 = mapperLogicInBase64;
//     }
// 
//     public JobInfo getJobInfo() {
//         return jobInfo;
//     }
// 
//     public void setJobInfo(JobInfo jobInfo) {
//         this.jobInfo = jobInfo;
//     }
// }
// 
// Path: ooso/src/main/java/fr/d2si/ooso/mappers_listener/MappersListenerInfo.java
// public class MappersListenerInfo {
//     private String reducerInBase64;
//     private JobInfo jobInfo;
// 
//     public MappersListenerInfo() {
//     }
// 
//     public MappersListenerInfo(String reducerInBase64, JobInfo jobInfo) {
//         this.reducerInBase64 = reducerInBase64;
//         this.jobInfo = jobInfo;
//     }
// 
//     public String getReducerInBase64() {
//         return reducerInBase64;
//     }
// 
//     public void setReducerInBase64(String reducerInBase64) {
//         this.reducerInBase64 = reducerInBase64;
//     }
// 
//     public JobInfo getJobInfo() {
//         return jobInfo;
//     }
// 
//     public void setJobInfo(JobInfo jobInfo) {
//         this.jobInfo = jobInfo;
//     }
// }
// 
// Path: ooso/src/main/java/fr/d2si/ooso/utils/Commons.java
// public final static String IGNORED_RETURN_VALUE = "";


import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import fr.d2si.ooso.mapper_wrapper.MapperWrapperInfo;
import fr.d2si.ooso.mappers_listener.MappersListenerInfo;
import fr.d2si.ooso.utils.*;
import java.util.List;
import static fr.d2si.ooso.utils.Commons.IGNORED_RETURN_VALUE;

        for (S3ObjectSummary object : reduceOutput)
            this.s3Client.deleteObject(object.getBucketName(), object.getKey());
    }

    private void validateParamsOrFail() {
        String realInputBucket = Commons.getBucketFromFullPath(this.jobInfo.getJobInputBucket());
        if (!this.s3Client.doesBucketExist(realInputBucket))
            throw new AmazonS3Exception("Bad parameter <jobInputBucket>: Bucket does not exist");

        if (!this.s3Client.doesBucketExist(this.jobInfo.getMapperOutputBucket()))
            throw new AmazonS3Exception("Bad parameter <mapperOutputBucket>: Bucket does not exist");

        if (!this.s3Client.doesBucketExist(this.jobInfo.getReducerOutputBucket()))
            throw new AmazonS3Exception("Bad parameter <reducerOutputBucket>: Bucket does not exist");

        if (this.jobInfo.getReducerForceBatchSize() == 1)
            throw new AmazonS3Exception("Bad parameter <reducerForceBatchSize>: Reducer batch size must be greater or equal than 2");
    }

    private List<List<ObjectInfoSimple>> getBatches() {
        return Commons.getBatches(
                this.jobInfo.getJobInputBucket(),
                this.jobInfo.getMapperMemory(),
                this.jobInfo.getMapperForceBatchSize());
    }

    private void invokeMappersListener() {
        Commons.invokeLambdaAsync(
                this.jobInfo.getMappersListenerFunctionName(),
// Path: ooso/src/main/java/fr/d2si/ooso/mapper_wrapper/MapperWrapperInfo.java
// public class MapperWrapperInfo {
//     private long id;
//     private List<ObjectInfoSimple> batch;
//     private String mapperLogicInBase64;
//     private JobInfo jobInfo;
// 
//     public MapperWrapperInfo() {
//     }
// 
//     public MapperWrapperInfo(List<ObjectInfoSimple> batch, long id, String mapperLogicInBase64, JobInfo jobInfo) {
//         this.batch = batch;
//         this.id = id;
//         this.mapperLogicInBase64 = mapperLogicInBase64;
//         this.jobInfo = jobInfo;
//     }
// 
//     public List<ObjectInfoSimple> getBatch() {
//         return batch;
//     }
// 
//     public void setBatch(List<ObjectInfoSimple> batch) {
//         this.batch = batch;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getMapperLogicInBase64() {
//         return mapperLogicInBase64;
//     }
// 
//     public void setMapperLogicInBase64(String mapperLogicInBase64) {
//         this.mapperLogicInBase64 = mapperLogicInBase64;
//     }
// 
//     public JobInfo getJobInfo() {
//         return jobInfo;
//     }
// 
//     public void setJobInfo(JobInfo jobInfo) {
//         this.jobInfo = jobInfo;
//     }
// }
// 
// Path: ooso/src/main/java/fr/d2si/ooso/mappers_listener/MappersListenerInfo.java
// public class MappersListenerInfo {
//     private String reducerInBase64;
//     private JobInfo jobInfo;
// 
//     public MappersListenerInfo() {
//     }
// 
//     public MappersListenerInfo(String reducerInBase64, JobInfo jobInfo) {
//         this.reducerInBase64 = reducerInBase64;
//         this.jobInfo = jobInfo;
//     }
// 
//     public String getReducerInBase64() {
//         return reducerInBase64;
//     }
// 
//     public void setReducerInBase64(String reducerInBase64) {
//         this.reducerInBase64 = reducerInBase64;
//     }
// 
//     public JobInfo getJobInfo() {
//         return jobInfo;
//     }
// 
//     public void setJobInfo(JobInfo jobInfo) {
//         this.jobInfo = jobInfo;
//     }
// }
// 
// Path: ooso/src/main/java/fr/d2si/ooso/utils/Commons.java
// public final static String IGNORED_RETURN_VALUE = "";


// Path: ooso/src/main/java/fr/d2si/ooso/mappers_driver/MappersDriver.java
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import fr.d2si.ooso.mapper_wrapper.MapperWrapperInfo;
import fr.d2si.ooso.mappers_listener.MappersListenerInfo;
import fr.d2si.ooso.utils.*;
import java.util.List;
import static fr.d2si.ooso.utils.Commons.IGNORED_RETURN_VALUE;


        for (S3ObjectSummary object : reduceOutput)
            this.s3Client.deleteObject(object.getBucketName(), object.getKey());
    }

    private void validateParamsOrFail() {
        String realInputBucket = Commons.getBucketFromFullPath(this.jobInfo.getJobInputBucket());
        if (!this.s3Client.doesBucketExist(realInputBucket))
            throw new AmazonS3Exception("Bad parameter <jobInputBucket>: Bucket does not exist");

        if (!this.s3Client.doesBucketExist(this.jobInfo.getMapperOutputBucket()))
            throw new AmazonS3Exception("Bad parameter <mapperOutputBucket>: Bucket does not exist");

        if (!this.s3Client.doesBucketExist(this.jobInfo.getReducerOutputBucket()))
            throw new AmazonS3Exception("Bad parameter <reducerOutputBucket>: Bucket does not exist");

        if (this.jobInfo.getReducerForceBatchSize() == 1)
            throw new AmazonS3Exception("Bad parameter <reducerForceBatchSize>: Reducer batch size must be greater or equal than 2");
    }

    private List<List<ObjectInfoSimple>> getBatches() {
        return Commons.getBatches(
                this.jobInfo.getJobInputBucket(),
                this.jobInfo.getMapperMemory(),
                this.jobInfo.getMapperForceBatchSize());
    }

    private void invokeMappersListener() {
        Commons.invokeLambdaAsync(
                this.jobInfo.getMappersListenerFunctionName(),
                new MappersListenerInfo(