Rationale for bespoke extension system?

Hi, Nathan (and others); what was the rationale behind developing your own extension system instead of using ServiceLoader (http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html)?

Note that ServiceLoader allows you to prioritize the possible implementations, and is a standard part of the JDK.

In brief, place a file named com.whatever.YourService in META-INF/services.  Each line in the file is a classname that represents, in order, all known implementations of that service.

By contrast, the priority scheme which you’ve implemented requires all possible implementations to be instantiated so that their priority can be assessed.  That seems a little odd.

Best,
Laird

The main reason is because we still need to support 1.5 and ServiceLoader is new with 1.6. 

I also wanted to support more priority logic and so need to have an actual instance created of each class to support that.  For example, You all built-in Database implementations have a priority of 5, but a particular instance will only be used as the correct service if a it is a Database instance that supports the given database connection (based on database type and possibly version number).

Nathan

Thanks for the insight.

L

I am glad Liquibase doesn’t use ServiceLoader because “class” based integration is clunky with some JVM-languages, for example Clojure, which has functions as the idiomatic way to expose functionality and generating compiled classes forces one to jump through hoops.

Regards,
Shantanu

Does the liquibase system work well with clojure?

Nathan

Does the liquibase system work well with clojure?

Indeed yes! Calling Java code from Clojure is easy. Calling Clojure code from Java is not that difficult either. The trouble begins when a Java code expects a class name from Clojure. Bigger trouble ensues when some Java code expects a class with annotated fields/methods. To generate a class you need to compile a namespace with (:gen-class) and that is not very REPL friendly.

Regards,
Shantanu