You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/03/30 16:00:05 UTC

[28/50] brooklyn-server git commit: Add ability to scan catalog.bom files in the root of bundles.

Add ability to scan catalog.bom files in the root of bundles.

This adds entries to the catalog from any catalog.bom files in the bundle,
automatically adding a 'brooklyn.libraries' section for the bundle itself
to the bom before scanning it for items.

e.g.

brooklyn.catalog:
    version: 0.9.0
    scanJavaAnnotations: true
    description: For testing loading catalog.bom
    items:
    -   id: simpleTest1
        item:
            type: org.apache.brooklyn.test.osgi.entities.SimpleEntity

Note, however that the scanJavaAnnotations will not work on the bundle. Only
explicitly declared items will be added to the catalog.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f76f9eef
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f76f9eef
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f76f9eef

Branch: refs/heads/master
Commit: f76f9eefe5c85c100e1d9d78873dbdf2e968150b
Parents: 6f87b0e
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Mon Mar 7 17:08:18 2016 +0000
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Thu Mar 24 17:41:26 2016 +0000

----------------------------------------------------------------------
 .../catalog/internal/CatalogBomScanner.java     | 185 +++++++++++++++++++
 .../apache/brooklyn/util/core/osgi/Osgis.java   |   4 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  16 +-
 core/src/main/resources/catalog.bom             |  21 +++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  61 +++---
 policy/src/main/resources/catalog.bom           |  21 +++
 software/base/src/main/resources/catalog.bom    |  21 +++
 test-framework/src/main/resources/catalog.bom   |  21 +++
 .../test/osgi/entities/SimpleEntity.java        |   3 +
 .../entities/src/main/resources/catalog.bom     |  27 +++
 .../src/main/resources/catalog.bom              |  21 +++
 .../src/main/resources/catalog.bom              |  21 +++
 .../src/main/resources/catalog.bom              |  21 +++
 .../osgi/brooklyn-test-osgi-entities.jar        | Bin 0 -> 14649 bytes
 14 files changed, 404 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
new file mode 100644
index 0000000..4477f62
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.catalog.internal;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.util.collections.MutableList;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.stream.Streams;
+import org.apache.brooklyn.util.yaml.Yamls;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.BundleTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+public class CatalogBomScanner {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CatalogBomScanner.class);
+    private static final String CATALOG_BOM_URL = "catalog.bom";
+    private static final String BROOKLYN_CATALOG = "brooklyn.catalog";
+    private static final String BROOKLYN_LIBRARIES = "brooklyn.libraries";
+
+    private CatalogPopulator catalogTracker;
+
+    public void bind(ServiceReference<ManagementContext> managementContext) throws Exception {
+        LOG.debug("Binding management context");
+        catalogTracker = new CatalogPopulator(managementContext);
+    }
+
+    public void unbind(ServiceReference<ManagementContext> managementContext) throws Exception {
+        LOG.debug("Unbinding management context");
+        if (null != catalogTracker) {
+            CatalogPopulator temp = catalogTracker;
+            catalogTracker = null;
+            temp.close();
+        }
+    }
+
+    private String[] bundleIds(Bundle bundle) {
+        return new String[] {
+            String.valueOf(bundle.getBundleId()), String.valueOf(bundle.getState()), bundle.getSymbolicName()
+        };
+    }
+
+
+    public class CatalogPopulator extends BundleTracker<Long> {
+
+        private ServiceReference<ManagementContext> mgmtContextReference;
+        private ManagementContext managementContext;
+
+        public CatalogPopulator(ServiceReference<ManagementContext> serviceReference) {
+            super(serviceReference.getBundle().getBundleContext(), Bundle.ACTIVE, null);
+            this.mgmtContextReference = serviceReference;
+            open();
+        }
+
+        @Override
+        public void open() {
+            managementContext = mgmtContextReference.getBundle().getBundleContext().getService(mgmtContextReference);
+            super.open();
+        }
+
+        @Override
+        public void close() {
+            super.close();
+            managementContext = null;
+            mgmtContextReference.getBundle().getBundleContext().ungetService(mgmtContextReference);
+        }
+
+        public ManagementContext getManagementContext() {
+            return managementContext;
+        }
+
+        @Override
+        public Long addingBundle(Bundle bundle, BundleEvent bundleEvent) {
+
+            final BundleContext bundleContext = FrameworkUtil.getBundle(CatalogBomScanner.class).getBundleContext();
+            if (bundleContext == null) {
+                LOG.info("Bundle context not yet established for bundle {} {} {}", bundleIds(bundle));
+                return null;
+            }
+
+            scanForCatalog(bundle);
+
+            return bundle.getBundleId();
+        }
+
+        @Override
+        public void modifiedBundle(Bundle bundle, BundleEvent event, Long bundleId) {
+            sanityCheck(bundle, bundleId);
+            LOG.info("Modified bundle {} {} {}", bundleIds(bundle));
+        }
+
+        @Override
+        public void removedBundle(Bundle bundle, BundleEvent bundleEvent, Long bundleId) {
+            sanityCheck(bundle, bundleId);
+            LOG.info("Unloading catalog BOM from {} {} {}", bundleIds(bundle));
+        }
+
+        private void scanForCatalog(Bundle bundle) {
+            LOG.info("Scanning for catalog items in bundle {} {} {}", bundleIds(bundle));
+            final URL bom = bundle.getResource(CATALOG_BOM_URL);
+
+            if (null != bom) {
+                LOG.info("Found catalog BOM in {} {} {}", bundleIds(bundle));
+                String bomText = readBom(bom);
+                String bomWithLibraryPath = addLibraryDetails(bundle, bomText);
+                for (CatalogItem<?, ?> item : getManagementContext().getCatalog().addItems(bomWithLibraryPath)) {
+                    LOG.debug("Added to catalog: {}", item.getSymbolicName());
+                }
+            }
+        }
+
+        private String addLibraryDetails(Bundle bundle, String bomText) {
+            final Map<String, Object> bom = (Map<String, Object>)Iterables.getOnlyElement(Yamls.parseAll(bomText));
+            final Object catalog = bom.get(BROOKLYN_CATALOG);
+            if (null != catalog && catalog instanceof Map<?, ?>) {
+                addLibraryDetails(bundle, (Map<String, Object>) catalog);
+            }
+            final String updatedBom = new Yaml().dump(bom);
+            LOG.debug("Updated catalog bom:\n{}", updatedBom);
+            return updatedBom;
+        }
+
+        private void addLibraryDetails(Bundle bundle, Map<String, Object> catalog) {
+            if (!catalog.containsKey(BROOKLYN_LIBRARIES)) {
+                catalog.put(BROOKLYN_LIBRARIES, MutableList.of());
+            }
+            final Object librarySpec = catalog.get(BROOKLYN_LIBRARIES);
+            if (!(librarySpec instanceof List)) {
+                throw new RuntimeException("expected " + BROOKLYN_LIBRARIES + " to be a list");
+            }
+            List libraries = (List)librarySpec;
+            libraries.add(ImmutableMap.of(
+                "name", bundle.getSymbolicName(),
+                "version", bundle.getVersion().toString()));
+            LOG.debug("library spec is {}", librarySpec);
+        }
+
+        private String readBom(URL bom) {
+            try {
+                return Streams.readFullyString(bom.openStream());
+            } catch (IOException e) {
+                throw Exceptions.propagate("Error loading Catalog BOM from " + bom, e);
+            }
+        }
+
+        private void sanityCheck(Bundle bundle, Long bundleId) {
+            if (bundleId != bundle.getBundleId()) {
+                throw new RuntimeException("Unexpected ID supplied for bundle " + bundle + " (" + bundleId + ")");
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
index 0a03366..82f8723 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
@@ -179,9 +179,7 @@ public class Osgis {
             for (Bundle b: framework.getBundleContext().getBundles()) {
                 if (symbolicName!=null && !symbolicName.equals(b.getSymbolicName())) continue;
                 if (version!=null && !Version.parseVersion(version).equals(b.getVersion())) continue;
-                for (Predicate<? super Bundle> predicate: predicates) {
-                    if (!predicate.apply(b)) continue;
-                }
+                if (!Predicates.and(predicates).apply(b)) continue;
 
                 // check url last, because if it isn't mandatory we should only clear if we find a url
                 // for which the other items also match

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index a91e829..8f0fea0 100644
--- a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -17,10 +17,8 @@ limitations under the License.
 
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"
            xsi:schemaLocation="
              http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
-             http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
              ">
 
    <bean id="brooklynVersion"
@@ -30,10 +28,6 @@ limitations under the License.
    <service ref="brooklynVersion"
             interface="org.apache.brooklyn.core.BrooklynVersionService" />
 
-    <bean id="containerFramework"
-          class="org.apache.brooklyn.util.core.osgi.ContainerFramework" />
-    <service ref="containerFramework"
-          interface="org.apache.brooklyn.util.osgi.SystemFramework" />
 
     <bean id="apiObjectsFactoryImpl" class="org.apache.brooklyn.core.internal.ApiObjectsFactoryImpl" />
 
@@ -43,14 +37,16 @@ limitations under the License.
         </interfaces>
     </service>
 
-    <bean id="javaClassNameTypePlanTransformer"
-          class="org.apache.brooklyn.core.typereg.JavaClassNameTypePlanTransformer"
-          scope="prototype"/>
+    <bean id="containerFramework"
+          class="org.apache.brooklyn.util.core.osgi.ContainerFramework" />
+    <service ref="containerFramework"
+          interface="org.apache.brooklyn.util.osgi.SystemFramework" />
 
+    <bean id="javaClassNameTypePlanTransformer" scope="prototype"
+          class="org.apache.brooklyn.core.typereg.JavaClassNameTypePlanTransformer"/>
     <service id="javaClassNameTypePlanTransformerService" ref="javaClassNameTypePlanTransformer"
              interface="org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer" />
 
-
     <bean id="javaCatalogToSpecTransformer" scope="prototype"
           class="org.apache.brooklyn.core.catalog.internal.JavaCatalogToSpecTransformer"/>
     <service id="javaCatalogToSpecTransformerService" ref="javaCatalogToSpecTransformer"

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/core/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/core/src/main/resources/catalog.bom b/core/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/core/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 7312531..9dd0452 100644
--- a/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -20,63 +20,63 @@ limitations under the License.
            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"
            xsi:schemaLocation="
              http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
-             http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.2.0.xsd
              ">
 
     <!-- Make sure core bundle is already started -->
     <reference id="brooklynVersion"
-               interface="org.apache.brooklyn.core.BrooklynVersionService" />
+               interface="org.apache.brooklyn.core.BrooklynVersionService"/>
 
     <cm:property-placeholder persistent-id="org.apache.brooklyn.osgilauncher" update-strategy="reload">
         <cm:default-properties>
-            <cm:property name="ignoreCatalogErrors" value="true" />
-            <cm:property name="ignorePersistenceErrors" value="true" />
-            <cm:property name="highAvailabilityMode" value="DISABLED" />
-            <cm:property name="persistMode" value="DISABLED" />
-            <cm:property name="persistenceDir" value="" />
-            <cm:property name="persistenceLocation" value="" />
-            <cm:property name="persistPeriod" value="1s" />
-            <cm:property name="globalBrooklynPropertiesFile" value="~/.brooklyn/brooklyn.properties" />
-            <cm:property name="localBrooklynPropertiesFile" value="" /> <!-- used to be settable through cli params -->
+            <cm:property name="ignoreCatalogErrors" value="true"/>
+            <cm:property name="ignorePersistenceErrors" value="true"/>
+            <cm:property name="highAvailabilityMode" value="DISABLED"/>
+            <cm:property name="persistMode" value="DISABLED"/>
+            <cm:property name="persistenceDir" value=""/>
+            <cm:property name="persistenceLocation" value=""/>
+            <cm:property name="persistPeriod" value="1s"/>
+            <cm:property name="globalBrooklynPropertiesFile" value="~/.brooklyn/brooklyn.properties"/>
+            <cm:property name="localBrooklynPropertiesFile" value=""/> <!-- used to be settable through cli params -->
         </cm:default-properties>
     </cm:property-placeholder>
 
     <bean id="propertiesBuilderFactory"
           class="org.apache.brooklyn.launcher.common.BrooklynPropertiesFactoryHelper">
-        <argument value="${globalBrooklynPropertiesFile}" />
-        <argument value="${localBrooklynPropertiesFile}" />
+        <argument value="${globalBrooklynPropertiesFile}"/>
+        <argument value="${localBrooklynPropertiesFile}"/>
     </bean>
 
     <bean id="propertiesBuilder"
           class="org.apache.brooklyn.core.internal.BrooklynProperties.Factory.Builder"
           factory-ref="propertiesBuilderFactory"
-          factory-method="createPropertiesBuilder" />
+          factory-method="createPropertiesBuilder"/>
 
     <bean id="launcher"
           class="org.apache.brooklyn.launcher.osgi.OsgiLauncher"
           init-method="init">
 
-        <property name="brooklynVersion" ref="brooklynVersion" />
-        <property name="brooklynPropertiesBuilder" ref="propertiesBuilder" />
+        <property name="brooklynVersion" ref="brooklynVersion"/>
+        <property name="brooklynPropertiesBuilder" ref="propertiesBuilder"/>
 
-        <property name="ignoreCatalogErrors" value="${ignoreCatalogErrors}" />
-        <property name="ignorePersistenceErrors" value="${ignorePersistenceErrors}" />
-        <property name="highAvailabilityMode" value="${highAvailabilityMode}" />
-        <property name="persistMode" value="${persistMode}" />
-        <property name="persistenceDir" value="${persistenceDir}" />
-        <property name="persistenceLocation" value="${persistenceLocation}" />
-        <property name="persistPeriod" value="${persistPeriod}" />
+        <property name="ignoreCatalogErrors" value="${ignoreCatalogErrors}"/>
+        <property name="ignorePersistenceErrors" value="${ignorePersistenceErrors}"/>
+        <property name="highAvailabilityMode" value="${highAvailabilityMode}"/>
+        <property name="persistMode" value="${persistMode}"/>
+        <property name="persistenceDir" value="${persistenceDir}"/>
+        <property name="persistenceLocation" value="${persistenceLocation}"/>
+        <property name="persistPeriod" value="${persistPeriod}"/>
     </bean>
 
     <bean id="localManagementContextService"
           class="org.apache.brooklyn.core.mgmt.internal.LocalManagementContext"
           factory-ref="launcher"
-          factory-method="getManagementContext" />
-          
+          factory-method="getManagementContext"/>
+
     <bean id="campPlatform"
           class="org.apache.brooklyn.camp.CampPlatform"
           factory-ref="launcher"
-          factory-method="getCampPlatform" />
+          factory-method="getCampPlatform"/>
 
     <!-- TODO shutdown -->
 
@@ -87,4 +87,13 @@ limitations under the License.
         </interfaces>
     </service>
 
+    <reference-list id="managementContextReferences"
+                    interface="org.apache.brooklyn.api.mgmt.ManagementContext"
+                    availability="optional">
+
+        <reference-listener bind-method="bind" unbind-method="unbind">
+            <bean class="org.apache.brooklyn.core.catalog.internal.CatalogBomScanner"/>
+        </reference-listener>
+    </reference-list>
+
 </blueprint>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/policy/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/policy/src/main/resources/catalog.bom b/policy/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/policy/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/software/base/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/software/base/src/main/resources/catalog.bom b/software/base/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/software/base/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/test-framework/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/test-framework/src/main/resources/catalog.bom b/test-framework/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/test-framework/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
----------------------------------------------------------------------
diff --git a/utils/common/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java b/utils/common/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
index 87cd944..ffed15f 100644
--- a/utils/common/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
+++ b/utils/common/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
@@ -21,7 +21,10 @@ package org.apache.brooklyn.test.osgi.entities;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.api.catalog.Catalog;
 
+
+@Catalog(name="A Simple Entity", description="Simple entity for test purposes")
 @ImplementedBy(SimpleEntityImpl.class)
 public interface SimpleEntity extends Entity {
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/dependencies/osgi/entities/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/utils/common/dependencies/osgi/entities/src/main/resources/catalog.bom b/utils/common/dependencies/osgi/entities/src/main/resources/catalog.bom
new file mode 100644
index 0000000..bfc1fe5
--- /dev/null
+++ b/utils/common/dependencies/osgi/entities/src/main/resources/catalog.bom
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    description: For testing loading catalog.bom with catalog scan
+    displayName: I Haz Catalog
+    items:
+    -   id: simpleTest
+        item:
+            type: org.apache.brooklyn.test.osgi.entities.SimpleEntity
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/dependencies/osgi/more-entities-v1/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/utils/common/dependencies/osgi/more-entities-v1/src/main/resources/catalog.bom b/utils/common/dependencies/osgi/more-entities-v1/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/utils/common/dependencies/osgi/more-entities-v1/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/dependencies/osgi/more-entities-v2-evil-twin/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/utils/common/dependencies/osgi/more-entities-v2-evil-twin/src/main/resources/catalog.bom b/utils/common/dependencies/osgi/more-entities-v2-evil-twin/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/utils/common/dependencies/osgi/more-entities-v2-evil-twin/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/dependencies/osgi/more-entities-v2/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/utils/common/dependencies/osgi/more-entities-v2/src/main/resources/catalog.bom b/utils/common/dependencies/osgi/more-entities-v2/src/main/resources/catalog.bom
new file mode 100644
index 0000000..e281ada
--- /dev/null
+++ b/utils/common/dependencies/osgi/more-entities-v2/src/main/resources/catalog.bom
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+brooklyn.catalog:
+    version: 0.9.0
+    scanJavaAnnotations: true
+    items:

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f76f9eef/utils/common/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
----------------------------------------------------------------------
diff --git a/utils/common/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar b/utils/common/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
new file mode 100644
index 0000000..20c84ed
Binary files /dev/null and b/utils/common/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar differ