Search in sources :

Example 81 with Resource

use of lucee.commons.io.res.Resource in project Lucee by lucee.

the class ConfigImpl method getRPCClassLoader.

@Override
public ClassLoader getRPCClassLoader(boolean reload) throws IOException {
    if (rpcClassLoader != null && !reload)
        return rpcClassLoader;
    Resource dir = getClassDirectory().getRealResource("RPC");
    if (!dir.exists())
        dir.createDirectory(true);
    rpcClassLoader = new PhysicalClassLoader(this, dir, null, false);
    return rpcClassLoader;
}
Also used : PhysicalClassLoader(lucee.commons.lang.PhysicalClassLoader) Resource(lucee.commons.io.res.Resource) CompressResource(lucee.commons.io.res.type.compress.CompressResource)

Example 82 with Resource

use of lucee.commons.io.res.Resource in project Lucee by lucee.

the class ConfigImpl method getScriptMapping.

/* *
	 * @return the tagDirectory
	
	public Resource getTagDirectory() {
		return tagDirectory;
	} */
/**
 * mapping used for script (JSR 223)
 * @return
 */
public Mapping getScriptMapping() {
    if (scriptMapping == null) {
        // Physical resource TODO make in RAM
        Resource physical = getConfigDir().getRealResource("jsr223");
        if (!physical.exists())
            physical.mkdirs();
        this.scriptMapping = new MappingImpl(this, "/mapping-script/", physical.getAbsolutePath(), null, ConfigImpl.INSPECT_NEVER, true, true, true, true, false, true, null, -1, -1);
    }
    return scriptMapping;
}
Also used : Resource(lucee.commons.io.res.Resource) CompressResource(lucee.commons.io.res.type.compress.CompressResource) MappingImpl(lucee.runtime.MappingImpl)

Example 83 with Resource

use of lucee.commons.io.res.Resource in project Lucee by lucee.

the class ConfigServerImpl method loadLocalExtensions.

@Override
public List<ExtensionDefintion> loadLocalExtensions() {
    Resource[] locReses = getLocalExtensionProviderDirectory().listResources(new ExtensionResourceFilter(".lex"));
    if (localExtensions == null || localExtSize != locReses.length || extHash(locReses) != localExtHash) {
        localExtensions = new ArrayList<ExtensionDefintion>();
        Map<String, String> map = new HashMap<String, String>();
        RHExtension ext;
        String v, fileName, uuid, version;
        ExtensionDefintion ed;
        for (int i = 0; i < locReses.length; i++) {
            ed = null;
            // we stay happy with the file name when it has the right pattern (uuid-version.lex)
            fileName = locReses[i].getName();
            if (fileName.length() > 39) {
                uuid = fileName.substring(0, 35);
                version = fileName.substring(36, fileName.length() - 4);
                if (Decision.isUUId(uuid)) {
                    ed = new ExtensionDefintion(uuid, version);
                    ed.setSource(this, locReses[i]);
                }
            }
            if (ed == null) {
                try {
                    ext = new RHExtension(this, locReses[i], false);
                    ed = new ExtensionDefintion(ext.getId(), ext.getVersion());
                    ed.setSource(ext);
                } catch (Exception e) {
                    SystemOut.printDate(e);
                }
            }
            if (ed != null) {
                // check if we already have an extension with the same id to avoid having more than once
                v = map.get(ed.getId());
                if (v != null && v.compareToIgnoreCase(ed.getId()) > 0)
                    continue;
                map.put(ed.getId(), ed.getVersion());
                localExtensions.add(ed);
            }
        }
        localExtHash = extHash(locReses);
        // we store the size because localExtensions size could be smaller because of duplicates
        localExtSize = locReses.length;
    }
    return localExtensions;
}
Also used : RHExtension(lucee.runtime.extension.RHExtension) ExtensionDefintion(lucee.runtime.extension.ExtensionDefintion) HashMap(java.util.HashMap) Resource(lucee.commons.io.res.Resource) ExtensionResourceFilter(lucee.commons.io.res.filter.ExtensionResourceFilter) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) TagLibException(lucee.transformer.library.tag.TagLibException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException)

Example 84 with Resource

use of lucee.commons.io.res.Resource in project Lucee by lucee.

the class ConfigServerImpl method getSecurityDirectory.

@Override
public Resource getSecurityDirectory() {
    Resource cacerts = null;
    // javax.net.ssl.trustStore
    String trustStore = SystemUtil.getPropertyEL("javax.net.ssl.trustStore");
    if (trustStore != null) {
        cacerts = ResourcesImpl.getFileResourceProvider().getResource(trustStore);
    }
    // security/cacerts
    if (cacerts == null || !cacerts.exists()) {
        cacerts = getConfigDir().getRealResource("security/cacerts");
        if (!cacerts.exists())
            cacerts.mkdirs();
    }
    return cacerts;
}
Also used : Resource(lucee.commons.io.res.Resource)

Example 85 with Resource

use of lucee.commons.io.res.Resource in project Lucee by lucee.

the class ConfigWebImpl method getDebuggerPool.

public DebuggerPool getDebuggerPool() {
    if (debuggerPool == null) {
        Resource dir = getConfigDir().getRealResource("debugger");
        dir.mkdirs();
        debuggerPool = new DebuggerPool(dir);
    }
    return debuggerPool;
}
Also used : DebuggerPool(lucee.runtime.debug.DebuggerPool) Resource(lucee.commons.io.res.Resource)

Aggregations

Resource (lucee.commons.io.res.Resource)309 IOException (java.io.IOException)100 ApplicationException (lucee.runtime.exp.ApplicationException)54 PageException (lucee.runtime.exp.PageException)40 ArrayList (java.util.ArrayList)31 Struct (lucee.runtime.type.Struct)28 ByteArrayInputStream (java.io.ByteArrayInputStream)21 InputStream (java.io.InputStream)21 ExpressionException (lucee.runtime.exp.ExpressionException)19 StructImpl (lucee.runtime.type.StructImpl)18 MalformedURLException (java.net.MalformedURLException)17 PageContextImpl (lucee.runtime.PageContextImpl)17 PageSource (lucee.runtime.PageSource)16 FileResource (lucee.commons.io.res.type.file.FileResource)15 SecurityException (lucee.runtime.exp.SecurityException)15 BundleException (org.osgi.framework.BundleException)15 ZipEntry (java.util.zip.ZipEntry)13 ExtensionResourceFilter (lucee.commons.io.res.filter.ExtensionResourceFilter)13 Array (lucee.runtime.type.Array)13 File (java.io.File)12