jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mitch Gorman <gor...@sportsline.com>
Subject Re: cache.ccf resolution via classpath?
Date Wed, 31 Aug 2005 18:21:41 GMT
Tim Cronin wrote:

> It's still the same.
> I got the latest code from the svn repos and CompositeCacheManager
> Hasn't changed.
> InputStream is = getClass().getResourceAsStream( propFile );

    personally, i got a little frustrated with that mechanism.  our SAs 
are rather anal about enforcing standardized application deployment 
locations, which means i needed to be able to specify on the commandline 
to my app exactly where the various config files it needs will be residing.

    therefore, i kluged CompositeCacheManager.java (, not that it 
matters, probably) like so:

    public void configure( String propFile )
        log.debug( "Creating cache manager from config file: " + propFile );

        Properties props = new Properties();

        InputStream is = getClass().getResourceAsStream( propFile );
        try {
            if (is == null)
                is = new FileInputStream(new File(propFile));
        } catch (FileNotFoundException fe) {
            if (log.isErrorEnabled()) {
                log.error("Cannot locate properties file " + propFile);
            props.load( is );
etc., etc., etc.

    now, i pass it in to my via commons-cli, call 
JCS.setConfigFilename(), and everything's hunky-dory;  no more worrying 
about making sure it's in the right location in the classpath.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message