Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1176#discussion_r50975207
  
    --- Diff: 
brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/ItemLister.java
 ---
    @@ -98,88 +115,150 @@ public Void call() throws Exception {
                 List<URL> urls = getUrls();
                 LOG.info("Retrieving objects from "+urls);
     
    -            // TODO Remove duplication from separate ListPolicyCommand etc
    -            List<Class<? extends Entity>> entityTypes = getTypes(urls, 
Entity.class);
    -            List<Class<? extends Policy>> policyTypes = getTypes(urls, 
Policy.class);
    -            List<Class<? extends Enricher>> enricherTypes = getTypes(urls, 
Enricher.class);
    -            List<Class<? extends Location>> locationTypes = getTypes(urls, 
Location.class, Boolean.FALSE);
    +            Map<String, Object> result = MutableMap.of();
    +            List<String> jsonList = new ArrayList<>();
     
    -            Map<String, Object> result = ImmutableMap.<String, 
Object>builder()
    -                    .put("entities", 
ItemDescriptors.toItemDescriptors(entityTypes, headingsOnly, "name"))
    -                    .put("policies", 
ItemDescriptors.toItemDescriptors(policyTypes, headingsOnly, "name"))
    -                    .put("enrichers", 
ItemDescriptors.toItemDescriptors(enricherTypes, headingsOnly, "name"))
    -                    .put("locations", 
ItemDescriptors.toItemDescriptors(locationTypes, headingsOnly, "type"))
    -                    .put("locationResolvers", 
ItemDescriptors.toItemDescriptors(ImmutableList.copyOf(ServiceLoader.load(LocationResolver.class)),
 true))
    -                    .build();
    +            if (!jars.isEmpty()) {
    +                // TODO Remove duplication from separate ListPolicyCommand 
etc
    +                List<Class<? extends Entity>> entityTypes = getTypes(urls, 
Entity.class);
    +                List<Class<? extends Policy>> policyTypes = getTypes(urls, 
Policy.class);
    +                List<Class<? extends Enricher>> enricherTypes = 
getTypes(urls, Enricher.class);
    +                List<Class<? extends Location>> locationTypes = 
getTypes(urls, Location.class, Boolean.FALSE);
     
    -            String json = toJson(result);
    +                result = ImmutableMap.<String, Object>builder()
    +                        .put("entities", 
ItemDescriptors.toItemDescriptors(entityTypes, headingsOnly, "name"))
    +                        .put("policies", 
ItemDescriptors.toItemDescriptors(policyTypes, headingsOnly, "name"))
    +                        .put("enrichers", 
ItemDescriptors.toItemDescriptors(enricherTypes, headingsOnly, "name"))
    +                        .put("locations", 
ItemDescriptors.toItemDescriptors(locationTypes, headingsOnly, "type"))
    +                        .put("locationResolvers", 
ItemDescriptors.toItemDescriptors(ImmutableList.copyOf(ServiceLoader.load(LocationResolver.class)),
 true))
    +                        .build();
    +                jsonList.add(toJson(result));
    +            } else if (!yaml.isEmpty()) {
    +                LocalManagementContext lmgmt = new 
LocalManagementContext();
    --- End diff --
    
    This will read config from the user's `brooklyn.properties`. Better 
initialize it with an empty state using `new 
LocalManagementContext(BrooklynProperties.Factory.newEmpty());`


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