Search in sources :

Example 11 with CFMLEngineFactory

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

the class XMLConfigAdmin method runUpdate.

/**
 * run update from cfml engine
 * @throws PageException
 */
public void runUpdate(Password password) throws PageException {
    checkWriteAccess();
    ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
    CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
    synchronized (factory) {
        try {
            cleanUp(factory);
            factory.update(cs.getPassword(), cs.getIdentification());
        } catch (Exception e) {
            throw Caster.toPageException(e);
        }
    }
}
Also used : FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) ConverterException(lucee.runtime.converter.ConverterException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CFXTagException(lucee.runtime.cfx.CFXTagException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClassException(lucee.commons.lang.ClassException) DOMException(org.w3c.dom.DOMException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) HTTPException(lucee.runtime.exp.HTTPException) CFMLEngineFactory(lucee.loader.engine.CFMLEngineFactory)

Example 12 with CFMLEngineFactory

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

the class XMLConfigAdmin method _removeUpdate.

private void _removeUpdate(Password password, boolean onlyLatest) throws PageException {
    checkWriteAccess();
    ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
    try {
        CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
        if (onlyLatest) {
            factory.removeLatestUpdate(cs.getPassword());
        } else
            factory.removeUpdate(cs.getPassword());
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
}
Also used : FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) ConverterException(lucee.runtime.converter.ConverterException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CFXTagException(lucee.runtime.cfx.CFXTagException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClassException(lucee.commons.lang.ClassException) DOMException(org.w3c.dom.DOMException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) HTTPException(lucee.runtime.exp.HTTPException) CFMLEngineFactory(lucee.loader.engine.CFMLEngineFactory)

Example 13 with CFMLEngineFactory

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

the class XMLConfigAdmin method changeVersionTo.

public void changeVersionTo(Version version, Password password, IdentificationWeb id) throws PageException {
    checkWriteAccess();
    ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
    try {
        CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
        cleanUp(factory);
        // do we have the core file?
        final File patchDir = factory.getPatchDirectory();
        File localPath = new File(version.toString() + ".lco");
        if (!localPath.isFile()) {
            localPath = null;
            Version v;
            final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
            for (final File patch : patches) {
                v = CFMLEngineFactory.toVersion(patch.getName(), null);
                // not a valid file get deleted
                if (v == null) {
                    patch.delete();
                } else {
                    if (v.equals(version)) {
                        // match!
                        localPath = patch;
                    } else // delete newer files
                    if (OSGiUtil.isNewerThan(v, version)) {
                        patch.delete();
                    }
                }
            }
        }
        // download patch
        if (localPath == null) {
            downloadCore(factory, version, id);
        }
        factory.restart(password);
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
}
Also used : Version(org.osgi.framework.Version) ExtensionFilter(lucee.loader.util.ExtensionFilter) BundleFile(lucee.runtime.osgi.BundleFile) File(java.io.File) IsZipFile(lucee.runtime.functions.system.IsZipFile) ZipFile(java.util.zip.ZipFile) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) ConverterException(lucee.runtime.converter.ConverterException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CFXTagException(lucee.runtime.cfx.CFXTagException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClassException(lucee.commons.lang.ClassException) DOMException(org.w3c.dom.DOMException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) HTTPException(lucee.runtime.exp.HTTPException) CFMLEngineFactory(lucee.loader.engine.CFMLEngineFactory)

Example 14 with CFMLEngineFactory

use of lucee.loader.engine.CFMLEngineFactory 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 15 with CFMLEngineFactory

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

the class XMLConfigAdmin method restart.

public void restart(ConfigServerImpl cs) throws PageException {
    CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
    synchronized (factory) {
        try {
            Method m = factory.getClass().getDeclaredMethod("_restart", new Class[0]);
            if (m == null)
                throw new ApplicationException("cannot restart Lucee.");
            m.setAccessible(true);
            m.invoke(factory, new Object[0]);
        } catch (Exception e) {
            throw Caster.toPageException(e);
        }
    }
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) Method(java.lang.reflect.Method) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) ConverterException(lucee.runtime.converter.ConverterException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CFXTagException(lucee.runtime.cfx.CFXTagException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClassException(lucee.commons.lang.ClassException) DOMException(org.w3c.dom.DOMException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) HTTPException(lucee.runtime.exp.HTTPException) CFMLEngineFactory(lucee.loader.engine.CFMLEngineFactory)

Aggregations

CFMLEngineFactory (lucee.loader.engine.CFMLEngineFactory)15 IOException (java.io.IOException)10 CFMLEngine (lucee.loader.engine.CFMLEngine)9 PageException (lucee.runtime.exp.PageException)8 BundleException (org.osgi.framework.BundleException)8 UnknownHostException (java.net.UnknownHostException)7 File (java.io.File)6 MalformedURLException (java.net.MalformedURLException)6 ApplicationException (lucee.runtime.exp.ApplicationException)6 Bundle (org.osgi.framework.Bundle)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 ClassException (lucee.commons.lang.ClassException)5 CFXTagException (lucee.runtime.cfx.CFXTagException)5 ConverterException (lucee.runtime.converter.ConverterException)5 ExpressionException (lucee.runtime.exp.ExpressionException)5 HTTPException (lucee.runtime.exp.HTTPException)5 SecurityException (lucee.runtime.exp.SecurityException)5 FunctionLibException (lucee.transformer.library.function.FunctionLibException)5 TagLibException (lucee.transformer.library.tag.TagLibException)5 DOMException (org.w3c.dom.DOMException)5