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

    https://github.com/apache/brooklyn-server/pull/136#discussion_r63025137
  
    --- Diff: 
software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java
 ---
    @@ -98,4 +107,21 @@
             log.debug("getRequiredOpenPorts detected default {} for {}", 
ports, entity);
             return ports;
         }
    +
    +    /**
    +     * Checks if a configkey can be managed as a config key {@link 
PortRange}. The method checks if
    +     * the config type or the entity config key value are assignable from 
the {@link PortRange}.
    +     * Moreover the method retrieves true if the config key name matches 
with pattern.
    +     *
    +     * @param configuredConfigKeys the configured entity config keys
    +     * @param configKey            the configkey that could be assigned as 
a {@link org.apache.brooklyn.api.location.PortRange}
    +     * @param portsPattern         pattern to recognized Config key {@link 
org.apache.brooklyn.api.location.PortRange} of the name   @return if the config 
key is recognized as a config key {@link PortRange}
    +     */
    +    private static boolean isAssignableFromPortConfigKey(Map<ConfigKey<?>, 
?> configuredConfigKeys, ConfigKey<?> configKey, Pattern portsPattern) {
    +        Object a = configuredConfigKeys.get(configKey);
    +        return PortRange.class.isAssignableFrom(configKey.getType())
    +                || (portsPattern.matcher(configKey.getName()).matches())
    +                || (a != null) && (a instanceof PortRange);
    --- End diff --
    
    Null check not actually needed.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to