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 + "]");
}
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()));
}
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);
}
}
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);
}
}
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()));
}
Aggregations