No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Fixed LINCENSE and Jan 6, 2015

Coverage Status

What is lightblue?

Cloud focused data services with dynamic querying, versioned schemas, and robust security.

Java Client Quickstart

The following example demonstrates how a lightblue service call can be used to retrieve data and unmarshal it to a model object.


In order to test the java client, the following prerequisites are needed (Parenthetical values are used in example below).

  • Existing lightblue installation (@
  • Private key + password (client-cert.pkcs12/'s3cr3t')
  • Trusted CA file for lightblue server (ca-cert.pem)
  • lightblue find query (
  • Java model object representing the returned projection (Foo)

Maven Dependendencies

Begin by importing the following maven dependencies, or their equivalent in your build system of choice. This example uses both the core library as well as the http library since the author's lightblue service communicates via http.




First, set configuration objects by creating a LightblueClientConfiguration object:

    LightblueClientConfiguration config = new LightblueClientConfiguration();
  • The certificate files need to either be prefixed with 'file://' or be on the same runtime classpath as the lightblue libraries.

Client Instantiation

After a configuration has been defined, a lightblue java client can be instantiated.

    HttpTransport httpTransport = JavaNetHttpTransport.fromLightblueClientConfiguration(config);
    LightblueHttpClient client = new LightblueHttpClient(config, httpTransport);

Performing a Query

Now simply use the lightblue client to retrieve data:

    DataFindRequest findRequest = new DataFindRequest("foo", "1.0");
    Foo foo =, Foo.class);

First the findRequest is given both the metadata model as well as the version of that model. Also, a where clause is given to define specific parameters for the sort. In addition to this, selects can be used to define projections, sorts for ordered collections, and ranges to limit returned results.

Now, the call can be made in order to call Lightblue, retrieve the find results, and attempt to map the returned JSON entity to the provided Java class.

  • Remember, that when attempting to retrieve related entities, be sure to include them recursively in the DataFindRequest"*"));

Other Common Operations

In addition to the quickstart above, below are several common operations that java developers will find useful.

Getting the Raw Lightblue Response

Often times, it is useful to parse the status and other information provided by the Lightblue response, in addition to the entities. This can be done using the following sample code:

    LightblueDataResponse response =;

Once a response object has been returned, the operation metadata can be interpreted:

    System.out.println("Query match count: " + response.parseMatchCount());

To map and inspect returned entities, simply parse the 'processed' JSON nodes:

    Foo foo = response.parseProcessed(Foo.class);