Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.megatim.fdxcommons.model.camel;
 
import java.io.IOException;
 
/**
 *
 * @author Gabuntu
 */
public class CamelRouteConfiguration {
 
    private final LocalConfiguration localConfiguration;
    private final SftpConfiguration sftpConfiguration;
 
    public CamelRouteConfiguration(String configurationFilePath) {
        FileProperties fileProperties = new FileProperties(configurationFilePath);
        localConfiguration = new LocalConfiguration(fileProperties);
        sftpConfiguration = new SftpConfiguration(fileProperties);
    }
 
    public boolean isStandaloneSftpConfigCorrect() throws IOException {
        return sftpConfiguration.isStandaloneCorrect();
    }
 
    public boolean isStandaloneLocalConfigCorrect() throws IOException {
        return localConfiguration.isStandaloneCorrect();
    }
 
    public boolean isConsultationConfigCorrect() throws IOException {
        return localConfiguration.isConsultationCorrect() || sftpConfiguration.isConsultationCorrect();
    }
 
    public LocalConfiguration getLocalConfiguration() {
        return localConfiguration;
    }
 
    public SftpConfiguration getSftpConfiguration() {
        return sftpConfiguration;
    }
 
    public String standaloneURI() throws IOException {
        return isStandaloneStfpConfigCorrect()
                ? getSftpConfiguration().standaloneRouteURI()
                : getLocalConfiguration().standaloneRouteURI();
    }
 
    public String consultationURI() throws IOException {
        return isConsultationStfpConfigCorrect()
                ? getSftpConfiguration().consultationRouteURI()
                : getLocalConfiguration().consultationRouteURI();
    }
 
    private boolean isStandaloneStfpConfigCorrect() throws IOException {
        return sftpConfiguration.isStandaloneCorrect();
    }
 
    private boolean isConsultationStfpConfigCorrect() throws IOException {
        return sftpConfiguration.isStandaloneCorrect();
    }
 
}