Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/332#discussion_r79597137
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/config/ConfigUtils.java ---
    @@ -126,4 +128,20 @@ else if 
(HasConfigKey.class.isAssignableFrom(f.getType()))
             }
             return Collections.unmodifiableSet(result);
         }
    +
    +    /**
    +     * Look for keys with <code>configPrefix</code> in 
<code>configBag</code> and
    +     * those which have <code>configPrefix</code> are added in 
<code>destinationBucket</code> but without <code>configPrefix</code>.
    +     * @param configPrefix prefix to look for
    +     * @param configBag keys to look in
    +     * @param destinationBucket should not be an ImmutableMap
    +     */
    +    public static void addUnprefixedConfigKeyInConfigBack(String 
configPrefix, ConfigBag configBag, Map<String, Object> destinationBucket) {
    +        for (Map.Entry<ConfigKey<?>, ?> entry : 
configBag.getAllConfigAsConfigKeyMap().entrySet()) {
    +            String keyName = entry.getKey().getName();
    +            if (keyName.startsWith(configPrefix)) {
    +                destinationBucket.put(Strings.removeFromStart(keyName, 
configPrefix), entry.getValue());
    +            }
    +        }
    +    }
    --- End diff --
    
    I made it this way because it is convenient to use this way in 
https://github.com/apache/brooklyn-server/blob/master/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java#L636-L645


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to