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 #485: `BundleMaker` REST call allowing to add Z...
Date Tue, 21 Mar 2017 12:49:04 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/485#discussion_r107144653
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
---
    @@ -417,6 +419,53 @@ else for (String key: otherKeys) {
             return result;
         }
     
    +    public static Map<?,?> getCatalogMetadata(String yaml) {
    +        Map<?,?> itemDef = Yamls.getAs(Yamls.parseAll(yaml), Map.class);
    +        return getFirstAsMap(itemDef, "brooklyn.catalog").orNull();        
    +    }
    +    
    +    public static VersionedName getVersionedName(Map<?,?> catalogMetadata) {
    +        String id = getFirstAs(catalogMetadata, String.class, "id").orNull();
    +        String version = getFirstAs(catalogMetadata, String.class, "version").orNull();
    +        String symbolicName = getFirstAs(catalogMetadata, String.class, "symbolicName").orNull();
    +        symbolicName = findAssertingConsistentIfSet("symbolicName", symbolicName, getFirstAs(catalogMetadata,
String.class, "symbolic-name").orNull());
    +        // prefer symbolic name and version, if supplied
    +        // else use id as symbolic name : version or just symbolic name
    +        // (must match if both supplied)
    +        if (Strings.isNonBlank(id)) {
    +            if (CatalogUtils.looksLikeVersionedId(id)) {
    +                symbolicName = findAssertingConsistentIfSet("symbolicName", symbolicName,
CatalogUtils.getSymbolicNameFromVersionedId(id));
    +                version = findAssertingConsistentIfSet("version", version, CatalogUtils.getVersionFromVersionedId(id));
    +            } else {
    +                symbolicName = findAssertingConsistentIfSet("symbolicName", symbolicName,
id);
    +            }
    +        }
    +        if (Strings.isBlank(symbolicName) && Strings.isBlank(version)) {
    --- End diff --
    
    Ah, I should have read a few lines lower down. Deleting previous comment :-) Should have
do as a review so you didn't see it until I was finished...


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