Search in sources :

Example 21 with CFMLEngine

use of lucee.loader.engine.CFMLEngine in project Lucee by lucee.

the class MappingImpl method loadArchive.

private void loadArchive() {
    if (archive == null || archMod == archive.lastModified())
        return;
    CFMLEngine engine = ConfigWebUtil.getEngine(config);
    BundleContext bc = engine.getBundleContext();
    try {
        archiveBundle = OSGiUtil.installBundle(bc, archive, true);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        archMod = archive.lastModified();
        config.getLog("application").log(Log.LEVEL_ERROR, "OSGi", t);
        archive = null;
    }
}
Also used : CFMLEngine(lucee.loader.engine.CFMLEngine) BundleContext(org.osgi.framework.BundleContext)

Example 22 with CFMLEngine

use of lucee.loader.engine.CFMLEngine in project Lucee by lucee.

the class CFMLEngineImpl method isRunning.

public boolean isRunning() {
    try {
        CFMLEngine other = CFMLEngineFactory.getInstance();
        // FUTURE patch, do better impl when changing loader
        if (other != this && controlerState.active() && !(other instanceof CFMLEngineWrapper)) {
            SystemOut.printDate("CFMLEngine is still set to true but no longer valid, " + lucee.runtime.config.Constants.NAME + " disable this CFMLEngine.");
            controlerState.setActive(false);
            reset();
            return false;
        }
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
    }
    return controlerState.active();
}
Also used : CFMLEngineWrapper(lucee.loader.engine.CFMLEngineWrapper) CFMLEngine(lucee.loader.engine.CFMLEngine)

Example 23 with CFMLEngine

use of lucee.loader.engine.CFMLEngine in project Lucee by lucee.

the class XMLConfigAdmin method updateCore.

public static void updateCore(ConfigServerImpl config, Resource core, boolean reload) throws PageException {
    try {
        // get patches directory
        CFMLEngine engine = ConfigWebUtil.getEngine(config);
        File f = engine.getCFMLEngineFactory().getResourceRoot();
        Resource res = ResourcesImpl.getFileResourceProvider().getResource(f.getAbsolutePath());
        Resource pd = res.getRealResource("patches");
        if (!pd.exists())
            pd.mkdirs();
        Resource pf = pd.getRealResource(core.getName());
        // move to patches directory
        core.moveTo(pf);
        core = pf;
        // 
        XMLConfigAdmin admin = new XMLConfigAdmin(config, null);
        admin.restart(config);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        DeployHandler.moveToFailedFolder(config.getDeployDirectory(), core);
        throw Caster.toPageException(t);
    }
}
Also used : Resource(lucee.commons.io.res.Resource) CFMLEngine(lucee.loader.engine.CFMLEngine) BundleFile(lucee.runtime.osgi.BundleFile) File(java.io.File) IsZipFile(lucee.runtime.functions.system.IsZipFile) ZipFile(java.util.zip.ZipFile)

Example 24 with CFMLEngine

use of lucee.loader.engine.CFMLEngine in project Lucee by lucee.

the class XMLConfigAdmin method installBundle.

private static BundleFile installBundle(Config config, BundleFile bf) throws IOException, BundleException {
    // does this bundle already exists
    BundleFile _bf = OSGiUtil.getBundleFile(bf.getSymbolicName(), bf.getVersion(), null, false, null);
    if (_bf != null)
        return _bf;
    CFMLEngine engine = CFMLEngineFactory.getInstance();
    CFMLEngineFactory factory = engine.getCFMLEngineFactory();
    // copy to jar directory
    File jar = new File(factory.getBundleDirectory(), bf.getSymbolicName() + "-" + bf.getVersion().toString() + (".jar"));
    InputStream is = bf.getInputStream();
    OutputStream os = new FileOutputStream(jar);
    try {
        IOUtil.copy(is, os, false, false);
    } finally {
        IOUtil.closeEL(is, os);
    }
    return new BundleFile(jar);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ZipInputStream(java.util.zip.ZipInputStream) InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) CFMLEngine(lucee.loader.engine.CFMLEngine) BundleFile(lucee.runtime.osgi.BundleFile) BundleFile(lucee.runtime.osgi.BundleFile) File(java.io.File) IsZipFile(lucee.runtime.functions.system.IsZipFile) ZipFile(java.util.zip.ZipFile) CFMLEngineFactory(lucee.loader.engine.CFMLEngineFactory)

Example 25 with CFMLEngine

use of lucee.loader.engine.CFMLEngine in project Lucee by lucee.

the class XMLConfigAdmin method _reload.

private synchronized void _reload() throws PageException, SAXException, ClassException, IOException, TagLibException, FunctionLibException, BundleException {
    // if(storeInMemoryData)XMLCaster.writeTo(doc,config.getConfigFile());
    CFMLEngine engine = ConfigWebUtil.getEngine(config);
    if (config instanceof ConfigServerImpl) {
        ConfigServerImpl cs = (ConfigServerImpl) config;
        XMLConfigServerFactory.reloadInstance(engine, cs);
        ConfigWeb[] webs = cs.getConfigWebs();
        for (int i = 0; i < webs.length; i++) {
            XMLConfigWebFactory.reloadInstance(engine, (ConfigServerImpl) config, (ConfigWebImpl) webs[i], true);
        }
    } else {
        ConfigServerImpl cs = ((ConfigWebImpl) config).getConfigServerImpl();
        XMLConfigWebFactory.reloadInstance(engine, cs, (ConfigWebImpl) config, false);
    }
}
Also used : CFMLEngine(lucee.loader.engine.CFMLEngine)

Aggregations

CFMLEngine (lucee.loader.engine.CFMLEngine)31 File (java.io.File)10 IOException (java.io.IOException)9 CFMLEngineFactory (lucee.loader.engine.CFMLEngineFactory)9 Bundle (org.osgi.framework.Bundle)9 Resource (lucee.commons.io.res.Resource)6 BundleFile (lucee.runtime.osgi.BundleFile)5 BundleException (org.osgi.framework.BundleException)5 ServletException (javax.servlet.ServletException)4 BundleContext (org.osgi.framework.BundleContext)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 Reader (java.io.Reader)3 BundleCollection (lucee.loader.osgi.BundleCollection)3 PageContext (lucee.runtime.PageContext)3 Struct (lucee.runtime.type.Struct)3 OutputStream (java.io.OutputStream)2 StringReader (java.io.StringReader)2 UnknownHostException (java.net.UnknownHostException)2 ArrayList (java.util.ArrayList)2