Github user aledsage commented on the pull request:

    
https://github.com/apache/incubator-brooklyn/pull/1138#issuecomment-171319459
  
    @ahgittin @johnmccabe I definitely agree with you in the case where there 
are multiple entities within the plan - the most sensible thing is to compose 
all of those under one entity - a `BasicApplication` is a reasonable choice for 
that.
    
    Where there is just one type under services, it's less clear what the user 
would expect. In the case of using `2-bash-web-server-template` as the type of 
the `memberSpec` for the `DynamicCluster` of 
`4-resilient-bash-web-cluster-template`... it looked most logical to me that 
we'd get the *entity* rather than the wrapping application. The wrapping app 
doesn't have all the sensors propagated, so is not usable as a member of the 
cluster directly.
    
    The initializers, enrichers etc are coming from additional config on the 
memberSpec within `4-resilient-bash-web-cluster-template`. Again it felt 
natural to me that this was being applied to the entity that I see in the 
definition of `2-bash-web-server-template` (rather than an extra wrapping app).
    
    ---
    
    My (current) take is that we should expect the output of the parse to be a 
single entity - if we had to wrap it (e.g. because there were multiple 
children), then that top level entity will be an app; otherwise it will be the 
entity itself.
    
    This requires that the caller knows whether they expected an app. And has 
the ability to wrap it in an app if it really required that. However, that is 
fiddly: by the time we hit the camp code, we don't necessarily know what the 
caller really wanted. When we're inside the brooklyn-core code (e.g. 
`BasicBrooklynTypeRegistry.createSpecFromPlan`) then we don't know how to look 
at the template plan to know how best to wrap it.
    
    Maybe there is a way inside the camp code to understand what the caller 
really wanted. But we need to be really careful, because there aren't very 
clear entry points into the camp code (that are not alos used by internal 
methods).


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