rya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From miha...@apache.org
Subject [26/52] [abbrv] incubator-rya git commit: RYA-81 Fixed a bug in the RyaSailFactory where the Rya DAO wasn't been placed within the store object and where the Accumulo table names were not matching the table prefix.
Date Fri, 26 Aug 2016 00:06:47 GMT
RYA-81 Fixed a bug in the RyaSailFactory where the Rya DAO wasn't been placed within the store
object and where the Accumulo table names were not matching the table prefix.


Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/ab56da1c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/ab56da1c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/ab56da1c

Branch: refs/heads/master
Commit: ab56da1c09e57ad4c41a4c369be5f431883705ba
Parents: 12b8ce6
Author: Kevin Chilton <kevin.chilton@parsons.com>
Authored: Tue Jul 19 21:33:29 2016 -0400
Committer: Aaron Mihalik <mihalik@alum.mit.edu>
Committed: Tue Aug 23 10:41:37 2016 -0400

----------------------------------------------------------------------
 .../api/instance/RyaDetailsToConfiguration.java | 18 ++++++++++++
 .../mvm/rya/sail/config/RyaSailFactory.java     | 30 +++++++++++---------
 2 files changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ab56da1c/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java
b/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java
index 8c7ba6e..75ae416 100644
--- a/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java
+++ b/common/rya.api/src/main/java/mvm/rya/api/instance/RyaDetailsToConfiguration.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
 package mvm.rya.api.instance;
 
 import org.apache.hadoop.conf.Configuration;

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ab56da1c/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
index 54b872c..ef1f59f 100644
--- a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
+++ b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
@@ -42,6 +42,7 @@ import mvm.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository;
 import mvm.rya.api.RdfCloudTripleStoreConfiguration;
 import mvm.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException;
 import mvm.rya.api.instance.RyaDetailsToConfiguration;
+import mvm.rya.api.layout.TablePrefixLayoutStrategy;
 import mvm.rya.api.persist.RyaDAO;
 import mvm.rya.api.persist.RyaDAOException;
 import mvm.rya.indexing.accumulo.ConfigUtils;
@@ -62,22 +63,25 @@ public class RyaSailFactory {
 
     private static Sail getRyaSail(final Configuration config) throws InferenceEngineException,
RyaDAOException, AccumuloException, AccumuloSecurityException {
         final RdfCloudTripleStore store = new RdfCloudTripleStore();
-        final RyaDAO dao;
+        final RyaDAO<?> dao;
         final RdfCloudTripleStoreConfiguration rdfConfig;
 
         final String user = config.get(ConfigUtils.CLOUDBASE_USER);
         final String pswd = config.get(ConfigUtils.CLOUDBASE_PASSWORD);
-        final String instance = config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX);
+        final String ryaInstance = config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX);
+
         if(ConfigUtils.getUseMongo(config)) {
             rdfConfig = new MongoDBRdfConfiguration(config);
-            final MongoClient client = updateMongoConfig((MongoDBRdfConfiguration) rdfConfig,
user, pswd, instance);
+            final MongoClient client = updateMongoConfig((MongoDBRdfConfiguration) rdfConfig,
user, pswd, ryaInstance);
             dao = getMongoDAO((MongoDBRdfConfiguration)rdfConfig, client);
         } else {
             rdfConfig = new AccumuloRdfConfiguration(config);
-            updateAccumuloConfig((AccumuloRdfConfiguration) rdfConfig, user, pswd, instance);
+            rdfConfig.setTableLayoutStrategy( new TablePrefixLayoutStrategy(ryaInstance)
);
+            updateAccumuloConfig((AccumuloRdfConfiguration) rdfConfig, user, pswd, ryaInstance);
             dao = getAccumuloDAO((AccumuloRdfConfiguration)rdfConfig);
         }
-        rdfConfig.setTablePrefix(instance);
+        store.setRyaDAO(dao);
+        rdfConfig.setTablePrefix(ryaInstance);
 
         if (rdfConfig.isInfer()){
             final InferenceEngine inferenceEngine = new InferenceEngine();
@@ -90,7 +94,7 @@ public class RyaSailFactory {
         return store;
     }
 
-    private static RyaDAO getMongoDAO(final MongoDBRdfConfiguration config, final MongoClient
client) throws RyaDAOException {
+    private static MongoDBRyaDAO getMongoDAO(final MongoDBRdfConfiguration config, final
MongoClient client) throws RyaDAOException {
         MongoDBRyaDAO dao = null;
         ConfigUtils.setIndexers(config);
         if(client != null) {
@@ -106,7 +110,7 @@ public class RyaSailFactory {
         return dao;
     }
 
-    private static RyaDAO getAccumuloDAO(final AccumuloRdfConfiguration config) throws AccumuloException,
AccumuloSecurityException, RyaDAOException {
+    private static AccumuloRyaDAO getAccumuloDAO(final AccumuloRdfConfiguration config) throws
AccumuloException, AccumuloSecurityException, RyaDAOException {
         final Connector connector = ConfigUtils.getConnector(config);
         final AccumuloRyaDAO dao = new AccumuloRyaDAO();
         dao.setConnector(connector);
@@ -119,8 +123,8 @@ public class RyaSailFactory {
         return dao;
     }
 
-    private static MongoClient updateMongoConfig(final MongoDBRdfConfiguration config, final
String user, final String pswd, final String instance) throws RyaDAOException {
-        final MongoCredential creds = MongoCredential.createCredential(user, instance, pswd.toCharArray());
+    private static MongoClient updateMongoConfig(final MongoDBRdfConfiguration config, final
String user, final String pswd, final String ryaInstance) throws RyaDAOException {
+        final MongoCredential creds = MongoCredential.createCredential(user, ryaInstance,
pswd.toCharArray());
         final String hostname = config.getMongoInstance();
         final int port = Integer.parseInt(config.getMongoPort());
 
@@ -130,21 +134,21 @@ public class RyaSailFactory {
             final MongoRyaInstanceDetailsRepository ryaDetailsRepo = new MongoRyaInstanceDetailsRepository(client,
config.getCollectionName());
             RyaDetailsToConfiguration.addRyaDetailsToConfiguration(ryaDetailsRepo.getRyaInstanceDetails(),
config);
         } catch(final RyaDetailsRepositoryException e) {
-            LOG.info("Instance does not have a rya details collection, skipping.", e);
+            LOG.info("Instance does not have a rya details collection, skipping.");
         } catch (final UnknownHostException ue) {
             throw new RyaDAOException("Unable to connect to mongo at the configured location.",
ue);
         }
         return client;
     }
 
-    private static void updateAccumuloConfig(final AccumuloRdfConfiguration config, final
String user, final String pswd, final String instance) throws AccumuloException, AccumuloSecurityException
{
+    private static void updateAccumuloConfig(final AccumuloRdfConfiguration config, final
String user, final String pswd, final String ryaInstance) throws AccumuloException, AccumuloSecurityException
{
         try {
             final PasswordToken pswdToken = new PasswordToken(pswd);
             final Instance accInst = ConfigUtils.getInstance(config);
-            final AccumuloRyaInstanceDetailsRepository ryaDetailsRepo = new AccumuloRyaInstanceDetailsRepository(accInst.getConnector(user,
pswdToken), instance);
+            final AccumuloRyaInstanceDetailsRepository ryaDetailsRepo = new AccumuloRyaInstanceDetailsRepository(accInst.getConnector(user,
pswdToken), ryaInstance);
             RyaDetailsToConfiguration.addRyaDetailsToConfiguration(ryaDetailsRepo.getRyaInstanceDetails(),
config);
         } catch(final RyaDetailsRepositoryException e) {
-            LOG.info("Instance does not have a rya details collection, skipping.", e);
+            LOG.info("Instance does not have a rya details collection, skipping.");
         }
     }
 }
\ No newline at end of file


Mime
View raw message