incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanne Waldman <>
Subject [Skinning] FileSystemStyleCache code - ok to delete?
Date Mon, 12 Feb 2007 23:04:19 GMT
I'm trying to figure out what's going on in FileSystemStyleCache 
regarding the caching code.

I noticed that this code is not called by anyone. Does anyone object to 
my deleting it? Or is there
some use for it so I should keep it around.

   * Returns a shared ImageProvider instance for the specified
   * XSS document and target cache directory.
   * @param source The path of the source XSS document.  The
   *   specified file must be a valid XSS document.  If the specified
   *   file does not exists, an IllegalArgumentException is thrown.
   * @param target The path of the target directory.  Generated
   *   CSS files are stored in this directory.  If the directory
   *   does not exist and can not be created, an IllegalArgumentException
   *   is thrown.
  public static StyleProvider getSharedCache(
    String source,
    String target
    // Make sure we have some source/target.
    if (source == null)
      throw new IllegalArgumentException("No source specified.");
    if (target == null)
      throw new IllegalArgumentException("No target specified.");

    // First, get the key to use to look up the cache
    String key = _getSharedCacheKey(source, target);

    // See if we've got a shared cache
    StyleProvider cache = _sSharedCaches.get(key);

    // If we didn't find a shared cache, create a new cache
    // and cache it in the shared cache cache.  :-)
    if (cache == null)
      // Create the new cache
      cache = new FileSystemStyleCache(source, target);

      // Before we save the new cache, make sure another thread hasn't
      // already cached a different instance.  Synchronize to lock up
      // _sSharedCaches.
      synchronized (_sSharedCaches)
        StyleProvider tmp = _sSharedCaches.get(key);
        if (tmp != null)
          // Stick with tmp
          cache = tmp;
          _sSharedCaches.put(key, cache);

    return cache;

View raw message