Github user neykov commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/617#discussion_r30694106
--- 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 --
* Will it work if annotated classes depend on a bundle not explicitly
listed (no OSGi dependency mechanism in play here)?
* Can't figure out how the bundles in `urls` can see the brooklyn
classpath. The classloader created for scanning is limited to only this list.
* Even if the brooklyn classpath is visible how are conflicting versions
handled?
* The libraries list can contain name:version pairs only, leaving it to
OSGi to figure out the bundle. `getUrl` will return `null` in this case.
---
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.
---