Package com.granule

Examples of com.granule.CachedBundle


        id = signatureToId.get(signature);
      }

    // If it wasn't then compress it
    if (id == null) {
      CachedBundle cs = new CachedBundle();
      cs.setFragments(fragmentDescriptors);
      cs.setOptions(options);
      if (isJs)
        cs.compileScript(settings, request);
      else
        cs.compileCss(settings, request);
      synchronized (this) {
        id = generateId(signature);
        signatureToId.put(signature, id);
        bundles.put(id, cs);
View Full Code Here


  }

  public CachedBundle getCompiledBundle(IRequestProxy request,
      CompressorSettings settings, String id) throws JSCompileException {
    logger.debug("FileCache getCompiledBundle");
    CachedBundle bundle = null;
    synchronized (this) {
      bundle = bundles.get(id);
    }
    if (bundle != null && settings.isCheckTimestamps()) {
      synchronized (bundle) {
        if (bundle.isChanged(request)) {
          if (bundle.getOptions() != null)
            settings.setOptions(bundle.getOptions());
          bundle.compile(settings, request);
          synchronized (this) {
            saveBundle(id, bundle);
          }
        }
      }
View Full Code Here

          String id = obj.getString("id");
          if (bundles.containsKey(id)) {
            logger.warn("Rebuilding from dublicate id");
            needRebuildCache = true;
          }
          CachedBundle cs = new CachedBundle();
          cs.loadFromJSON(obj, cacheFolder);
          CompressorSettings settings = TagCacheFactory
              .getCompressorSettings(context.getRealPath("/"));
          if (cs.getOptions() != null)
            settings.setOptions(cs.getOptions());
          String signature = generateSignature(settings, cs
              .getFragments(), cs.getOptions(), cs.isScript());
          signatureToId.put(signature, id);
          bundles.put(id, cs);
        } catch (Exception e) {
          needRebuildCache = true;
          logger.error("Could not load bundle from catalog:", e);
View Full Code Here

                id = signatureToId.get(signature);
            }

        // If it wasn't then compress it
        if (id == null) {
            CachedBundle cs = new CachedBundle();
            cs.setFragments(fragmentDescriptors);
            cs.setOptions(options);
            if (isJs)
                cs.compileScript(settings, request);
            else
                cs.compileCss(settings, request);
            synchronized (this) {
                id = generateId(signature);
                signatureToId.put(signature, id);
                bundles.put(id, cs);
                try {
                    logger.debug(cs.getJSONString(id));
                } catch (JSONException e) {
                    //
                }
            }
        }
View Full Code Here

        return id;
    }

    public CachedBundle getCompiledBundle(IRequestProxy request, CompressorSettings settings, String id)
            throws JSCompileException {
        CachedBundle bundle = null;
        synchronized (this) {
            bundle = bundles.get(id);
        }
        if (bundle != null && settings.isCheckTimestamps()) {
            synchronized (bundle) {
                if (bundle.isChanged(request)) {
                    if (bundle.getOptions() != null)
                        settings.setOptions(bundle.getOptions());
                    bundle.compile(settings, request);
                }
            }
        }

        return bundle;
View Full Code Here

TOP

Related Classes of com.granule.CachedBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.