columnSelectors = Set.of();
-
- /**
- * Descriptive name of the contents. This will be used as baseline for the target archive name and its contents.
- * If not specified then this will be deduced from the source dataset name.
- * Should not include file suffixes such as .csv or .json.
- */
- private String targetContentName;
-
- /**
- * The content type of the resulting file.
- * Defaults to application/json.
- */
- @Schema(implementation = String.class, allowableValues = {
- MediaType.APPLICATION_JSON, MoreMediaTypes.TEXT_CSV})
- private MediaType targetContentType = MediaType.APPLICATION_JSON_TYPE;
-
- /** The password for the resulting archive */
- @NotBlank
- @Schema(implementation = String.class)
- @Min(9)
- private char[] targetPassword;
-
- /** Whether or not to depseudonymize dataset during export */
- private Boolean depseudonymize = false;
-
- /**
- * Pseudonymization rules to be used to depseudonymize the dataset. This is only
- * relevant if depseudonymize=true.
- *
- * If not specified then pseudonymization rules are read from the
- * dataset's dataset-meta.json file.
- */
- private List pseudoRules = new ArrayList<>();
- }
-}
diff --git a/src/main/java/no/ssb/dlp/pseudo/service/export/ExportService.java b/src/main/java/no/ssb/dlp/pseudo/service/export/ExportService.java
deleted file mode 100644
index b41c2a4..0000000
--- a/src/main/java/no/ssb/dlp/pseudo/service/export/ExportService.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package no.ssb.dlp.pseudo.service.export;
-
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Stopwatch;
-import io.micronaut.context.event.ApplicationEventPublisher;
-import io.micronaut.core.annotation.Introspected;
-import io.micronaut.http.MediaType;
-import io.micronaut.runtime.event.annotation.EventListener;
-import io.micronaut.scheduling.annotation.Async;
-import io.reactivex.Flowable;
-import lombok.*;
-import lombok.experimental.Accessors;
-import lombok.extern.slf4j.Slf4j;
-import no.ssb.dapla.dataset.api.DatasetMeta;
-import no.ssb.dapla.parquet.FieldInterceptor;
-import no.ssb.dapla.storage.client.DatasetStorage;
-import no.ssb.dapla.storage.client.backend.gcs.GoogleCloudStorageBackend;
-import no.ssb.dlp.pseudo.core.FieldPseudoInterceptor;
-import no.ssb.dlp.pseudo.core.func.PseudoFuncRule;
-import no.ssb.dlp.pseudo.core.func.PseudoFuncs;
-import no.ssb.dlp.pseudo.core.PseudoOperation;
-import no.ssb.dlp.pseudo.core.file.Compression;
-import no.ssb.dlp.pseudo.core.file.MoreMediaTypes;
-import no.ssb.dlp.pseudo.core.map.RecordMapSerializerFactory;
-import no.ssb.dlp.pseudo.core.util.Json;
-import no.ssb.dlp.pseudo.core.util.PathJoiner;
-import no.ssb.dlp.pseudo.core.util.Zips;
-import no.ssb.dlp.pseudo.service.datasetmeta.DatasetMetaService;
-import no.ssb.dlp.pseudo.service.pseudo.PseudoConfig;
-import no.ssb.dlp.pseudo.service.pseudo.PseudoSecrets;
-
-import javax.inject.Singleton;
-import javax.validation.constraints.NotNull;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.time.format.DateTimeFormatter;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.google.common.base.CharMatcher.anyOf;
-import static com.google.common.base.CharMatcher.inRange;
-import static no.ssb.dlp.pseudo.core.util.Zips.ZipOptions.zipOpts;
-
-@RequiredArgsConstructor
-@Singleton
-@Slf4j
-public class ExportService {
-
- private static final CharMatcher ALLOWED_FILENAME_CHARACTERS = inRange('a', 'z')
- .or(inRange('A', 'Z'))
- .or(inRange('0', '9'))
- .or(anyOf("_-"));
-
- private final ExportConfig exportConfig;
- private final DatasetStorage datasetClient;
- private final GoogleCloudStorageBackend storageBackend;
- private final PseudoSecrets pseudoSecrets;
- private final DatasetMetaService datasetMetaService;
- private final ApplicationEventPublisher eventPublisher;
-
- public DatasetExportResult export(DatasetExport e) {
- final DatasetExportReport report = new DatasetExportReport(e);
- final DatasetMeta sourceDatasetMeta = datasetMetaService.readDatasetMeta(e.getSourceDataset().legacyDatasetUri()).orElse(null);
-
- // Initialize target names
- if (e.getTargetContentName() == null || e.getTargetContentName().isBlank()) {
- // if not specified then deduce content name from dataset name
- e.setTargetContentName(e.getSourceDataset().getPath().replaceFirst(".*/([^/?]+).*", "$1"));
- }
- String targetRootLocation = targetRootLocationOf(e.getSourceDataset());
- String targetArchiveUri = targetFileLocationOf(targetRootLocation, archiveFilenameOf(e.getTargetContentName(), e.getCompression().getType()));
-
- eventPublisher.publishEvent(ExportEvent.builder()
- .targetRootLocation(targetRootLocation)
- .targetArchiveUri(targetArchiveUri)
- .datasetExport(e)
- .report(report)
- .sourceDataset(e.getSourceDataset())
- .sourceDatasetMeta(sourceDatasetMeta)
- .build());
-
- return DatasetExportResult.builder()
- .targetUri(targetArchiveUri)
- .build();
- }
-
- @EventListener
- @Async
- public void onExportEvent(ExportEvent e) {
- final Stopwatch stopwatch = Stopwatch.createStarted();
- final AtomicInteger counter = new AtomicInteger();
-
- // Initialize depseudo mechanism if needed - else use a noOp interceptor
- FieldInterceptor fieldPseudoInterceptor = initPseudoInterceptor(e.datasetExport(), e.sourceDatasetMeta(), e.report());
-
- // Initiate record stream
- log.debug("Read parquet records");
- Flowable