diff --git a/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunner.java b/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunner.java index a5c62b3..7ae707c 100644 --- a/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunner.java +++ b/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunner.java @@ -226,9 +226,7 @@ public class BootstrapRunner { *
  • Load and validate the configuration.
  • *
  • Initialise the SQLite persistence schema. A {@link DocumentPersistenceException} * here is a hard startup failure and causes exit code 1.
  • - *
  • Resolve the run-lock file path, apply default if not configured.
  • - *
  • Create the batch use case with all required adapters wired.
  • - *
  • Execute the CLI command and map the outcome to an exit code.
  • + *
  • Execute the batch processing pipeline with dependencies wired.
  • * *

    * Document-level failures during the batch loop are not startup failures and @@ -243,13 +241,7 @@ public class BootstrapRunner { try { StartConfiguration config = loadAndValidateConfiguration(); initializeSchema(config); - RunLockPort runLockPort = runLockPortFactory.create(resolveLockFilePath(config)); - BatchRunContext runContext = createRunContext(); - BatchRunProcessingUseCase useCase = useCaseFactory.create(config, runLockPort); - SchedulerBatchCommand command = commandFactory.create(useCase); - BatchRunOutcome outcome = command.run(runContext); - runContext.setEndInstant(Instant.now()); - return mapOutcomeToExitCode(outcome, runContext); + return executeWithStartConfiguration(config); } catch (ConfigurationLoadingException e) { LOG.error("Configuration loading failed: {}", e.getMessage()); return 1; @@ -285,6 +277,28 @@ public class BootstrapRunner { schemaInitPortFactory.create(buildJdbcUrl(config)).initializeSchema(); } + /** + * Executes the batch processing pipeline with the prepared startup configuration. + *

    + * Wires all runtime dependencies, constructs adapters and the batch use case, + * invokes the CLI command, and maps the outcome to an exit code. + *

    + * This represents the execution phase after startup configuration is validated + * and persistence schema is initialized. + * + * @param config the validated startup configuration + * @return exit code: 0 for batch completion, 1 for critical runtime failures + */ + private int executeWithStartConfiguration(StartConfiguration config) { + RunLockPort runLockPort = runLockPortFactory.create(resolveLockFilePath(config)); + BatchRunContext runContext = createRunContext(); + BatchRunProcessingUseCase useCase = useCaseFactory.create(config, runLockPort); + SchedulerBatchCommand command = commandFactory.create(useCase); + BatchRunOutcome outcome = command.run(runContext); + runContext.setEndInstant(Instant.now()); + return mapOutcomeToExitCode(outcome, runContext); + } + /** * Resolves the run-lock file path from the configuration, applying a default when not set. */