001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.camel.httpforwarding;
007
008import org.apache.camel.builder.RouteBuilder;
009import org.apache.camel.component.http.HttpComponent;
010import org.fcrepo.camel.common.config.BasePropsConfig;
011import org.fcrepo.camel.common.config.ConditionOnPropertyTrue;
012import org.springframework.beans.factory.annotation.Value;
013import org.springframework.context.annotation.Bean;
014import org.springframework.context.annotation.Conditional;
015import org.springframework.context.annotation.Configuration;
016
017/**
018 * A configuration class for the Http Indexer service
019 *
020 * @author Geoff Scholl
021 * @author Demian Katz
022 */
023@Configuration
024@Conditional(FcrepoHttpForwardingConfig.HttpForwardingingEnabled.class)
025public class FcrepoHttpForwardingConfig extends BasePropsConfig {
026
027    static final String HTTP_FORWARDING_ENABLED = "http.enabled";
028
029    static class HttpForwardingingEnabled extends ConditionOnPropertyTrue {
030        HttpForwardingingEnabled() {
031            super(FcrepoHttpForwardingConfig.HTTP_FORWARDING_ENABLED, false);
032        }
033    }
034
035    @Value("${http.input.stream:broker:topic:fedora}")
036    private String inputStream;
037
038    @Value("${http.reindex.stream:broker:queue:http.reindex}")
039    private String reindexStream;
040
041    @Value("${http.filter.containers:http://localhost:8080/fcrepo/rest/audit}")
042    private String filterContainers;
043
044    @Value("${http.baseUrl:}")
045    private String httpBaseUrl;
046
047    @Value("${http.authUsername:}")
048    private String httpAuthUsername;
049
050    @Value("${http.authPassword:}")
051    private String httpAuthPassword;
052
053    public String getInputStream() {
054        return inputStream;
055    }
056
057    public String getReindexStream() {
058        return reindexStream;
059    }
060
061    public String getFilterContainers() {
062        return filterContainers;
063    }
064
065    public String getHttpBaseUrl() {
066        return httpBaseUrl;
067    }
068
069    public String getHttpAuthUsername() {
070        return httpAuthUsername;
071    }
072
073    public String getHttpAuthPassword() {
074        return httpAuthPassword;
075    }
076
077
078    @Bean(name = "http")
079    public HttpComponent http() {
080        return new HttpComponent();
081    }
082
083    @Bean(name = "https")
084    public HttpComponent https() {
085        return new HttpComponent();
086    }
087
088    @Bean
089    public RouteBuilder httpRoute() {
090        return new HttpRouter();
091    }
092}