Skip to content

Commit

Permalink
move RHExetension Metadata in separate class and relove issue with up…
Browse files Browse the repository at this point in the history
…dating regular mappings
  • Loading branch information
michaeloffner committed Nov 26, 2024
1 parent ca91892 commit 7351471
Show file tree
Hide file tree
Showing 5 changed files with 340 additions and 266 deletions.
111 changes: 66 additions & 45 deletions core/src/main/java/lucee/runtime/config/ConfigAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4812,8 +4812,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update cache
if (!ArrayUtil.isEmpty(rhext.getCaches())) {
Iterator<Map<String, String>> itl = rhext.getCaches().iterator();
List<Map<String, String>> caches = rhext.getMetadata().getCaches();
if (!ArrayUtil.isEmpty(caches)) {
Iterator<Map<String, String>> itl = caches.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4829,8 +4830,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update cache handler
if (!ArrayUtil.isEmpty(rhext.getCacheHandlers())) {
Iterator<Map<String, String>> itl = rhext.getCacheHandlers().iterator();
List<Map<String, String>> handlers = rhext.getMetadata().getCacheHandlers();
if (!ArrayUtil.isEmpty(handlers)) {
Iterator<Map<String, String>> itl = handlers.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4846,8 +4848,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update Search
if (!ArrayUtil.isEmpty(rhext.getSearchs())) {
Iterator<Map<String, String>> itl = rhext.getSearchs().iterator();
List<Map<String, String>> searchs = rhext.getMetadata().getSearchs();
if (!ArrayUtil.isEmpty(searchs)) {
Iterator<Map<String, String>> itl = searchs.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4862,8 +4865,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update Resource
if (!ArrayUtil.isEmpty(rhext.getResources())) {
Iterator<Map<String, String>> itl = rhext.getResources().iterator();
List<Map<String, String>> resources = rhext.getMetadata().getResources();
if (!ArrayUtil.isEmpty(resources)) {
Iterator<Map<String, String>> itl = resources.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4882,8 +4886,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update orm
if (!ArrayUtil.isEmpty(rhext.getOrms())) {
Iterator<Map<String, String>> itl = rhext.getOrms().iterator();
List<Map<String, String>> orms = rhext.getMetadata().getOrms();
if (!ArrayUtil.isEmpty(orms)) {
Iterator<Map<String, String>> itl = orms.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4899,8 +4904,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update webservice
if (!ArrayUtil.isEmpty(rhext.getWebservices())) {
Iterator<Map<String, String>> itl = rhext.getWebservices().iterator();
List<Map<String, String>> webservices = rhext.getMetadata().getWebservices();
if (!ArrayUtil.isEmpty(webservices)) {
Iterator<Map<String, String>> itl = webservices.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4915,8 +4921,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update monitor
if (!ArrayUtil.isEmpty(rhext.getMonitors())) {
Iterator<Map<String, String>> itl = rhext.getMonitors().iterator();
List<Map<String, String>> monitors = rhext.getMetadata().getMonitors();
if (!ArrayUtil.isEmpty(monitors)) {
Iterator<Map<String, String>> itl = monitors.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4932,8 +4939,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update jdbc
if (!ArrayUtil.isEmpty(rhext.getJdbcs())) {
Iterator<Map<String, String>> itl = rhext.getJdbcs().iterator();
List<Map<String, String>> jdbcs = rhext.getMetadata().getJdbcs();
if (!ArrayUtil.isEmpty(jdbcs)) {
Iterator<Map<String, String>> itl = jdbcs.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4952,8 +4960,9 @@ public void updateRHExtension(Config config, RHExtension rhext, boolean reload,
}

// update startup hook
if (!ArrayUtil.isEmpty(rhext.getStartupHooks())) {
Iterator<Map<String, String>> itl = rhext.getStartupHooks().iterator();
List<Map<String, String>> startupHooks = rhext.getMetadata().getStartupHooks();
if (!ArrayUtil.isEmpty(startupHooks)) {
Iterator<Map<String, String>> itl = startupHooks.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -4978,8 +4987,9 @@ else if (!StringUtil.isEmpty(cfc, true)) {
}

// update mapping
if (!ArrayUtil.isEmpty(rhext.getMappings())) {
Iterator<Map<String, String>> itl = rhext.getMappings().iterator();
List<Map<String, String>> mappings = rhext.getMetadata().getMappings();
if (!ArrayUtil.isEmpty(mappings)) {
Iterator<Map<String, String>> itl = mappings.iterator();
Map<String, String> map;

String virtual, physical, archive, primary;
Expand Down Expand Up @@ -5031,9 +5041,9 @@ else if (!StringUtil.isEmpty(cfc, true)) {
}

// update event-gateway-instance

if (!ArrayUtil.isEmpty(rhext.getEventGatewayInstances())) {
Iterator<Map<String, Object>> itl = rhext.getEventGatewayInstances().iterator();
List<Map<String, Object>> egs = rhext.getMetadata().getEventGatewayInstances();
if (!ArrayUtil.isEmpty(egs)) {
Iterator<Map<String, Object>> itl = egs.iterator();
Map<String, Object> map;
while (itl.hasNext()) {
map = itl.next();
Expand Down Expand Up @@ -5175,8 +5185,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
removePlugins(config, logger, rhe.getMetadata().getPlugins()); // MUST check if others use one of this

// remove cache handler
if (!ArrayUtil.isEmpty(rhe.getCacheHandlers())) {
Iterator<Map<String, String>> itl = rhe.getCacheHandlers().iterator();
List<Map<String, String>> handlers = rhe.getMetadata().getCacheHandlers();
if (!ArrayUtil.isEmpty(handlers)) {
Iterator<Map<String, String>> itl = handlers.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5193,8 +5204,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove cache
if (!ArrayUtil.isEmpty(rhe.getCaches())) {
Iterator<Map<String, String>> itl = rhe.getCaches().iterator();
List<Map<String, String>> caches = rhe.getMetadata().getCaches();
if (!ArrayUtil.isEmpty(caches)) {
Iterator<Map<String, String>> itl = caches.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5208,8 +5220,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove Search
if (!ArrayUtil.isEmpty(rhe.getSearchs())) {
Iterator<Map<String, String>> itl = rhe.getSearchs().iterator();
List<Map<String, String>> searchs = rhe.getMetadata().getSearchs();
if (!ArrayUtil.isEmpty(searchs)) {
Iterator<Map<String, String>> itl = searchs.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5223,8 +5236,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove resource
if (!ArrayUtil.isEmpty(rhe.getResources())) {
Iterator<Map<String, String>> itl = rhe.getResources().iterator();
List<Map<String, String>> resources = rhe.getMetadata().getResources();
if (!ArrayUtil.isEmpty(resources)) {
Iterator<Map<String, String>> itl = resources.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5238,8 +5252,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove orm
if (!ArrayUtil.isEmpty(rhe.getOrms())) {
Iterator<Map<String, String>> itl = rhe.getOrms().iterator();
List<Map<String, String>> orms = rhe.getMetadata().getOrms();
if (!ArrayUtil.isEmpty(orms)) {
Iterator<Map<String, String>> itl = orms.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5254,8 +5269,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove webservice
if (!ArrayUtil.isEmpty(rhe.getWebservices())) {
Iterator<Map<String, String>> itl = rhe.getWebservices().iterator();
List<Map<String, String>> webservices = rhe.getMetadata().getWebservices();
if (!ArrayUtil.isEmpty(webservices)) {
Iterator<Map<String, String>> itl = webservices.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5270,8 +5286,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove monitor
if (!ArrayUtil.isEmpty(rhe.getMonitors())) {
Iterator<Map<String, String>> itl = rhe.getMonitors().iterator();
List<Map<String, String>> monitors = rhe.getMetadata().getMonitors();
if (!ArrayUtil.isEmpty(monitors)) {
Iterator<Map<String, String>> itl = monitors.iterator();
Map<String, String> map;
String name;
while (itl.hasNext()) {
Expand All @@ -5288,8 +5305,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove jdbc
if (!ArrayUtil.isEmpty(rhe.getJdbcs())) {
Iterator<Map<String, String>> itl = rhe.getJdbcs().iterator();
List<Map<String, String>> jdbcs = rhe.getMetadata().getJdbcs();
if (!ArrayUtil.isEmpty(jdbcs)) {
Iterator<Map<String, String>> itl = jdbcs.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5302,8 +5320,9 @@ private void removeRHExtension(Config config, RHExtension rhe, RHExtension repla
}

// remove startup hook
if (!ArrayUtil.isEmpty(rhe.getStartupHooks())) {
Iterator<Map<String, String>> itl = rhe.getStartupHooks().iterator();
List<Map<String, String>> startupHooks = rhe.getMetadata().getStartupHooks();
if (!ArrayUtil.isEmpty(startupHooks)) {
Iterator<Map<String, String>> itl = startupHooks.iterator();
Map<String, String> map;
while (itl.hasNext()) {
map = itl.next();
Expand All @@ -5323,8 +5342,9 @@ else if (!StringUtil.isEmpty(cfc, true)) {
}

// remove mapping
if (!ArrayUtil.isEmpty(rhe.getMappings())) {
Iterator<Map<String, String>> itl = rhe.getMappings().iterator();
List<Map<String, String>> mappings = rhe.getMetadata().getMappings();
if (!ArrayUtil.isEmpty(mappings)) {
Iterator<Map<String, String>> itl = mappings.iterator();
Map<String, String> map;
String virtual;
while (itl.hasNext()) {
Expand All @@ -5336,8 +5356,9 @@ else if (!StringUtil.isEmpty(cfc, true)) {
}

// remove event-gateway-instance
if (!ArrayUtil.isEmpty(rhe.getEventGatewayInstances())) {
Iterator<Map<String, Object>> itl = rhe.getEventGatewayInstances().iterator();
List<Map<String, Object>> egs = rhe.getMetadata().getEventGatewayInstances();
if (!ArrayUtil.isEmpty(egs)) {
Iterator<Map<String, Object>> itl = egs.iterator();
Map<String, Object> map;
String id;
while (itl.hasNext()) {
Expand Down
Loading

0 comments on commit 7351471

Please sign in to comment.