There is now an easy way to set "factory default" symbols in HiveMind. There's a new extension point, hivemind.FactoryDefaults
. Contributions to this extension point define default values for symbols. The "order" of the SymbolSource contribution is very high (I suppose I should have use MAX_INT, but instead, it's at 1,000,000). This means that, in all likelyhood, whatever additional SymbolSources you add will be consulted first, before FactoryDefaults.
So, you might ask, what the hell are symbols? Symbols are a kind of escape clause; sometimes the information you want to contribute isn't known until runtime (or at least, until the time the application is installed). This might include database URLs or admin e-mail addresses.
What we don't want is to make anyone unpack a JAR and edit the descriptors ... that's just asking for trouble.
Instead, the descriptor includes a placeholder for the value (using the Ant syntax), i.e.
<database url="${database.url}"/>
At runtime, HiveMind will convert database.url
into a real string. How? By using HiveMind extension points. hivemind.SymbolSource
identifies different
objects or services that can be consulted for symbol values, and establishes the order in which checks take place. FactoryDefaults is one contribution here (if you check, you'll see that
there's a service to complement the extension point). You can add your own SymbolSources as well.
I can imagine an installer that would present a UI to collect all of these configurable values ... the database URLs and e-mail addresses. The installer creates a properties file and stores it where the running application can access it; a SymbolSource contribution can read the properties file. Tah dah!
Increasingly, new HiveMind features are being implemented in terms of existing features. This is very cool and to be expected.
No comments:
Post a Comment