Docs‎ > ‎


Espresso Logic is designed to complement automation with provisions for extending:
  • SQL access - Your SQL operations are normally automated, but you can override these defaults to address more complex cases

  • logic - most of your logic is addressed with spreadsheet-like expressions, but you can utilize the full power of server-side JavaScript as described here.  You can even extend the system with new rule types that automate patterns you discover.
Note you can use the JavaScript debugger to verify your logic.

Architected to be Open, Extensible

Recall that Espresso Logic is, underneath, a war file.  It is distributed that way, or as a cloud/appliance-based service.  It runs within the JVM as shown below.

Any client or server can call in to Espresso, via REST.  This might include chron jobs, App Servers built with familiar frameworks, etc.

There are some key tenants that make the logic open and extensible:
  • The system provides numerous events, which you can handle in server-side JavaScript.

  • Logic for Events, Formulas and Constraints are specified in JavaScript
In both cases, once you get into JavaScript, you have
  • Full access to JavaScript (note it is restricted in eval versions, due to multi-tenant security considerations)

  • Ability to access any other JavaScript or Java logic running in the JVM, via loadable libraries (described below)

  • Ability to access remote services, via REST, SOAP, etc.
In addition, as a RESTful service, you can of course invoke Espresso resources from any machine or client, ranging from a mobile app, to a internal / partner system, an App Server, etc.

Server-side JavaScript

Server-side JavaScript enables you to extend system automation for update and retrieval logic with procedural code.  Underlying these services is the Object Model created from your schema, providing persistence-enabled row objects for accessing attributes and related data.

Formula and Validation Logic

You specify JavaScript methods for Reactive formula and validation expressions.  In the most common case, these are simple expression such as row.price * row.quantity.  Note the system analyzes your JavaScript for dependencies to provide proper ordering.

JavaScript support makes it straightforward to build conditional logic, or invoke standard functions such as date arithmetic.  You are also free to perform complex processing, invoke other SOA services or re-usable Java/JavaScript methods.  Your logic is analyzed for dependencies which are reflected in proper execution order.

Logic Event Rule Type

Table Event Handlers are invoked with the current / old rows and the current verb on POST, PUT and DELETE operations.  They can operate on this row, the results of which is subjected to Reactive Expressions.

Resource Row Event

Resource Row Events are fired as rows are retrieved.  You can inject new attributes or remove attributes or even make REST calls and append results.

JavaScript Resource Type

Resources are typically retrieved by automated SQL, but you can specify the Resource Type as JavaScript, wherein you supply your own JavaScript to return the JSON.

HTTP Handler

You can define HTTP Handler for your own custom end points to build services perhaps unrelated to your database objects.

Request Event

Request Events provide an entry point before logic is invoked and Reponse Events can be used after all processing has been completed on any Request.

Supporting Services

The extension capabilities draw upon the following underlying services.

JavaScript Context variables (e.g., row, LogicContext)

The system initializes important Context Variables you'll need for your code to operate, including:
  • row - a JavaScript object representing the current row, with accessors for attributes and related data, persistence (with logic enforcement)

  • LogicContext - services for creating, reading, updating and deleting rows.
      Provides information about key logic state, including verb, nest level; please see the api documentation  
You also have access to System Logic services such as allocate, copy, etc.


Formulas and Validations can refer to JavaScript functions that return scalar results.  Good examples include Date/Time functions.

Re-usable Rule Types

You can add new Rule Types to the core rules (Formula, Sum, Count, Validation and so forth).  You can define the parameters they accept, which are then used by the Logic Designer to utilize an extended rule.  Extended Rule Types are designed to enable you to detect logic patterns, and implement re-usable solutions to these.  The InsertIntoFrom and Allocation rules utilize this underlying technology, and so are good illustrations of the power of this technique.

JavaScript Libraries

JavaScript invocations typically provide the row and logic context for your programmatic access.  In many cases, you will want to utilize libraries of existing functions, such as date routines. Only select (check) the libraries you intend to use.  You can also include your own libraries (upload) by selecting the 'Your Libraries tab and the 'Create New Library' button. 

Java jars

In the same manner, you can add (upload) Java jar files (remember to click the used to allow the classloader to load them for your project).  Once the Jar file is loaded you can invoke classes and methods directly from JavaScript.

Customized SQL

Custom SQL

Resources with a Type of Custom SQL enable you to supply your own SQL for update-able objects.  Your SQL must return the columns modeled by the Resource.

Free SQL

You can define Resources with a Type of Free SQL.  This enables you to supply your own SQL, without restriction.  

Subpages (1): HTTP Handler