use of lucee.runtime.cfx.customtag.JavaCFXTagClass in project Lucee by lucee.
the class Admin method doGetJavaCFXTags.
/**
* @throws PageException
*/
private void doGetJavaCFXTags() throws PageException {
Map map = config.getCFXTagPool().getClasses();
lucee.runtime.type.Query qry = new QueryImpl(new Collection.Key[] { KeyConstants._displayname, KeyConstants._sourcename, KeyConstants._readonly, KeyConstants._name, KeyConstants._class, KeyConstants._bundleName, KeyConstants._bundleVersion, KeyConstants._isvalid }, 0, "query");
Iterator it = map.keySet().iterator();
int row = 0;
while (it.hasNext()) {
CFXTagClass tag = (CFXTagClass) map.get(it.next());
if (tag instanceof JavaCFXTagClass) {
row++;
qry.addRow(1);
JavaCFXTagClass jtag = (JavaCFXTagClass) 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, jtag.getName());
qry.setAt(KeyConstants._class, row, jtag.getClassDefinition().getClassName());
qry.setAt(KeyConstants._bundleName, row, jtag.getClassDefinition().getName());
qry.setAt(KeyConstants._bundleVersion, row, jtag.getClassDefinition().getVersionAsString());
}
}
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.cfx.customtag.JavaCFXTagClass 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.JavaCFXTagClass 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