I have broken MantleService into several logical REST end points.
Themes (/pentaho/api/theme)
A new service allowing you to list the available themes as well as set / get the current theme for the authenticated user.
User Settings (/pentaho/api/user-settings)
A general purpose user settings service API which lets you list settings (for the authenticated user) as well as get / set user settings.
Version (/pentaho/api/version)
Simple service to return the current product version and also provide a software updates list (if applicable).
System Refresh (/pentaho/api/system/refresh)
A collection of resource refresh/reload services for global actions, metadata, system settings, repository, mondrian and reporting.
User Console (/pentaho/api/mantle)
This was my dumping ground for services which I did not feel provided value to be separated into their own endpoint. The service is able to return mantle settings (different than user settings), list mondrian cubes, and get/set the locale for the authenticated user.
This work has simplified the User Console from a development standpoint, we have less ivy dependencies and the debug configuration is much more simple. All of the services return XML or JSON (determined by request headers) except for the extremely simple services which just return a string (text/plain), such as getting the current theme. I had to change the client code in PUC to consume JSON rather than the convenience/luxury we had before with GWT-RPC. The approach I took was to create JSON overlay objects (which extend JavaScriptObject). These JSON overlays are returned from the JSON eval/parsing and we then re-gain all of the richness we once had, at the expense of rewriting our POJO mutators as JNI.
For example, in the simple case of themes, which have an id and a value we now have a JsTheme:
public class JsTheme extends JavaScriptObject {
protected JsTheme() {
}
public final native String getId() /*-{ return this.id; }-*/; //
public final native String getName() /*-{ return this.name; }-*/; //
}
Once we return a list of JsTheme from JSON, our GWT app can go on enjoying life pretty much the same way as before. As a point of completeness, here is how we return get the themes from the JSON string:
JsArray<JsTheme> themes = JsonUtils.safeEval(JsonUtils.escapeJsonForEval(response.getText()));
As of Friday, April 13, 2012 the entire use of GWT-RPC has been replaced with REST. Enjoy!
Hi Mike, great work!
ReplyDeletejust wondering, what about services for accessing datasources, metadata models and the repository? Are those in the generic mantle service too? Or is there still work to be done for these?
(Just curious, not impatient :)
kind regards,
Roland
PUC as it stands on its own has been purified. There are still some plugins that need some work to be converted over, but that work is entirely independent of PUC itself. With that being said, there are some data access API's which PIR uses (it uses open APIs). The entire repository has been exposed via REST, this is how PUC interacts with it. Pentaho Report Designer even publishes PRPTs over REST to the repository.
ReplyDeleteIs there any documentation covering the REST services that are available?
ReplyDelete