package com.megatim.apifdxweb.service.impl.camel.config; import java.io.IOException; /** * * @author Gabuntu */ public class LocalConfiguration { private final FileProperties fileProperties; public LocalConfiguration(FileProperties fileProperties) { this.fileProperties = fileProperties; } public String referentielRouteURI() throws IOException { return "file:" + referentielLocalPath() + "?include=.*.zip" + routeParameters(); } public String fichierRouteURI() throws IOException { return "file:" + fichierLocalPath() + "?include=.*.txt" + routeParameters(); } public String standaloneTmpRouteURI() throws IOException { return "file:" + standaloneTmpDir() + "?include=.*.txt" + routeParameters(); } public String standaloneRouteURI() throws IOException { return "file:" + standaloneDestinationDir() + "?include=.*.txt" + routeParameters(); } public String standaloneTmpDir() throws IOException { return fileProperties.properties().getProperty("fdx.api.integration-standalone-temp-dir"); } public boolean isCorrect() throws IOException { return referentielLocalPath() != null && fichierLocalPath() != null && standaloneTmpDir() != null && standaloneDestinationDir() != null; } private String routeParameters() { return "&moveFailed=error&noop=true&readLock=changed"; } public String referentielLocalPath() throws IOException { return fileProperties.properties().getProperty("fdx.api.referentiel-integration-local-path"); } public String fichierLocalPath() throws IOException { return fileProperties.properties().getProperty("fdx.api.fichier-integration-local-path"); } private String standaloneDestinationDir() throws IOException { return fileProperties.properties().getProperty("fdx.api.integration-standalone-destination-dir"); } }