use of lucee.runtime.gateway.GatewayEntryImpl in project Lucee by lucee.
the class XMLConfigWebFactory method loadGateway.
private static void loadGateway(ConfigServerImpl configServer, ConfigImpl config, Document doc) {
boolean hasCS = configServer != null;
// ConfigWebImpl cw = (ConfigWebImpl) config;
GatewayEngineImpl engine = hasCS ? ((ConfigWebImpl) config).getGatewayEngine() : null;
Map<String, GatewayEntry> mapGateways = new HashMap<String, GatewayEntry>();
// get from server context
if (hasCS) {
Map<String, GatewayEntry> entries = configServer.getGatewayEntries();
if (entries != null && !entries.isEmpty()) {
Iterator<Entry<String, GatewayEntry>> it = entries.entrySet().iterator();
Entry<String, GatewayEntry> e;
while (it.hasNext()) {
e = it.next();
mapGateways.put(e.getKey(), ((GatewayEntryImpl) e.getValue()).duplicateReadOnly(engine));
}
}
}
Element eGateWay = getChildByName(doc.getDocumentElement(), "gateways");
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_GATEWAY);
GatewayEntry ge;
// cache connections
Element[] gateways = getChildren(eGateWay, "gateway");
// if(hasAccess) {
String id;
// caches
if (hasAccess) {
for (int i = 0; i < gateways.length; i++) {
Element eConnection = gateways[i];
id = getAttr(eConnection, "id").trim().toLowerCase();
ge = new GatewayEntryImpl(engine, id, getClassDefinition(eConnection, "", config.getIdentification()), eConnection.getAttribute("cfc-path"), eConnection.getAttribute("listener-cfc-path"), getAttr(eConnection, "startup-mode"), toStruct(getAttr(eConnection, "custom")), Caster.toBooleanValue(getAttr(eConnection, "read-only"), false));
if (!StringUtil.isEmpty(id)) {
mapGateways.put(id.toLowerCase(), ge);
} else
SystemOut.print(config.getErrWriter(), "missing id");
}
config.setGatewayEntries(mapGateways);
} else if (hasCS) {
((ConfigWebImpl) config).getGatewayEngine().clear();
}
}
Aggregations