You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by ka...@apache.org on 2019/02/26 06:17:50 UTC
[metamodel] branch master updated (0f5a21e -> 2dd1ddc)
This is an automated email from the ASF dual-hosted git repository.
kaspersor pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git.
from 0f5a21e Closes #207
new a08cae5 Added the DynamoDB module to the `full` module. And created DC factory.
new c81437c Added optional "region" property to factory
new 2dd1ddc Corrections as per review by @LosD
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:
dynamodb/pom.xml | 2 +-
.../dynamodb/DynamoDbDataContextFactory.java | 64 ++++++++++++++++++++++
...org.apache.metamodel.factory.DataContextFactory | 1 +
full/pom.xml | 5 ++
4 files changed, 71 insertions(+), 1 deletion(-)
create mode 100644 dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
create mode 100644 dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
[metamodel] 02/03: Added optional "region" property to factory
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git
commit c81437cd7a5fb1c4d92bfde5e3a610a37b5f5ff7
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Fri Feb 15 21:32:27 2019 -0800
Added optional "region" property to factory
---
.../apache/metamodel/dynamodb/DynamoDbDataContextFactory.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
index 1e7273f..f9ce562 100644
--- a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
+++ b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
@@ -40,8 +40,14 @@ public class DynamoDbDataContextFactory extends AbstractDataContextFactory {
@Override
public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry) {
- final AmazonDynamoDB client =
- AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties)).build();
+ final AmazonDynamoDBClientBuilder clientBuilder =
+ AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties));
+ final Object region = properties.toMap().get("region");
+ if (region != null && region instanceof String) {
+ clientBuilder.setRegion(region.toString());
+ }
+
+ final AmazonDynamoDB client = clientBuilder.build();
final SimpleTableDef[] tableDefs = properties.getTableDefs();
return new DynamoDbDataContext(client, tableDefs);
}
[metamodel] 01/03: Added the DynamoDB module to the `full` module.
And created DC factory.
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git
commit a08cae575dc63e2f06c8d55bd46e3858d91f6b69
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Fri Feb 15 21:29:32 2019 -0800
Added the DynamoDB module to the `full` module. And created DC factory.
---
dynamodb/pom.xml | 2 +-
.../dynamodb/DynamoDbDataContextFactory.java | 58 ++++++++++++++++++++++
...org.apache.metamodel.factory.DataContextFactory | 1 +
full/pom.xml | 5 ++
4 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/dynamodb/pom.xml b/dynamodb/pom.xml
index 9d7e0dc..045d5e4 100644
--- a/dynamodb/pom.xml
+++ b/dynamodb/pom.xml
@@ -35,7 +35,7 @@ under the License.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
- <version>1.11.81</version>
+ <version>1.11.500</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
diff --git a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
new file mode 100644
index 0000000..1e7273f
--- /dev/null
+++ b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
@@ -0,0 +1,58 @@
+/**
+ * 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 org.apache.metamodel.dynamodb;
+
+import org.apache.metamodel.DataContext;
+import org.apache.metamodel.factory.AbstractDataContextFactory;
+import org.apache.metamodel.factory.DataContextProperties;
+import org.apache.metamodel.factory.ResourceFactoryRegistry;
+import org.apache.metamodel.util.SimpleTableDef;
+
+import com.amazonaws.auth.AWSCredentialsProvider;
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
+
+public class DynamoDbDataContextFactory extends AbstractDataContextFactory {
+
+ @Override
+ protected String getType() {
+ return "dynamodb";
+ }
+
+ @Override
+ public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry) {
+ final AmazonDynamoDB client =
+ AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties)).build();
+ final SimpleTableDef[] tableDefs = properties.getTableDefs();
+ return new DynamoDbDataContext(client, tableDefs);
+ }
+
+ private AWSCredentialsProvider getCredentials(DataContextProperties properties) {
+ if (properties.getUsername() != null) {
+ final BasicAWSCredentials credentials =
+ new BasicAWSCredentials(properties.getUsername(), properties.getPassword());
+ return new AWSStaticCredentialsProvider(credentials);
+ } else {
+ return DefaultAWSCredentialsProviderChain.getInstance();
+ }
+ }
+}
diff --git a/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory b/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
new file mode 100644
index 0000000..dba2053
--- /dev/null
+++ b/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
@@ -0,0 +1 @@
+org.apache.metamodel.dynamodb.DynamoDbDataContextFactory
\ No newline at end of file
diff --git a/full/pom.xml b/full/pom.xml
index da78c7f..7ed94c7 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -167,6 +167,11 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.metamodel</groupId>
+ <artifactId>MetaModel-dynamodb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metamodel</groupId>
<artifactId>MetaModel-hbase</artifactId>
<version>${project.version}</version>
</dependency>
[metamodel] 03/03: Corrections as per review by @LosD
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaspersor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git
commit 2dd1ddc35d0d11de6e99d6f22045c63f29df1928
Author: Kasper Sørensen <i....@gmail.com>
AuthorDate: Sat Feb 23 21:58:21 2019 -0800
Corrections as per review by @LosD
---
.../org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java | 4 ++--
.../META-INF/services/org.apache.metamodel.factory.DataContextFactory | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
index f9ce562..47548ac 100644
--- a/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
+++ b/dynamodb/src/main/java/org/apache/metamodel/dynamodb/DynamoDbDataContextFactory.java
@@ -43,8 +43,8 @@ public class DynamoDbDataContextFactory extends AbstractDataContextFactory {
final AmazonDynamoDBClientBuilder clientBuilder =
AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties));
final Object region = properties.toMap().get("region");
- if (region != null && region instanceof String) {
- clientBuilder.setRegion(region.toString());
+ if (region instanceof String) {
+ clientBuilder.setRegion((String) region);
}
final AmazonDynamoDB client = clientBuilder.build();
diff --git a/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory b/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
index dba2053..297f5a4 100644
--- a/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
+++ b/dynamodb/src/main/resources/META-INF/services/org.apache.metamodel.factory.DataContextFactory
@@ -1 +1 @@
-org.apache.metamodel.dynamodb.DynamoDbDataContextFactory
\ No newline at end of file
+org.apache.metamodel.dynamodb.DynamoDbDataContextFactory