Search in sources :

Example 61 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetDebuggingList.

private void doGetDebuggingList() throws PageException {
    Resource luceeContext = ResourceUtil.toResourceExisting(pageContext, "/lucee/templates/debugging/");
    Resource[] children = luceeContext.listResources(new ExtensionResourceFilter(Constants.getTemplateExtensions()));
    String rtnVar = getString("admin", action, "returnVariable");
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "name" }, children.length, rtnVar);
    for (int i = 0; i < children.length; i++) {
        qry.setAt("name", i + 1, children[i].getName());
    }
    pageContext.setVariable(rtnVar, qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Resource(lucee.commons.io.res.Resource) ExtensionResourceFilter(lucee.commons.io.res.filter.ExtensionResourceFilter) Query(lucee.runtime.type.Query)

Example 62 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetTLDs.

/**
 * @throws PageException
 */
private void doGetTLDs() throws PageException {
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "displayname", "namespace", "namespaceseparator", "shortname", "type", "description", "uri", "elclass", "elBundleName", "elBundleVersion", "source" }, new String[] { "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar" }, 0, "tlds");
    int dialect = "lucee".equalsIgnoreCase(getString("dialect", "cfml")) ? CFMLEngine.DIALECT_LUCEE : CFMLEngine.DIALECT_CFML;
    TagLib[] libs = config.getTLDs(dialect);
    for (int i = 0; i < libs.length; i++) {
        qry.addRow();
        qry.setAt("displayname", i + 1, libs[i].getDisplayName());
        qry.setAt("namespace", i + 1, libs[i].getNameSpace());
        qry.setAt("namespaceseparator", i + 1, libs[i].getNameSpaceSeparator());
        qry.setAt("shortname", i + 1, libs[i].getShortName());
        qry.setAt("type", i + 1, libs[i].getType());
        qry.setAt("description", i + 1, libs[i].getDescription());
        qry.setAt("uri", i + 1, Caster.toString(libs[i].getUri()));
        qry.setAt("elclass", i + 1, libs[i].getELClassDefinition().getClassName());
        qry.setAt("elBundleName", i + 1, libs[i].getELClassDefinition().getName());
        qry.setAt("elBundleVersion", i + 1, libs[i].getELClassDefinition().getVersionAsString());
        qry.setAt("source", i + 1, StringUtil.emptyIfNull(libs[i].getSource()));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) TagLib(lucee.transformer.library.tag.TagLib) Query(lucee.runtime.type.Query)

Example 63 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetCacheConnections.

private void doGetCacheConnections() throws PageException {
    Map conns = config.getCacheConnections();
    Iterator it = conns.entrySet().iterator();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "class", "bundleName", "bundleVersion", "name", "custom", "default", "readOnly", "storage" }, 0, "connections");
    Map.Entry entry;
    CacheConnection cc;
    CacheConnection defObj = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_OBJECT);
    CacheConnection defTmp = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_TEMPLATE);
    CacheConnection defQry = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_QUERY);
    CacheConnection defRes = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_RESOURCE);
    CacheConnection defUDF = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_FUNCTION);
    CacheConnection defInc = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_INCLUDE);
    CacheConnection defHTT = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_HTTP);
    CacheConnection defFil = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_FILE);
    CacheConnection defWSe = config.getCacheDefaultConnection(ConfigImpl.CACHE_TYPE_WEBSERVICE);
    int row = 0;
    String def;
    while (it.hasNext()) {
        row++;
        entry = (Entry) it.next();
        cc = (CacheConnection) entry.getValue();
        qry.addRow();
        def = "";
        if (cc == defObj)
            def = "object";
        if (cc == defTmp)
            def = "template";
        if (cc == defQry)
            def = "query";
        if (cc == defRes)
            def = "resource";
        if (cc == defUDF)
            def = "function";
        if (cc == defInc)
            def = "include";
        if (cc == defHTT)
            def = "http";
        if (cc == defFil)
            def = "file";
        if (cc == defWSe)
            def = "webservice";
        qry.setAtEL(KeyConstants._class, row, cc.getClassDefinition().getClassName());
        qry.setAtEL(KeyConstants._bundleName, row, cc.getClassDefinition().getName());
        qry.setAtEL(KeyConstants._bundleVersion, row, cc.getClassDefinition().getVersionAsString());
        qry.setAtEL(KeyConstants._name, row, cc.getName());
        qry.setAtEL(KeyConstants._custom, row, cc.getCustom());
        qry.setAtEL(KeyConstants._default, row, def);
        qry.setAtEL(KeyConstants._readonly, row, Caster.toBoolean(cc.isReadOnly()));
        qry.setAtEL(KeyConstants._storage, row, Caster.toBoolean(cc.isStorage()));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : Entry(java.util.Map.Entry) QueryImpl(lucee.runtime.type.QueryImpl) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) CacheConnection(lucee.runtime.cache.CacheConnection) Query(lucee.runtime.type.Query)

Example 64 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class Admin method doGetDatasources.

/**
 * @throws PageException
 */
private void doGetDatasources() throws PageException {
    Map ds = config.getDataSourcesAsMap();
    Iterator it = ds.keySet().iterator();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "name", "host", "classname", "bundleName", "bundleVersion", "dsn", "DsnTranslated", "database", "port", "timezone", "username", "password", "passwordEncrypted", "readonly", "grant", "drop", "create", "revoke", "alter", "select", "delete", "update", "insert", "connectionLimit", "openConnections", "connectionTimeout", "clob", "blob", "validate", "storage", "customSettings", "metaCacheTimeout" }, ds.size(), "query");
    int row = 0;
    while (it.hasNext()) {
        Object key = it.next();
        DataSource d = (DataSource) ds.get(key);
        row++;
        qry.setAt(KeyConstants._name, row, key);
        qry.setAt(KeyConstants._host, row, d.getHost());
        qry.setAt("classname", row, d.getClassDefinition().getClassName());
        qry.setAt("bundleName", row, d.getClassDefinition().getName());
        qry.setAt("bundleVersion", row, d.getClassDefinition().getVersionAsString());
        qry.setAt("dsn", row, d.getDsnOriginal());
        qry.setAt("database", row, d.getDatabase());
        qry.setAt(KeyConstants._port, row, d.getPort() < 1 ? "" : Caster.toString(d.getPort()));
        qry.setAt("dsnTranslated", row, d.getDsnTranslated());
        qry.setAt("timezone", row, toStringTimeZone(d.getTimeZone()));
        qry.setAt(KeyConstants._password, row, d.getPassword());
        qry.setAt("passwordEncrypted", row, ConfigWebUtil.encrypt(d.getPassword()));
        qry.setAt(KeyConstants._username, row, d.getUsername());
        qry.setAt(KeyConstants._readonly, row, Caster.toBoolean(d.isReadOnly()));
        qry.setAt(KeyConstants._select, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_SELECT)));
        qry.setAt(KeyConstants._delete, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DELETE)));
        qry.setAt(KeyConstants._update, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_UPDATE)));
        qry.setAt(KeyConstants._create, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_CREATE)));
        qry.setAt(KeyConstants._insert, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
        qry.setAt(KeyConstants._drop, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DROP)));
        qry.setAt(KeyConstants._grant, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_GRANT)));
        qry.setAt(KeyConstants._revoke, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_REVOKE)));
        qry.setAt(KeyConstants._alter, row, Boolean.valueOf(d.hasAllow(DataSource.ALLOW_ALTER)));
        int oc = config.getDatasourceConnectionPool().openConnections(key.toString());
        qry.setAt("openConnections", row, oc < 0 ? 0 : oc);
        qry.setAt("connectionLimit", row, d.getConnectionLimit() < 1 ? "" : Caster.toString(d.getConnectionLimit()));
        qry.setAt("connectionTimeout", row, d.getConnectionTimeout() < 1 ? "" : Caster.toString(d.getConnectionTimeout()));
        qry.setAt("customSettings", row, d.getCustoms());
        qry.setAt("blob", row, Boolean.valueOf(d.isBlob()));
        qry.setAt("clob", row, Boolean.valueOf(d.isClob()));
        qry.setAt("validate", row, Boolean.valueOf(d.validate()));
        qry.setAt("storage", row, Boolean.valueOf(d.isStorage()));
        qry.setAt("metaCacheTimeout", row, Caster.toDouble(d.getMetaCacheTimeout()));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) Query(lucee.runtime.type.Query) DataSource(lucee.runtime.db.DataSource)

Example 65 with QueryImpl

use of lucee.runtime.type.QueryImpl in project Lucee by lucee.

the class TaskFileFilter method createQuery.

private Query createQuery() throws DatabaseException {
    String v = "VARCHAR";
    String d = "DATE";
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "type", "name", "detail", "id", "lastExecution", "nextExecution", "closed", "tries", "exceptions", "triesmax" }, new String[] { v, v, "object", v, d, d, "boolean", "int", "object", "int" }, 0, "query");
    return qry;
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Query(lucee.runtime.type.Query)

Aggregations

QueryImpl (lucee.runtime.type.QueryImpl)82 Query (lucee.runtime.type.Query)65 Collection (lucee.runtime.type.Collection)17 Struct (lucee.runtime.type.Struct)16 StructImpl (lucee.runtime.type.StructImpl)13 PageException (lucee.runtime.exp.PageException)12 Key (lucee.runtime.type.Collection.Key)12 Iterator (java.util.Iterator)11 Map (java.util.Map)10 ApplicationException (lucee.runtime.exp.ApplicationException)10 Array (lucee.runtime.type.Array)10 DatabaseException (lucee.runtime.exp.DatabaseException)9 Stopwatch (lucee.runtime.timer.Stopwatch)9 HashMap (java.util.HashMap)8 Resource (lucee.commons.io.res.Resource)7 BundleCollection (lucee.loader.osgi.BundleCollection)7 Entry (java.util.Map.Entry)6 IOException (java.io.IOException)5 ResultSet (java.sql.ResultSet)5 ArrayImpl (lucee.runtime.type.ArrayImpl)5