The current implementation of org.geotools.referencing.factory.epsg.DefaultFactory in conjunction with org.geotools.referencing.factory.epsg.DataSource has several issues in JBoss:
- The DATASOURCE_NAME is hardcoded to a name that is not appropriate for JBoss (it should be 'java:EPSG'). I suggest to make the name configurable, perhaps with a Hint.
- Extending javax.sql.DataSource prevents the use of a standard J2EE JDBC data source. It is also inappropriate to do this just to create the actual factory.
- In a multiuser-environment, it is not appropriate to permanently reserve a database connection from a pool like FactoryUsingSQL does it. A connection should just be obtained from the pool when needed and then returned by closing it.
- The current architecture has problems with concurreny: either one uses just a single factory, then it becomes a bottleneck. Or one uses a pool of factories, but then the connection hogging (see above) becomes a serious issue.