brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #821: REST API for accessing adjuncts (includin...
Date Tue, 03 Oct 2017 10:01:07 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/821#discussion_r142359688
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/BrooklynRestResourceUtils.java
---
    @@ -130,6 +143,36 @@ public Policy getPolicy(Entity entity, String policy) {
             
             throw WebResourceUtils.notFound("Cannot find policy '%s' in entity '%s'", policy,
entity);
         }
    +    
    +    /** finds the policy indicated by the given ID or name.
    +     * @see {@link #getAdjunct(String,String,String)}.
    +     * <p>
    +     * 
    +     * @throws 404 or 412 (unless input is null in which case output is null) */
    +    public EntityAdjunct getAdjunct(Entity entity, String adjunct) {
    +        if (adjunct==null) return null;
    --- End diff --
    
    let's make it separate just in case -- agree no use case for `null` input.  i'd probably
make it a fail-fast NPE (500 or 412 precondition failed) rather than a 404.


---

Mime
View raw message