An aspect of configuration I want this JSR to address is management, from an Ops point of view.
Unzipping an *AR archive to edit some XML descriptor as JavaEE used to suggest is a non-sense from an Ops point of view. I don't think we will ever propose JavaEE apps to be distributed as RPM system packages, but we have to consider Ops practices and tooling with care.
Application delivery should be a self contained, single artifact, ready for production, and all deployment steps has to be scriptable (think about puppet/chef and other tools)
I'd like the configuration JSR to define a system level API so a configuration management tool can manage application config injecting configuration parameters and defining resources and bindings for application.
We could provide a command line tool for this purpose, but I have a preference for REST API, so it's easily usable from whatever languages (python, ruby, shell scripts). Docker has such an API to define application containers, even this is a lower level than what we're considering here, this is a good sample to follow. java-config could then offer a daemon to offer a REST endpoint and let configuration tools query/update the application configuration.
Note : a JavaEE container could also act as such a daemon and let Ops tool manage resources and application bindings directly.
create a new application :
POST applications/create
{
// some optional JSON metadata, can be vendor specific
}
return application unique ID
create a managed resource, for sample a database connection pool
{
"type":"datasource",
"url":"jdbc:....",
// some more (can be vendor specific) parameters
}
return resource unique ID
set application parameters as key=value pairs
POST applications/id/parameters
{
"foo":"bar"
}
could also easily support structured data if this makes sense.
bind a resource to an application
POST applications/id/bindings
{
"resouce":"id",
"alias":"jdbc/db"
}
From application itself, can use this same API to retrieve application configuration during startup / deployment. On a standalone (SE) application, this can just be used by a javaagent to GET parameters and bindings and setup system properties and resources for starting application.
On a JavaEE application, I advocate for System properties support, I think this is fully feasible with application isolation but arguably hack-ish (*). Anyway same mechanism to GET application configuration from daemon can be used for comparable purpose, injecting JNDI resources and offering a higher level, new API for direct consumption.
(*) many things on Java are hacks anyway. Looking at lambdas implementations using a private $ method demonstrates a clever hack, but still a hack. I don't think we should exclude such a solution just because it looks like a hack. Java is old now, and we have to ensure backward compatibility, so have to suffer this constraints. As a Jenkins committer I know well backward compatibility impact on API design and maintenance :P