jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Cronin" <tcro...@interwoven.com>
Subject RE: cache.ccf resolution via classpath?
Date Thu, 01 Sep 2005 19:14:39 GMT
Fyi.

I was able to do the following without moding the jar.

  public static void init(String cacheRoot)
  {
    try
    {
      CompositeCacheManager ccm =
CompositeCacheManager.getUnconfiguredInstance();
      Properties props = new Properties();
 
props.load(Thread.currentThread().getContextClassLoader().getResourceAsS
tream(CACHE_PROPS_FILE));
      props.setProperty(DISK_CACHE_ROOT_KEY, cacheRoot);
      ccm.configure(props);
    }
    catch (IOException e)
    {
      throw new RuntimeException("Failed to init cache", e);
    }
  }

-----Original Message-----
From: Tim Cronin [mailto:tcronin@interwoven.com] 
Sent: Wednesday, August 31, 2005 1:27 PM
To: JCS Users List
Subject: RE: cache.ccf resolution via classpath?


Thanks, yes it would be nice if you could configure the exact path.

I'm trying to build jcs now.

Do you have a copy of jisp 2.5 all that's on the site is 3.0 and
It's incompatible (lot's of errors).



-----Original Message-----
From: Mitch Gorman [mailto:gorman@sportsline.com] 
Sent: Wednesday, August 31, 2005 1:22 PM
To: JCS Users List
Subject: Re: cache.ccf resolution via classpath?

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 (1.2.6.5, 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);
            }
        }
        try
        {
            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.

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



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


Mime
View raw message