This is unofficial Java client library for WeDeploy!

WeDeploy provides a set of ready-to-use services that enables you to store data in the cloud, search and stream content in real time, authenticate users, send e-mails to your users and so much more!

This client allows Java applications to talk to WeDeploy cloud services as if those were local ones.

Why unofficial Java client ?

When this project started the Java client provided by WeDeploy had several issues. The major two ware

  • the API was modeled after the JavaScript API which makes it hard to work with in Java
  • it wasn’t modular which makes it hard to us it in modular runtimes (such as OSGi)

This client is composed of several modules prepared to be deployed in OSGi container. For traditional Java applications modules are loaded via standard Java SPI.

Modules

API Provides API contracts (in the form of interfaces and data classes) for all supported WeDeploy client services. This is the module that provides the types your application will use.
Cloud Client for (some of) WeDeploy's cloud services. It currently allows to:
  • check WeDeploy's status
Data Client for WeDeploy's data services. It currently allows to:
  • create / remove / update collections
  • create / remove / update documents
  • use Java beans or maps as documents
Gson data mapper Gson based implementation of the data mapping contract consumed by data services.
OkHttp transport OkHttp based implementation of the rest transport contract consumed by other services.
BOM BOM (Bill of Material) used by provisioning tools (such us Eccentric Modularity to auto provision applications and build stand-alone executables!

Usage

All modules are available in Maven Central!

Traditional Java applications make sure to have needed modules (API, cloud, data, mapper, transport, …) in your classpath.
OSGi containers deploy needed modules (API, cloud, data, mapper, transport, …) in whatever way you container supports
Eccentric Modularity (EM) executable jar in your POM declare dependency on API module and import the BOM. EM will automatically provision required modules.

Here is simple example of Data service:

WeDeployClient weDeploy = new WeDeployClient();
Collection collection = weDeploy.data().connect(project, service).collection("customers");

List<WeDeployDataDocument<User>> loadedUsers = collection.read(User.class, 10, 10);
User user = loadedUsers.get(1).getObject();
String id = loadedUsers.get(1).getId();
collection.update(id, updatedUser);
collection.delete(id);
collection.save(anotherUser);

In modular environment (OSGi and projects built with Eccentric Modularity (EM)) you can simply inject the service

@Reference
private WeDeployDataService weDeployDataService;

...

Collection collection = weDeployDataService.connect(project, service).collection("customers");

...

License

The project is released under Apache License, Version 2.0