You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@rya.apache.org by kchilton2 <gi...@git.apache.org> on 2018/01/02 18:58:26 UTC

[GitHub] incubator-rya pull request #258: [WIP] RYA-104 Mongo Rya Shell Integration

GitHub user kchilton2 opened a pull request:

    https://github.com/apache/incubator-rya/pull/258

    [WIP] RYA-104 Mongo Rya Shell Integration

    ## Description
    Added Mongo support to the Rya Shell.
    
    ### Tests
    Added tests.
    
    ### Links
    https://issues.apache.org/jira/browse/RYA-104


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

    $ git pull https://github.com/kchilton2/incubator-rya RYA-104

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

    https://github.com/apache/incubator-rya/pull/258.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 #258
    
----
commit 767349dac9822cd13e92f9b117d1b5d2dad13e3d
Author: kchilton2 <ke...@...>
Date:   2017-12-23T01:52:27Z

    RYA-414 Introduced the stateful mongo configuratino object so that it is the arbitor of MongoDB state within a Sail object.

commit 17cebae3328916bd80fbe5447da5ccb660539556
Author: Andrew Smith <sm...@...>
Date:   2017-12-26T19:30:32Z

    RYA-414 Removed mongo connection factory
    
    addressed the indexers that used the factory
    addressed the geo project

commit 157c06491cd814a1d6e445ebfe77fc63226e5739
Author: kchilton2 <ke...@...>
Date:   2017-12-26T23:42:33Z

    RYA-414 Fixing broken tests, cleaning up documentate, cleaning up whitespace.

commit a0d3b02e9883d300be9c60bb87b6a4e4e4a09bff
Author: David W. Lotts <da...@...>
Date:   2017-12-13T22:34:55Z

    RYA-104 most interactors complete.

commit ac8fc3d040a68d39e2911d9fc2c96341eeb15193
Author: kchilton2 <ke...@...>
Date:   2017-12-13T23:14:40Z

    RYA-104 Updated the RyaClient to optionally include features that are required for the Accumulo Client, but not the Mongo Client.

commit 7a09ab338d402204eb3ebef73d5e193f54a22751
Author: David W. Lotts <da...@...>
Date:   2017-12-15T22:19:45Z

    RYA-104 LoadStatementFile is not reading for some reason, todo: MongoExecSparql.

commit 49aadaf2970c39522985c74c61d12fa38a0fb27d
Author: kchilton2 <ke...@...>
Date:   2017-12-17T19:56:03Z

    Making the build pass.

commit 1cea9b416e5e7168e5696dd5b9efb84b4da05058
Author: kchilton2 <ke...@...>
Date:   2017-12-17T20:23:41Z

    RYA-104 Implemented the Rya Shell integration with the Mongo DB interactors.

commit 777c1d394858d95cd10c6ba965d53475067852cf
Author: David W. Lotts <da...@...>
Date:   2017-12-19T20:39:31Z

    RYA-104

commit 3774f4b28b168454b9c6146b00ba7b0ddff9b89d
Author: isper3at <sm...@...>
Date:   2017-12-27T18:35:36Z

    Post-mongo change rebase

commit 2a68e37c119b1d0f48423ff21c5e204a4b66fbb7
Author: kchilton2 <ke...@...>
Date:   2017-12-28T00:50:57Z

    RYA-104 Removed the MongoCommand class.

commit 1944ea9260bf25035ad95d2e67cabcb150875ce8
Author: kchilton2 <ke...@...>
Date:   2017-12-28T23:21:44Z

    RYA-104 Closing resources and fixing tests for some of the Mongo interactors.

commit 23977111ac7469072bcd49e2395a8717ffa73778
Author: kchilton2 <ke...@...>
Date:   2017-12-29T18:27:27Z

    RYA-104 Updated the Rya Shell to prompt for Mongo Specific install configurations.

commit e8e43a11a81088b2902d3d952f40286d2bf5e6b9
Author: kchilton2 <ke...@...>
Date:   2017-12-29T22:56:48Z

    RYA-104 Starting integration tests with Mongo for the shell.

----


---

[GitHub] incubator-rya issue #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/596/



---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159989181
  
    --- Diff: extras/indexing/src/main/java/org/apache/rya/api/client/mongo/MongoConnectionDetails.java ---
    @@ -0,0 +1,119 @@
    +/**
    + * 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.rya.api.client.mongo;
    +
    +import static java.util.Objects.requireNonNull;
    +
    +import java.util.Optional;
    +
    +import org.apache.rya.indexing.accumulo.ConfigUtils;
    +import org.apache.rya.mongodb.MongoDBRdfConfiguration;
    +
    +import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
    +import edu.umd.cs.findbugs.annotations.NonNull;
    +
    +/**
    + * The information the shell used to connect to Mongo server, not the DB or collections.
    + */
    +@DefaultAnnotation(NonNull.class)
    +public class MongoConnectionDetails {
    +
    +    private final Optional<String> username;
    +    private final Optional<char[]> password;
    +    private final String hostname;
    +    private final int port;
    +
    +    /**
    +     * Constructs an instance of {@link MongoConnectionDetails}.
    +     *
    +     * @param hostname - The hostname of the Mongo DB that was connected to. (not null)
    +     * @param port - The port of the Mongo DB that was connected to.
    +     * @param username - The username that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     * @param password - The password that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     */
    +    public MongoConnectionDetails(
    +            final String hostname,
    +            final int port,
    +            final Optional<String> username,
    +            final Optional<char[]> password) {
    +        this.hostname = requireNonNull(hostname);
    +        this.port = port;
    +        this.username = requireNonNull(username);
    +        this.password = requireNonNull(password);
    +    }
    +
    +    /**
    +     * @return The hostname of the Mongo DB that was connected to.
    +     */
    +    public String getHostname() {
    +        return hostname;
    +    }
    +
    +    /**
    +     * @return The port of the Mongo DB that was connected to.
    +     */
    +    public int getPort() {
    +        return port;
    +    }
    +
    +     /**
    +      * @return The username that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<String> getUsername() {
    +         return this.username;
    +     }
    +
    +     /**
    +      * @return The password that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<char[]> getPassword() {
    +         return password;
    +     }
    +
    +    /**
    +     * Create a {@link MongoDBRdfConfiguration} that is using this object's values.
    +     *
    +     * @param ryaInstanceName - The Rya instance to connect to. (not null)
    +     * @return Constructs a new {@link MongoDBRdfConfiguration} object with values from this object.
    +     */
    +    public MongoDBRdfConfiguration build(final String ryaInstanceName) {
    +        // Note, we don't use the MongoDBRdfConfigurationBuilder here because it explicitly sets
    +        // authorizations and visibilities to an empty string if they are not set on the builder.
    +        // If they are null in the MongoRdfConfiguration object, it may do the right thing.
    +        final MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration();
    +        conf.setBoolean(ConfigUtils.USE_MONGO, true);
    +        conf.setMongoHostname(hostname);
    +        conf.setMongoPort("" + port);
    +        conf.setMongoDBName(ryaInstanceName);
    +
    +        if(username.isPresent()) {
    +            conf.setMongoUser(username.get());
    +        }
    +
    +        if(password.isPresent()) {
    +            conf.setMongoPassword( new String(password.get()) );
    +        }
    +
    +        // Default to having a table prefix of "rya", otherwise the app doesn't work for some reason.
    +        conf.setTablePrefix("rya");
    --- End diff --
    
    This requirement is hard coded in RyaSailFactory for unknown reasons, so I'm working around it. It is probably a defect.


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159945788
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/client/RyaClient.java ---
    @@ -53,37 +55,37 @@
          */
         public RyaClient(
                 final Install install,
    -            final CreatePCJ createPcj,
    -            final DeletePCJ deletePcj,
    -            final CreatePeriodicPCJ createPeriodicPcj,
    -            final DeletePeriodicPCJ deletePeriodicPcj,
    -            final ListIncrementalQueries listIncrementalQueries,
    -            final BatchUpdatePCJ batchUpdatePcj,
    +            final Optional<CreatePCJ> createPcj,
    +            final Optional<DeletePCJ> deletePcj,
    +            final Optional<CreatePeriodicPCJ> createPeriodicPcj,
    +            final Optional<DeletePeriodicPCJ> deletePeriodicPcj,
    +            final Optional<ListIncrementalQueries> listIncrementalQueries,
    +            final Optional<BatchUpdatePCJ> batchUpdatePcj,
                 final GetInstanceDetails getInstanceDetails,
                 final InstanceExists instanceExists,
                 final ListInstances listInstances,
    -            final AddUser addUser,
    -            final RemoveUser removeUser,
    +            final Optional<AddUser> addUser,
    +            final Optional<RemoveUser> removeUser,
                 final Uninstall uninstall,
                 final LoadStatements loadStatements,
                 final LoadStatementsFile loadStatementsFile,
                 final ExecuteSparqlQuery executeSparqlQuery) {
             this.install = requireNonNull(install);
             this.createPcj = requireNonNull(createPcj);
             this.deletePcj = requireNonNull(deletePcj);
    -        this.createPeriodicPcj = createPeriodicPcj;
    -        this.deletePeriodicPcj = deletePeriodicPcj;
    -        this.listIncrementalQueries = listIncrementalQueries;
    +        this.createPeriodicPcj = requireNonNull(createPeriodicPcj);
    +        this.deletePeriodicPcj = requireNonNull(deletePeriodicPcj);
    +        this.listIncrementalQueries = requireNonNull(listIncrementalQueries);
             this.bactchUpdatePCJ = requireNonNull(batchUpdatePcj);
             this.getInstanceDetails = requireNonNull(getInstanceDetails);
             this.instanceExists = requireNonNull(instanceExists);
             this.listInstances = requireNonNull(listInstances);
             this.addUser = requireNonNull(addUser);
             this.removeUser = requireNonNull(removeUser);
             this.uninstall = requireNonNull(uninstall);
    -        this.loadStatements = requireNonNull(loadStatements);
    --- End diff --
    
    Why did the null checks get removed?


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159989515
  
    --- Diff: extras/indexing/src/main/java/org/apache/rya/api/client/mongo/MongoUninstall.java ---
    @@ -0,0 +1,65 @@
    +/**
    + * 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.rya.api.client.mongo;
    +
    +import static java.util.Objects.requireNonNull;
    +
    +import org.apache.rya.api.client.InstanceDoesNotExistException;
    +import org.apache.rya.api.client.InstanceExists;
    +import org.apache.rya.api.client.RyaClientException;
    +import org.apache.rya.api.client.Uninstall;
    +
    +import com.mongodb.MongoClient;
    +import com.mongodb.MongoException;
    +
    +import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
    +import edu.umd.cs.findbugs.annotations.NonNull;
    +
    +/**
    + * An Mongo implementation of the {@link Uninstall} command.
    + */
    +@DefaultAnnotation(NonNull.class)
    +public class MongoUninstall implements Uninstall {
    +
    +    private final MongoClient adminClient;
    +    private final InstanceExists instanceExists;
    +
    +    /**
    +     * Constructs an instance of {@link MongoUninstall}.
    +     *
    +     * @param adminClient- Provides programmatic access to the instance of Mongo that hosts Rya instances. (not null)
    +     * @param instanceExists - The interactor used to check if a Rya instance exists. (not null)
    +     */
    +    public MongoUninstall(final MongoClient adminClient, final MongoInstanceExists instanceExists) {
    +        this.adminClient = requireNonNull(adminClient);
    +        this.instanceExists = requireNonNull(instanceExists);
    +    }
    +
    +    @Override
    +    public void uninstall(final String ryaInstanceName) throws InstanceDoesNotExistException, RyaClientException {
    +        try {
    --- End diff --
    
    Done.


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159989874
  
    --- Diff: extras/indexing/src/main/java/org/apache/rya/api/client/mongo/MongoConnectionDetails.java ---
    @@ -0,0 +1,119 @@
    +/**
    + * 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.rya.api.client.mongo;
    +
    +import static java.util.Objects.requireNonNull;
    +
    +import java.util.Optional;
    +
    +import org.apache.rya.indexing.accumulo.ConfigUtils;
    +import org.apache.rya.mongodb.MongoDBRdfConfiguration;
    +
    +import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
    +import edu.umd.cs.findbugs.annotations.NonNull;
    +
    +/**
    + * The information the shell used to connect to Mongo server, not the DB or collections.
    + */
    +@DefaultAnnotation(NonNull.class)
    +public class MongoConnectionDetails {
    +
    +    private final Optional<String> username;
    +    private final Optional<char[]> password;
    +    private final String hostname;
    +    private final int port;
    +
    +    /**
    +     * Constructs an instance of {@link MongoConnectionDetails}.
    +     *
    +     * @param hostname - The hostname of the Mongo DB that was connected to. (not null)
    +     * @param port - The port of the Mongo DB that was connected to.
    +     * @param username - The username that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     * @param password - The password that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     */
    +    public MongoConnectionDetails(
    +            final String hostname,
    +            final int port,
    +            final Optional<String> username,
    +            final Optional<char[]> password) {
    +        this.hostname = requireNonNull(hostname);
    +        this.port = port;
    +        this.username = requireNonNull(username);
    +        this.password = requireNonNull(password);
    +    }
    +
    +    /**
    +     * @return The hostname of the Mongo DB that was connected to.
    +     */
    +    public String getHostname() {
    +        return hostname;
    +    }
    +
    +    /**
    +     * @return The port of the Mongo DB that was connected to.
    +     */
    +    public int getPort() {
    +        return port;
    +    }
    +
    +     /**
    +      * @return The username that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<String> getUsername() {
    +         return this.username;
    +     }
    +
    +     /**
    +      * @return The password that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<char[]> getPassword() {
    +         return password;
    +     }
    +
    +    /**
    +     * Create a {@link MongoDBRdfConfiguration} that is using this object's values.
    +     *
    +     * @param ryaInstanceName - The Rya instance to connect to. (not null)
    +     * @return Constructs a new {@link MongoDBRdfConfiguration} object with values from this object.
    +     */
    +    public MongoDBRdfConfiguration build(final String ryaInstanceName) {
    +        // Note, we don't use the MongoDBRdfConfigurationBuilder here because it explicitly sets
    +        // authorizations and visibilities to an empty string if they are not set on the builder.
    +        // If they are null in the MongoRdfConfiguration object, it may do the right thing.
    +        final MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration();
    +        conf.setBoolean(ConfigUtils.USE_MONGO, true);
    +        conf.setMongoHostname(hostname);
    +        conf.setMongoPort("" + port);
    +        conf.setMongoDBName(ryaInstanceName);
    +
    +        if(username.isPresent()) {
    +            conf.setMongoUser(username.get());
    +        }
    +
    +        if(password.isPresent()) {
    +            conf.setMongoPassword( new String(password.get()) );
    +        }
    +
    +        // Default to having a table prefix of "rya", otherwise the app doesn't work for some reason.
    +        conf.setTablePrefix("rya");
    --- End diff --
    
    It looks like there's already a ticket open for this. 
    https://issues.apache.org/jira/browse/RYA-135


---

[GitHub] incubator-rya issue #258: [WIP] RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/585/



---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159950520
  
    --- Diff: extras/rya.pcj.fluo/pom.xml ---
    @@ -37,7 +37,7 @@
             <module>pcj.fluo.api</module>
             <module>pcj.fluo.app</module>
             <module>pcj.fluo.client</module>
    -        <module>pcj.fluo.integration</module>
    --- End diff --
    
    This probably shouldn't be commented out.


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159989279
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/client/RyaClient.java ---
    @@ -53,37 +55,37 @@
          */
         public RyaClient(
                 final Install install,
    -            final CreatePCJ createPcj,
    -            final DeletePCJ deletePcj,
    -            final CreatePeriodicPCJ createPeriodicPcj,
    -            final DeletePeriodicPCJ deletePeriodicPcj,
    -            final ListIncrementalQueries listIncrementalQueries,
    -            final BatchUpdatePCJ batchUpdatePcj,
    +            final Optional<CreatePCJ> createPcj,
    +            final Optional<DeletePCJ> deletePcj,
    +            final Optional<CreatePeriodicPCJ> createPeriodicPcj,
    +            final Optional<DeletePeriodicPCJ> deletePeriodicPcj,
    +            final Optional<ListIncrementalQueries> listIncrementalQueries,
    +            final Optional<BatchUpdatePCJ> batchUpdatePcj,
                 final GetInstanceDetails getInstanceDetails,
                 final InstanceExists instanceExists,
                 final ListInstances listInstances,
    -            final AddUser addUser,
    -            final RemoveUser removeUser,
    +            final Optional<AddUser> addUser,
    +            final Optional<RemoveUser> removeUser,
                 final Uninstall uninstall,
                 final LoadStatements loadStatements,
                 final LoadStatementsFile loadStatementsFile,
                 final ExecuteSparqlQuery executeSparqlQuery) {
             this.install = requireNonNull(install);
             this.createPcj = requireNonNull(createPcj);
             this.deletePcj = requireNonNull(deletePcj);
    -        this.createPeriodicPcj = createPeriodicPcj;
    -        this.deletePeriodicPcj = deletePeriodicPcj;
    -        this.listIncrementalQueries = listIncrementalQueries;
    +        this.createPeriodicPcj = requireNonNull(createPeriodicPcj);
    +        this.deletePeriodicPcj = requireNonNull(deletePeriodicPcj);
    +        this.listIncrementalQueries = requireNonNull(listIncrementalQueries);
             this.bactchUpdatePCJ = requireNonNull(batchUpdatePcj);
             this.getInstanceDetails = requireNonNull(getInstanceDetails);
             this.instanceExists = requireNonNull(instanceExists);
             this.listInstances = requireNonNull(listInstances);
             this.addUser = requireNonNull(addUser);
             this.removeUser = requireNonNull(removeUser);
             this.uninstall = requireNonNull(uninstall);
    -        this.loadStatements = requireNonNull(loadStatements);
    --- End diff --
    
    They shouldn't have been. Adding them back in.


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159949461
  
    --- Diff: extras/indexing/src/main/java/org/apache/rya/api/client/mongo/MongoUninstall.java ---
    @@ -0,0 +1,65 @@
    +/**
    + * 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.rya.api.client.mongo;
    +
    +import static java.util.Objects.requireNonNull;
    +
    +import org.apache.rya.api.client.InstanceDoesNotExistException;
    +import org.apache.rya.api.client.InstanceExists;
    +import org.apache.rya.api.client.RyaClientException;
    +import org.apache.rya.api.client.Uninstall;
    +
    +import com.mongodb.MongoClient;
    +import com.mongodb.MongoException;
    +
    +import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
    +import edu.umd.cs.findbugs.annotations.NonNull;
    +
    +/**
    + * An Mongo implementation of the {@link Uninstall} command.
    + */
    +@DefaultAnnotation(NonNull.class)
    +public class MongoUninstall implements Uninstall {
    +
    +    private final MongoClient adminClient;
    +    private final InstanceExists instanceExists;
    +
    +    /**
    +     * Constructs an instance of {@link MongoUninstall}.
    +     *
    +     * @param adminClient- Provides programmatic access to the instance of Mongo that hosts Rya instances. (not null)
    +     * @param instanceExists - The interactor used to check if a Rya instance exists. (not null)
    +     */
    +    public MongoUninstall(final MongoClient adminClient, final MongoInstanceExists instanceExists) {
    +        this.adminClient = requireNonNull(adminClient);
    +        this.instanceExists = requireNonNull(instanceExists);
    +    }
    +
    +    @Override
    +    public void uninstall(final String ryaInstanceName) throws InstanceDoesNotExistException, RyaClientException {
    +        try {
    --- End diff --
    
    Preconditions


---

[GitHub] incubator-rya issue #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/606/



---

[GitHub] incubator-rya issue #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/587/<h2>Failed Tests: <span class='status-failure'>3</span></h2><h3><a name='incubator-rya-master-with-optionals-pull-requests/org.apache.rya:rya.prospector' /><a href='https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/587/org.apache.rya$rya.prospector/testReport'>incubator-rya-master-with-optionals-pull-requests/org.apache.rya:rya.prospector</a>: <span class='status-failure'>3</span></h3><ul><li><a href='https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/587/org.apache.rya$rya.prospector/testReport/org.apache.rya.prospector.mr/ProspectorTest/testCount/'><strong>org.apache.rya.prospector.mr.ProspectorTest.testCount</strong></a></li><li><a href='https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/587/org.apache.rya$rya.prospector/testReport/org.apache.rya.prospector.service/ProspectorServiceEvalStatsDAOTest/testCount
 /'><strong>org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAOTest.testCount</strong></a></li><li><a href='https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/587/org.apache.rya$rya.prospector/testReport/org.apache.rya.prospector.service/ProspectorServiceEvalStatsDAOTest/testNoAuthsCount/'><strong>org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAOTest.testNoAuthsCount</strong></a></li></ul>



---

[GitHub] incubator-rya issue #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/607/



---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258


---

[GitHub] incubator-rya issue #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/586/



---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159947383
  
    --- Diff: extras/indexing/src/main/java/org/apache/rya/api/client/mongo/MongoConnectionDetails.java ---
    @@ -0,0 +1,119 @@
    +/**
    + * 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.rya.api.client.mongo;
    +
    +import static java.util.Objects.requireNonNull;
    +
    +import java.util.Optional;
    +
    +import org.apache.rya.indexing.accumulo.ConfigUtils;
    +import org.apache.rya.mongodb.MongoDBRdfConfiguration;
    +
    +import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
    +import edu.umd.cs.findbugs.annotations.NonNull;
    +
    +/**
    + * The information the shell used to connect to Mongo server, not the DB or collections.
    + */
    +@DefaultAnnotation(NonNull.class)
    +public class MongoConnectionDetails {
    +
    +    private final Optional<String> username;
    +    private final Optional<char[]> password;
    +    private final String hostname;
    +    private final int port;
    +
    +    /**
    +     * Constructs an instance of {@link MongoConnectionDetails}.
    +     *
    +     * @param hostname - The hostname of the Mongo DB that was connected to. (not null)
    +     * @param port - The port of the Mongo DB that was connected to.
    +     * @param username - The username that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     * @param password - The password that was used to establish the connection
    +     *   when performing administrative operations. (not null)
    +     */
    +    public MongoConnectionDetails(
    +            final String hostname,
    +            final int port,
    +            final Optional<String> username,
    +            final Optional<char[]> password) {
    +        this.hostname = requireNonNull(hostname);
    +        this.port = port;
    +        this.username = requireNonNull(username);
    +        this.password = requireNonNull(password);
    +    }
    +
    +    /**
    +     * @return The hostname of the Mongo DB that was connected to.
    +     */
    +    public String getHostname() {
    +        return hostname;
    +    }
    +
    +    /**
    +     * @return The port of the Mongo DB that was connected to.
    +     */
    +    public int getPort() {
    +        return port;
    +    }
    +
    +     /**
    +      * @return The username that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<String> getUsername() {
    +         return this.username;
    +     }
    +
    +     /**
    +      * @return The password that was used to establish the connection when performing administrative operations.
    +      */
    +     public Optional<char[]> getPassword() {
    +         return password;
    +     }
    +
    +    /**
    +     * Create a {@link MongoDBRdfConfiguration} that is using this object's values.
    +     *
    +     * @param ryaInstanceName - The Rya instance to connect to. (not null)
    +     * @return Constructs a new {@link MongoDBRdfConfiguration} object with values from this object.
    +     */
    +    public MongoDBRdfConfiguration build(final String ryaInstanceName) {
    +        // Note, we don't use the MongoDBRdfConfigurationBuilder here because it explicitly sets
    +        // authorizations and visibilities to an empty string if they are not set on the builder.
    +        // If they are null in the MongoRdfConfiguration object, it may do the right thing.
    +        final MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration();
    +        conf.setBoolean(ConfigUtils.USE_MONGO, true);
    +        conf.setMongoHostname(hostname);
    +        conf.setMongoPort("" + port);
    +        conf.setMongoDBName(ryaInstanceName);
    +
    +        if(username.isPresent()) {
    +            conf.setMongoUser(username.get());
    +        }
    +
    +        if(password.isPresent()) {
    +            conf.setMongoPassword( new String(password.get()) );
    +        }
    +
    +        // Default to having a table prefix of "rya", otherwise the app doesn't work for some reason.
    +        conf.setTablePrefix("rya");
    --- End diff --
    
    That is strange behavior.  You don't have any idea where it breaks?  Was the table prefix hard coded somewhere else?  Seems like hard coding it here just perpetuates the problem...


---

[GitHub] incubator-rya pull request #258: RYA-104 Mongo Rya Shell Integration

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

    https://github.com/apache/incubator-rya/pull/258#discussion_r159989683
  
    --- Diff: extras/rya.pcj.fluo/pom.xml ---
    @@ -37,7 +37,7 @@
             <module>pcj.fluo.api</module>
             <module>pcj.fluo.app</module>
             <module>pcj.fluo.client</module>
    -        <module>pcj.fluo.integration</module>
    --- End diff --
    
    Fixed.


---