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.audit.triplestore; 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.slf4j.Logger; 013import org.slf4j.LoggerFactory; 014import org.springframework.beans.factory.annotation.Value; 015import org.springframework.context.annotation.Bean; 016import org.springframework.context.annotation.Conditional; 017import org.springframework.context.annotation.Configuration; 018 019/** 020 * A configuration class for the audit triplestore service 021 * 022 * @author dbernstein 023 */ 024@Configuration 025@Conditional({FcrepoAuditTriplestoreConfig.AuditTriplestoreEnabled.class}) 026public class FcrepoAuditTriplestoreConfig extends BasePropsConfig { 027 028 private static final Logger LOGGER = LoggerFactory.getLogger(FcrepoAuditTriplestoreConfig.class); 029 static final String AUDIT_ENABLED = "audit.enabled"; 030 031 static class AuditTriplestoreEnabled extends ConditionOnPropertyTrue { 032 AuditTriplestoreEnabled() { 033 super(FcrepoAuditTriplestoreConfig.AUDIT_ENABLED, false); 034 } 035 } 036 037 @Value("${audit.input.stream:broker:topic:fedora}") 038 private String inputStream; 039 040 @Value("${audit.event.baseUri:http://example.com/event}") 041 private String eventBaseUri; 042 043 @Value("${audit.triplestore.baseUrl:http://localhost:3030/fuseki/test/update}") 044 private String triplestoreBaseUrl; 045 046 @Value("${audit.triplestore.authUsername:}") 047 private String triplestoreAuthUsername; 048 049 @Value("${audit.triplestore.authPassword:}") 050 private String tripleStoreAuthPassword; 051 052 @Value("${audit.filter.containers:http://localhost:8080/fcrepo/rest/audit}") 053 private String filterContainers; 054 055 @Bean(name = "http") 056 public HttpComponent http() { 057 return new HttpComponent(); 058 } 059 060 @Bean(name = "https") 061 public HttpComponent https() { 062 return new HttpComponent(); 063 } 064 065 @Bean 066 public RouteBuilder route() { 067 return new EventRouter(); 068 } 069 070 public String getTriplestoreBaseUrl() { 071 return triplestoreBaseUrl; 072 } 073 074 public String getTriplestoreAuthPassword() { 075 return tripleStoreAuthPassword; 076 } 077 078 public String getTriplestoreAuthUsername() { 079 return triplestoreAuthUsername; 080 } 081 082 public String getFilterContainers() { 083 return filterContainers; 084 } 085 086 public String getEventBaseUri() { 087 return eventBaseUri; 088 } 089 090 public String getInputStream() { 091 return inputStream; 092 } 093}