ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gareth Moorst <gazj...@yahoo.co.uk>
Subject Re: Creating SQLMaps at runtime
Date Wed, 30 Aug 2006 15:45:00 GMT

The classpath scanning code is much simpler than I expected - in Spring, it just boils down


which returns an Enumeration of URLs.
The javadoc notes that there must be a folder for the method call to work reliably when searching
inside jar files.

Allowing wildcards in the filename is a bit more complex and involves finding the classpath
roots and iterating through the entries in classpath jars or folders to see if they match
the pattern.

The code is all in org.springframework.core.io.support.PathMatchingResourcePatternResolver
for the interested.

So scanning the classpath for named files is pretty easy to do... shall I expect it in the
next release? ;)

What remains is for me to figure out a way to mung the retrieved sql map files into an sql
map client.

Can anyone point me in the right direction?


----- Original Message ----
From: Gareth Moorst <gazj2ee@yahoo.co.uk>
To: user-java@ibatis.apache.org
Sent: Wednesday, 30 August, 2006 3:16:46 PM
Subject: Fw: Creating SQLMaps at runtime

Cheers for the quick reply..

As for searching the classpath, I'm not sure yet.
I only found out earlier today that Spring allows you to do just that - you can create an
ApplicationContext using a string  like 'classpath*:context.xml' to find all the context.xml
files on the classpath - that's how I was going to sort out the spring side of things.

I'll take a look at the spring source and see how they do it.


----- Original Message ----
From: Clinton Begin <clinton.begin@gmail.com>
To: user-java@ibatis.apache.org; Gareth Moorst <gazj2ee@yahoo.co.uk>
Sent: Wednesday, 30 August, 2006 3:09:02  PM
Subject: Re: Creating SQLMaps at runtime

>> search the classpath

How are you going to do that?  If that were an easy thing to do reliably, we'd probably just
do it for you by allowing:  <sqlMap resource="/*.xml" />

Any ideas? 


On 8/30/06, Gareth Moorst <gazj2ee@yahoo.co.uk> wrote: Hi,

What I'm trying to achieve is a way to have a set of 'core' sqlmaps, which are always loaded,
and a further set of optional sqlmaps, which are only loaded if present. 
 In particular, I want to search the classpath for sqlmap files at startup and 'inject' them
all into a running Spring configured sql map client.


View raw message