brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grkvlt <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Adds support for ${attribute['att...
Date Thu, 16 Apr 2015 14:21:55 GMT
Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/601#discussion_r28513414
  
    --- Diff: core/src/main/java/brooklyn/util/text/TemplateProcessor.java ---
    @@ -225,6 +229,40 @@ public String toString() {
             }
         }
     
    +    protected final static class EntityAttributeTemplateModel implements TemplateHashModel
{
    +        protected final EntityInternal entity;
    +
    +        protected EntityAttributeTemplateModel(EntityInternal entity) {
    +            this.entity = entity;
    +        }
    +
    +        @Override
    +        public boolean isEmpty() throws TemplateModelException {
    +            return false;
    +        }
    +
    +        @Override
    +        public TemplateModel get(String key) throws TemplateModelException {
    +            Object result;
    +            try {
    +                result = Entities.submit(entity, DependentConfiguration.attributeWhenReady(entity,
    +                        Sensors.builder(Object.class, key).persistence(AttributeSensor.SensorPersistenceMode.NONE).build())).get();
    +            } catch (Exception e) {
    +                throw Exceptions.propagate(e);
    --- End diff --
    
    Do `throw new TemplateModelException("Error obtaining sensor data for " + key, e)` here
instead


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