Trillo Java SDK
Search
⌃K

Introduction

This document describes Java APIs for writing serverless functions. This document uses class and table for the same concept.

Terminology

Trillo data layer is designed to be generic and independent of the type of database such as relational, document, graph, etc. Therefore, some of the API use generic terms from UML (Unified Modelling Language). In the context of particular database technology, a UML concept may not support all the features for simplicity. For example, a relational DB 'table' can also be referred to as 'class', but it does not support inheritance. The following table describes the common terms (they may be used interchangeably).
Equivalent Terms
Concept
data source
It corresponds to a database. Trillo Workbench creates two default data sources common and vault. The corresponding database names are cloud_common and cloud_vault.
table, class, collection
Represents a structure with attributes. In a relational DB, it corresponds to a table.
column, attribute
A column of a table, an attribute of a class, a property of an object, etc.
association, relation
Relationship between tables or association between classes.
object, record
An instance of a class or a database record.
The following note is very important for the use of API.
When you create a class (using Trillo Workbench), it corresponds to a DB table. The table name is by default <class name>_tbl (i.e. the name you give to class/table at the time of creation suffixed by _tbl).
In APIs, the className parameter corresponds to the given name. You can create classes in the different data sources. Each data source corresponds to one DB.

Default Databases

Trillo Workbench by default provisions Cloud SQL in Google Cloud (MySQL). It uses it for storing data, metadata. It is also used for the new tables. By default it creates the following two databases:
  • cloud_vault: this is used as the user, tenant store. Its tables can be customized (while retaining a few important attributes as they are). You can't add new tables to this database using the workbench UI. This is referred to in the API by vault and in any SQL statement by cloud_vault.
  • cloud_common: this is used for several system tables that can be configured (while retaining a few important attributes as they are). Any new table specified in the application is created inside this database. This is referred to in the API by common and in any SQL statement by cloud_common.
Trillo Core platform permits the creation of several databases and integration with other DB technologies such as Mongo. But this functionality is not available through Trillo Workbench UI.
Trillo Core platform permits the creation of several databases and integration with other DB technologies such as Mongo. But this functionality is not available through Trillo Workbench UI.

Result Class

In the following sections, a special value for the return value will be mentioned. Trillo Workbench returns the result of API (SDK or restful) as an instance of the Result class. It is described below:
public class Result {
public static final String SUCCESS = "success";
public static final String FAILED = "failed";
public static final String UNKNOWN = "unknown";
private String status = UNKNOWN; // see other values above
private String message = null; // error or success message
private Map<String, Object> props = null; // functions may use for more info
private Object data = null; // In case of success it is the actual value of API
private int code = 0; // HTTP code when applicable
private String _rtag = "_r_"; // a flag indicating result object (useful for JS)
private boolean failed = false; // true if failed else false
private boolean success = true; // true if success else false
}
"failed" and "success" are redundant. They are provided for convenience.
Last modified 1yr ago