You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by pu...@apache.org on 2017/01/03 20:11:04 UTC
[3/3] incubator-rya git commit: RYA-232 - Create a Mongo profile for
deploy rest service; Closes #133
RYA-232 - Create a Mongo profile for deploy rest service; Closes #133
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/591675e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/591675e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/591675e0
Branch: refs/heads/master
Commit: 591675e07b3bbe50f87998c6d61f84766710ec80
Parents: 9022484
Author: Lynne Lawrence <ly...@comcast.net>
Authored: Thu Dec 22 15:46:41 2016 -0500
Committer: pujav65 <pu...@gmail.com>
Committed: Tue Jan 3 15:10:06 2017 -0500
----------------------------------------------------------------------
README.md | 29 +++-
web/web.rya/pom.xml | 132 ++++++++++++-------
web/web.rya/resources/environment.properties | 2 +-
.../webapp/WEB-INF/spring/spring-mongodb.xml | 2 +-
.../WEB-INF/spring/spring-root-accumulo.xml | 68 ++++++++++
.../WEB-INF/spring/spring-root-mongodb.xml | 53 ++++++++
.../main/webapp/WEB-INF/spring/spring-root.xml | 68 ----------
web/web.rya/src/main/webapp/WEB-INF/web.xml | 2 +-
8 files changed, 239 insertions(+), 117 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e129033..70414fe 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,15 @@ Run the command to build the code `mvn clean install`
If all goes well, the build should be successful and a war should be produced in `web/web.rya/target/web.rya.war`
-Note: To perform a build of the geomesa/lucene indexing, run the build with the profile 'indexing' `mvn clean install -P indexing`
+Note: The following profiles are available to tailor the build:
+
+
+| Profile ID | Purpose |
+| ---------- | ------- |
+| geoindexing | perform a build of the geomesa/lucene indexing |
+| mongodb | build with mongoDB configuration (defaults to accumulo) |
+
+To run the build with the profile 'geoindexing' `mvn clean install -P geoindexing`.
Note: If you are building on windows, you will need hadoop-common 2.6.0's `winutils.exe` and `hadoop.dll`. You can download it from [here](https://github.com/amihalik/hadoop-common-2.6.0-bin/archive/master.zip). This build requires the [Visual C++ Redistributable for Visual Studio 2015 (x64)](https://www.microsoft.com/en-us/download/details.aspx?id=48145). Also you will need to set your path and Hadoop home using the commands below:
@@ -74,7 +82,9 @@ set PATH=%PATH%;c:\hadoop-common-2.6.0-bin\bin
Unwar the above war into the webapps directory.
-To point the web.rya war to the appropriate Accumulo instance, make a properties file `environment.properties` and put it in the classpath. Here is an example:
+To point the web.rya war to the appropriate database instance, make a properties file `environment.properties` and put it in the classpath.
+
+Here is an example for accumulo:
```
instance.name=accumulo #Accumulo instance name
@@ -85,6 +95,21 @@ rya.tableprefix=triplestore_ #Rya Table Prefix
rya.displayqueryplan=true #To display the query plan
```
+Here is an example for mongoDB (populate user/userpassword if authentication to mongoDB required):
+```
+rya.displayqueryplan=true
+sc.useMongo=true
+sc.use_freetext=true
+sc.geo.predicates=http://www.opengis.net/ont/geosparql#asWKT
+sc.freetext.predicates=http://www.w3.org/2000/01/rdf-schema#label
+mongo.db.instance=localhost
+mongo.db.port=27017
+mongo.db.name=rya
+mongo.db.collectionprefix=rya_
+mongo.db.user=
+mongo.db.userpassword=
+mongo.geo.maxdist=1e-10
+```
Start the Tomcat server. `./bin/startup.sh`
## Usage
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/pom.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/pom.xml b/web/web.rya/pom.xml
index 97d5d30..b3918d9 100644
--- a/web/web.rya/pom.xml
+++ b/web/web.rya/pom.xml
@@ -106,48 +106,92 @@ under the License.
<artifactId>commons-pool</artifactId>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <finalName>web.rya</finalName>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.26</version>
- <configuration>
- <webAppConfig>
- <contextPath>/web.rya</contextPath>
- <extraClasspath>resources</extraClasspath>
- </webAppConfig>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- RDF data Files -->
- <exclude>**/*.trig</exclude>
- <exclude>**/*.nt</exclude>
- <!-- data file -->
- <exclude>**/*.data</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>web.rya</finalName>
+ <resources>
+ <resource>
+ <!-- filter the web.xml so the correct db-related spring-root.xml will
+ be used -->
+ <!-- based on the profile settings, below. -->
+ <targetPath>${project.build.directory}</targetPath>
+ <filtering>true</filtering>
+ <directory>src/main/webapp/WEB-INF</directory>
+ <includes>
+ <include>web.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <!-- Use the web.xml that was filtered in the resources section. -->
+ <webXml>${project.build.directory}/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>9.4.0.v20161208</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <webApp>
+ <contextPath>/web.rya</contextPath>
+ <extraClasspath>resources</extraClasspath>
+ <!-- Use the web.xml that was filtered in the resources section. -->
+ <descriptor>${project.build.directory}/web.xml</descriptor>
+ </webApp>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- RDF data Files -->
+ <exclude>**/*.trig</exclude>
+ <exclude>**/*.nt</exclude>
+ <!-- data file -->
+ <exclude>**/*.data</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <profiles>
+ <profile>
+ <id>nodbspecified</id>
+ <activation>
+ <property>
+ <name>!db.specified</name>
+ </property>
+ </activation>
+ <properties>
+ <database.implementation>accumulo</database.implementation>
+ </properties>
+ </profile>
+ <profile>
+ <id>mongodb</id>
+ <properties>
+ <db.specified>true</db.specified>
+ <database.implementation>mongodb</database.implementation>
+ </properties>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/resources/environment.properties
----------------------------------------------------------------------
diff --git a/web/web.rya/resources/environment.properties b/web/web.rya/resources/environment.properties
index 7848a4e..2a9ffe7 100644
--- a/web/web.rya/resources/environment.properties
+++ b/web/web.rya/resources/environment.properties
@@ -24,4 +24,4 @@ rya.displayqueryplan=true
mongo.db.collectionprefix=rya_
mongo.db.instance=localhost
mongo.db.name=rya
-mongo.db.port=21017
+mongo.db.port=27017
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/src/main/webapp/WEB-INF/spring/spring-mongodb.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-mongodb.xml b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-mongodb.xml
index 5891cee..e99ec5f 100644
--- a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-mongodb.xml
+++ b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-mongodb.xml
@@ -38,6 +38,6 @@ under the License.
</bean>
<bean id="ryaDAO" class="org.apache.rya.mongodb.MongoDBRyaDAO" init-method="init" destroy-method="destroy">
- <property name="conf" ref="conf"/>
+ <constructor-arg ref="conf"/>
</bean>
</beans>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-accumulo.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-accumulo.xml b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-accumulo.xml
new file mode 100644
index 0000000..126df0e
--- /dev/null
+++ b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-accumulo.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
+
+ <bean id="environmentProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:environment.properties"/>
+ </bean>
+
+ <context:component-scan base-package="org.apache.cloud.rdf.web.sail" />
+
+ <import resource="spring-security.xml"/>
+ <import resource="spring-accumulo.xml"/>
+
+ <bean id="inferenceEngine" class="org.apache.rya.rdftriplestore.inference.InferenceEngine" init-method="init" destroy-method="destroy">
+ <property name="ryaDAO" ref="ryaDAO"/>
+ <property name="conf" ref="conf"/>
+ </bean>
+
+ <bean id="prospectTableName" class="org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO" factory-method="getProspectTableName">
+ <constructor-arg ref="conf"/>
+ </bean>
+
+ <bean id="prospectorService" class="org.apache.rya.prospector.service.ProspectorService">
+ <constructor-arg ref="connector"/>
+ <constructor-arg ref="prospectTableName"/>
+ </bean>
+
+ <bean id="rdfEvalStatsDAO" class="org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO">
+ <property name="prospectorService" ref="prospectorService"/>
+ <property name="conf" ref="conf"/>
+ </bean>
+
+ <bean id="rts" class="org.apache.rya.rdftriplestore.RdfCloudTripleStore">
+ <property name="ryaDAO" ref="ryaDAO"/>
+ <property name="rdfEvalStatsDAO" ref="rdfEvalStatsDAO"/>
+ <property name="inferenceEngine" ref="inferenceEngine"/>
+ <property name="conf" ref="conf"/>
+ </bean>
+
+ <bean id="sailRepo" class="org.apache.rya.rdftriplestore.RyaSailRepository" init-method="initialize" destroy-method="shutDown">
+ <constructor-arg ref="rts"/>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-mongodb.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-mongodb.xml b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-mongodb.xml
new file mode 100644
index 0000000..321890c
--- /dev/null
+++ b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root-mongodb.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
+
+ <bean id="environmentProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:environment.properties"/>
+ </bean>
+
+ <context:component-scan base-package="org.apache.cloud.rdf.web.sail" />
+
+ <import resource="spring-security.xml"/>
+ <import resource="spring-mongodb.xml"/>
+
+ <bean id="inferenceEngine" class="org.apache.rya.rdftriplestore.inference.InferenceEngine" init-method="init" destroy-method="destroy">
+ <property name="ryaDAO" ref="ryaDAO"/>
+ <property name="conf" ref="conf"/>
+ </bean>
+
+ <bean id="rts" class="org.apache.rya.rdftriplestore.RdfCloudTripleStore">
+ <property name="ryaDAO" ref="ryaDAO"/>
+ <property name="inferenceEngine" ref="inferenceEngine"/>
+ <property name="conf" ref="conf"/>
+ </bean>
+
+ <bean id="sailRepo" class="org.apache.rya.rdftriplestore.RyaSailRepository" init-method="initialize" destroy-method="shutDown">
+ <constructor-arg ref="rts"/>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root.xml b/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root.xml
deleted file mode 100644
index 126df0e..0000000
--- a/web/web.rya/src/main/webapp/WEB-INF/spring/spring-root.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
-
- <bean id="environmentProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location" value="classpath:environment.properties"/>
- </bean>
-
- <context:component-scan base-package="org.apache.cloud.rdf.web.sail" />
-
- <import resource="spring-security.xml"/>
- <import resource="spring-accumulo.xml"/>
-
- <bean id="inferenceEngine" class="org.apache.rya.rdftriplestore.inference.InferenceEngine" init-method="init" destroy-method="destroy">
- <property name="ryaDAO" ref="ryaDAO"/>
- <property name="conf" ref="conf"/>
- </bean>
-
- <bean id="prospectTableName" class="org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO" factory-method="getProspectTableName">
- <constructor-arg ref="conf"/>
- </bean>
-
- <bean id="prospectorService" class="org.apache.rya.prospector.service.ProspectorService">
- <constructor-arg ref="connector"/>
- <constructor-arg ref="prospectTableName"/>
- </bean>
-
- <bean id="rdfEvalStatsDAO" class="org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO">
- <property name="prospectorService" ref="prospectorService"/>
- <property name="conf" ref="conf"/>
- </bean>
-
- <bean id="rts" class="org.apache.rya.rdftriplestore.RdfCloudTripleStore">
- <property name="ryaDAO" ref="ryaDAO"/>
- <property name="rdfEvalStatsDAO" ref="rdfEvalStatsDAO"/>
- <property name="inferenceEngine" ref="inferenceEngine"/>
- <property name="conf" ref="conf"/>
- </bean>
-
- <bean id="sailRepo" class="org.apache.rya.rdftriplestore.RyaSailRepository" init-method="initialize" destroy-method="shutDown">
- <constructor-arg ref="rts"/>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/591675e0/web/web.rya/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/web/web.rya/src/main/webapp/WEB-INF/web.xml b/web/web.rya/src/main/webapp/WEB-INF/web.xml
index 0b8de72..a109ba7 100644
--- a/web/web.rya/src/main/webapp/WEB-INF/web.xml
+++ b/web/web.rya/src/main/webapp/WEB-INF/web.xml
@@ -30,7 +30,7 @@ under the License.
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
- /WEB-INF/spring/spring-root.xml
+ /WEB-INF/spring/spring-root-${database.implementation}.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>