Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The Play Framework
Mimir's web interface is built on top of the Play Framework. This framework has a built-in web-server. There is no need to mess around with installing and maintaining a separate server process. Calling
sbt run in the application starts up the embedded server.
The current interface
As of this writing, Mimir is a single page web application. The main page contains a navigation bar and a query box. The last part of the page can either be textual status messages or tabular query output. Only state information that is kept is the current working database, and that is maintained through a hidden field. Dynamic content such as query explanations are handled through AJAX. An asynchronous request is made to the server and the server responds with JSON content.
Adding new functionality could mean adding a new page or new services that can be accessed through AJAX requests.
- Add an entry to the
/conf/routesfile, specifying the URI and an
Actionto be called that would handle requests for that URI. The URI could be
POSTor other HTTP methods.
- Define the
Actions accept query string parameters as method arguments. Responses can be HTML specified in
/views, JSON or XML. Play provides utilities to convert data objects into JSON/XML and vice versa.
- Use existing methods in the
mimircore/src/main/scala/mimir/WebAPI.scalato call into the core mimir code or add new methods if necessary.
In Play code changes are auto-reloaded. There is no need to restart the server for most code changes to be reflected. However, changing application configurations does require a restart. This includes modifying the
Unit tests can be specified using
specs2 and are contained within the
A note on synchronization
Actions are asynchronous, which means there can be multiple
Actions executing at the same time. The bulk of the debugging in Mimir happens on the SQLite database, which does not support multiple connections to the same database file. Therefore, opening and closing connections to the backend need to be synchronized. At present, a semaphore like solution is implemented in
/mimircore/src/main/scala/mimir/sql/JDBCBackend.scala to deal with this issue.
- Add support for connecting to databases backed by backends other than SQLite.
- Possibly, add user sessions and maintain state information. This could lead to a more elegant solution to the synchronization problem with SQLite. Backend connections would be opened and closed in session scope instead of per query.