Search in sources :

Example 1 with RamResourceProviderOld

use of lucee.commons.io.res.type.ram.RamResourceProviderOld in project Lucee by lucee.

the class Compress method load.

private synchronized void load(boolean caseSensitive) throws IOException {
    long actLastMod = ffile.lastModified();
    lastMod = actLastMod;
    lastCheck = System.currentTimeMillis();
    Map<String, Boolean> args = new HashMap<String, Boolean>();
    args.put("case-sensitive", Caster.toBoolean(caseSensitive));
    if (temp == null) {
        String cid = "";
        Config config = ThreadLocalPageContext.getConfig();
        if (config != null) {
            cid = config.getIdentification().getId();
            temp = config.getTempDirectory();
        }
        if (temp == null)
            temp = SystemUtil.getTempDirectory();
        temp = temp.getRealResource("compress");
        temp = temp.getRealResource(MD5.getDigestAsString(cid + "-" + ffile.getAbsolutePath()));
        if (!temp.exists())
            temp.mkdirs();
    }
    if (temp != null) {
        String name = Caster.toString(actLastMod) + ":" + Caster.toString(ffile.length());
        name = MD5.getDigestAsString(name, name);
        root = temp.getRealResource(name);
        if (actLastMod > 0 && root.exists())
            return;
        ResourceUtil.removeChildrenEL(temp);
        // if(root!=null)ResourceUtil.removeChildrenEL(root);
        // String name=CreateUUID.invoke();
        // root=temp.getRealResource(name);
        root.mkdirs();
    } else {
        ResourceProvider ramProvider = new RamResourceProviderOld().init("ram", args);
        root = ramProvider.getResource("/");
    }
    _load();
}
Also used : RamResourceProviderOld(lucee.commons.io.res.type.ram.RamResourceProviderOld) HashMap(java.util.HashMap) Config(lucee.runtime.config.Config) ResourceProvider(lucee.commons.io.res.ResourceProvider)

Aggregations

HashMap (java.util.HashMap)1 ResourceProvider (lucee.commons.io.res.ResourceProvider)1 RamResourceProviderOld (lucee.commons.io.res.type.ram.RamResourceProviderOld)1 Config (lucee.runtime.config.Config)1