Skip to content

Conversation

@DimitrisStaratzis
Copy link
Contributor

@DimitrisStaratzis DimitrisStaratzis commented Oct 6, 2022

This PR enables TileDB-Cloud-Java to use $home/.tiledb/cloud.json to store login information.

To achieve that I created a new Login class. This class is used the first time someone wants to login. This Login class takes as input all credentials and server settings required and has two additional options.

  1. RememberMe : if true, it will store the credentials in $home/.tiledb/cloud.json for future use.
  2. OverwritePrevious: If true, it will favor the new input credentials over the saved ones. In combination with RememberMe it can be used to overwrite the data in $home/.tiledb/cloud.json

In Addition I created the TileDBClient class to wrap the ApiClient class, similarly to what we do in python and R to avoid modifying auto-generated classes.

Loading the credentials is done by statically initiallizing the TileDBClient class.

Note: See updated example file for details.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #22111: Support cloud config file..

settings.gradle

#the api client contains the custom code for static initialization from the json file
src/main/java/io/tiledb/cloud/rest_api/ApiClient.java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should override generated classes. Can we take the approach we had in TileDB-Cloud-Py in that we create higher level classes that wrap the generated API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created the TileDBClient class to wrap the autogenerated one

Copy link
Member

@Shelnutt2 Shelnutt2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! One question then lgtm.

@@ -0,0 +1,73 @@
package io.tiledb.cloud.rest_api;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this up a level so we keep autogenerated in a separate package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@DimitrisStaratzis DimitrisStaratzis merged commit 8962c3e into master Oct 7, 2022
@DimitrisStaratzis DimitrisStaratzis deleted the dimitrisstaratzis/sc-22111/support-cloud-config-file branch October 7, 2022 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants