brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Adds addAssociationListener and r...
Date Mon, 02 Mar 2015 20:47:54 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/538#discussion_r25636815
  
    --- Diff: core/src/main/java/brooklyn/location/access/PortForwardManager.java ---
    @@ -46,6 +47,42 @@
     @Beta
     public interface PortForwardManager extends Location {
     
    +    @Beta
    +    class AssociationMetadata {
    +        private final String publicIpId;
    +        private final HostAndPort publicEndpoint;
    +        private final Location location;
    +        private final int privatePort;
    +
    +        public AssociationMetadata(String publicIpId, HostAndPort publicEndpoint, Location
location, int privatePort) {
    +            this.publicIpId = publicIpId;
    +            this.publicEndpoint = publicEndpoint;
    +            this.location = location;
    +            this.privatePort = privatePort;
    +        }
    +
    +        public String getPublicIpId() {
    +            return publicIpId;
    +        }
    +
    +        public HostAndPort getPublicEndpoint() {
    +            return publicEndpoint;
    +        }
    +
    +        public Location getLocation() {
    +            return location;
    +        }
    +
    +        public int getPrivatePort() {
    +            return privatePort;
    +        }
    +    }
    +
    +    @Beta
    +    interface AssociationListener {
    +        void onEvent(AssociationMetadata metadata);
    --- End diff --
    
    Do you think we should call this on removal of a port mapping? I think we probably should.
    
    The reason is that it impacts the choice of method name, so impacts backwards compatibility.
How about changing this to `onAssociationCreated(AssociationMetadata)` and `onAssociationDeleted(AssociationMetadata)`?
    
    For the impl of the latter, see `PortForwardManagerImpl.forgetPortMapping(...)` and `forgetPortMappings(...)`
- i.e. everywhere that it removes from the `PortForwardManagerImpl.mappings` map.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message