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

    https://github.com/apache/incubator-brooklyn/pull/617#discussion_r30704536
  
    --- Diff: 
core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java ---
    @@ -750,7 +780,37 @@ private String setFromItemIfUnset(String oldValue, 
Map<?,?> item, String fieldAt
             return oldValue;
         }
     
    +    private Collection<CatalogItemDtoAbstract<?, ?>> 
scanAnnotationsFromLocal(ManagementContext mgmt) {
    +        CatalogDto dto = CatalogDto.newNamedInstance("Local Scanned 
Catalog", "All annotated Brooklyn entities detected in the classpath", 
"scanning-local-classpath");
    +        return scanAnnotationsInternal(mgmt, new CatalogDo(dto));
    +    }
         
    +    private Collection<CatalogItemDtoAbstract<?, ?>> 
scanAnnotationsFromBundles(ManagementContext mgmt, Collection<CatalogBundle> 
libraries) {
    +        String[] urls = null;
    +        CatalogDto dto = CatalogDto.newNamedInstance("Bundles Scanned 
Catalog", "All annotated Brooklyn entities detected in the classpath", 
"scanning-bundles-classpath-"+libraries.hashCode());
    +        urls = new String[libraries.size()];
    +        int i=0;
    +        for (CatalogBundle b: libraries)
    +            urls[i++] = b.getUrl();
    +            
    +        CatalogDo subCatalog = new CatalogDo(dto);
    +        subCatalog.addToClasspath(urls);
    --- End diff --
    
    i think the what-to-scan logic is correct.  we do
    
         Collection<CatalogBundle> libraryBundlesNew = 
CatalogItemDtoAbstract.parseLibraries(librariesNew);
    
    which accepts both `name:version` pairs and URL's; that collection won't be 
empty if either is supplied, and so it then won't `scanAnnotationsFromLocal`.
    
    the brooklyn classpath will always be available because it is the bootstrap 
class loader, won't it?  it just won't be scanned when any bundles are defined.
    
    i've added a log warning when only `name:version` is supplied, and comments 
in several places for the other issues (all of which i agree), including the 
docs for the `scanJavaAnnotations [experimental]`.  i think this is the right 
balance until we know whether we want to support scanning of OSGi or instead 
have some other tool to extract a `bom` (or even a TOSCA definition) which we 
expect included in the bundle.


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