use of lucee.runtime.type.QueryImpl in project Lucee by lucee.
the class Admin method doGetMonitors.
private void doGetMonitors() throws PageException {
if (!(config instanceof ConfigServerImpl))
throw new ApplicationException("invalid context for this action");
ConfigServerImpl cs = (ConfigServerImpl) config;
IntervallMonitor[] intervalls = cs.getIntervallMonitors();
RequestMonitor[] requests = cs.getRequestMonitors();
lucee.runtime.type.Query qry = new QueryImpl(new Collection.Key[] { KeyConstants._name, KeyConstants._type, LOG_ENABLED, CLASS }, 0, "monitors");
doGetMonitors(qry, intervalls);
doGetMonitors(qry, requests);
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.type.QueryImpl in project Lucee by lucee.
the class Admin method doGetBundles.
private void doGetBundles() throws PageException {
CFMLEngine engine = ConfigWebUtil.getEngine(config);
BundleCollection coreBundles = engine.getBundleCollection();
java.util.Collection<BundleDefinition> extBundles = config.getAllExtensionBundleDefintions();
List<BundleDefinition> bds = OSGiUtil.getBundleDefinitions(engine.getBundleContext());
Iterator<BundleDefinition> it = bds.iterator();
BundleDefinition bd;
Bundle b;
String str;
Query qry = new QueryImpl(new Key[] { SYMBOLIC_NAME, KeyConstants._title, KeyConstants._description, KeyConstants._version, VENDOR, KeyConstants._state, PATH, USED_BY, KeyConstants._id, FRAGMENT, HEADERS }, bds.size(), "bundles");
int row = 0;
while (it.hasNext()) {
row++;
bd = it.next();
b = bd.getLoadedBundle();
qry.setAt(SYMBOLIC_NAME, row, bd.getName());
qry.setAt(KeyConstants._title, row, bd.getName());
qry.setAt(KeyConstants._version, row, bd.getVersionAsString());
qry.setAt(USED_BY, row, _usedBy(bd.getName(), bd.getVersion(), coreBundles, extBundles));
BundleFile bf = null;
try {
if (b != null) {
qry.setAt(PATH, row, b.getLocation());
} else {
bf = bd.getBundleFile(false);
qry.setAt(PATH, row, bf.getFile());
}
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
Map<String, Object> headers = null;
if (b != null) {
qry.setAt(KeyConstants._version, row, bd.getVersion().toString());
qry.setAt(KeyConstants._id, row, b.getBundleId());
qry.setAt(KeyConstants._state, row, OSGiUtil.toState(b.getState(), null));
qry.setAt(FRAGMENT, row, OSGiUtil.isFragment(b));
headers = OSGiUtil.getHeaders(b);
} else {
qry.setAt(KeyConstants._state, row, "notinstalled");
try {
if (b != null) {
qry.setAt(KeyConstants._version, row, b.getVersion().toString());
qry.setAt(FRAGMENT, row, OSGiUtil.isFragment(b));
Dictionary<String, String> dic = b.getHeaders();
Enumeration<String> keys = dic.keys();
headers = new HashMap<String, Object>();
String key;
while (keys.hasMoreElements()) {
key = keys.nextElement();
headers.put(key, dic.get(key));
}
} else {
if (bf != null)
bf = bd.getBundleFile(false);
qry.setAt(KeyConstants._version, row, bf.getVersionAsString());
// qry.setAt(KeyConstants._id, row, bf.getBundleId());
qry.setAt(FRAGMENT, row, OSGiUtil.isFragment(bf));
headers = bf.getHeaders();
}
} catch (BundleException e) {
}
}
if (headers != null) {
Struct h = Caster.toStruct(headers, false);
qry.setAt(HEADERS, row, h);
// title
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))
qry.setAt(KeyConstants._title, row, 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))
qry.setAt(KeyConstants._description, row, 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))
qry.setAt(VENDOR, row, str);
// Specification-Vendor,Bundle-Vendor
}
}
QuerySort.call(pageContext, qry, "title");
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.type.QueryImpl in project Lucee by lucee.
the class Admin method doGetContexts.
/**
* @throws PageException
*/
private void doGetContexts() throws PageException {
CFMLFactory[] factories;
if (config instanceof ConfigServerImpl) {
ConfigServerImpl cs = (ConfigServerImpl) config;
factories = cs.getJSPFactories();
} else {
ConfigWebImpl cw = (ConfigWebImpl) config;
factories = new CFMLFactory[] { cw.getFactory() };
}
lucee.runtime.type.Query qry = new QueryImpl(new Collection.Key[] { KeyConstants._path, KeyConstants._id, KeyConstants._hash, KeyConstants._label, HAS_OWN_SEC_CONTEXT, KeyConstants._url, CONFIG_FILE, CLIENT_SIZE, CLIENT_ELEMENTS, SESSION_SIZE, SESSION_ELEMENTS }, factories.length, getString("admin", action, "returnVariable"));
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
ConfigWebImpl cw;
for (int i = 0; i < factories.length; i++) {
int row = i + 1;
CFMLFactoryImpl factory = (CFMLFactoryImpl) factories[i];
cw = (ConfigWebImpl) factory.getConfig();
qry.setAtEL(KeyConstants._path, row, ReqRspUtil.getRootPath(factory.getConfigWebImpl().getServletContext()));
qry.setAtEL(CONFIG_FILE, row, factory.getConfigWebImpl().getConfigFile().getAbsolutePath());
if (factory.getURL() != null)
qry.setAtEL(KeyConstants._url, row, factory.getURL().toExternalForm());
qry.setAtEL(KeyConstants._id, row, factory.getConfig().getIdentification().getId());
qry.setAtEL(KeyConstants._hash, row, SystemUtil.hash(factory.getConfigWebImpl().getServletContext()));
qry.setAtEL(KeyConstants._label, row, factory.getLabel());
qry.setAtEL(HAS_OWN_SEC_CONTEXT, row, Caster.toBoolean(cw.hasIndividualSecurityManager()));
setScopeDirInfo(qry, row, CLIENT_SIZE, CLIENT_ELEMENTS, cw.getClientScopeDir());
setScopeDirInfo(qry, row, SESSION_SIZE, SESSION_ELEMENTS, cw.getSessionScopeDir());
}
}
use of lucee.runtime.type.QueryImpl in project Lucee by lucee.
the class Admin method doGetRemoteClients.
private void doGetRemoteClients() throws PageException {
RemoteClient[] clients = config.getRemoteClients();
RemoteClient client;
ProxyData pd;
lucee.runtime.type.Query qry = new QueryImpl(new String[] { "label", "usage", "securityKey", "adminPassword", "serverUsername", "serverPassword", "type", "url", "proxyServer", "proxyUsername", "proxyPassword", "proxyPort" }, clients.length, "query");
int row = 0;
for (int i = 0; i < clients.length; i++) {
client = clients[i];
pd = client.getProxyData();
row = i + 1;
qry.setAt("label", row, client.getLabel());
qry.setAt("usage", row, client.getUsage());
qry.setAt("securityKey", row, client.getSecurityKey());
qry.setAt("adminPassword", row, client.getAdminPassword());
qry.setAt("ServerUsername", row, client.getServerUsername());
qry.setAt("ServerPassword", row, client.getServerPassword());
qry.setAt("type", row, client.getType());
qry.setAt("url", row, client.getUrl());
qry.setAt("proxyServer", row, pd == null ? "" : pd.getServer());
qry.setAt("proxyUsername", row, pd == null ? "" : pd.getUsername());
qry.setAt("proxyPassword", row, pd == null ? "" : pd.getPassword());
qry.setAt("proxyPort", row, pd == null ? "" : Caster.toString(pd.getPort()));
}
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
use of lucee.runtime.type.QueryImpl in project Lucee by lucee.
the class Admin method doGetGatewayEntries.
private void doGetGatewayEntries() throws PageException {
Map entries = ((ConfigWebImpl) config).getGatewayEngine().getEntries();
Iterator it = entries.entrySet().iterator();
lucee.runtime.type.Query qry = new QueryImpl(new String[] { "class", "bundleName", "bundleVersion", "id", "custom", "cfcPath", "listenerCfcPath", "startupMode", "state", "readOnly" }, 0, "entries");
Map.Entry entry;
GatewayEntry ge;
// Gateway g;
int row = 0;
while (it.hasNext()) {
row++;
entry = (Entry) it.next();
ge = (GatewayEntry) entry.getValue();
// g=ge.getGateway();
qry.addRow();
qry.setAtEL("class", row, ge.getClassDefinition().getClassName());
qry.setAtEL("bundleName", row, ge.getClassDefinition().getName());
qry.setAtEL("bundleVersion", row, ge.getClassDefinition().getVersionAsString());
qry.setAtEL("id", row, ge.getId());
qry.setAtEL("listenerCfcPath", row, ge.getListenerCfcPath());
qry.setAtEL("cfcPath", row, ge.getCfcPath());
qry.setAtEL("startupMode", row, GatewayEntryImpl.toStartup(ge.getStartupMode(), "automatic"));
qry.setAtEL("custom", row, ge.getCustom());
qry.setAtEL("readOnly", row, Caster.toBoolean(ge.isReadOnly()));
qry.setAtEL("state", row, GatewayEngineImpl.toStringState(GatewayUtil.getState(ge), "failed"));
}
pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Aggregations