Navigation Menu

Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Factored out API and factored Solr indexer into new module
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Jan 7, 2014
1 parent a9269e1 commit 8ec51e6
Show file tree
Hide file tree
Showing 35 changed files with 644 additions and 215 deletions.
42 changes: 42 additions & 0 deletions fcrepo-jms-indexer-api/pom.xml
@@ -0,0 +1,42 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-jms-indexer-pluggable</artifactId>
<version>4.0.0-alpha-3-SNAPSHOT</version>
</parent>
<artifactId>fcrepo-jms-indexer-api</artifactId>
<name>Indexer API</name>
<description>Contains types for Java and JCR.</description>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -13,18 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.fcrepo.indexer;

import java.io.InputStream;
import java.util.concurrent.Callable;

/**
* Implemented by classes that retrieve indexable content for a resource.
*
*
*/
/**
* @author ajs6f
* @date Dec 6, 2013
* @date Jan 7, 2014
*/
public interface IndexableContentRetriever extends Callable<InputStream> {

}
package org.fcrepo.indexer;
1 change: 1 addition & 0 deletions fcrepo-jms-indexer-core/.gitignore
@@ -0,0 +1 @@
/target
80 changes: 34 additions & 46 deletions fcrepo-jms-indexer-core/pom.xml
Expand Up @@ -14,9 +14,16 @@
<packaging>jar</packaging>

<dependencies>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-jms-indexer-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -121,36 +128,7 @@
<groupId>org.apache.jena</groupId>
<artifactId>jena-fuseki</artifactId>
<scope>test</scope>
<!-- <exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions> -->
</dependency>
<!-- Start of Solr Indexer libs -->
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-test-framework</artifactId>
</dependency> -->
<!-- HttpClient are used for create standardalone SolrIndexer Server client.
They seem to be included with Solr 3.6.2?
Ver 4.2.5 aim to fit JENA included version -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<!-- End of Solr Indexer libs -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand All @@ -165,7 +143,16 @@
</resource>
</resources>
<plugins>

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.2</version>
Expand Down Expand Up @@ -245,9 +232,24 @@
</goals>
</execution>
</executions>

</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<configuration>
<resourceBundles>
<resourceBundle>org.fcrepo:fcrepo-jms-indexer-api:${project.version}</resourceBundle>
</resourceBundles>
</configuration>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand All @@ -263,18 +265,4 @@
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${solr.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-facet</artifactId>
<version>${solr.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Expand Up @@ -79,33 +79,14 @@ public void setUp() throws ClientProtocolException, IOException {
LOGGER.debug("Installing indexing type information...");
update = new HttpPost(serverAddress + "fcr:nodetypes");
update.setHeader("Content-Type", "text/cnd");
HttpEntity cnd =
final HttpEntity cnd =
new StringEntity(Files.toString(new File(
"target/classes/indexing.cnd"), defaultCharset()));
"target/maven-shared-archive-resources/indexing.cnd"),
defaultCharset()));
update.setEntity(cnd);
response = client.execute(update);
assertEquals("Failed to install indexing type information!",
SC_NO_CONTENT, response.getStatusLine().getStatusCode());

LOGGER.debug("Installing indexing test type information...");
update = new HttpPost(serverAddress + "fcr:nodetypes");
update.setHeader("Content-Type", "text/cnd");
cnd =
new StringEntity(Files.toString(new File(
"target/test-classes/indexingtest.cnd"), defaultCharset()));
update.setEntity(cnd);
response = client.execute(update);
assertEquals("Failed to install indexing test type information!",
SC_NO_CONTENT, response.getStatusLine().getStatusCode());
/*HttpGet nsRequest = new HttpGet(serverAddress + "fcr:namespaces");
nsRequest.setHeader("Content-Type", WebContent.contentTypeN3Alt1);
LOGGER.debug("Now registered namespaces include:\n{}", IOUtils
.toString(client.execute(nsRequest).getEntity().getContent()));
nsRequest = new HttpGet(serverAddress + "fcr:nodetypes");
nsRequest.setHeader("Content-Type", WebContent.contentTypeN3Alt1);
LOGGER.debug("and registered node types:\n{}", IOUtils.toString(client
.execute(nsRequest).getEntity().getContent()));*/

}


Expand Down
3 changes: 0 additions & 3 deletions fcrepo-jms-indexer-core/src/test/resources/indexingtest.cnd

This file was deleted.

Expand Up @@ -3,50 +3,23 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd">

<!-- sparql-update indexer -->
<bean id="sparqlUpdate" class="org.fcrepo.indexer.sparql.SparqlIndexer">

<!-- fuseki -->
<property name="queryBase"
value="http://localhost:${test.fuseki.port:3030}/test/query"/>
<property name="updateBase"
value="http://localhost:${test.fuseki.port:3030}/test/update"/>
<property name="formUpdates">
<value type="java.lang.Boolean">false</value>
</property>

</bean>
<bean id="sparqlUpdate" class="org.fcrepo.indexer.sparql.SparqlIndexer"
p:queryBase="http://localhost:${test.fuseki.port:3030}/test/query"
p:updateBase="http://localhost:${test.fuseki.port:3030}/test/update"
p:formUpdates="false"/>

<!-- test indexer -->
<bean id="testIndexer" class="org.fcrepo.indexer.TestIndexer"/>

<!-- file serializer -->
<bean id="fileSerializer" class="org.fcrepo.indexer.FileSerializer">
<property name="path" value="./target/test-classes/fileSerializer/"/>
</bean>

<!-- Solr Indexer START-->
<bean id="solrIndexer" class="org.fcrepo.indexer.solr.SolrIndexer"/>

<bean class="java.io.File" id="solrConfig">
<constructor-arg type="String">
<value>target/test-classes/solr/solr.xml</value>
</constructor-arg>
</bean>

<!--Embedded Server -->
<bean id="multiCore" class="org.apache.solr.core.CoreContainer"
factory-method="createAndLoad" c:solrHome="target/test-classes/solr"
c:configFile-ref="solrConfig"/>

<bean id="solrServer"
class="org.apache.solr.client.solrj.embedded.EmbeddedSolrServer"
c:coreContainer-ref="multiCore" c:coreName="testCore"/>
<!-- Solr Indexer END-->
<bean id="fileSerializer" class="org.fcrepo.indexer.FileSerializer"
p:path="./target/test-classes/fileSerializer/"/>

<!-- Message Driven POJO (MDP) that manages individual indexers -->
<bean id="indexerGroup" class="org.fcrepo.indexer.IndexerGroup">
Expand All @@ -56,7 +29,6 @@
<ref bean="testIndexer"/>
<ref bean="fileSerializer"/>
<ref bean="sparqlUpdate"/>
<ref bean="solrIndexer"/>
</set>
</property>
</bean>
Expand Down
56 changes: 55 additions & 1 deletion fcrepo-jms-indexer-elasticsearch/pom.xml
Expand Up @@ -10,14 +10,24 @@
<description>Fedora JMS-driven indexer for Elasticsearch</description>

<properties>
<es.lucene.version>4.5.1</es.lucene.version>
<es.lucene.version>4.6.0</es.lucene.version>
</properties>

<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-jms-indexer-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-jms-indexer-core</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -46,12 +56,36 @@
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-memory</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-join</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-join</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-suggest</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-codecs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand All @@ -70,6 +104,26 @@
<artifactId>lucene-facet</artifactId>
<version>${es.lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-join</artifactId>
<version>${es.lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>${es.lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-suggest</artifactId>
<version>${es.lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-codecs</artifactId>
<version>${es.lucene.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

0 comments on commit 8ec51e6

Please sign in to comment.