You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2015/03/02 09:57:51 UTC
[2/2] karaf git commit: [KARAF-3577] Optimize
SecuredCommandConfigTransformer#generateServiceGuardConfig
[KARAF-3577] Optimize SecuredCommandConfigTransformer#generateServiceGuardConfig
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/bfd0db0e
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/bfd0db0e
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/bfd0db0e
Branch: refs/heads/karaf-3.0.x
Commit: bfd0db0e7877f534d9191854719fbdace3fa4c7a
Parents: a3ceb47
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Sat Feb 28 14:00:14 2015 +0100
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Mon Mar 2 09:19:21 2015 +0100
----------------------------------------------------------------------
.../security/impl/SecuredCommandConfigTransformer.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/bfd0db0e/shell/console/src/main/java/org/apache/karaf/shell/security/impl/SecuredCommandConfigTransformer.java
----------------------------------------------------------------------
diff --git a/shell/console/src/main/java/org/apache/karaf/shell/security/impl/SecuredCommandConfigTransformer.java b/shell/console/src/main/java/org/apache/karaf/shell/security/impl/SecuredCommandConfigTransformer.java
index 345ff22..3b44765 100644
--- a/shell/console/src/main/java/org/apache/karaf/shell/security/impl/SecuredCommandConfigTransformer.java
+++ b/shell/console/src/main/java/org/apache/karaf/shell/security/impl/SecuredCommandConfigTransformer.java
@@ -74,8 +74,10 @@ public class SecuredCommandConfigTransformer implements ConfigurationListener {
}
scopeName = scopeName.trim();
+ Dictionary<String, Object> configProps = config.getProperties();
+
Map<String, Dictionary<String, Object>> configMaps = new HashMap<String, Dictionary<String, Object>>();
- for (Enumeration<String> e = config.getProperties().keys(); e.hasMoreElements(); ) {
+ for (Enumeration<String> e = configProps.keys(); e.hasMoreElements(); ) {
String key = e.nextElement();
String bareCommand = key;
String arguments = "";
@@ -104,7 +106,7 @@ public class SecuredCommandConfigTransformer implements ConfigurationListener {
// put rules on the map twice, once for commands that 'execute' (implement Function) and
// once for commands that are invoked directly
- Object roleString = config.getProperties().get(key);
+ Object roleString = configProps.get(key);
map.put("execute" + arguments, roleString);
map.put(key, roleString);
map.put("*", "*"); // any other method may be invoked by anyone
@@ -160,8 +162,9 @@ public class SecuredCommandConfigTransformer implements ConfigurationListener {
deleteServiceGuardConfig(event.getPid(), event.getPid().substring(PROXY_COMMAND_ACL_PID_PREFIX.length()));
break;
case ConfigurationEvent.CM_UPDATED:
- generateServiceGuardConfig(configAdmin.getConfiguration(event.getPid(), null));
- refreshTheAffectedShellCommandBundle(event, configAdmin.getConfiguration(event.getPid(), null));
+ Configuration config = configAdmin.getConfiguration(event.getPid(), null);
+ generateServiceGuardConfig(config);
+ refreshTheAffectedShellCommandBundle(event, config);
break;
}
} catch (Exception e) {