use of lucee.runtime.cfx.customtag.CPPCFXTagClass in project Lucee by lucee.
the class Admin method doGetCPPCFXTags.
private void doGetCPPCFXTags() throws PageException {
Map map = config.getCFXTagPool().getClasses();
lucee.runtime.type.Query qry = new QueryImpl(new Collection.Key[] { KeyConstants._displayname, KeyConstants._sourcename, KeyConstants._readonly, PROCEDURE, KeyConstants._name, KeyConstants._isvalid, SERVER_LIBRARY, KEEP_ALIVE }, 0, "query");
Iterator it = map.keySet().iterator();
int row = 0;
while (it.hasNext()) {
CFXTagClass tag = (CFXTagClass) map.get(it.next());
if (tag instanceof CPPCFXTagClass) {
row++;
qry.addRow(1);
CPPCFXTagClass ctag = (CPPCFXTagClass) tag;
qry.setAt(KeyConstants._displayname, row, tag.getDisplayType());
qry.setAt(KeyConstants._sourcename, row, tag.getSourceName());
qry.setAt(KeyConstants._readonly, row, Caster.toBoolean(tag.isReadOnly()));
qry.setAt(KeyConstants._isvalid, row, Caster.toBoolean(tag.isValid()));
qry.setAt(KeyConstants._name, row, ctag.getName());
qry.setAt(PROCEDURE, row, ctag.getProcedure());
qry.setAt(SERVER_LIBRARY, row, ctag.getServerLibrary());
qry.setAt(KEEP_ALIVE, row, Caster.toBoolean(ctag.getKeepAlive()));
}
}
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.cfx.customtag.CPPCFXTagClass in project Lucee by lucee.
the class Admin method doGetCFXTags.
/**
* @throws PageException
*/
private void doGetCFXTags() throws PageException {
Map map = config.getCFXTagPool().getClasses();
lucee.runtime.type.Query qry = new QueryImpl(new String[] { "displayname", "sourcename", "readonly", "isvalid", "name", "procedure_class", "procedure_bundleName", "procedure_bundleVersion", "keep_alive" }, map.size(), "query");
Iterator it = map.keySet().iterator();
int row = 0;
while (it.hasNext()) {
row++;
CFXTagClass tag = (CFXTagClass) map.get(it.next());
qry.setAt("displayname", row, tag.getDisplayType());
qry.setAt("sourcename", row, tag.getSourceName());
qry.setAt("readonly", row, Caster.toBoolean(tag.isReadOnly()));
qry.setAt("isvalid", row, Caster.toBoolean(tag.isValid()));
if (tag instanceof CPPCFXTagClass) {
CPPCFXTagClass ctag = (CPPCFXTagClass) tag;
qry.setAt(KeyConstants._name, row, ctag.getName());
qry.setAt("procedure_class", row, ctag.getProcedure());
qry.setAt("keepalive", row, Caster.toBoolean(ctag.getKeepAlive()));
} else if (tag instanceof JavaCFXTagClass) {
JavaCFXTagClass jtag = (JavaCFXTagClass) tag;
qry.setAt(KeyConstants._name, row, jtag.getName());
qry.setAt("procedure_class", row, jtag.getClassDefinition().getClassName());
qry.setAt("procedure_bundleName", row, jtag.getClassDefinition().getName());
qry.setAt("procedure_bundleVersion", row, jtag.getClassDefinition().getVersionAsString());
}
}
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.cfx.customtag.CPPCFXTagClass in project Lucee by lucee.
the class XMLConfigWebFactory method loadCFX.
/**
* @param configServer
* @param config
* @param doc
*/
private static void loadCFX(ConfigServerImpl configServer, ConfigImpl config, Document doc) {
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING);
Map<String, CFXTagClass> map = MapFactory.<String, CFXTagClass>getConcurrentMap();
if (configServer != null) {
try {
if (configServer.getCFXTagPool() != null) {
Map<String, CFXTagClass> classes = configServer.getCFXTagPool().getClasses();
Iterator<Entry<String, CFXTagClass>> it = classes.entrySet().iterator();
Entry<String, CFXTagClass> e;
while (it.hasNext()) {
e = it.next();
map.put(e.getKey(), e.getValue().cloneReadOnly());
}
}
} catch (SecurityException e) {
}
}
if (hasAccess) {
if (configServer == null) {
System.setProperty("cfx.bin.path", config.getConfigDir().getRealResource("bin").getAbsolutePath());
}
// Java CFX Tags
Element cfxTagsParent = getChildByName(doc.getDocumentElement(), "ext-tags", false, true);
if (cfxTagsParent == null)
cfxTagsParent = getChildByName(doc.getDocumentElement(), "cfx-tags", false, true);
if (cfxTagsParent == null)
cfxTagsParent = getChildByName(doc.getDocumentElement(), "ext-tags");
boolean oldStyle = cfxTagsParent.getNodeName().equals("cfx-tags");
Element[] cfxTags = oldStyle ? getChildren(cfxTagsParent, "cfx-tag") : getChildren(cfxTagsParent, "ext-tag");
for (int i = 0; i < cfxTags.length; i++) {
String type = getAttr(cfxTags[i], "type");
if (type != null) {
// Java CFX Tags
if (type.equalsIgnoreCase("java")) {
String name = getAttr(cfxTags[i], "name");
ClassDefinition cd = getClassDefinition(cfxTags[i], "", config.getIdentification());
if (!StringUtil.isEmpty(name) && cd.hasClass()) {
map.put(name.toLowerCase(), new JavaCFXTagClass(name, cd));
}
} else // C++ CFX Tags
if (type.equalsIgnoreCase("cpp")) {
String name = getAttr(cfxTags[i], "name");
String serverLibrary = getAttr(cfxTags[i], "server-library");
String procedure = getAttr(cfxTags[i], "procedure");
boolean keepAlive = Caster.toBooleanValue(getAttr(cfxTags[i], "keep-alive"), false);
if (!StringUtil.isEmpty(name) && !StringUtil.isEmpty(serverLibrary) && !StringUtil.isEmpty(procedure)) {
map.put(name.toLowerCase(), new CPPCFXTagClass(name, serverLibrary, procedure, keepAlive));
}
}
}
}
}
config.setCFXTagPool(map);
}
Aggregations