Search in sources :

Example 1 with AMFEngine

use of lucee.runtime.net.amf.AMFEngine in project Lucee by lucee.

the class XMLConfigWebFactory method loadFlex.

private static void loadFlex(ConfigServerImpl configServer, ConfigImpl config, Document doc) throws IOException {
    Element el = getChildByName(doc.getDocumentElement(), "flex");
    // engine - we init a engine for every context, but only the server context defines the eggine class
    if (config instanceof ConfigServerImpl) {
        // only server context
        // arguments
        Map<String, String> args = new HashMap<String, String>();
        String _caster = getAttr(el, "caster");
        if (_caster != null)
            args.put("caster", _caster);
        String _config = getAttr(el, "configuration");
        if (_config != null)
            args.put("configuration", _config);
        ClassDefinition<AMFEngine> cd = getClassDefinition(el, "", config.getIdentification());
        if (cd.hasClass())
            ((ConfigServerImpl) config).setAMFEngine(cd, args);
    } else if (configServer != null && configServer.getAMFEngineClassDefinition() != null && configServer.getAMFEngineClassDefinition().hasClass()) {
        // only web contexts
        AMFEngine engine = toAMFEngine(config, configServer.getAMFEngineClassDefinition(), null);
        if (engine != null) {
            engine.init((ConfigWeb) config, configServer.getAMFEngineArgs());
            ((ConfigWebImpl) config).setAMFEngine(engine);
        }
        ;
    }
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) Element(org.w3c.dom.Element) AMFEngine(lucee.runtime.net.amf.AMFEngine)

Example 2 with AMFEngine

use of lucee.runtime.net.amf.AMFEngine in project Lucee by lucee.

the class XMLConfigWebFactory method toAMFEngine.

private static AMFEngine toAMFEngine(Config config, ClassDefinition<AMFEngine> cd, AMFEngine defaultValue) {
    Log log = config.getLog("application");
    try {
        Class<AMFEngine> clazz = cd.getClazz(null);
        if (clazz != null) {
            Object obj = clazz.newInstance();
            if ((obj instanceof AMFEngine))
                return (AMFEngine) obj;
            log.error("Flex", "object [" + Caster.toClassName(obj) + "] must implement the interface " + AMFEngine.class.getName());
        }
    } catch (Exception e) {
        log.error("Flex", e);
    }
    return defaultValue;
}
Also used : ConsoleExecutionLog(lucee.runtime.engine.ConsoleExecutionLog) Log(lucee.commons.io.log.Log) ExecutionLog(lucee.runtime.engine.ExecutionLog) AMFEngine(lucee.runtime.net.amf.AMFEngine) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) InvocationTargetException(java.lang.reflect.InvocationTargetException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SQLException(java.sql.SQLException) IOException(java.io.IOException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) ClassException(lucee.commons.lang.ClassException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException)

Aggregations

AMFEngine (lucee.runtime.net.amf.AMFEngine)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Log (lucee.commons.io.log.Log)1 ClassException (lucee.commons.lang.ClassException)1 ConsoleExecutionLog (lucee.runtime.engine.ConsoleExecutionLog)1 ExecutionLog (lucee.runtime.engine.ExecutionLog)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 PageException (lucee.runtime.exp.PageException)1 SecurityException (lucee.runtime.exp.SecurityException)1 FunctionLibException (lucee.transformer.library.function.FunctionLibException)1 TagLibException (lucee.transformer.library.tag.TagLibException)1 BundleException (org.osgi.framework.BundleException)1 Element (org.w3c.dom.Element)1