You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by cguzel <gi...@git.apache.org> on 2016/08/13 18:52:23 UTC

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

GitHub user cguzel opened a pull request:

    https://github.com/apache/gora/pull/74

    GORA-437 implement couchdb datastore

    This pull request is for GORA-437. I developed couchdb store for gora. I added javadocs and test codes. The tests required couchdb instance. But I wondered how to start couchdb server programmatically using java. So, I sent an email to couchDB userlist. They suggest that using docker. Then I use docker programmaticaly with  https://github.com/testcontainers/testcontainers-java . All test cases passed with this approach. But this caused dependece to **docker** and **jdk 1.8** . So this pull request doesn't merge to master. 
    
    We should look another solution. Maybe using mockito for testing or another idea?
    
    All tests are passed on my local. I ignored 3 tests. You can see them in my test code.
    
    
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cguzel/gora-couchdb gora-couchdb

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/gora/pull/74.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #74
    
----
commit aad58789c93ce18b0cf5e99d05624a4b122071e6
Author: cihad guzel <cg...@gmail.com>
Date:   2016-05-19T07:16:34Z

    GORA-437 implement couchdb datastore
    ,added a new store for gora as gora-couchdb
    ,added unit tests
    ,added javadocs
    ,bugfixed

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708218
  
    --- Diff: gora-core/src/test/java/org/apache/gora/GoraTestDriver.java ---
    @@ -94,14 +94,18 @@ public void tearDown() throws Exception {
       }
     
       protected void setProperties(Properties properties) {
    +    //FIXME This method contains no code.
    --- End diff --
    
    Can you add?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    I have added new  javadocs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708250
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMappingBuilder.java ---
    @@ -0,0 +1,96 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.gora.persistency.impl.PersistentBase;
    +import org.jdom.Element;
    +import org.jdom.input.SAXBuilder;
    +
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.util.List;
    +
    +public class CouchDBMappingBuilder<K, T extends PersistentBase> {
    +
    +  // Class description
    +  private static final String TAG_CLASS = "class";
    +  private static final String TAG_FIELD = "field";
    +  private static final String ATT_KEYCLASS = "keyClass";
    +  private static final String ATT_DOCUMENT = "document";
    +
    +  // Document description
    +  private static final String ATT_NAME = "name";
    +
    +  /**
    +   * Mapping instance being built
    +   */
    +  private final CouchDBMapping mapping;
    +
    +  private final CouchDBStore<K, T> dataStore;
    +
    +  public CouchDBMappingBuilder(final CouchDBStore<K, T> store) {
    +    this.dataStore = store;
    +    this.mapping = new CouchDBMapping();
    +  }
    +
    +  /**
    +   * Return the built mapping if it is in a legal state
    +   */
    +  public CouchDBMapping build() {
    +    if (mapping.getDatabaseName() == null)
    +      throw new IllegalStateException("A collection is not specified");
    --- End diff --
    
    Can you also add this to the application logging through use of Slf4j.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600534
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMappingBuilder.java ---
    @@ -0,0 +1,102 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.gora.persistency.impl.PersistentBase;
    +import org.jdom.Element;
    +import org.jdom.input.SAXBuilder;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.util.List;
    +
    +public class CouchDBMappingBuilder<K, T extends PersistentBase> {
    +
    +  private static final Logger LOG = LoggerFactory.getLogger(CouchDBMappingBuilder.class);
    +
    +  // Class description
    +  private static final String TAG_CLASS = "class";
    +  private static final String TAG_FIELD = "field";
    +  private static final String ATT_KEYCLASS = "keyClass";
    +  private static final String ATT_DOCUMENT = "document";
    +
    +  // Document description
    +  private static final String ATT_NAME = "name";
    +
    +  /**
    +   * Mapping instance being built
    +   */
    +  private final CouchDBMapping mapping;
    +
    +  private final CouchDBStore<K, T> dataStore;
    +
    +  public CouchDBMappingBuilder(final CouchDBStore<K, T> store) {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75225014
  
    --- Diff: gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java ---
    @@ -690,6 +690,7 @@ else if (effectiveSchema.getType() == Type.MAP) {
               }
               // continue like a regular top-level union
             case RECORD:
    +          //TODO duplicated code @see org.apache.gora.util.IOUtils#serialize()
    --- End diff --
    
    I have created new pull request for it as follow: https://github.com/apache/gora/pull/76


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708224
  
    --- Diff: gora-core/src/test/java/org/apache/gora/GoraTestDriver.java ---
    @@ -94,14 +94,18 @@ public void tearDown() throws Exception {
       }
     
       protected void setProperties(Properties properties) {
    +    //FIXME This method contains no code.
       }
     
       @SuppressWarnings("unchecked")
       public<K, T extends Persistent> DataStore<K,T>
         createDataStore(Class<K> keyClass, Class<T> persistentClass) throws GoraException {
    -    setProperties(DataStoreFactory.createProps());
    +
    +    Properties properties = DataStoreFactory.createProps();
    +
    --- End diff --
    
    Remove whitespace


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600528
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMapping.java ---
    @@ -0,0 +1,43 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.jdom.Element;
    +
    +import java.util.List;
    +
    +public class CouchDBMapping {
    +
    +  /**
    +   * Name of the database this mapping is linked to
    +   */
    +  public String databaseName;
    +
    +  /**
    +   * CouchDB document description
    +   */
    +  public List<Element> fields;
    +
    +  public String getDatabaseName() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708213
  
    --- Diff: gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java ---
    @@ -690,6 +690,7 @@ else if (effectiveSchema.getType() == Type.MAP) {
               }
               // continue like a regular top-level union
             case RECORD:
    +          //TODO duplicated code @see org.apache.gora.util.IOUtils#serialize()
    --- End diff --
    
    What do you suggest implementing here? Please open a ticket in Jira.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708285
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/couchdb/store/TestCouchDBStore.java ---
    @@ -0,0 +1,158 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.avro.util.Utf8;
    +import org.apache.gora.GoraCouchDBTestDriver;
    +import org.apache.gora.couchdb.query.CouchDBResult;
    +import org.apache.gora.examples.WebPageDataCreator;
    +import org.apache.gora.examples.generated.Employee;
    +import org.apache.gora.examples.generated.WebPage;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreTestBase;
    +import org.junit.ClassRule;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.io.IOException;
    +import java.nio.ByteBuffer;
    +import java.nio.charset.Charset;
    +
    +import static org.junit.Assert.*;
    +
    +/**
    + * Tests extending {@link DataStoreTestBase}
    + * which run the base JUnit test suite for Gora.
    + */
    +public class TestCouchDBStore extends DataStoreTestBase {
    +
    +  private static final String DOCKER_CONTAINER_NAME = "klaemo/couchdb:1.6.1";
    +  /**
    +   * JUnit integration testing with Docker and Testcontainers
    +   */
    +  @ClassRule
    +  public static GenericContainer CouchDB_CONTAINER = new GenericContainer(DOCKER_CONTAINER_NAME);
    +
    +  static {
    +    try {
    +      setTestDriver(new GoraCouchDBTestDriver(CouchDB_CONTAINER));
    +    } catch (Exception e) {
    +      throw new RuntimeException(e);
    +    }
    +  }
    +
    +  @Override
    +  public void setUp() throws Exception {
    +    super.setUp();
    +  }
    +
    +  @SuppressWarnings("unchecked")
    +  @Override
    +  protected DataStore<String, Employee> createEmployeeDataStore() throws IOException {
    +    throw new UnsupportedOperationException();
    +    //    return DataStoreFactory.createDataStore(CouchDBStore.class, String.class, Employee.class, conf);
    +  }
    +
    +  @SuppressWarnings("unchecked")
    +  @Override
    +  protected DataStore<String, WebPage> createWebPageDataStore() throws IOException {
    +    throw new UnsupportedOperationException();
    +    //    return DataStoreFactory.createDataStore(CouchDBStore.class, String.class, WebPage.class, conf);
    --- End diff --
    
    Remove if not used.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/gora/pull/74


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on the issue:

    https://github.com/apache/gora/pull/74
  
    http://svn.apache.org/repos/asf/gora/site/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    Sorry. Yes true.  I corrected the mistake.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    Hi, @bsideup . It's OK for me. But I am not PMC for GORA. So, This question should be answered by GORA PMC members. 
    @lewis ? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600464
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/query/CouchDBQuery.java ---
    @@ -0,0 +1,42 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.query;
    +
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.impl.PersistentBase;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.query.impl.QueryBase;
    +import org.apache.gora.store.DataStore;
    +
    +/**
    + * CouchDB specific implementation of the {@link Query} interface.
    + */
    +public class CouchDBQuery<K, T extends PersistentBase> extends QueryBase<K, T> {
    +
    +  final CouchDBStore store;
    +
    +  public CouchDBQuery() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75223135
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/couchdb/store/TestCouchDBStore.java ---
    @@ -0,0 +1,158 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.avro.util.Utf8;
    +import org.apache.gora.GoraCouchDBTestDriver;
    +import org.apache.gora.couchdb.query.CouchDBResult;
    +import org.apache.gora.examples.WebPageDataCreator;
    +import org.apache.gora.examples.generated.Employee;
    +import org.apache.gora.examples.generated.WebPage;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreTestBase;
    +import org.junit.ClassRule;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.io.IOException;
    +import java.nio.ByteBuffer;
    +import java.nio.charset.Charset;
    +
    +import static org.junit.Assert.*;
    +
    +/**
    + * Tests extending {@link DataStoreTestBase}
    + * which run the base JUnit test suite for Gora.
    + */
    +public class TestCouchDBStore extends DataStoreTestBase {
    +
    +  private static final String DOCKER_CONTAINER_NAME = "klaemo/couchdb:1.6.1";
    +  /**
    +   * JUnit integration testing with Docker and Testcontainers
    +   */
    +  @ClassRule
    +  public static GenericContainer CouchDB_CONTAINER = new GenericContainer(DOCKER_CONTAINER_NAME);
    +
    +  static {
    +    try {
    +      setTestDriver(new GoraCouchDBTestDriver(CouchDB_CONTAINER));
    +    } catch (Exception e) {
    +      throw new RuntimeException(e);
    +    }
    +  }
    +
    +  @Override
    +  public void setUp() throws Exception {
    +    super.setUp();
    +  }
    +
    +  @SuppressWarnings("unchecked")
    +  @Override
    +  protected DataStore<String, Employee> createEmployeeDataStore() throws IOException {
    +    throw new UnsupportedOperationException();
    +    //    return DataStoreFactory.createDataStore(CouchDBStore.class, String.class, Employee.class, conf);
    +  }
    +
    +  @SuppressWarnings("unchecked")
    +  @Override
    +  protected DataStore<String, WebPage> createWebPageDataStore() throws IOException {
    +    throw new UnsupportedOperationException();
    +    //    return DataStoreFactory.createDataStore(CouchDBStore.class, String.class, WebPage.class, conf);
    --- End diff --
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708221
  
    --- Diff: gora-core/src/test/java/org/apache/gora/GoraTestDriver.java ---
    @@ -94,14 +94,18 @@ public void tearDown() throws Exception {
       }
     
       protected void setProperties(Properties properties) {
    +    //FIXME This method contains no code.
       }
     
       @SuppressWarnings("unchecked")
       public<K, T extends Persistent> DataStore<K,T>
         createDataStore(Class<K> keyClass, Class<T> persistentClass) throws GoraException {
    -    setProperties(DataStoreFactory.createProps());
    +
    --- End diff --
    
    Remove whitespace


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75223403
  
    --- Diff: gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java ---
    @@ -690,6 +690,7 @@ else if (effectiveSchema.getType() == Type.MAP) {
               }
               // continue like a regular top-level union
             case RECORD:
    +          //TODO duplicated code @see org.apache.gora.util.IOUtils#serialize()
    --- End diff --
    
    I have created a new issue : https://issues.apache.org/jira/browse/GORA-487


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by bsideup <gi...@git.apache.org>.
Github user bsideup commented on the issue:

    https://github.com/apache/gora/pull/74
  
    @lewismc may I ask you to comment or react with " :+1: " in https://github.com/testcontainers/testcontainers-java/pull/296 ? :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600469
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/query/CouchDBQuery.java ---
    @@ -0,0 +1,42 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.query;
    +
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.impl.PersistentBase;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.query.impl.QueryBase;
    +import org.apache.gora.store.DataStore;
    +
    +/**
    + * CouchDB specific implementation of the {@link Query} interface.
    + */
    +public class CouchDBQuery<K, T extends PersistentBase> extends QueryBase<K, T> {
    +
    +  final CouchDBStore store;
    +
    +  public CouchDBQuery() {
    +    super(null);
    +    store = null;
    +  }
    +
    +  public CouchDBQuery(DataStore<K, T> dataStore) {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600533
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMappingBuilder.java ---
    @@ -0,0 +1,102 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.gora.persistency.impl.PersistentBase;
    +import org.jdom.Element;
    +import org.jdom.input.SAXBuilder;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.util.List;
    +
    +public class CouchDBMappingBuilder<K, T extends PersistentBase> {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    I have added maven profile in gora-couchdb pom.xml. So The tests skip by default. If you use java 1.8 and docker, you build and run tests using maven profile as "mvn clean install -P couchdb-with-test".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708216
  
    --- Diff: gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java ---
    @@ -511,6 +511,7 @@ private void addOrUpdateField(K key, Field field, Schema schema, Object value) {
               if (value instanceof PersistentBase) {
                 PersistentBase persistentBase = (PersistentBase) value;            
                 try {
    +              //TODO duplicated code @see org.apache.gora.util.IOUtils#serialize()
    --- End diff --
    
    What do you suggest implementing here? Please open a ticket in Jira.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600540
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBParameters.java ---
    @@ -0,0 +1,79 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import java.util.Properties;
    +
    +/**
    + * Configuration properties
    + */
    +public class CouchDBParameters {
    +
    +  /**
    +   * Property pointing to the file for the mapping
    +   */
    +  public static final String PROP_MAPPING_FILE = "gora.couchdb.mapping.file";
    +
    +  /**
    +   * Property pointing to the host where the server is running
    +   */
    +  public static final String PROP_COUCHDB_SERVER = "gora.datastore.couchdb.server";
    +
    +  /**
    +   * Property pointing to the port where the server is running
    +   */
    +  public static final String PROP_COUCHDB_PORT = "gora.datastore.couchdb.port";
    +
    +  private final String mappingFile;
    +  private final String server;
    +  private final String port;
    +
    +  /**
    +   *
    +   *  Initializing for configuration properties
    +   *
    +   * @param mappingFile property pointing to the file for the mapping
    +   * @param server      server domain or ip for couchDB connection
    +   * @param port        port for couchDB connection
    +   */
    +  private CouchDBParameters(String mappingFile, String server, String port) {
    +    this.mappingFile = mappingFile;
    +    this.server = server;
    +    this.port = port;
    +  }
    +
    +  public String getMappingFile() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600542
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBParameters.java ---
    @@ -0,0 +1,79 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import java.util.Properties;
    +
    +/**
    + * Configuration properties
    + */
    +public class CouchDBParameters {
    +
    +  /**
    +   * Property pointing to the file for the mapping
    +   */
    +  public static final String PROP_MAPPING_FILE = "gora.couchdb.mapping.file";
    +
    +  /**
    +   * Property pointing to the host where the server is running
    +   */
    +  public static final String PROP_COUCHDB_SERVER = "gora.datastore.couchdb.server";
    +
    +  /**
    +   * Property pointing to the port where the server is running
    +   */
    +  public static final String PROP_COUCHDB_PORT = "gora.datastore.couchdb.port";
    +
    +  private final String mappingFile;
    +  private final String server;
    +  private final String port;
    +
    +  /**
    +   *
    +   *  Initializing for configuration properties
    +   *
    +   * @param mappingFile property pointing to the file for the mapping
    +   * @param server      server domain or ip for couchDB connection
    +   * @param port        port for couchDB connection
    +   */
    +  private CouchDBParameters(String mappingFile, String server, String port) {
    +    this.mappingFile = mappingFile;
    +    this.server = server;
    +    this.port = port;
    +  }
    +
    +  public String getMappingFile() {
    +    return mappingFile;
    +  }
    +
    +  public String getServer() {
    +    return server;
    +  }
    +
    +  public int getPort() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75224040
  
    --- Diff: gora-core/src/test/java/org/apache/gora/GoraTestDriver.java ---
    @@ -94,14 +94,18 @@ public void tearDown() throws Exception {
       }
     
       protected void setProperties(Properties properties) {
    +    //FIXME This method contains no code.
    --- End diff --
    
    I have created a new issue :  https://issues.apache.org/jira/browse/GORA-488


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on the issue:

    https://github.com/apache/gora/pull/74
  
    @cguzel can you please rebase against master?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708281
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/GoraCouchDBTestDriver.java ---
    @@ -0,0 +1,62 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora;
    +
    +import org.apache.gora.couchdb.store.CouchDBParameters;
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreFactory;
    +import org.apache.gora.util.GoraException;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.util.Properties;
    +
    +public class GoraCouchDBTestDriver extends GoraTestDriver {
    +
    +  private final GenericContainer couchdbContainer;
    +  private Properties properties = DataStoreFactory.createProps();
    +
    +  /**
    +   * Default constructor
    +   */
    +  public GoraCouchDBTestDriver(GenericContainer couchdbContainer) {
    +    super(CouchDBStore.class);
    +    this.couchdbContainer = couchdbContainer;
    +  }
    +
    +  @Override
    +  public void setUpClass() throws Exception {
    +    properties.put(CouchDBParameters.PROP_COUCHDB_PORT, couchdbContainer.getMappedPort(5984).toString());
    +  }
    +
    +  @Override
    +  public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K> keyClass, Class<T> persistentClass)
    +      throws GoraException {
    +
    +    final DataStore<K, T> dataStore = DataStoreFactory
    +        .createDataStore((Class<? extends DataStore<K, T>>) dataStoreClass, keyClass, persistentClass, conf,
    +            properties);
    +    dataStores.add(dataStore);
    +
    +    log.info("Datastore for " + persistentClass + " was added.");
    --- End diff --
    
    Please use paramaterized logging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by bsideup <gi...@git.apache.org>.
Github user bsideup commented on the issue:

    https://github.com/apache/gora/pull/74
  
    Hey@cguzel,
    
    FYI TestContainers dependency has "compile" scope. You probably want to move it to "test" scope :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on the issue:

    https://github.com/apache/gora/pull/74
  
    Absolutely @bsideup @cguzel thank you. Let's get a ticket filed to change scope to @Test as well


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600541
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBParameters.java ---
    @@ -0,0 +1,79 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import java.util.Properties;
    +
    +/**
    + * Configuration properties
    + */
    +public class CouchDBParameters {
    +
    +  /**
    +   * Property pointing to the file for the mapping
    +   */
    +  public static final String PROP_MAPPING_FILE = "gora.couchdb.mapping.file";
    +
    +  /**
    +   * Property pointing to the host where the server is running
    +   */
    +  public static final String PROP_COUCHDB_SERVER = "gora.datastore.couchdb.server";
    +
    +  /**
    +   * Property pointing to the port where the server is running
    +   */
    +  public static final String PROP_COUCHDB_PORT = "gora.datastore.couchdb.port";
    +
    +  private final String mappingFile;
    +  private final String server;
    +  private final String port;
    +
    +  /**
    +   *
    +   *  Initializing for configuration properties
    +   *
    +   * @param mappingFile property pointing to the file for the mapping
    +   * @param server      server domain or ip for couchDB connection
    +   * @param port        port for couchDB connection
    +   */
    +  private CouchDBParameters(String mappingFile, String server, String port) {
    +    this.mappingFile = mappingFile;
    +    this.server = server;
    +    this.port = port;
    +  }
    +
    +  public String getMappingFile() {
    +    return mappingFile;
    +  }
    +
    +  public String getServer() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600560
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/util/CouchDBObjectMapperFactory.java ---
    @@ -0,0 +1,52 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.util;
    +
    +import com.fasterxml.jackson.annotation.JsonInclude;
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.fasterxml.jackson.databind.SerializationFeature;
    +import org.ektorp.CouchDbConnector;
    +import org.ektorp.impl.ObjectMapperFactory;
    +import org.ektorp.impl.jackson.EktorpJacksonModule;
    +
    +//
    +public class CouchDBObjectMapperFactory implements ObjectMapperFactory {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600558
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/util/CouchDBObjectMapperFactory.java ---
    @@ -0,0 +1,52 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.util;
    +
    +import com.fasterxml.jackson.annotation.JsonInclude;
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.fasterxml.jackson.databind.SerializationFeature;
    +import org.ektorp.CouchDbConnector;
    +import org.ektorp.impl.ObjectMapperFactory;
    +import org.ektorp.impl.jackson.EktorpJacksonModule;
    +
    +//
    +public class CouchDBObjectMapperFactory implements ObjectMapperFactory {
    +
    +  private ObjectMapper instance;
    +  private boolean writeDatesAsTimestamps = false;
    +
    +  public synchronized ObjectMapper createObjectMapper() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708230
  
    --- Diff: gora-couchdb/pom.xml ---
    @@ -0,0 +1,209 @@
    +<?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.
    +-->
    +<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.apache.gora</groupId>
    +    <artifactId>gora</artifactId>
    +    <version>0.7-SNAPSHOT</version>
    +    <relativePath>../</relativePath>
    +  </parent>
    +  <artifactId>gora-couchdb</artifactId>
    +  <packaging>bundle</packaging>
    +
    +  <name>Apache Gora :: CouchDB</name>
    +  <url>http://gora.apache.org</url>
    +  <description>The Apache Gora open source framework provides an in-memory data model and 
    +    persistence for big data. Gora supports persisting to column stores, key value stores, 
    +    document stores and RDBMSs, and analyzing the data with extensive Apache Hadoop MapReduce 
    +    support.</description>
    +  <inceptionYear>2010</inceptionYear>
    +  <organization>
    +    <name>The Apache Software Foundation</name>
    +    <url>http://www.apache.org/</url>
    +  </organization>
    +  <issueManagement>
    +    <system>JIRA</system>
    +    <url>https://issues.apache.org/jira/browse/GORA</url>
    +  </issueManagement>
    +  <ciManagement>
    +    <system>Jenkins</system>
    +    <url>https://builds.apache.org/job/Gora-trunk/</url>
    +  </ciManagement>
    +
    +  <properties>
    +    <osgi.import>*</osgi.import>
    +    <osgi.export>org.apache.gora.hbase*;version="${project.version}";-noimport:=true</osgi.export>
    --- End diff --
    
    Should not be hbase, please replace with
    ```<osgi.export>org.apache.gora.couchdb*;version="${project.version}";-noimport:=true</osgi.export>```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on the issue:

    https://github.com/apache/gora/pull/74
  
    In general this is looking very good. Can you please go through and address my comments? Can you also ensure that for every new method that you've added you also add a Javadoc comment?
    Finally, for the time being at least, can you
    1) Add package-info.java for each and every new module you've added.
    2) Create documentation for this module as per http://gora.apache.org/current/index.html#gora-modules
    
    Thanks @cguzel great work :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    @lewismc How to create documentation? I don't know how to edit this page :  http://gora.apache.org/current/index.html#gora-modules


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600556
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/util/CouchDBObjectMapperFactory.java ---
    @@ -0,0 +1,52 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.util;
    +
    +import com.fasterxml.jackson.annotation.JsonInclude;
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.fasterxml.jackson.databind.SerializationFeature;
    +import org.ektorp.CouchDbConnector;
    +import org.ektorp.impl.ObjectMapperFactory;
    +import org.ektorp.impl.jackson.EktorpJacksonModule;
    +
    +//
    +public class CouchDBObjectMapperFactory implements ObjectMapperFactory {
    +
    +  private ObjectMapper instance;
    +  private boolean writeDatesAsTimestamps = false;
    +
    +  public synchronized ObjectMapper createObjectMapper() {
    +    if (instance == null) {
    +      instance = new ObjectMapper();
    +      applyDefaultConfiguration(instance);
    +    }
    +    return instance;
    +  }
    +
    +  public synchronized ObjectMapper createObjectMapper(CouchDbConnector connector) {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by bsideup <gi...@git.apache.org>.
Github user bsideup commented on the issue:

    https://github.com/apache/gora/pull/74
  
    @cguzel did you mean @lewismc ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600524
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMapping.java ---
    @@ -0,0 +1,43 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.jdom.Element;
    +
    +import java.util.List;
    +
    +public class CouchDBMapping {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708284
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/couchdb/store/TestCouchDBStore.java ---
    @@ -0,0 +1,158 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.apache.avro.util.Utf8;
    +import org.apache.gora.GoraCouchDBTestDriver;
    +import org.apache.gora.couchdb.query.CouchDBResult;
    +import org.apache.gora.examples.WebPageDataCreator;
    +import org.apache.gora.examples.generated.Employee;
    +import org.apache.gora.examples.generated.WebPage;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreTestBase;
    +import org.junit.ClassRule;
    +import org.junit.Ignore;
    +import org.junit.Test;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.io.IOException;
    +import java.nio.ByteBuffer;
    +import java.nio.charset.Charset;
    +
    +import static org.junit.Assert.*;
    +
    +/**
    + * Tests extending {@link DataStoreTestBase}
    + * which run the base JUnit test suite for Gora.
    + */
    +public class TestCouchDBStore extends DataStoreTestBase {
    +
    +  private static final String DOCKER_CONTAINER_NAME = "klaemo/couchdb:1.6.1";
    +  /**
    +   * JUnit integration testing with Docker and Testcontainers
    +   */
    +  @ClassRule
    +  public static GenericContainer CouchDB_CONTAINER = new GenericContainer(DOCKER_CONTAINER_NAME);
    +
    +  static {
    +    try {
    +      setTestDriver(new GoraCouchDBTestDriver(CouchDB_CONTAINER));
    +    } catch (Exception e) {
    +      throw new RuntimeException(e);
    +    }
    +  }
    +
    +  @Override
    +  public void setUp() throws Exception {
    +    super.setUp();
    +  }
    +
    +  @SuppressWarnings("unchecked")
    +  @Override
    +  protected DataStore<String, Employee> createEmployeeDataStore() throws IOException {
    +    throw new UnsupportedOperationException();
    +    //    return DataStoreFactory.createDataStore(CouchDBStore.class, String.class, Employee.class, conf);
    --- End diff --
    
    Remove if not used.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600531
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBMapping.java ---
    @@ -0,0 +1,43 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import org.jdom.Element;
    +
    +import java.util.List;
    +
    +public class CouchDBMapping {
    +
    +  /**
    +   * Name of the database this mapping is linked to
    +   */
    +  public String databaseName;
    +
    +  /**
    +   * CouchDB document description
    +   */
    +  public List<Element> fields;
    +
    +  public String getDatabaseName() {
    +    return databaseName;
    +  }
    +
    +  public void setDatabaseName(String databaseName) {
    --- End diff --
    
    javadocc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    Thanks @bsideup . I will check it.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r74708261
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/store/CouchDBParameters.java ---
    @@ -0,0 +1,76 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.store;
    +
    +import java.util.Properties;
    +
    +/**
    + * Configuration properties
    + */
    +public class CouchDBParameters {
    +
    +  /**
    +   * Property pointing to the file for the mapping
    +   */
    +  public static final String PROP_MAPPING_FILE = "gora.couchdb.mapping.file";
    +
    +  /**
    +   * Property pointing to the host where the server is running
    +   */
    +  public static final String PROP_COUCHDB_SERVER = "gora.datastore.couchdb.server";
    +
    +  /**
    +   * Property pointing to the port where the server is running
    +   */
    +  public static final String PROP_COUCHDB_PORT = "gora.datastore.couchdb.port";
    +
    +  private final String mappingFile;
    +  private final String server;
    +  private final String port;
    +
    +  /**
    +   * @param mappingFile
    --- End diff --
    
    Please add Javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600568
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/couchdb/GoraCouchDBTestDriver.java ---
    @@ -0,0 +1,62 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb;
    +
    +import org.apache.gora.GoraTestDriver;
    +import org.apache.gora.couchdb.store.CouchDBParameters;
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreFactory;
    +import org.apache.gora.util.GoraException;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.util.Properties;
    +
    +public class GoraCouchDBTestDriver extends GoraTestDriver {
    +
    +  private final GenericContainer couchdbContainer;
    +  private Properties properties = DataStoreFactory.createProps();
    +
    +  /**
    +   * Default constructor
    +   */
    +  public GoraCouchDBTestDriver(GenericContainer couchdbContainer) {
    +    super(CouchDBStore.class);
    +    this.couchdbContainer = couchdbContainer;
    +  }
    +
    +  @Override
    +  public void setUpClass() throws Exception {
    +    properties.put(CouchDBParameters.PROP_COUCHDB_PORT, couchdbContainer.getMappedPort(5984).toString());
    +  }
    +
    +  @Override
    +  public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K> keyClass, Class<T> persistentClass)
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by cguzel <gi...@git.apache.org>.
Github user cguzel commented on the issue:

    https://github.com/apache/gora/pull/74
  
    I added a patch for documentation https://issues.apache.org/jira/browse/GORA-489


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600564
  
    --- Diff: gora-couchdb/src/test/java/org/apache/gora/couchdb/GoraCouchDBTestDriver.java ---
    @@ -0,0 +1,62 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb;
    +
    +import org.apache.gora.GoraTestDriver;
    +import org.apache.gora.couchdb.store.CouchDBParameters;
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreFactory;
    +import org.apache.gora.util.GoraException;
    +import org.testcontainers.containers.GenericContainer;
    +
    +import java.util.Properties;
    +
    +public class GoraCouchDBTestDriver extends GoraTestDriver {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora issue #74: GORA-437 implement couchdb datastore

Posted by bsideup <gi...@git.apache.org>.
Github user bsideup commented on the issue:

    https://github.com/apache/gora/pull/74
  
    @cguzel we're planning to add Apache Gora to TestContainers' "who is using?" list, don't you mind?
    https://github.com/testcontainers/testcontainers-java/pull/296 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] gora pull request #74: GORA-437 implement couchdb datastore

Posted by lewismc <gi...@git.apache.org>.
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/74#discussion_r75600521
  
    --- Diff: gora-couchdb/src/main/java/org/apache/gora/couchdb/query/CouchDBResult.java ---
    @@ -0,0 +1,85 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.gora.couchdb.query;
    +
    +import org.apache.gora.couchdb.store.CouchDBStore;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.query.Query;
    +import org.apache.gora.query.impl.ResultBase;
    +import org.apache.gora.store.DataStore;
    +
    +import java.io.IOException;
    +import java.util.List;
    +import java.util.Map;
    +
    +/**
    + * CouchDB specific implementation of the {@link org.apache.gora.query.Result}
    + * interface.
    + */
    +public class CouchDBResult<K, T extends Persistent> extends ResultBase<K, T> {
    +
    +  /**
    +   * Result set containing query results
    +   */
    +  private List<Map> result;
    +
    +  protected CouchDBStore dataStore;
    +  int position = 0;
    +
    +  /**
    +   * Constructor for the result set
    +   *
    +   * @param dataStore Data store used
    +   * @param query     Query used
    +   * @param result    Result obtained from querying
    +   */
    +  public CouchDBResult(DataStore<K, T> dataStore, Query<K, T> query, List<Map> result) {
    +    super(dataStore, query);
    +    this.result = result;
    +    this.dataStore = (CouchDBStore) dataStore;
    +  }
    +
    +  /**
    +   * Gets the next item
    +   */
    +  @Override
    +  protected boolean nextInner() throws IOException {
    +    if (result == null || result.size() <= 0 || position >= result.size()) {
    +      return false;
    +    }
    +    key = (K) result.get(position).get("_id");
    +    persistent = (T) dataStore.newInstance(result.get(position++), query.getFields());
    +    return persistent != null;
    +  }
    +
    +  /**
    +   * Gets the items reading progress
    +   */
    +  @Override
    +  public float getProgress() throws IOException, InterruptedException {
    +    if (result != null && result.size() > 0) {
    +      return (float) position / (float) result.size();
    +    } else {
    +      return 0;
    +    }
    +  }
    +
    +  public List<Map> getResultData() {
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---