[wildfly-dev] EE level java:comp/DefaultDataSource for WildFly 8...

Eduardo Martins emartins at redhat.com
Tue Sep 24 06:14:34 EDT 2013


Maybe we should create a doc with a reference design, since there are several default EE resources among our subsystems...

IMHO default EE resources should be defined in the related subsystem configuration, otherwise the EE subsystem config will always be changing. In this case there should a configuration in the Datasources subsystem such as:

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
       <datasources>
       		<default-datasource jndi-name="java:jboss/datasources/ExampleDS" />   
		<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
			...
	        </datasource>
        	...
       </datasources>
</subsystem>

For an easier/faster logic to find the default resource, and since we don't officially support linkref on jndi, the subsystem management op that adds the default resource (in this case default-datasource) should create a binder service pointing to a *fixed* jndi name (let's says java:jboss/ee/default/datasource) and inject it with the target resource (in this case the jndi name java:jboss/datasources/ExampleDS).

Then the subsystem should provide a DUP that for EE modules do the required default bindings, in this case java:comp/DefaultDataSource and/or java:module/DefaultDataSource

The subsystem then also needs to take care of the default mapping to the *fixed* jndi name from @Resource injection, this can be accomplished by adding a EEResourceReferenceProcessor to the EEResourceReferenceProcessorRegistry present in DU attachment with key org.jboss.as.ee.component.Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY

--E


More information about the wildfly-dev mailing list