Splicer Blog

Data Model Automation

Mobile App SDK and Form Generator for Accessing Relational Data

Today, we released our free mobile app SDK generator. This tool allows you to generate an android SDK that correlates to the data structures in your relational database.

The generator is on our developer page, and works in conjunction with various open source source files found here. This blog post details how to use the Splicer SDK generator, which is part of the Splicer low code stack.

Demonstration of open source, model-driven design (MDD) for Android
This demonstrates dynamic droid forms, retrieving model data from a webservice, and storing/fetching model data in the Realm.io mobile database:

  1. Clone our android project.
  2. Clone our sample models project. To view the CAM template (.cam file) in this project, download and install the CAM Editor. General information about CAM is available here.
  3. Import the droid project into Android Studio and run it within an emulator.
  4. Click on the menu, then “fetch json” to view. This demonstrates retrieving data from a RESTful webservice, storing in Realm.io object database upon retrieval, and then the View displaying data the data in that database.
  5. Next, click on dropdown, “Forms”. This form is dynamic, and based on our model. The project —QMBForm — that draws the forms is fully open source. Hence, this project demonstrates how models defined in CAM drive open source droid forms.
  6. Now to do a round-trip test, navigate to our developer page and upload the cam template. This will return a newly generated model.
  7. Unzip the result of the generator per instructions on the developer page and re-run.

Phase 2: Create a custom android SDK that correlates to your relational database schema

  1. You should already have the CAM editor open with the sample template open for editing.
  2. Open the Cam preferences dialog by clicking “CAM Template Editor” menu item, then “Preferences”. Click “CAMEditor” drop-down, then “CAM Editor XSLT Transform”. Scroll to the bottom and you will see the following: Set stylesheet
  3. In that last input box, click “browse” to find CAM-SQL-designer.xsl in our Model-Samples project (under “xsl/tools” dir) as such: Set stylesheet 2 Click “apply” and “OK”.
  4. To create a droid model from your database, connect to your database, then drag-and-drop as outlined in this CAM video1. Make sure to use our working CAM template instead of creating a new one. Also, we need to add an additional step to this process. In the video, David instructs you to click the button to switch into “designer mode”. After you do that, we need to assign a namespace for your database: click the button just to the right of “designer mode”. The following dialog box will appear: Set Namespace 1
  5. Now click “set namespace” and enter the following string into the input box: “splicer=http://splicer.models”. Click “ok”. Next, change the “renaming mode” to CamelCase. The dialog box should look like the following: Set Namespace 2
  6. Click “ok” and then you can proceed to drag-and-drop your table structures into the left-hand-side of the tree. Drop your root elements beneath ModelRoot; here is what my model looks like after I dropped a “Metrics” element from one of my databases: Drag and Drop Sample
  7. Save your cam template, navigate to our developer page, and upload your .cam file. Note that the “namespace” input box should contain the “splicer” namespace as we set above. This will dictate the package name of your droid model classes. So if you change it, make sure to change in both places.
  8. Unzip the result of the generator per instructions on the developer page and re-run.
  9. Note that you would need to change the server URL (API_BASE_URL static in UserArrayAdapter) to point to your custom webservice. We plan to publish an open source version of our server system in the near-future, so drop us an email if you are interested in our server solutions and we’ll keep you in the loop.

This process allows you to create your own custom mobile app SDK for free and is part of the Splicer low code stack. The Splicer stack is a practical and light-weight “low code” solution using established open source modules.

We also support IOS and will provide details on that in a future blog post. Drop us an email in the mean-time if you urgently need help with that.


  1. Note all the CAM-related videos are here

Comments