// Path: distiller/src/main/java/com/vlkan/hrrs/distiller/cli/Distiller.java
// public class Distiller implements Runnable, Closeable {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(Distiller.class);
// 
//     private final Config config;
// 
//     private final HttpRequestRecordReader<?> reader;
// 
//     private final HttpRequestRecordWriter<?> writer;
// 
//     private interface Transformer {
// 
//         HttpRequestRecord transform(HttpRequestRecord input);
// 
//     }
// 
//     @Inject
//     public Distiller(
//             Config config,
//             HttpRequestRecordReader<?> reader,
//             HttpRequestRecordWriter<?> writer) {
//         this.config = config;
//         this.reader = reader;
//         this.writer = writer;
//     }
// 
//     @Override
//     public void run() {
// 
//         // Read the transformation function.
//         Transformer transformer = createTransformer();
// 
//         // Initialize statistics.
//         long totalRecordCount = 0;
//         long ignoredRecordCount = 0;
//         long changedRecordCount = 0;
// 
//         // Perform distillation.
//         for (HttpRequestRecord input : reader.read()) {
//             totalRecordCount++;
//             LOGGER.trace("transforming (id={})", input.getId());
//             HttpRequestRecord output = transformer.transform(input);
//             if (output == null) {
//                 ignoredRecordCount++;
//             } else {
//                 if (input != output) {
//                     changedRecordCount++;
//                 }
//                 writer.write(output);
//             }
//         }
// 
//         // Report statistics.
//         LOGGER.info("totalRecordCount = {}", totalRecordCount);
//         String ignoredRecordPercentage = String.format("%.1f%%", (100.0f * ignoredRecordCount / totalRecordCount));
//         LOGGER.info("ignoredRecordCount = {} ({})", ignoredRecordCount, ignoredRecordPercentage);
//         String changedRecordPercentage = String.format("%.1f%%", (100.0f * changedRecordCount / totalRecordCount));
//         LOGGER.info("changedRecordCount = {} ({})", changedRecordCount, changedRecordPercentage);
// 
//     }
// 
//     private Transformer createTransformer() {
//         URI scriptUri = config.getScriptUri();
//         File scriptFile = new File(scriptUri);
//         ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
//         try {
//             FileReader scriptFileReader = new FileReader(scriptFile);
//             engine.eval(scriptFileReader);
//             final Invocable invocable = (Invocable) engine;
//             return createTransformer(invocable);
//         } catch (FileNotFoundException error) {
//             String message = String.format("failed opening script file (uri=%s)", scriptUri);
//             throw new RuntimeException(message, error);
//         } catch (ScriptException error) {
//             String message = String.format("failed executing script file (uri=%s)", scriptUri);
//             throw new RuntimeException(message, error);
//         }
//     }
// 
//     private static Transformer createTransformer(final Invocable invocable) {
//         return input -> {
//             try {
//                 Object output = invocable.invokeFunction("transform", input);
//                 return (HttpRequestRecord) output;
//             } catch (Throwable error) {
//                 throw new RuntimeException("failed invoking transform function", error);
//             }
//         };
//     }
// 
//     @Override
//     public void close() {
// 
//         // Close the reader source.
//         try {
//             reader.getSource().close();
//         } catch (IOException error) {
//             String message = String.format("failed closing reader source (inputUri=%s)", config.getInputUri());
//             LOGGER.error(message, error);
//         }
// 
//         // Close the writer source.
//         try {
//             writer.getTarget().close();
//         } catch (IOException error) {
//             String message = String.format("failed closing writer target (outputUri=%s)", config.getOutputUri());
//             LOGGER.error(message, error);
//         }
// 
//     }
// 
//     public static void main(String[] args, DistillerModuleFactory moduleFactory) {
//         Config config = Config.of(args);
//         config.dump();
//         DistillerModule module = moduleFactory.create(config);
//         Injector injector = Guice.createInjector(module);
//         LoggerLevelAccessor loggerLevelAccessor = injector.getInstance(LoggerLevelAccessor.class);
//         LoggerLevels.applyLoggerLevelSpecs(config.getLoggerLevelSpecs(), loggerLevelAccessor);
//         try (Distiller distiller = injector.getInstance(Distiller.class)) {
//             distiller.run();
//         }
//     }
// 
// }


import com.vlkan.hrrs.distiller.cli.Distiller;
import java.io.IOException;
package com.vlkan.hrrs.distiller.base64;



public enum Base64Distiller {;

    public static void main(String[] args) throws IOException {
        Base64DistillerModuleFactory moduleFactory = new Base64DistillerModuleFactory();
// Path: distiller/src/main/java/com/vlkan/hrrs/distiller/cli/Distiller.java
// public class Distiller implements Runnable, Closeable {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(Distiller.class);
// 
//     private final Config config;
// 
//     private final HttpRequestRecordReader<?> reader;
// 
//     private final HttpRequestRecordWriter<?> writer;
// 
//     private interface Transformer {
// 
//         HttpRequestRecord transform(HttpRequestRecord input);
// 
//     }
// 
//     @Inject
//     public Distiller(
//             Config config,
//             HttpRequestRecordReader<?> reader,
//             HttpRequestRecordWriter<?> writer) {
//         this.config = config;
//         this.reader = reader;
//         this.writer = writer;
//     }
// 
//     @Override
//     public void run() {
// 
//         // Read the transformation function.
//         Transformer transformer = createTransformer();
// 
//         // Initialize statistics.
//         long totalRecordCount = 0;
//         long ignoredRecordCount = 0;
//         long changedRecordCount = 0;
// 
//         // Perform distillation.
//         for (HttpRequestRecord input : reader.read()) {
//             totalRecordCount++;
//             LOGGER.trace("transforming (id={})", input.getId());
//             HttpRequestRecord output = transformer.transform(input);
//             if (output == null) {
//                 ignoredRecordCount++;
//             } else {
//                 if (input != output) {
//                     changedRecordCount++;
//                 }
//                 writer.write(output);
//             }
//         }
// 
//         // Report statistics.
//         LOGGER.info("totalRecordCount = {}", totalRecordCount);
//         String ignoredRecordPercentage = String.format("%.1f%%", (100.0f * ignoredRecordCount / totalRecordCount));
//         LOGGER.info("ignoredRecordCount = {} ({})", ignoredRecordCount, ignoredRecordPercentage);
//         String changedRecordPercentage = String.format("%.1f%%", (100.0f * changedRecordCount / totalRecordCount));
//         LOGGER.info("changedRecordCount = {} ({})", changedRecordCount, changedRecordPercentage);
// 
//     }
// 
//     private Transformer createTransformer() {
//         URI scriptUri = config.getScriptUri();
//         File scriptFile = new File(scriptUri);
//         ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
//         try {
//             FileReader scriptFileReader = new FileReader(scriptFile);
//             engine.eval(scriptFileReader);
//             final Invocable invocable = (Invocable) engine;
//             return createTransformer(invocable);
//         } catch (FileNotFoundException error) {
//             String message = String.format("failed opening script file (uri=%s)", scriptUri);
//             throw new RuntimeException(message, error);
//         } catch (ScriptException error) {
//             String message = String.format("failed executing script file (uri=%s)", scriptUri);
//             throw new RuntimeException(message, error);
//         }
//     }
// 
//     private static Transformer createTransformer(final Invocable invocable) {
//         return input -> {
//             try {
//                 Object output = invocable.invokeFunction("transform", input);
//                 return (HttpRequestRecord) output;
//             } catch (Throwable error) {
//                 throw new RuntimeException("failed invoking transform function", error);
//             }
//         };
//     }
// 
//     @Override
//     public void close() {
// 
//         // Close the reader source.
//         try {
//             reader.getSource().close();
//         } catch (IOException error) {
//             String message = String.format("failed closing reader source (inputUri=%s)", config.getInputUri());
//             LOGGER.error(message, error);
//         }
// 
//         // Close the writer source.
//         try {
//             writer.getTarget().close();
//         } catch (IOException error) {
//             String message = String.format("failed closing writer target (outputUri=%s)", config.getOutputUri());
//             LOGGER.error(message, error);
//         }
// 
//     }
// 
//     public static void main(String[] args, DistillerModuleFactory moduleFactory) {
//         Config config = Config.of(args);
//         config.dump();
//         DistillerModule module = moduleFactory.create(config);
//         Injector injector = Guice.createInjector(module);
//         LoggerLevelAccessor loggerLevelAccessor = injector.getInstance(LoggerLevelAccessor.class);
//         LoggerLevels.applyLoggerLevelSpecs(config.getLoggerLevelSpecs(), loggerLevelAccessor);
//         try (Distiller distiller = injector.getInstance(Distiller.class)) {
//             distiller.run();
//         }
//     }
// 
// }


// Path: distiller-base64/src/main/java/com/vlkan/hrrs/distiller/base64/Base64Distiller.java
import com.vlkan.hrrs.distiller.cli.Distiller;
import java.io.IOException;

package com.vlkan.hrrs.distiller.base64;



public enum Base64Distiller {;

    public static void main(String[] args) throws IOException {
        Base64DistillerModuleFactory moduleFactory = new Base64DistillerModuleFactory();
        Distiller.main(args, moduleFactory);