brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Catalog default niceness
Date Wed, 24 Jun 2015 20:47:59 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/705#discussion_r33194180
  
    --- Diff: core/src/main/java/brooklyn/util/flags/TypeCoercions.java ---
    @@ -723,7 +727,31 @@ public Class apply(final String input) {
             registerAdapter(String.class, AttributeSensor.class, new Function<String,AttributeSensor>()
{
                 @Override
                 public AttributeSensor apply(final String input) {
    -                return new BasicAttributeSensor<Object>(Object.class, input);
    +                Entity entity = BrooklynTaskTags.getContextEntity(Tasks.current());
    +                if (entity!=null) {
    +                    Sensor<?> result = null;
    +                    if (entity!=null) {
    +                        result = entity.getEntityType().getSensor(input);
    +                        if (result instanceof AttributeSensor) 
    +                            return (AttributeSensor) result;
    +                    }
    +                }
    +                return Sensors.newSensor(Object.class, input);
    +            }
    +        });
    +        registerAdapter(String.class, Sensor.class, new Function<String,Sensor>()
{
    +            @Override
    +            public AttributeSensor apply(final String input) {
    +                Entity entity = BrooklynTaskTags.getContextEntity(Tasks.current());
    +                if (entity!=null) {
    +                    Sensor<?> result = null;
    +                    if (entity!=null) {
    --- End diff --
    
    who wrote this mess?  :)


---
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