Here's the format I suggest. See it with syntax highlighting:
(https)pastee(dot)org(slash)7tj7r

The main advantages are:

* It's extensible (XML w/ XSD isn't extensible)
* It's typesafe (Properties are not typesafe)
* It's discoverable (Properties are not discoverable)
* It's still readable
* It's testable (XML is, properties aren't)
* It has exactly "one way" of doing things.
* It could integrate with CDI qualifiers.

@TomEEModuleConfiguration("my-application-name")
public class ConfigModule {
 
        @Inject
        private ServerContext context;
 
        @ConfigurationId(env = "Development")
        public void getDevConfig(ModuleConfig config) {
 
                DataSourceConfig dataSourceConfig =
                       
createResourceConfig(MySqlDataSource.class).setUserName("bob").setPassword("thebuilder").setHostName("localhost")
                                .setPort(3306);
 
                DataSource newDataSource =
config.addServerResource(dataSourceConfig);
               
config.addConfig(bind(Resource.class).withName("jdbc/myAppDataSource").annotatingType(DataSource.class)
                        .to(newDataSource));
        }
 
        @DefaultConfiguration
        @ConfigurationId(env = "Production")
        public void getProdConfig(ModuleConfig config) {
               
config.addConfig(bind(Resource.class).withName("jdbc/anotherDataSource").annotatingType(DataSource.class)
                        .to(context.lookup(DataSource.class,
"jdbc/anotherDataSource")));
        }
}


* To extend the format, TomEE authors just add new properties or classes on
the classpath
* I like the notion of "environments". The current environment could be set
with JMX, the server's http console, or in the tomee.properties under
tomcat/conf
* I'd like to have these descriptors in the ear/war/jar itself, but if they
could be also placed in tomcat/lib this would be a huge benefit to server
administrators
* This could integrate with CDI really well!
* This is groundbreaking. No other app server has ever done this!



--
View this message in context: 
http://openejb.979440.n4.nabble.com/DISCUSS-New-descriptor-format-tp4657040p4657092.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Reply via email to