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.reindexing;
007
008import org.apache.camel.builder.RouteBuilder;
009import org.fcrepo.camel.common.config.BasePropsConfig;
010import org.fcrepo.camel.common.config.ConditionOnPropertyTrue;
011import org.slf4j.Logger;
012import org.slf4j.LoggerFactory;
013import org.springframework.beans.factory.annotation.Value;
014import org.springframework.context.annotation.Bean;
015import org.springframework.context.annotation.Conditional;
016import org.springframework.context.annotation.Configuration;
017
018/**
019 * A configuration class for the re-indexer service
020 *
021 * @author dbernstein
022 */
023
024@Configuration
025@Conditional(FcrepoReindexingConfig.ReindexingEnabled.class)
026public class FcrepoReindexingConfig extends BasePropsConfig {
027
028    private static final Logger LOGGER = LoggerFactory.getLogger(FcrepoReindexingConfig.class);
029    static final String REINDEXING_ENABLED = "reindexing.enabled";
030
031    static class ReindexingEnabled extends ConditionOnPropertyTrue {
032        ReindexingEnabled() {
033            super(FcrepoReindexingConfig.REINDEXING_ENABLED, true);
034        }
035    }
036
037    @Value("${reindexing.stream:broker:queue:reindexing}")
038    private String reindexingStream;
039
040    @Value("${reindexing.rest.prefix:/reindexing}")
041    private String restPrefix;
042
043    @Value("${reindexing.rest.host:localhost}")
044    private String restHost;
045
046    @Value("${reindexing.rest.port:9080}")
047    private int restPort;
048
049
050    public String getReindexingStream() {
051        return reindexingStream;
052    }
053
054    public String getRestPrefix() {
055        return restPrefix;
056    }
057
058    public String getRestHost() {
059        return restHost;
060    }
061
062    public int getRestPort() {
063        return restPort;
064    }
065
066    @Bean
067    public RouteBuilder reindexingRoute() {
068        return new ReindexingRouter();
069    }
070}