Search in sources :

Example 1 with CPPCFXTagClass

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);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Iterator(java.util.Iterator) BundleCollection(lucee.loader.osgi.BundleCollection) Collection(lucee.runtime.type.Collection) CFXTagClass(lucee.runtime.cfx.customtag.CFXTagClass) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) JavaCFXTagClass(lucee.runtime.cfx.customtag.JavaCFXTagClass) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) Map(java.util.Map) HashMap(java.util.HashMap) Query(lucee.runtime.type.Query)

Example 2 with CPPCFXTagClass

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);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) JavaCFXTagClass(lucee.runtime.cfx.customtag.JavaCFXTagClass) Iterator(java.util.Iterator) CFXTagClass(lucee.runtime.cfx.customtag.CFXTagClass) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) JavaCFXTagClass(lucee.runtime.cfx.customtag.JavaCFXTagClass) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) Map(java.util.Map) HashMap(java.util.HashMap) Query(lucee.runtime.type.Query)

Example 3 with CPPCFXTagClass

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);
}
Also used : Element(org.w3c.dom.Element) CFXTagClass(lucee.runtime.cfx.customtag.CFXTagClass) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) JavaCFXTagClass(lucee.runtime.cfx.customtag.JavaCFXTagClass) SecurityException(lucee.runtime.exp.SecurityException) ClassDefinition(lucee.runtime.db.ClassDefinition) CPPCFXTagClass(lucee.runtime.cfx.customtag.CPPCFXTagClass) lucee.aprint(lucee.aprint) DumpWriterEntry(lucee.runtime.dump.DumpWriterEntry) Entry(java.util.Map.Entry) GatewayEntry(lucee.runtime.gateway.GatewayEntry) JavaCFXTagClass(lucee.runtime.cfx.customtag.JavaCFXTagClass)

Aggregations

CFXTagClass (lucee.runtime.cfx.customtag.CFXTagClass)3 CPPCFXTagClass (lucee.runtime.cfx.customtag.CPPCFXTagClass)3 JavaCFXTagClass (lucee.runtime.cfx.customtag.JavaCFXTagClass)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 Query (lucee.runtime.type.Query)2 QueryImpl (lucee.runtime.type.QueryImpl)2 Entry (java.util.Map.Entry)1 lucee.aprint (lucee.aprint)1 BundleCollection (lucee.loader.osgi.BundleCollection)1 ClassDefinition (lucee.runtime.db.ClassDefinition)1 DumpWriterEntry (lucee.runtime.dump.DumpWriterEntry)1 SecurityException (lucee.runtime.exp.SecurityException)1 GatewayEntry (lucee.runtime.gateway.GatewayEntry)1 Collection (lucee.runtime.type.Collection)1 Element (org.w3c.dom.Element)1