jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Honig, Daniel" <DHo...@tiaa-cref.org>
Subject RE: Changing the default configuration behaviour
Date Wed, 25 Jun 2003 00:16:20 GMT
I think it would be cleaner to have 

 configure(String){} call a new method configure(InputStream).

 Configure(String) should just build an InputStream and invoke
with the stream it got from the classpath or filesystem.
configure(inputstream) would then
do the work.

I didn't take this approach due to time, I just slapped this together though
and for now it seems to work fairly well.
I can submit the patch in the form I mentioned above or just go with this:
     * Configure from specific properties file
     * @param propFile Path <u>within classpath</u> to load configuration
    public void configure( String propFile )
        log.debug( "Creating cache manager from config file: " + propFile );
        Properties props = new Properties();

        InputStream is=null;
			//Check to see if we can get the file in propFile
from the claspath.
			//If not check the fileSystem for(propFile)
			is=getClass().getResourceAsStream( propFile );
		        is = new FileInputStream(new File(propFile));

            props.load( is );

            if ( log.isDebugEnabled() )
                log.debug( "File contained " + props.size() + " properties"
        catch ( IOException ex )
            log.error( "Failed to load properties", ex );
            throw new IllegalStateException( ex.getMessage() );
            catch ( Exception ignore )
                // Ignored

        configure( props );


-----Original Message-----
From: James Taylor [mailto:james@jamestaylor.org]
Sent: Tuesday, June 24, 2003 3:21 PM
To: Turbine JCS Users List
Subject: Re: Changing the default configuration behaviour

I think it would be perfectly reasonable to change
CompositeCacheManager#configure( String ) to attempt to load from the
filesystem if the config is not found in the classpath. That method could
easily be refactored to create a new version accepting an InputStream. I
have no objection to applying a patch which did either or both of these

-- jt

To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-user-help@jakarta.apache.org

This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.

View raw message