brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: CLI commands for manipulating cat...
Date Wed, 20 May 2015 14:59:41 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/617#discussion_r30711175
  
    --- 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 --
    
    Made a quick test - tried scanning `brooklyn-test-osgi-entities.jar` (after annotating
`SimpleEntity`). Fails with
    
    ```
    2015-05-20 17:46:39,482 ERROR Error loading catalog item 'brooklyn.catalog.internal.CatalogItemDo[CatalogEntityItemDto[brooklyn.osgi.tests.SimpleEntity:0.0.0.SNAPSHOT/Tomcat
Server]]': java.lang.IllegalStateException: Error creating class brooklyn.entity.proxying.EntitySpec
brooklyn.osgi.tests.SimpleEntity: java.lang.IllegalStateException: Unable to load brooklyn.osgi.tests.SimpleEntity
from []: Invalid class: brooklyn.osgi.tests.SimpleEntity: java.lang.ClassNotFoundException:
brooklyn.osgi.tests.SimpleEntity
    ```
    with the yaml
    
    ```
    brooklyn.catalog:
    - libraries:
      - file:///.../core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
      scanJavaAnnotations: true
    ```
    
    Worth adding it to the PR. But no classpath:// protocol supported by the catalog CL, as
used in other tests.
    
    If there's no explicit parent class loader (as in our case) only the bootstrap class loader
will be consulted which doesn't have access to the app classes.


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