Search in sources :

Example 16 with QueryImpl

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

the class Admin method doGetRemoteClientUsage.

private void doGetRemoteClientUsage() throws PageException {
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "code", "displayname" }, new String[] { "varchar", "varchar" }, 0, "usage");
    Struct usages = config.getRemoteClientUsage();
    // Key[] keys = usages.keys();
    Iterator<Entry<Key, Object>> it = usages.entryIterator();
    Entry<Key, Object> e;
    int i = -1;
    while (it.hasNext()) {
        i++;
        e = it.next();
        qry.addRow();
        qry.setAt(KeyConstants._code, i + 1, e.getKey().getString());
        qry.setAt(KeyConstants._displayname, i + 1, e.getValue());
    // qry.setAt("description", i+1, usages[i].getDescription());
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) DebugEntry(lucee.runtime.config.DebugEntry) Entry(java.util.Map.Entry) GatewayEntry(lucee.runtime.gateway.GatewayEntry) Query(lucee.runtime.type.Query) Key(lucee.runtime.type.Collection.Key) Struct(lucee.runtime.type.Struct)

Example 17 with QueryImpl

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

the class Admin method doGetTimeZones.

/**
 * @throws PageException
 */
private void doGetTimeZones() throws PageException {
    String strLocale = getString("locale", "english (united kingdom)");
    Locale locale = LocaleFactory.getLocale(strLocale);
    String[] timeZones = TimeZone.getAvailableIDs();
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "id", "display" }, new String[] { "varchar", "varchar" }, timeZones.length, "timezones");
    Arrays.sort(timeZones);
    TimeZone timeZone;
    for (int i = 0; i < timeZones.length; i++) {
        timeZone = TimeZone.getTimeZone(timeZones[i]);
        qry.setAt("id", i + 1, timeZones[i]);
        qry.setAt("display", i + 1, timeZone.getDisplayName(locale));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : Locale(java.util.Locale) QueryImpl(lucee.runtime.type.QueryImpl) TimeZone(java.util.TimeZone) Query(lucee.runtime.type.Query)

Example 18 with QueryImpl

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

the class Admin method getSSLCertificate.

public static Query getSSLCertificate(Config config, String host, int port) throws PageException {
    Resource cacerts = config.getSecurityDirectory();
    CertificateInstaller installer;
    try {
        installer = new CertificateInstaller(cacerts, host, port);
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    X509Certificate[] certs = installer.getCertificates();
    X509Certificate cert;
    Query qry = new QueryImpl(new String[] { "subject", "issuer" }, certs.length, "certificates");
    for (int i = 0; i < certs.length; i++) {
        cert = certs[i];
        qry.setAtEL("subject", i + 1, cert.getSubjectDN().getName());
        qry.setAtEL("issuer", i + 1, cert.getIssuerDN().getName());
    }
    return qry;
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Query(lucee.runtime.type.Query) Resource(lucee.commons.io.res.Resource) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) X509Certificate(java.security.cert.X509Certificate) CertificateInstaller(lucee.runtime.net.http.CertificateInstaller)

Example 19 with QueryImpl

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

Example 20 with QueryImpl

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

the class Admin method doGetDatasourceDriverList.

private void doGetDatasourceDriverList() throws PageException {
    Resource luceeContext = ResourceUtil.toResourceExisting(pageContext, "/lucee/admin/dbdriver/");
    Resource[] children = luceeContext.listResources(new ExtensionResourceFilter(Constants.getComponentExtensions()));
    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)

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