You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by ma...@apache.org on 2020/03/13 18:29:22 UTC
[gora] branch master updated (783580c -> 3f4d474)
This is an automated email from the ASF dual-hosted git repository.
madhawa pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/gora.git.
from 783580c Update developers list (#200)
new e08524c Fix mapping file name access method in hbaseStore
new 18d95f9 Fix mapping file name access method in dynamoDBStore
new 3f4d474 Remove unused imports
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/gora/dynamodb/store/DynamoDBStore.java | 9 ++++---
.../org/apache/gora/hbase/store/HBaseStore.java | 31 +++++++++-------------
2 files changed, 19 insertions(+), 21 deletions(-)
[gora] 02/03: Fix mapping file name access method in dynamoDBStore
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhawa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gora.git
commit 18d95f9b59c7a74be741f400ff97fc2d83b396bc
Author: LahiruJayasekara <ml...@gmail.com>
AuthorDate: Sun May 12 13:23:31 2019 +0530
Fix mapping file name access method in dynamoDBStore
---
.../main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java b/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java
index e5ba17c..48ecf3a 100644
--- a/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java
+++ b/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java
@@ -41,6 +41,7 @@ import org.apache.gora.query.PartitionQuery;
import org.apache.gora.query.Query;
import org.apache.gora.query.Result;
import org.apache.gora.store.DataStore;
+import org.apache.gora.store.DataStoreFactory;
import org.apache.gora.util.GoraException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -226,7 +227,9 @@ public class DynamoDBStore<K, T extends Persistent> implements DataStore<K, T> {
setDynamoDBClient(DynamoDBUtils.getClient(
properties.getProperty(CLI_TYP_PROP), creds));
getDynamoDBClient().setEndpoint(properties.getProperty(ENDPOINT_PROP));
- setDynamoDbMapping(readMapping());
+ String mappingFile = DataStoreFactory.getMappingFile(properties, this,
+ MAPPING_FILE);
+ setDynamoDbMapping(readMapping(mappingFile));
setConsistency(properties.getProperty(CONSISTENCY_READS));
}
@@ -311,14 +314,14 @@ public class DynamoDBStore<K, T extends Persistent> implements DataStore<K, T> {
* @throws IOException
*/
@SuppressWarnings("unchecked")
- private DynamoDBMapping readMapping() throws IOException {
+ private DynamoDBMapping readMapping(String filename) throws IOException {
DynamoDBMappingBuilder mappingBuilder = new DynamoDBMappingBuilder();
try {
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(getClass().getClassLoader()
- .getResourceAsStream(MAPPING_FILE));
+ .getResourceAsStream(filename));
if (doc == null || doc.getRootElement() == null)
throw new GoraException("Unable to load " + MAPPING_FILE
+ ". Please check its existance!");
[gora] 01/03: Fix mapping file name access method in hbaseStore
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhawa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gora.git
commit e08524c5d5aaac9fd3e4ed42739c03e398d6fa8b
Author: LahiruJayasekara <ml...@gmail.com>
AuthorDate: Sat May 11 01:50:44 2019 +0530
Fix mapping file name access method in hbaseStore
---
.../org/apache/gora/hbase/store/HBaseStore.java | 28 ++++++++++------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
index 518f6ac..d16700b 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
@@ -139,20 +139,17 @@ public class HBaseStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
try {
this.conf = HBaseConfiguration.create(getConf());
-
- InputStream mappingInputStream ;
- // If there is a mapping definition in the Properties, use it.
- if (properties.containsKey(XML_MAPPING_DEFINITION)) {
- if (LOG.isTraceEnabled()) LOG.trace(XML_MAPPING_DEFINITION + " = " + properties.getProperty(XML_MAPPING_DEFINITION));
- mappingInputStream = IOUtils.toInputStream(properties.getProperty(XML_MAPPING_DEFINITION), (Charset)null) ;
- }
- // Otherwise use the configuration from de default file gora-hbase-mapping.xml or whatever
- // configured in the key "gora.hbase.mapping.file"
- else {
- mappingInputStream = getClass().getClassLoader().getResourceAsStream(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)) ;
+
+ String mappingFile = DataStoreFactory.getMappingFile(properties, this,
+ DEFAULT_MAPPING_FILE);
+
+ // if there is no mapping.file property in gora.properties, then check
+ // configurations for mapping.file key
+ if (mappingFile.equals(DEFAULT_MAPPING_FILE)) {
+ mappingFile = getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE);
}
- mapping = readMapping(mappingInputStream);
+ mapping = readMapping(mappingFile);
filterUtil = new HBaseFilterUtil<>(this.conf);
} catch (FileNotFoundException ex) {
throw new GoraException("Mapping file '" + getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE) + "' not found.",ex);
@@ -819,13 +816,14 @@ public class HBaseStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
}
@SuppressWarnings("unchecked")
- private HBaseMapping readMapping(InputStream mappingStream) throws IOException {
+ private HBaseMapping readMapping(String filename) throws IOException {
HBaseMappingBuilder mappingBuilder = new HBaseMappingBuilder();
try {
SAXBuilder builder = new SAXBuilder();
- Document doc = builder.build(mappingStream);
+ Document doc = builder.build(getClass().getClassLoader()
+ .getResourceAsStream(filename));
Element root = doc.getRootElement();
List<Element> tableElements = root.getChildren("table");
@@ -892,7 +890,7 @@ public class HBaseStore<K, T extends PersistentBase> extends DataStoreBase<K, T>
LOG.error("Error while trying to read the mapping file {}. "
+ "Expected to be in the classpath "
+ "(ClassLoader#getResource(java.lang.String)).",
- mappingStream) ;
+ filename) ;
LOG.error("Actual classpath = {}", Arrays.asList(
((URLClassLoader) getClass().getClassLoader()).getURLs()));
throw ex ;
[gora] 03/03: Remove unused imports
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhawa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gora.git
commit 3f4d474c98c4c4fde94b915d54a60f126448def3
Author: LahiruJayasekara <ml...@gmail.com>
AuthorDate: Sun May 12 13:25:56 2019 +0530
Remove unused imports
---
gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
index d16700b..77a30bd 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
@@ -22,10 +22,8 @@ import static org.apache.gora.hbase.util.HBaseByteInterface.toBytes;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URLClassLoader;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -43,7 +41,6 @@ import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.apache.avro.Schema.Type;
import org.apache.avro.util.Utf8;
-import org.apache.commons.io.IOUtils;
import org.apache.gora.hbase.query.HBaseGetResult;
import org.apache.gora.hbase.query.HBaseQuery;
import org.apache.gora.hbase.query.HBaseScannerResult;