Skip to content

Clotho Internals : JongoConnection

David Tran edited this page May 24, 2017 · 1 revision

JongoConnection

src/main/java/org/clothocad/core/persistence/jongo/JongoConnection.java

Summary

JongoConnection is the class that actually goes out and accesses the specified database on the specified port according to either the default or the .clothoconfig file. Persistor performs final checks on the data, and then tells JongoConnection to go and actually do some CRUD operation. It holds references to the database and the data, cred, and roles collections.

How to use

JongoConnection handles CRUD related to:

  1. User Permissions and Credentials
  2. Objects related to the Data Model

Jongo's semantics mimics MongoDB's if you have experience using the shell. You can form special queries in the same way. An example formed by the getRegex function:

JongoConnection Regex query:
{'parameters.variable': {$regex: 'rate', $options: 'i'},'parameters.units': {$regex: 'second-1', $options: 'i'},'name': {$regex: 'yfp', $options: 'i'},'displayID': {$regex: 'c32', $options: 'i'},'parameters.name': {$regex: 'YFP Degradation Rate', $options: 'i'}}

When to look/work here

You'll do work here if you need to modify/fix/expand any operations related to the database.

If there are ever any moments when interacting with the database does not go the way you would expect, you may also need to work here. An example is when Persistor.get(BioDesign.class, bdId); would return a BioDesign object properly, but it would not check to see if the document from the database indeed represented a BioDesign object.

As we start reworking/fixing the security, we'll also need to rework the related functions here unless we decide to use a separate database/framework/application for security. There are a bunch of avenues that do not necessarily coincide with JongoConnection.

Clone this wiki locally