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);
}
;
}
}
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;
}
Aggregations