Over the last couple of weeks I have reimplemented just enough of the C++ libglom code as Java in Online Glom‘s gwt-glom, removing the need for java-libglom (which wrapped libglom for Java via SWIG). It’s now working and deployed on the Online Glom test server.
This makes both development and deployment much easier. It also made the source code all camelCase so it’s not offensive to the eyes of Java coders.
To replace libglom’s use of GdaSqlBuilder, I used jOOQ. That worked well, thanks to its maintainer, Lukas Eder, who was very helpful and who quickly added some API that I needed.
Now that the code is all Java I really hope that more people will look over the code and point out anything that can be improved. I still don’t know Java like I know C++ so please don’t be shy about telling me that I have made mistakes.
However, this raised some new issues. I wanted some of the objects to contain some extra cached data, so that the client code did not have to calculate it itself, often by retrieving some other related object. Right now these are extra member variables in the classes, but that prevents me from splitting the code off into a new java-glom library.
The GWT system works great, but something is inconsistent about how it shows errors, and it can’t be right that some compilation errors only show up when running, rather than when building.
As much as I would like to move on to implementing editing, I need to spend some time now on getting some regression tests set up in the maven build. These must create and run temporary PostgreSQL database instances like I do in the Glom autotools build. For instance, I need to check that the new SQL-building code, using jOOQ, is really safe from SQL injection like the libglom code seems to be.
My recent changes also caused the OnlineGlomService async API to be particularly inefficient, sometimes sending far more data back to the server than should be necessary. I will try to avoid that and try to make this API smaller, to avoid so many round trips.
5 thoughts on “Online Glom is now all Java”
It’s great to see a pure Java version of libglom working with Online Glom! It’s definitely going to make deploying and hacking easier.
Just one comment: If you want to create a full Java version of libglom without the restrictions of GWT, I believe you can use the RequestFactory framework to transfer the data without having to manually copy it into DTOs. Of course this will add complexity to the code. Here’s the documentation in case you’re interested:
Now that Online Glom has only Java dependencies, it would be interesting to see if it could be run on Heroku (http://www.heroku.com/) or OpenShift (https://openshift.redhat.com/app/) to remove the need to manage servers.
Many thanks for the suggestions.
My question is regarding this java library is how you do login. I have a student that is currently implementing the android version for glom and we wanted to have some ideas regarding how do you authenticate the user.
> My question is regarding this java library
What Java library do you mean?
> is how you do login
Both regular Glom and Online Glom (gwt-glom) just defer to PostgreSQL. You give Online Glom (or Glom) your password, and Online Glom tries to connect to the database server (via JDBC). If it cannot connect the the database server (as specified in the .glom file) then it doesn’t bother trying to do anything else with that .glom file.
This means, of course, that the database structure is currently not secret, though the data is.
> I have a student that is currently implementing the android version for glom
That’s a rather large task. I hope you have modest initial goals, such as implementing a read-only UI, like Online Glom
Also, you probably want to use my libglom code from gwt-glom to load the .glom file and use its structure:
But you can’t use that source code unless your source code is open source. Which would be wise anyway, so it would be great to see a link to something in gitorious or github, for instance.
it’s open sourced, and it will be only a read only client, no developer mode will be supported. At the right time it will be available on git, but fist this student has to finish the project, after that everything has to be organized for git.