Skip to content

Commit

Permalink
move method getConfigServerImpl from Admin to ConfigUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Nov 23, 2024
1 parent 7118e74 commit 625e14e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
3 changes: 1 addition & 2 deletions core/src/main/java/lucee/runtime/config/CFConfigImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import lucee.runtime.exp.PageException;
import lucee.runtime.interpreter.JSONExpressionInterpreter;
import lucee.runtime.op.Caster;
import lucee.runtime.tag.Admin;
import lucee.runtime.type.Collection;
import lucee.runtime.type.Collection.Key;
import lucee.runtime.type.KeyImpl;
Expand Down Expand Up @@ -142,7 +141,7 @@ public Struct execute(boolean throwException) throws PageException {

admin.updateConfig(json, flushExistingData);
admin.storeAndReload();
Admin.getConfigServerImpl(config).resetAll();
ConfigUtil.getConfigServerImpl(config).resetAll();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
Expand Down
27 changes: 13 additions & 14 deletions core/src/main/java/lucee/runtime/config/ConfigAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
import lucee.runtime.security.SecurityManager;
import lucee.runtime.security.SecurityManagerImpl;
import lucee.runtime.security.SerialNumber;
import lucee.runtime.tag.Admin;
import lucee.runtime.type.Array;
import lucee.runtime.type.ArrayImpl;
import lucee.runtime.type.Collection;
Expand Down Expand Up @@ -585,7 +584,7 @@ protected static void updateComponentMapping(ConfigPro config, String virtual, S
ConfigAdmin admin = new ConfigAdmin(config, null, true);
admin._updateComponentMapping(virtual, physical, archive, primary, inspect, inspectTemplateIntervalSlow, inspectTemplateIntervalFast);
admin._store();
Admin.getConfigServerImpl(config).resetComponentMappings();
ConfigUtil.getConfigServerImpl(config).resetComponentMappings();
if (reload) admin._reload();
}

Expand All @@ -594,7 +593,7 @@ protected static void updateCustomTagMapping(ConfigPro config, String virtual, S
ConfigAdmin admin = new ConfigAdmin(config, null, true);
admin._updateCustomTag(virtual, physical, archive, primary, inspect, inspectTemplateIntervalSlow, inspectTemplateIntervalFast);
admin._store();
Admin.getConfigServerImpl(config).resetCustomTagMappings();
ConfigUtil.getConfigServerImpl(config).resetCustomTagMappings();
if (reload) admin._reload();
}

Expand Down Expand Up @@ -1868,7 +1867,7 @@ protected static void removeSearchEngine(ConfigPro config, boolean reload) throw
ConfigAdmin admin = new ConfigAdmin(config, null, true);
admin._removeSearchEngine();
admin._store();
Admin.getConfigServerImpl(config).resetSearchEngineClassDefinition().resetSearchEngineDirectory();
ConfigUtil.getConfigServerImpl(config).resetSearchEngineClassDefinition().resetSearchEngineDirectory();
if (reload) admin._reload();
}

Expand Down Expand Up @@ -1900,7 +1899,7 @@ protected static void removeORMEngine(ConfigPro config, boolean reload) throws I
ConfigAdmin admin = new ConfigAdmin(config, null, true);
admin._removeORMEngine();
admin._store();
Admin.getConfigServerImpl(config).resetORMEngineClassDefintion().resetORMConfig();
ConfigUtil.getConfigServerImpl(config).resetORMEngineClassDefintion().resetORMConfig();
if (reload) admin._reload();
}

Expand Down Expand Up @@ -4200,7 +4199,7 @@ protected static void removeCacheHandler(ConfigPro config, String id, boolean re
ConfigAdmin admin = new ConfigAdmin(config, null, true);
admin._removeCacheHandler(id);
admin._store();
Admin.getConfigServerImpl(config).resetCacheHandlers();
ConfigUtil.getConfigServerImpl(config).resetCacheHandlers();
if (reload) admin._reload();
}

Expand Down Expand Up @@ -4820,7 +4819,7 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
ClassDefinition cd = ClassDefinitionImpl.toClassDefinition(map, false, config.getIdentification());
if (cd != null && cd.isBundle()) {
_updateCache(cd);
Admin.getConfigServerImpl(config).resetCacheDefinitions();
ConfigUtil.getConfigServerImpl(config).resetCacheDefinitions();
ConfigUtil.getConfigServerImpl(config).resetCacheAll();
reloadNecessary = true;
}
Expand All @@ -4838,7 +4837,7 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
String _id = map.get("id");
if (!StringUtil.isEmpty(_id) && cd != null && cd.hasClass()) {
_updateCacheHandler(_id, cd);
Admin.getConfigServerImpl(config).resetCacheHandlers();
ConfigUtil.getConfigServerImpl(config).resetCacheHandlers();
reloadNecessary = true;
}
logger.info("extension", "Update cache handler [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
Expand All @@ -4854,7 +4853,7 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
ClassDefinition cd = ClassDefinitionImpl.toClassDefinition(map, false, config.getIdentification());
if (cd != null && cd.hasClass()) {
_updateSearchEngine(cd);
Admin.getConfigServerImpl(config).resetSearchEngineClassDefinition().resetSearchEngineDirectory();
ConfigUtil.getConfigServerImpl(config).resetSearchEngineClassDefinition().resetSearchEngineDirectory();
reloadNecessary = true;
}
logger.info("extension", "Update search engine [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
Expand Down Expand Up @@ -4963,14 +4962,14 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
// class
if (cd != null && cd.isBundle()) {
_updateStartupHook(cd);
Admin.getConfigServerImpl(config).resetStartups();
ConfigUtil.getConfigServerImpl(config).resetStartups();
reloadNecessary = true;
logger.info("extension", "Update Startup Hook [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
}
// component
else if (!StringUtil.isEmpty(cfc, true)) {
_updateStartupHook(cfc);
Admin.getConfigServerImpl(config).resetStartups();
ConfigUtil.getConfigServerImpl(config).resetStartups();
reloadNecessary = true;
logger.info("extension", "Update Startup Hook [" + cfc + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
}
Expand Down Expand Up @@ -5185,7 +5184,7 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla

if (!StringUtil.isEmpty(_id) && cd != null && cd.hasClass()) {
_removeCacheHandler(_id);
Admin.getConfigServerImpl(config).resetCacheHandlers();
ConfigUtil.getConfigServerImpl(config).resetCacheHandlers();
// reload=true;
}
logger.info("extension", "Remove cache handler [" + cd + "] from extension [" + rhe.getName() + ":" + rhe.getVersion() + "]");
Expand Down Expand Up @@ -5312,11 +5311,11 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla

if (cd != null && cd.isBundle()) {
_removeStartupHook(cd);
Admin.getConfigServerImpl(config).resetStartups();
ConfigUtil.getConfigServerImpl(config).resetStartups();
}
else if (!StringUtil.isEmpty(cfc, true)) {
_removeStartupHook(cfc);
Admin.getConfigServerImpl(config).resetStartups();
ConfigUtil.getConfigServerImpl(config).resetStartups();
}
logger.info("extension", "Remove Startup Hook [" + cd + "] from extension [" + rhe.getName() + ":" + rhe.getVersion() + "]");
}
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/lucee/runtime/config/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import lucee.runtime.op.Caster;
import lucee.runtime.op.Decision;
import lucee.runtime.osgi.OSGiUtil;
import lucee.runtime.tag.Admin;
import lucee.runtime.type.Array;
import lucee.runtime.type.ArrayImpl;
import lucee.runtime.type.Collection;
Expand Down Expand Up @@ -707,7 +706,7 @@ else if (old instanceof InputSource) {
Struct monitoring = ConfigUtil.getAsStruct("monitoring", root);
Array monitor = ConfigUtil.getAsArray("monitor", monitoring);
moveAsBool("enabled", "monitorEnable", monitoring, root);
Admin.getConfigServerImpl(config).resetMonitoringEnabled();
ConfigUtil.getConfigServerImpl(config).resetMonitoringEnabled();
Struct monitors = ConfigUtil.getAsStruct("monitors", root);
Key[] keys = monitor.keys();
for (int i = keys.length - 1; i >= 0; i--) {
Expand All @@ -717,7 +716,7 @@ else if (old instanceof InputSource) {
add(data, Caster.toString(data.remove(KeyConstants._name, null), null), monitors);
monitor.remove(k, null);
}
Admin.getConfigServerImpl(config).resetMonitors();
ConfigUtil.getConfigServerImpl(config).resetMonitors();
}

//////////////////// queue ////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ public void reset(String configId) {
SchedulerImpl scheduler = ((SchedulerImpl) config.getScheduler());
if (scheduler != null) {
if (config == null) scheduler.stop();
else Admin.getConfigServerImpl(config).resetScheduler();
else ConfigUtil.getConfigServerImpl(config).resetScheduler();
}

// scopes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static String call(PageContext pc, String dirPath, String strWebAdminPass
if (RestUtil.isMatch(pc, mapping, dir)) {
admin.removeRestMapping(mapping.getVirtual());
admin.storeAndReload();
Admin.getConfigServerImpl(config).resetRestMappings();
ConfigUtil.getConfigServerImpl(config).resetRestMappings();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void init(ConfigWeb config) {
* @return the maxThreads
*/
public int getMaxThreads() {
return Admin.getConfigServerImpl(config).getRemoteClientMaxThreads();
return ConfigUtil.getConfigServerImpl(config).getRemoteClientMaxThreads();
}

private int calculateSize(Resource res) {
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/lucee/runtime/tag/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ private void _doStartTag() throws PageException, IOException {
ConfigUtil.checkPassword(config, null, password);
ConfigUtil.checkGeneralReadAccess(config, password);

ConfigServerImpl csi = Admin.getConfigServerImpl(config);
ConfigServerImpl csi = ConfigUtil.getConfigServerImpl(config);
// ConfigServerFactory.createContextFilesAdmin(config.getConfigDir(), csi, csi.newVersion());
try {
if (config instanceof ConfigServer) ((PageContextImpl) pageContext).setServerPassword(password);
Expand Down Expand Up @@ -4297,7 +4297,7 @@ private void doUpdateCacheHandler() throws PageException {
ClassDefinition cd = ClassDefinitionImpl.toClassDefinitionImpl(attributes, null, true, config.getIdentification());
admin.updateCacheHandler(getString("admin", "updateCacheHandler", "id"), cd);
store();
Admin.getConfigServerImpl(config).resetCacheHandlers();
ConfigUtil.getConfigServerImpl(config).resetCacheHandlers();
adminSync.broadcast(attributes, config);
}

Expand All @@ -4318,7 +4318,7 @@ private void doRemoveMonitor() throws PageException {
private void doRemoveCacheHandler() throws PageException {
admin.removeCacheHandler(getString("admin", "removeCacheHandler", "id"));
store();
Admin.getConfigServerImpl(config).resetCacheHandlers();
ConfigUtil.getConfigServerImpl(config).resetCacheHandlers();
adminSync.broadcast(attributes, config);
}

Expand Down

0 comments on commit 625e14e

Please sign in to comment.