brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #300: Location DSL Updates
Date Thu, 18 Aug 2016 11:38:41 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/300#discussion_r75292379
  
    --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
---
    @@ -145,81 +171,88 @@ public Entity call() throws Exception {
                     default:
                         throw new IllegalStateException("Unexpected scope "+scope);
                 }
    -            
    +
                 Optional<Entity> result = Iterables.tryFind(entitiesToSearch, EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID,
componentId));
    -            
    +
                 if (result.isPresent())
    -                return result.get();
    -            
    +                return (O) result.get();
    +
                 // TODO may want to block and repeat on new entities joining?
                 throw new NoSuchElementException("No entity matching id " + componentId+
                     (scope==Scope.GLOBAL ? "" : ", in scope "+scope+" wrt "+entity+
                     (scopeComponent!=null ? " ("+scopeComponent+" from "+entity()+")" : "")));
    -        }        
    +        }
         }
    -    
    +
         // -------------------------------
     
         // DSL words which move to a new component
    -    
    -    public DslComponent entity(String scopeOrId) {
    +
    +    public DslComponent<Entity> entity(String scopeOrId) {
             return new DslComponent(this, Scope.GLOBAL, scopeOrId);
         }
    -    public DslComponent child(String scopeOrId) {
    +    public DslComponent<Entity> child(String scopeOrId) {
             return new DslComponent(this, Scope.CHILD, scopeOrId);
         }
    -    public DslComponent sibling(String scopeOrId) {
    +    public DslComponent<Entity> sibling(String scopeOrId) {
             return new DslComponent(this, Scope.SIBLING, scopeOrId);
         }
    -    public DslComponent descendant(String scopeOrId) {
    +    public DslComponent<Entity> descendant(String scopeOrId) {
             return new DslComponent(this, Scope.DESCENDANT, scopeOrId);
         }
    -    public DslComponent ancestor(String scopeOrId) {
    +    public DslComponent<Entity> ancestor(String scopeOrId) {
             return new DslComponent(this, Scope.ANCESTOR, scopeOrId);
         }
    -    public DslComponent root() {
    +    public DslComponent<Entity> root() {
             return new DslComponent(this, Scope.ROOT, "");
         }
    -    public DslComponent scopeRoot() {
    +    public DslComponent<Entity> scopeRoot() {
             return new DslComponent(this, Scope.SCOPE_ROOT, "");
         }
    -    
    +
         @Deprecated /** @deprecated since 0.7.0 */
    -    public DslComponent component(String scopeOrId) {
    +    public DslComponent<Entity> component(String scopeOrId) {
             return new DslComponent(this, Scope.GLOBAL, scopeOrId);
         }
    -    
    -    public DslComponent self() {
    +
    +    public DslComponent<Entity> self() {
             return new DslComponent(this, Scope.THIS, null);
         }
    -    
    -    public DslComponent parent() {
    +
    +    public DslComponent<Entity> parent() {
             return new DslComponent(this, Scope.PARENT, "");
         }
    -    
    -    public DslComponent component(String scope, String id) {
    +
    +    public DslComponent<Entity> component(String scope, String id) {
             if (!DslComponent.Scope.isValid(scope)) {
                 throw new IllegalArgumentException(scope + " is not a vlaid scope");
             }
             return new DslComponent(this, DslComponent.Scope.fromString(scope), id);
         }
     
    +    public DslComponent<Location> location() {
    +        return new DslComponent(this, Scope.LOCATION, null);
    +    }
    +
         // DSL words which return things
     
         public BrooklynDslDeferredSupplier<?> entityId() {
    -        return new EntityId(this);
    +        return new Identity(this);
         }
    -    protected static class EntityId extends BrooklynDslDeferredSupplier<Object>
{
    --- End diff --
    
    Is this rename going to be backwards compatible? Could `EntityId` be in anyone's persisted
state?


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