Java desktop links of the week, August 6

I’m back from my travels last week and have a few links to share – enjoy! 🙂

Java desktop links of the week, July 23

Heaps of good links this week – enjoy!

  • Johan Vos announced that JavaFX 11 early access builds are now available in Maven Central, and the final release is on track for release in September (with JDK 11). This is really cool as we are getting to the point where JavaFX is decoupled from and able to progress at its own pace, separate from the JDK. There is a short how-to document up on the Gluon website.
  • Pedro DV continues to improve JMetro, adding support for TreeView, Tabs / TabPane, and context menu.
  • Gerrit Grunwald has two posts this week. Firstly an anchor selector control, and secondly, on rolling gradients.
  • Jordan Martinez has announced he is looking for someone to take over maintaining the RichTextFX (and related) projects, as he is moving onto other technologies and won’t have the time going forward. I hope someone steps up, as there is some really cool technology here and it would be a shame to see it abandoned.
  • Andres Almiray has two blog posts this week. Firstly about creating aggregate JavaFX bindings, and secondly about using Sass in JavaFX (something that I know Gluon does also with Gluon Mobile).
  • Dirk Lemmermann has another JavaFX tip, this time on masking / clipping / alpha channels.
  • Tristan Deloche has open sourced Lyrebird, a free, open-source, cross-platform twitter client.

Triggering Azure Functions with Java when a storage change occurs

Recently my azure-javadocs project has been running into trouble. This project is a simple one that uses Travis CI to clone a number of GitHub projects, generate an aggregate JavaDoc from all of them, and then uses the static hosting feature of GitHub to host that output. The problem is that for every build, all of the files in the static branch on GitHub are overwritten, and over time this has become exceedingly large. Travis CI was configured to run daily, and in the last six months or so of running this service, the .git directory in a fresh clone has grown to 4.18GB! This is clearly not going to end well 🙂

So, I set about rearchitecting this project, and now I’m using the free Visual Studio Team Services (VSTS) to do the bulk of the work, as well as Azure Functions to do a little bit of work at the end. Essentially, VSTS now acts as my git repository and build system. For every commit into the git repo, a build is triggered automatically (I commit infrequently – just whenever I want to enable / disable a project from the generated Javadoc – so VSTS is also set to run the build daily). The build steps are specified within the VSTS user interface, and run through the standard steps: clone all the external repos, run Maven tasks to install and generate javadoc. The build concludes by creating a zip file containing the javadoc output, and storing it in an ‘incoming’ container within my Azure storage account.

Now that I don’t want to host the JavaDoc within GitHub (because I don’t want to end up with a massive repo again), I make use of a new feature of Azure Storage, which is the built-in support for hosting static sites directly from a storage container (technically the feature is still in-preview, but it works well for me). All I need to do is place my static website (i.e. the JavaDoc output) into a special $web container that is created for me by Azure Storage when I enable the static sites support.

The cool part comes next: I’ve written an Azure Function (in Java, of course) that is set up to trigger on any files being added to the incoming container. When a file appears, Azure makes sure to call my function, where I can then do whatever I want. In my case, I use it as a chance to firstly empty the entire $web container, and then to unzip the new zip file into the $web container, before deleting the zip file. Once this is all done, the docs are available from (which, coincidentally, is another Azure Function written in Java). At present the API docs available here are just a subset of all available docs, but I plan to add the missing ones soon (pending some pull requests into various projects).

The code I wrote is below. The most notable aspect is the use of @BlobTrigger  to tell the function that I want to trigger on file changes in the ‘incoming’ container. The code is not overly complex, and mostly just deals with deleting all files and then unzipping all files, but I hope it is helpful for someone who is wanting to work out how to use Azure Functions to act as the glue between different services.

In the fullness of time it is unlikely I will need to even have this Azure Function code at all – VSTS will almost certainly have first class support for static site hosting baked into it any day now, but because static site hosting is currently a preview feature, I took it as a good opportunity to learn how to trigger an Azure Function on something different than an HTTP Trigger, and I’m publishing it here in case others run into any issues trying to achieve this for themselves.