-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FCREPO-3753 #166
FCREPO-3753 #166
Changes from 1 commit
0636a82
43ab524
842d311
44e71fe
f5a2931
d883035
794a624
b3930d3
11aae05
6e98016
a0828b3
6f37847
251d949
8c8b6d7
aa57713
3fcee5a
5b10fe0
a2540b8
849dd95
a800275
c5b4d04
17bd46c
38c2b6d
f821cc6
9084326
ec45ce0
5d18b81
373ea19
9584d77
fc153d5
dee9860
347f95e
fc916b8
a7c09f3
c870401
8bf3c15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>fcrepo-camel-toolbox</artifactId> | ||
<groupId>org.fcrepo.camel</groupId> | ||
<version>6.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>fcrepo-indexing-http</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Fedora Indexing Service with a Http backend</name> | ||
<description>Camel-based indexing service for Http</description> | ||
|
||
<properties> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-spring-javaconfig</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-http</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-mustache</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.fcrepo.camel</groupId> | ||
<artifactId>fcrepo-camel</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.fcrepo.client</groupId> | ||
<artifactId>fcrepo-java-client</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>${project.parent.groupId}</groupId> | ||
<artifactId>fcrepo-camel-common</artifactId> | ||
<version>${project.parent.version}</version> | ||
</dependency> | ||
|
||
<!-- logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</dependency> | ||
|
||
<!-- Testing & Camel Plugin --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-test-spring</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>xerces</groupId> | ||
<artifactId>xercesImpl</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<defaultGoal>install</defaultGoal> | ||
|
||
<plugins> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
|
||
<!--plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin--> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
</plugin> | ||
|
||
<!-- to generate the MANIFEST-FILE of the bundle --> | ||
</plugins> | ||
</build> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed to DuraSpace under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* DuraSpace licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.fcrepo.camel.indexing.http; | ||
|
||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.http.HttpComponent; | ||
import org.fcrepo.camel.common.config.BasePropsConfig; | ||
import org.fcrepo.camel.common.config.ConditionOnPropertyTrue; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Conditional; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* A configuration class for the Http Indexer service | ||
* | ||
* @author Geoff Scholl, Demian Katz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the convention for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separate line I believe is preferable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks -- fixed! |
||
*/ | ||
@Configuration | ||
@Conditional(FcrepoHttpIndexerConfig.HttpIndexerEnabled.class) | ||
public class FcrepoHttpIndexerConfig extends BasePropsConfig { | ||
|
||
static final String HTTP_INDEXER_ENABLED = "http.indexer.enabled"; | ||
|
||
static class HttpIndexerEnabled extends ConditionOnPropertyTrue { | ||
HttpIndexerEnabled() { | ||
super(FcrepoHttpIndexerConfig.HTTP_INDEXER_ENABLED, false); | ||
} | ||
} | ||
|
||
@Value("${input.stream:broker:topic:fedora}") | ||
dbernstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private String inputStream; | ||
|
||
@Value("${http.reindex.stream:broker:queue:http.reindex}") | ||
private String reindexStream; | ||
|
||
@Value("${filter.containers:http://localhost:8080/fcrepo/rest/audit}") | ||
dbernstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private String filterContainers; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this is for; is it used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for ignoring messages from resources that start with the specified paths. |
||
|
||
@Value("${http.baseUrl:http://localhost:8983/http/collection1}") | ||
dbernstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private String httpBaseUrl; | ||
|
||
public String getInputStream() { | ||
return inputStream; | ||
} | ||
|
||
public String getReindexStream() { | ||
return reindexStream; | ||
} | ||
|
||
public String getHttpBaseUrl() { | ||
return httpBaseUrl; | ||
} | ||
|
||
|
||
@Bean(name = "http") | ||
public HttpComponent http() { | ||
return new HttpComponent(); | ||
} | ||
|
||
@Bean(name = "https") | ||
public HttpComponent https() { | ||
return new HttpComponent(); | ||
} | ||
|
||
@Bean | ||
public RouteBuilder httpRoute() { | ||
return new HttpRouter(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Licensed to DuraSpace under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* DuraSpace licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.fcrepo.camel.indexing.http; | ||
|
||
import org.apache.camel.LoggingLevel; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.support.builder.Namespaces; | ||
import org.fcrepo.camel.processor.EventProcessor; | ||
import org.slf4j.Logger; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static org.apache.camel.Exchange.HTTP_METHOD; | ||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
/** | ||
* A content router for handling JMS events. | ||
* | ||
* @author Geoff Scholl, Demian Katz | ||
*/ | ||
public class HttpRouter extends RouteBuilder { | ||
|
||
private static final Logger logger = getLogger(HttpRouter.class); | ||
|
||
@Autowired | ||
private FcrepoHttpIndexerConfig config; | ||
|
||
/** | ||
* Configure the message route workflow. | ||
*/ | ||
public void configure() throws Exception { | ||
|
||
final Namespaces ns = new Namespaces("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); | ||
ns.add("indexing", "http://fedora.info/definitions/v4/indexing#"); | ||
ns.add("ldp", "http://www.w3.org/ns/ldp#"); | ||
|
||
/* | ||
* A generic error handler (specific to this RouteBuilder) | ||
*/ | ||
onException(Exception.class) | ||
.maximumRedeliveries(config.getMaxRedeliveries()) | ||
.log("Index Routing Error: ${routeId}"); | ||
|
||
/* | ||
* route a message to the proper queue | ||
*/ | ||
from(config.getInputStream()) | ||
.routeId("FcrepoHttpRouter") | ||
.process(new EventProcessor()) | ||
.log(LoggingLevel.TRACE, "Received message from Fedora routing to index.http") | ||
.to("direct:send.to.http"); | ||
|
||
/* | ||
* Handle re-index events | ||
*/ | ||
from(config.getReindexStream()) | ||
.routeId("FcrepoHttpReindex") | ||
.to("direct:send.to.http"); | ||
dbernstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/* | ||
* Forward message to Http | ||
*/ | ||
from("direct:send.to.http").routeId("FcrepoHttpSend") | ||
.log(LoggingLevel.INFO, logger, "sending to http...") | ||
.setHeader(HTTP_METHOD).constant("POST") | ||
.to(config.getHttpBaseUrl()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that some of these dependencies aren't actually needed here; we based this pom.xml on the Solr component, and there's probably some junk that can be trimmed out.