Search in sources :

Example 41 with StructImpl

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

the class Admin method doGetRemoteClient.

private void doGetRemoteClient() throws PageException {
    String url = getString("admin", action, "url");
    RemoteClient[] clients = config.getRemoteClients();
    RemoteClient client;
    for (int i = 0; i < clients.length; i++) {
        client = clients[i];
        if (client.getUrl().equalsIgnoreCase(url)) {
            Struct sct = new StructImpl();
            ProxyData pd = client.getProxyData();
            sct.setEL("label", client.getLabel());
            sct.setEL("usage", client.getUsage());
            sct.setEL("securityKey", client.getSecurityKey());
            sct.setEL("adminPassword", client.getAdminPassword());
            sct.setEL("ServerUsername", client.getServerUsername());
            sct.setEL("ServerPassword", client.getServerPassword());
            sct.setEL("type", client.getType());
            sct.setEL("url", client.getUrl());
            sct.setEL("proxyServer", pd == null ? "" : StringUtil.emptyIfNull(pd.getServer()));
            sct.setEL("proxyUsername", pd == null ? "" : StringUtil.emptyIfNull(pd.getUsername()));
            sct.setEL("proxyPassword", pd == null ? "" : StringUtil.emptyIfNull(pd.getPassword()));
            sct.setEL("proxyPort", pd == null ? "" : (pd.getPort() == -1 ? "" : Caster.toString(pd.getPort())));
            pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
            return;
        }
    }
    throw new ApplicationException("there is no remote client with url [" + url + "]");
}
Also used : StructImpl(lucee.runtime.type.StructImpl) ProxyData(lucee.runtime.net.proxy.ProxyData) ApplicationException(lucee.runtime.exp.ApplicationException) RemoteClient(lucee.runtime.config.RemoteClient) Struct(lucee.runtime.type.Struct)

Example 42 with StructImpl

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

the class Admin method doGetCompilerSettings.

/*
	 * private void doGetLogSetting() throws PageException { String name=getString("admin", "GetLogSetting", "name"); name=name.trim().toLowerCase(); Query
	 * qry=_doGetLogSettings();
	 * 
	 * int records = qry.getRecordcount(); for(int row=1;row<=records;row++){ String n = Caster.toString(qry.getAt("name", row, null),null);
	 * if(!StringUtil.isEmpty(n) && n.trim().equalsIgnoreCase(name)) { Struct sct=new StructImpl(); String
	 * returnVariable=getString("admin",action,"returnVariable"); pageContext.setVariable(returnVariable,sct);
	 * 
	 * sct.setEL(KeyConstants._name, qry.getAt(KeyConstants._name, row, "")); sct.setEL(KeyConstants._level, qry.getAt(KeyConstants._level, row, ""));
	 * sct.setEL("virtualpath", qry.getAt("virtualpath", row, "")); sct.setEL(KeyConstants._class, qry.getAt(KeyConstants._class, row, ""));
	 * sct.setEL("maxFile", qry.getAt("maxFile", row, "")); sct.setEL("maxFileSize", qry.getAt("maxFileSize", row, "")); sct.setEL(KeyConstants._path,
	 * qry.getAt(KeyConstants._path, row, ""));
	 * 
	 * return; } } throw new ApplicationException("invalig log name ["+name+"]");
	 * 
	 * }
	 */
private void doGetCompilerSettings() throws PageException {
    String returnVariable = getString("admin", action, "returnVariable");
    Struct sct = new StructImpl();
    pageContext.setVariable(returnVariable, sct);
    sct.set("DotNotationUpperCase", config.getDotNotationUpperCase() ? Boolean.TRUE : Boolean.FALSE);
    sct.set("suppressWSBeforeArg", config.getSuppressWSBeforeArg() ? Boolean.TRUE : Boolean.FALSE);
    sct.set("nullSupport", config.getFullNullSupport() ? Boolean.TRUE : Boolean.FALSE);
    sct.set("handleUnquotedAttrValueAsString", config.getHandleUnQuotedAttrValueAsString() ? Boolean.TRUE : Boolean.FALSE);
    sct.set("templateCharset", config.getTemplateCharset());
    sct.set("externalizeStringGTE", Caster.toDouble(config.getExternalizeStringGTE()));
}
Also used : StructImpl(lucee.runtime.type.StructImpl) Struct(lucee.runtime.type.Struct)

Example 43 with StructImpl

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

the class Admin method doGetBundle.

private void doGetBundle() throws PageException {
    String symbolicName = getString("admin", "getBundle", "symbolicName", true);
    Version version = OSGiUtil.toVersion(getString("version", null), null);
    BundleDefinition bd;
    BundleFile bf = null;
    Bundle b = OSGiUtil.getBundleLoaded(symbolicName, version, null);
    if (b != null) {
        bd = new BundleDefinition(b);
    } else {
        try {
            bf = OSGiUtil.getBundleFile(symbolicName, version, null, false);
            bd = bf.toBundleDefinition();
            b = bd.getLoadedBundle();
        } catch (BundleException e) {
            throw Caster.toPageException(e);
        }
    }
    CFMLEngine engine = ConfigWebUtil.getEngine(config);
    BundleCollection coreBundles = engine.getBundleCollection();
    java.util.Collection<BundleDefinition> extBundles = config.getAllExtensionBundleDefintions();
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    sct.set(SYMBOLIC_NAME, bd.getName());
    sct.set(KeyConstants._title, bd.getName());
    sct.set(KeyConstants._version, bd.getVersionAsString());
    sct.set(USED_BY, _usedBy(bd.getName(), bd.getVersion(), coreBundles, extBundles));
    try {
        if (b != null) {
            sct.set(PATH, b.getLocation());
        } else {
            if (bf == null)
                bf = bd.getBundleFile(false);
            sct.set(PATH, bf.getFile());
        }
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
    }
    Map<String, Object> headers = null;
    if (b != null) {
        sct.set(KeyConstants._version, bd.getVersion().toString());
        sct.set(KeyConstants._id, b.getBundleId());
        sct.set(KeyConstants._state, OSGiUtil.toState(b.getState(), null));
        sct.set(FRAGMENT, OSGiUtil.isFragment(b));
        headers = OSGiUtil.getHeaders(b);
    } else {
        sct.set(KeyConstants._state, "notinstalled");
        try {
            if (bf == null)
                bf = bd.getBundleFile(false);
            sct.set(KeyConstants._version, bf.getVersionAsString());
            sct.set(FRAGMENT, OSGiUtil.isFragment(bf));
            headers = bf.getHeaders();
        } catch (BundleException e) {
        }
    }
    if (headers != null) {
        Struct h = Caster.toStruct(headers, false);
        sct.set(HEADERS, h);
        // title
        String str = Caster.toString(h.get("Bundle-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Bundle-Name", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(KeyConstants._title, str);
        // description
        str = Caster.toString(h.get("Bundle-Description", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Description", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Description", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(KeyConstants._description, str);
        // Vendor
        str = Caster.toString(h.get("Bundle-Vendor", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Vendor", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Vendor", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(VENDOR, str);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) Struct(lucee.runtime.type.Struct) BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) BundleCollection(lucee.loader.osgi.BundleCollection) StructImpl(lucee.runtime.type.StructImpl) Version(org.osgi.framework.Version) BundleException(org.osgi.framework.BundleException) CFMLEngine(lucee.loader.engine.CFMLEngine) BundleFile(lucee.runtime.osgi.BundleFile)

Example 44 with StructImpl

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

the class Admin method doReadBundle.

private void doReadBundle() throws PageException {
    String ret = getString("admin", action, "returnvariable");
    Resource res = ResourceUtil.toResourceExisting(pageContext, getString("admin", action, "bundle"));
    if (!res.isFile())
        throw new ApplicationException("[" + res + "] is not a file");
    try {
        Struct sct = new StructImpl();
        pageContext.setVariable(ret, new BundleFile(res).info());
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) StructImpl(lucee.runtime.type.StructImpl) Resource(lucee.commons.io.res.Resource) BundleFile(lucee.runtime.osgi.BundleFile) 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) Struct(lucee.runtime.type.Struct)

Example 45 with StructImpl

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

the class Admin method doGetCustomTagSetting.

private void doGetCustomTagSetting() throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    // deprecated
    sct.set("customTagDeepSearch", Caster.toBoolean(config.doCustomTagDeepSearch()));
    // deprecated
    sct.set("customTagLocalSearch", Caster.toBoolean(config.doLocalCustomTag()));
    sct.set("deepSearch", Caster.toBoolean(config.doCustomTagDeepSearch()));
    sct.set("localSearch", Caster.toBoolean(config.doLocalCustomTag()));
    sct.set("customTagPathCache", Caster.toBoolean(config.useCTPathCache()));
    sct.set("extensions", new ArrayImpl(config.getCustomTagExtensions()));
}
Also used : StructImpl(lucee.runtime.type.StructImpl) ArrayImpl(lucee.runtime.type.ArrayImpl) Struct(lucee.runtime.type.Struct)

Aggregations

StructImpl (lucee.runtime.type.StructImpl)251 Struct (lucee.runtime.type.Struct)216 PageException (lucee.runtime.exp.PageException)40 Entry (java.util.Map.Entry)34 Key (lucee.runtime.type.Collection.Key)28 Array (lucee.runtime.type.Array)25 ArrayImpl (lucee.runtime.type.ArrayImpl)24 ApplicationException (lucee.runtime.exp.ApplicationException)21 IOException (java.io.IOException)19 Map (java.util.Map)19 Resource (lucee.commons.io.res.Resource)18 Iterator (java.util.Iterator)17 PageContextImpl (lucee.runtime.PageContextImpl)14 QueryImpl (lucee.runtime.type.QueryImpl)13 Collection (lucee.runtime.type.Collection)11 Query (lucee.runtime.type.Query)11 DateTimeImpl (lucee.runtime.type.dt.DateTimeImpl)11 HashMap (java.util.HashMap)9 PageSource (lucee.runtime.PageSource)8 Element (org.w3c.dom.Element)8