You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/10/27 00:58:19 UTC

[01/12] incubator-brooklyn git commit: [BROOKLYN-183] Skeleton of karaf shell commands project

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 25e1c31d2 -> 8457515f6


[BROOKLYN-183] Skeleton of karaf shell commands project


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

Branch: refs/heads/master
Commit: 99c8218a01fe9c3feda783363e250112719c2371
Parents: b9d5a46
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Thu Sep 24 17:37:59 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 00:58:37 2015 +0300

----------------------------------------------------------------------
 karaf/commands/pom.xml                          | 77 ++++++++++++++++++++
 .../apache/brooklyn/karaf/commands/Catalog.java | 27 +++++++
 karaf/features/src/main/resources/features.xml  |  4 +
 karaf/pom.xml                                   |  4 +-
 4 files changed, 110 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/commands/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/commands/pom.xml b/karaf/commands/pom.xml
new file mode 100644
index 0000000..f3c60e6
--- /dev/null
+++ b/karaf/commands/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+    <artifactId>brooklyn-karaf</artifactId>
+    <groupId>org.apache.brooklyn</groupId>
+    <version>0.9.0-SNAPSHOT</version>
+  </parent>
+
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn-commands</artifactId>
+    <packaging>bundle</packaging>
+    <version>0.9.0-SNAPSHOT</version>
+
+    <name>Brooklyn Karaf Shell Commands</name>
+    <description>Provides brooklyn commands within karaf's shell</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
+            <version>${karaf.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${org.osgi.core.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>${org.osgi.compendium.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>org.apache.brooklyn.karaf.commands*;version=${project.version};-noimport:=true</Export-Package>
+                        <Karaf-Commands>org.apache.brooklyn.karaf.commands*</Karaf-Commands>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
----------------------------------------------------------------------
diff --git a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
new file mode 100644
index 0000000..3df948a
--- /dev/null
+++ b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
@@ -0,0 +1,27 @@
+
+package org.apache.brooklyn.karaf.commands;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+
+@Command(scope = "brooklyn", name = "catalog", description = "Manage the local brooklyn catalog")
+@Service
+public class Catalog implements Action {
+
+    @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
+    private String option;
+
+    @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
+    private String argument;
+
+    @Override
+    public Object execute() throws Exception {
+         System.out.println("Executing command catalog");
+         System.out.println("Option: " + option);
+         System.out.println("Argument: " + argument);
+         return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/resources/features.xml b/karaf/features/src/main/resources/features.xml
index ff843f9..ccbd649 100755
--- a/karaf/features/src/main/resources/features.xml
+++ b/karaf/features/src/main/resources/features.xml
@@ -9,4 +9,8 @@
   <feature name="brooklyn-core" version="${project.version}" resolver="(obr)">
     <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
   </feature>
+
+  <feature name="brooklyn-commands"  version="${project.version}">
+      <bundle>mvn:org.apache.brooklyn/brooklyn-commands/${project.version}</bundle>
+  </feature>
 </features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/pom.xml b/karaf/pom.xml
index 94b7750..b5c70d8 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -17,8 +17,7 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
   <parent>
@@ -46,6 +45,7 @@
   <modules>
     <module>features</module>
     <module>apache-brooklyn</module>
+    <module>commands</module>
   </modules>
 
   <build>


[06/12] incubator-brooklyn git commit: [BROOKLYN-183] Add pax-exam integration tests stub project

Posted by ha...@apache.org.
[BROOKLYN-183] Add pax-exam integration tests stub project


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

Branch: refs/heads/master
Commit: d944b7abcbfbe9f2c5f13a550407f4dac4cc059a
Parents: c8161a6
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Fri Oct 2 19:11:46 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 karaf/itest/pom.xml                             | 164 +++++++++++++++++++
 .../test/java/org/apache/brooklyn/MyTest.java   |  93 +++++++++++
 karaf/itest/src/test/resources/exam.properties  |  21 +++
 karaf/itest/src/test/resources/logback.xml      |  43 +++++
 karaf/pom.xml                                   |  21 +++
 5 files changed, 342 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d944b7ab/karaf/itest/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/itest/pom.xml b/karaf/itest/pom.xml
new file mode 100644
index 0000000..416d748
--- /dev/null
+++ b/karaf/itest/pom.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>brooklyn-karaf</artifactId>
+        <groupId>org.apache.brooklyn</groupId>
+        <version>0.9.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn-itest</artifactId>
+    <name>Brooklyn Karaf pax-exam itest</name>
+
+    <dependencies>
+        <!-- Pax Exam Dependencies -->
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-invoker-junit</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- Karaf Container -->
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-karaf</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-inject</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-extender-service</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- Preferred link because it does not require an mvn url handler implicitely. -->
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-assembly</artifactId>
+            <version>${pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>${logback.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-atinject_1.0_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${org.osgi.core.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>${org.osgi.compendium.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- framework to test with -->
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>standard</artifactId>
+            <version>${karaf.version}</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>org.apache.karaf.features.core</artifactId>
+            <version>${karaf.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.system</groupId>
+            <artifactId>org.apache.karaf.system.core</artifactId>
+            <version>${karaf.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>apache-karaf</artifactId>
+            <version>${karaf.version}</version>
+            <type>zip</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.karaf.shell</groupId>
+                    <artifactId>org.apache.karaf.shell.dev</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>${maven.compiler.source}</source>
+                    <target>${maven.compiler.target}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d944b7ab/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
new file mode 100644
index 0000000..d7b4917
--- /dev/null
+++ b/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.apache.karaf.features.BootFinished;
+import org.apache.karaf.features.FeaturesService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.BundleContext;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class MyTest {
+
+	@Inject
+	private BundleContext bc;
+	
+
+	@Inject
+	protected FeaturesService featuresService;
+	
+	/**
+	 * To make sure the tests run only when the boot features are fully
+	 * installed
+	 */
+	@Inject
+	BootFinished bootFinished;
+
+	@Configuration
+	public static Option[] configuration() throws Exception {
+		return new Option[] {
+				karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
+						.type("zip").version("4.0.1"))
+						.unpackDirectory(new File("target/paxexam/unpack/"))
+						.useDeployFolder(false),
+				configureConsole().ignoreLocalConsole(),
+				logLevel(LogLevel.INFO),
+				keepRuntimeFolder(),
+				features(
+						maven().groupId("org.apache.karaf.features")
+								.artifactId("standard").type("xml")
+								.classifier("features").version("3.0.3"),
+						"eventadmin")
+				};
+	}
+
+	@Test
+	public void shouldHaveBundleContext() {
+		assertThat(bc, is(notNullValue()));
+	}
+	
+	@Test
+	public void checkEventFeature() throws Exception {
+		assertThat(featuresService.isInstalled(featuresService.getFeature("eventadmin")), is(true));
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d944b7ab/karaf/itest/src/test/resources/exam.properties
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/resources/exam.properties b/karaf/itest/src/test/resources/exam.properties
new file mode 100644
index 0000000..d516df6
--- /dev/null
+++ b/karaf/itest/src/test/resources/exam.properties
@@ -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.
+#
+################################################################################
+
+pax.exam.logging = none
+pax.exam.service.timeout = 5000

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d944b7ab/karaf/itest/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/resources/logback.xml b/karaf/itest/src/test/resources/logback.xml
new file mode 100644
index 0000000..7c08bb7
--- /dev/null
+++ b/karaf/itest/src/test/resources/logback.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<configuration>
+
+  <!--  log to System.out on console  -->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+  
+  <!--  log to file test.log  -->
+    <appender name="TEST_LOG" class="ch.qos.logback.core.FileAppender">
+        <file>test.log</file>
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="TEST_LOG" />
+    </root>
+    <logger name="org.ops4j.pax.exam" level="INFO" />
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d944b7ab/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/pom.xml b/karaf/pom.xml
index e30adc3..9417336 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -37,6 +37,11 @@
     
     <lifecycle-mapping-plugin.version>1.0.0</lifecycle-mapping-plugin.version>
 
+    <!-- pax-exam -->
+    <pax.exam.version>4.5.0</pax.exam.version>
+    <pax.url.version>2.4.1</pax.url.version>
+    <ops4j.base.version>1.5.0</ops4j.base.version>
+
     <maven.compiler.source>${java.version}</maven.compiler.source>
     <maven.compiler.target>${java.version}</maven.compiler.target>
   </properties>
@@ -45,7 +50,23 @@
     <module>features</module>
     <module>apache-brooklyn</module>
     <module>commands</module>
+    <module>itest</module>
   </modules>
+  
+  <dependencyManagement>
+      <dependencies>
+          <dependency>
+              <groupId>org.ops4j.base</groupId>
+              <artifactId>ops4j-base-lang</artifactId>
+              <version>${ops4j.base.version}</version>
+          </dependency>
+          <dependency>
+              <groupId>org.ops4j.base</groupId>
+              <artifactId>ops4j-base-util-property</artifactId>
+              <version>${ops4j.base.version}</version>
+          </dependency>
+      </dependencies>
+  </dependencyManagement>
 
   <build>
     <pluginManagement>


[08/12] incubator-brooklyn git commit: [BROOKLYN-183] Use brooklyn-itest project to check features

Posted by ha...@apache.org.
[BROOKLYN-183] Use brooklyn-itest project to check features

Add brooklyn-core feature to boot features in apache-brooklyn karaf
assembly. Remove custom setting of org.osgi.framework.system.packages.extra.

Depend on apache-brooklyn assembly in brooklyn-itest. Use
apache-brooklyn as OSGi runtime for AssemblyTest.


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

Branch: refs/heads/master
Commit: 06b186faa74fcbe473ee3e41156ca49b4e56f252
Parents: d944b7a
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Mon Oct 5 15:50:34 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 karaf/apache-brooklyn/pom.xml                   |  11 +-
 .../src/main/resources/etc/custom.properties    | 180 +++++++++----------
 karaf/itest/pom.xml                             |  26 ++-
 .../java/org/apache/brooklyn/AssemblyTest.java  | 117 ++++++++++++
 .../test/java/org/apache/brooklyn/MyTest.java   |  93 ----------
 5 files changed, 238 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/apache-brooklyn/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/pom.xml b/karaf/apache-brooklyn/pom.xml
index f3374a6..e478e78 100755
--- a/karaf/apache-brooklyn/pom.xml
+++ b/karaf/apache-brooklyn/pom.xml
@@ -57,14 +57,14 @@
       <scope>runtime</scope>
     </dependency>
 
-    <!--dependency>
+    <dependency>
       <groupId>org.apache.brooklyn</groupId>
-      <artifactId>features</artifactId>
+      <artifactId>brooklyn-features</artifactId>
       <version>${project.version}</version>
       <type>xml</type>
       <classifier>features</classifier>
       <scope>runtime</scope>
-    </dependency-->
+    </dependency>
 
   </dependencies>
 
@@ -112,9 +112,10 @@
             <bootFeature>ssh</bootFeature>
             <bootFeature>system</bootFeature>
             <bootFeature>wrap</bootFeature>
-            <!--bootFeature>brooklyn-core</bootFeature-->
+            <!-- brooklyn features -->
+            <bootFeature>brooklyn-core</bootFeature>
           </bootFeatures>
-	    </configuration>
+        </configuration>
       </plugin>
     </plugins>
   </build>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
index 912207f..f2db8c2 100644
--- a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
+++ b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
@@ -22,93 +22,93 @@
 # All the values specified here will override the default value.
 #
 
-karaf.systemBundlesStartLevel=50
-
-org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom
-
-org.osgi.framework.system.packages.extra = \
-  org.apache.karaf.branding, \
-  com.sun.org.apache.xalan.internal.xsltc.trax, \
-  com.sun.org.apache.xerces.internal.dom, \
-  com.sun.org.apache.xerces.internal.jaxp, \
-  com.sun.org.apache.xerces.internal.xni, \
-  com.sun.jndi.ldap, \
-  org.apache.xalan.extensions; version="2.7.1", \
-  org.apache.xalan.xsltc.compiler; version="2.7.1", \
-  org.apache.xalan.xsltc.cmdline.getopt; version="2.7.1", \
-  org.apache.xalan.xsltc.util; version="2.7.1", \
-  org.apache.xalan.transformer; version="2.7.1", \
-  org.apache.xalan.xsltc.trax; version="2.7.1", \
-  org.apache.xalan.processor; version="2.7.1", \
-  org.apache.xalan.lib; version="2.7.1", \
-  org.apache.xalan.trace; version="2.7.1", \
-  org.apache.xalan.xsltc.compiler.util; version="2.7.1", \
-  org.apache.xalan.templates; version="2.7.1", \
-  org.apache.xalan.xsltc; version="2.7.1", \
-  org.apache.xalan.xsltc.runtime; version="2.7.1", \
-  org.apache.xalan; version="2.7.1", \
-  org.apache.xalan.xslt; version="2.7.1", \
-  org.apache.xalan.lib.sql; version="2.7.1", \
-  org.apache.xalan.xsltc.runtime.output; version="2.7.1", \
-  org.apache.xalan.xsltc.dom; version="2.7.1", \
-  org.apache.xalan.client; version="2.7.1", \
-  org.apache.xalan.xsltc.cmdline; version="2.7.1", \
-  org.apache.xalan.serialize; version="2.7.1", \
-  org.apache.xalan.res; version="2.7.1", \
-  org.apache.xml.dtm.ref; version="2.7.1", \
-  org.apache.xml.dtm; version="2.7.1", \
-  org.apache.xml.dtm.ref.sax2dtm; version="2.7.1", \
-  org.apache.xml.dtm.ref.dom2dtm; version="2.7.1", \
-  org.apache.xml.res; version="2.7.1", \
-  org.apache.xml.serializer.dom3; version="2.7.1", \
-  org.apache.xml.serializer; version="2.7.1", \
-  org.apache.xml.serializer.utils; version="2.7.1", \
-  org.apache.xml.utils.res; version="2.7.1", \
-  org.apache.xml.utils; version="2.7.1", \
-  org.apache.xpath.functions; version="2.7.1", \
-  org.apache.xpath.jaxp; version="2.7.1", \
-  org.apache.xpath.patterns; version="2.7.1", \
-  org.apache.xpath.objects; version="2.7.1", \
-  org.apache.xpath.res; version="2.7.1", \
-  org.apache.xpath; version="2.7.1", \
-  org.apache.xpath.axes; version="2.7.1", \
-  org.apache.xpath.compiler; version="2.7.1", \
-  org.apache.xpath.operations; version="2.7.1", \
-  org.apache.xpath.domapi; version="2.7.1", \
-  org.apache.html.dom; version="2.11.0", \
-  org.apache.wml.dom; version="2.11.0", \
-  org.apache.wml; version="2.11.0", \
-  org.apache.xerces.parsers; version="2.11.0", \
-  org.apache.xerces.impl.dtd.models; version="2.11.0", \
-  org.apache.xerces.xni.parser; version="2.11.0", \
-  org.apache.xerces.impl.dv.xs; version="2.11.0", \
-  org.apache.xerces.impl.xs.traversers; version="2.11.0", \
-  org.apache.xerces.util; version="2.11.0", \
-  org.apache.xerces.impl.dtd; version="2.11.0", \
-  org.apache.xerces.jaxp.validation; version="2.11.0", \
-  org.apache.xerces.dom3.as; version="2.11.0", \
-  org.apache.xerces.impl.dv; version="2.11.0", \
-  org.apache.xerces.jaxp; version="2.11.0", \
-  org.apache.xerces.jaxp.datatype; version="2.11.0", \
-  org.apache.xerces.impl.xpath.regex; version="2.11.0", \
-  org.apache.xerces.xni; version="2.11.0", \
-  org.apache.xerces.impl.msg; version="2.11.0", \
-  org.apache.xerces.impl.dv.util; version="2.11.0", \
-  org.apache.xerces.impl.xs.util; version="2.11.0", \
-  org.apache.xerces.dom; version="2.11.0", \
-  org.apache.xerces.dom.events; version="2.11.0", \
-  org.apache.xerces.impl.xs.opti; version="2.11.0", \
-  org.apache.xerces.impl; version="2.11.0", \
-  org.apache.xerces.xs; version="2.11.0", \
-  org.apache.xerces.impl.io; version="2.11.0", \
-  org.apache.xerces.xpointer; version="2.11.0", \
-  org.apache.xerces.impl.dv.dtd; version="2.11.0", \
-  org.apache.xerces.xinclude; version="2.11.0", \
-  org.apache.xerces.impl.xpath; version="2.11.0", \
-  org.apache.xerces.xs.datatypes; version="2.11.0", \
-  org.apache.xerces.impl.xs.identity; version="2.11.0", \
-  org.apache.xerces.impl.xs.models; version="2.11.0", \
-  org.apache.xerces.xni.grammars; version="2.11.0", \
-  org.apache.xerces.impl.xs; version="2.11.0", \
-  org.apache.xerces.impl.validation; version="2.11.0", \
-  org.apache.xml.serialize; version="2.11.0"
\ No newline at end of file
+#karaf.systemBundlesStartLevel=50
+#
+#org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom
+#
+#org.osgi.framework.system.packages.extra = \
+#  org.apache.karaf.branding, \
+#  com.sun.org.apache.xalan.internal.xsltc.trax, \
+#  com.sun.org.apache.xerces.internal.dom, \
+#  com.sun.org.apache.xerces.internal.jaxp, \
+#  com.sun.org.apache.xerces.internal.xni, \
+#  com.sun.jndi.ldap, \
+#  org.apache.xalan.extensions; version="2.7.1", \
+#  org.apache.xalan.xsltc.compiler; version="2.7.1", \
+#  org.apache.xalan.xsltc.cmdline.getopt; version="2.7.1", \
+#  org.apache.xalan.xsltc.util; version="2.7.1", \
+#  org.apache.xalan.transformer; version="2.7.1", \
+#  org.apache.xalan.xsltc.trax; version="2.7.1", \
+#  org.apache.xalan.processor; version="2.7.1", \
+#  org.apache.xalan.lib; version="2.7.1", \
+#  org.apache.xalan.trace; version="2.7.1", \
+#  org.apache.xalan.xsltc.compiler.util; version="2.7.1", \
+#  org.apache.xalan.templates; version="2.7.1", \
+#  org.apache.xalan.xsltc; version="2.7.1", \
+#  org.apache.xalan.xsltc.runtime; version="2.7.1", \
+#  org.apache.xalan; version="2.7.1", \
+#  org.apache.xalan.xslt; version="2.7.1", \
+#  org.apache.xalan.lib.sql; version="2.7.1", \
+#  org.apache.xalan.xsltc.runtime.output; version="2.7.1", \
+#  org.apache.xalan.xsltc.dom; version="2.7.1", \
+#  org.apache.xalan.client; version="2.7.1", \
+#  org.apache.xalan.xsltc.cmdline; version="2.7.1", \
+#  org.apache.xalan.serialize; version="2.7.1", \
+#  org.apache.xalan.res; version="2.7.1", \
+#  org.apache.xml.dtm.ref; version="2.7.1", \
+#  org.apache.xml.dtm; version="2.7.1", \
+#  org.apache.xml.dtm.ref.sax2dtm; version="2.7.1", \
+#  org.apache.xml.dtm.ref.dom2dtm; version="2.7.1", \
+#  org.apache.xml.res; version="2.7.1", \
+#  org.apache.xml.serializer.dom3; version="2.7.1", \
+#  org.apache.xml.serializer; version="2.7.1", \
+#  org.apache.xml.serializer.utils; version="2.7.1", \
+#  org.apache.xml.utils.res; version="2.7.1", \
+#  org.apache.xml.utils; version="2.7.1", \
+#  org.apache.xpath.functions; version="2.7.1", \
+#  org.apache.xpath.jaxp; version="2.7.1", \
+#  org.apache.xpath.patterns; version="2.7.1", \
+#  org.apache.xpath.objects; version="2.7.1", \
+#  org.apache.xpath.res; version="2.7.1", \
+#  org.apache.xpath; version="2.7.1", \
+#  org.apache.xpath.axes; version="2.7.1", \
+#  org.apache.xpath.compiler; version="2.7.1", \
+#  org.apache.xpath.operations; version="2.7.1", \
+#  org.apache.xpath.domapi; version="2.7.1", \
+#  org.apache.html.dom; version="2.11.0", \
+#  org.apache.wml.dom; version="2.11.0", \
+#  org.apache.wml; version="2.11.0", \
+#  org.apache.xerces.parsers; version="2.11.0", \
+#  org.apache.xerces.impl.dtd.models; version="2.11.0", \
+#  org.apache.xerces.xni.parser; version="2.11.0", \
+#  org.apache.xerces.impl.dv.xs; version="2.11.0", \
+#  org.apache.xerces.impl.xs.traversers; version="2.11.0", \
+#  org.apache.xerces.util; version="2.11.0", \
+#  org.apache.xerces.impl.dtd; version="2.11.0", \
+#  org.apache.xerces.jaxp.validation; version="2.11.0", \
+#  org.apache.xerces.dom3.as; version="2.11.0", \
+#  org.apache.xerces.impl.dv; version="2.11.0", \
+#  org.apache.xerces.jaxp; version="2.11.0", \
+#  org.apache.xerces.jaxp.datatype; version="2.11.0", \
+#  org.apache.xerces.impl.xpath.regex; version="2.11.0", \
+#  org.apache.xerces.xni; version="2.11.0", \
+#  org.apache.xerces.impl.msg; version="2.11.0", \
+#  org.apache.xerces.impl.dv.util; version="2.11.0", \
+#  org.apache.xerces.impl.xs.util; version="2.11.0", \
+#  org.apache.xerces.dom; version="2.11.0", \
+#  org.apache.xerces.dom.events; version="2.11.0", \
+#  org.apache.xerces.impl.xs.opti; version="2.11.0", \
+#  org.apache.xerces.impl; version="2.11.0", \
+#  org.apache.xerces.xs; version="2.11.0", \
+#  org.apache.xerces.impl.io; version="2.11.0", \
+#  org.apache.xerces.xpointer; version="2.11.0", \
+#  org.apache.xerces.impl.dv.dtd; version="2.11.0", \
+#  org.apache.xerces.xinclude; version="2.11.0", \
+#  org.apache.xerces.impl.xpath; version="2.11.0", \
+#  org.apache.xerces.xs.datatypes; version="2.11.0", \
+#  org.apache.xerces.impl.xs.identity; version="2.11.0", \
+#  org.apache.xerces.impl.xs.models; version="2.11.0", \
+#  org.apache.xerces.xni.grammars; version="2.11.0", \
+#  org.apache.xerces.impl.xs; version="2.11.0", \
+#  org.apache.xerces.impl.validation; version="2.11.0", \
+#  org.apache.xml.serialize; version="2.11.0"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/itest/pom.xml b/karaf/itest/pom.xml
index 416d748..2055f44 100644
--- a/karaf/itest/pom.xml
+++ b/karaf/itest/pom.xml
@@ -145,8 +145,16 @@
             </exclusions>
         </dependency>
 
-    </dependencies>
+        <!-- project deps -->
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>apache-brooklyn</artifactId>
+            <version>${project.version}</version>
+            <type>zip</type>
+            <scope>test</scope>
+        </dependency>
 
+    </dependencies>
 
     <build>
         <plugins>
@@ -159,6 +167,22 @@
                     <target>${maven.compiler.target}</target>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+                <version>1.2</version>
+                <executions>
+                    <execution>
+                        <id>generate-depends-file</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>generate-depends-file</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
new file mode 100644
index 0000000..ea620ab
--- /dev/null
+++ b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+import static org.ops4j.pax.exam.MavenUtils.asInProject;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.apache.karaf.features.BootFinished;
+import org.apache.karaf.features.FeaturesService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Tests the apache-brooklyn karaf runtime assembly.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AssemblyTest {
+
+    @Inject
+    private BundleContext bc;
+
+    @Inject
+    protected FeaturesService featuresService;
+
+    /**
+     * To make sure the tests run only when the boot features are fully
+     * installed
+     */
+    @Inject
+    BootFinished bootFinished;
+
+    @Configuration
+    public static Option[] configuration() throws Exception {
+        return new Option[]{
+            karafDistributionConfiguration()
+            .frameworkUrl(brooklynKarafDist())
+            .unpackDirectory(new File("target/paxexam/unpack/"))
+            .useDeployFolder(false),
+            configureConsole().ignoreLocalConsole(),
+            logLevel(LogLevel.INFO),
+            keepRuntimeFolder(),
+            features(karafStandardFeaturesRepository(), "eventadmin")
+        };
+    }
+
+    private static MavenArtifactUrlReference brooklynKarafDist() {
+        return maven()
+                .groupId("org.apache.brooklyn")
+                .artifactId("apache-brooklyn")
+                .type("zip")
+                .version(asInProject());
+    }
+
+    private static MavenUrlReference karafStandardFeaturesRepository() {
+        return maven()
+                .groupId("org.apache.karaf.features")
+                .artifactId("standard")
+                .type("xml")
+                .classifier("features")
+                .version(asInProject());
+    }
+
+    @Test
+    public void shouldHaveBundleContext() {
+        assertThat(bc, is(notNullValue()));
+    }
+
+    @Test
+    public void checkEventFeature() throws Exception {
+        assertThat(featuresService.isInstalled(featuresService.getFeature("eventadmin")), is(true));
+    }
+
+    @Test
+    public void checkBrooklynCoreFeature() throws Exception {
+        featuresService.installFeature("brooklyn-core");
+        assertThat(featuresService.isInstalled(featuresService.getFeature("brooklyn-core")), is(true));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
----------------------------------------------------------------------
diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
deleted file mode 100644
index d7b4917..0000000
--- a/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
-import java.io.File;
-
-import javax.inject.Inject;
-
-import org.apache.karaf.features.BootFinished;
-import org.apache.karaf.features.FeaturesService;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.osgi.framework.BundleContext;
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class MyTest {
-
-	@Inject
-	private BundleContext bc;
-	
-
-	@Inject
-	protected FeaturesService featuresService;
-	
-	/**
-	 * To make sure the tests run only when the boot features are fully
-	 * installed
-	 */
-	@Inject
-	BootFinished bootFinished;
-
-	@Configuration
-	public static Option[] configuration() throws Exception {
-		return new Option[] {
-				karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
-						.type("zip").version("4.0.1"))
-						.unpackDirectory(new File("target/paxexam/unpack/"))
-						.useDeployFolder(false),
-				configureConsole().ignoreLocalConsole(),
-				logLevel(LogLevel.INFO),
-				keepRuntimeFolder(),
-				features(
-						maven().groupId("org.apache.karaf.features")
-								.artifactId("standard").type("xml")
-								.classifier("features").version("3.0.3"),
-						"eventadmin")
-				};
-	}
-
-	@Test
-	public void shouldHaveBundleContext() {
-		assertThat(bc, is(notNullValue()));
-	}
-	
-	@Test
-	public void checkEventFeature() throws Exception {
-		assertThat(featuresService.isInstalled(featuresService.getFeature("eventadmin")), is(true));
-	}
-
-}


[05/12] incubator-brooklyn git commit: [BROOKLYN-183] Move Apache Felix code into specific jar

Posted by ha...@apache.org.
[BROOKLYN-183] Move Apache Felix code into specific jar

Move code that manages the Apache Felix framework into
brooklyn-rt-felix, with support code in brooklyn-rt-osgi.
Don't import packages from brooklyn-rt-felix in brooklyn-core.

Also move the OSGi test resources into brooklyn-rt-osgi.


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

Branch: refs/heads/master
Commit: 04bb1f2d0a11e873e2de109a67d0cf1caf273b71
Parents: 636d696
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Wed Oct 14 03:11:56 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 core/pom.xml                                    |  36 ++-
 .../apache/brooklyn/core/BrooklynVersion.java   |   2 +-
 .../brooklyn/util/core/ResourceUtils.java       |  32 +--
 .../util/core/osgi/EmbeddedFelixFramework.java  | 247 ------------------
 .../brooklyn/util/core/osgi/ManifestHelper.java | 103 --------
 .../apache/brooklyn/util/core/osgi/Osgis.java   |  93 +------
 core/src/test/dependencies/osgi/README.md       |  33 ---
 .../src/test/dependencies/osgi/entities/pom.xml |  84 ------
 .../test/osgi/entities/SimpleApplication.java   |  28 --
 .../osgi/entities/SimpleApplicationImpl.java    |  27 --
 .../test/osgi/entities/SimpleEntity.java        |  28 --
 .../test/osgi/entities/SimpleEntityImpl.java    |  26 --
 .../test/osgi/entities/SimpleLocation.java      |  35 ---
 .../test/osgi/entities/SimplePolicy.java        |  36 ---
 .../apache/brooklyn/test/osgi/entities/icon.gif | Bin 43 -> 0 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |  82 ------
 .../test/osgi/entities/more/MoreEntity.java     |  37 ---
 .../test/osgi/entities/more/MoreEntityImpl.java |  43 ----
 .../test/osgi/entities/more/MoreLocation.java   |  24 --
 .../test/osgi/entities/more/MorePolicy.java     |  25 --
 .../test/osgi/entities/more/MoreTemplate.java   |  24 --
 .../osgi/more-entities-v2-evil-twin/pom.xml     |  88 -------
 .../test/osgi/entities/more/MoreEntity.java     |  37 ---
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ----
 .../dependencies/osgi/more-entities-v2/pom.xml  |  88 -------
 .../test/osgi/entities/more/MoreEntity.java     |  40 ---
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ----
 .../test/osgi/entities/more/MoreLocation.java   |  26 --
 .../test/osgi/entities/more/MorePolicy.java     |  29 ---
 .../test/osgi/entities/more/MoreTemplate.java   |  26 --
 .../brooklyn/core/BrooklynVersionTest.java      |   2 +-
 .../core/mgmt/osgi/OsgiStandaloneTest.java      |  33 +--
 .../core/mgmt/osgi/OsgiTestResources.java       |  74 ------
 .../mgmt/osgi/OsgiVersionMoreEntityTest.java    |   4 +-
 .../mgmt/persist/XmlMementoSerializerTest.java  |   2 +-
 .../core/osgi/EmbeddedFelixFrameworkTest.java   |  92 -------
 .../brooklyn/util/core/osgi/OsgiTestBase.java   |  56 ++++
 .../brooklyn/util/core/osgi/OsgisTest.java      |  41 ---
 core/src/test/resources/brooklyn/osgi/README.md |  25 --
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         | Bin 2055 -> 0 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |  26 --
 .../osgi/brooklyn-test-osgi-entities.jar        | Bin 14454 -> 0 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |  26 --
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  | Bin 14964 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |  26 --
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  | Bin 15622 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |  26 --
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 13922 -> 0 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |  26 --
 .../src/main/resources/etc/custom.properties    |   6 +
 pom.xml                                         |   4 +
 usage/camp/pom.xml                              |   7 +
 .../catalog/AbstractCatalogXmlTest.java         |   2 +-
 .../brooklyn/catalog/CatalogYamlEntityTest.java |   2 +-
 .../catalog/CatalogYamlTemplateTest.java        |   2 +-
 utils/rt-felix/pom.xml                          |  61 +++++
 .../rt/felix/EmbeddedFelixFramework.java        | 258 +++++++++++++++++++
 .../brooklyn/rt/felix/ManifestHelper.java       | 103 ++++++++
 .../rt/felix/EmbeddedFelixFrameworkTest.java    | 101 ++++++++
 utils/rt-osgi/pom.xml                           |  53 ++++
 .../apache/brooklyn/util/osgi/OsgiUtils.java    | 101 ++++++++
 .../brooklyn/util/osgi/VersionedName.java       |  76 ++++++
 .../brooklyn/util/osgi/OsgiTestResources.java   |  74 ++++++
 .../apache/brooklyn/util/osgi/OsgisTest.java    |  39 +++
 .../src/test/resources/brooklyn/osgi/README.md  |  25 ++
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         | Bin 0 -> 2055 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |  26 ++
 .../osgi/brooklyn-test-osgi-entities.jar        | Bin 0 -> 14454 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |  26 ++
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  | Bin 0 -> 14964 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |  26 ++
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  | Bin 0 -> 15622 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |  26 ++
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 0 -> 13922 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |  26 ++
 .../test/resources/dependencies/osgi/README.md  |  33 +++
 .../dependencies/osgi/entities/pom.xml          |  84 ++++++
 .../test/osgi/entities/SimpleApplication.java   |  28 ++
 .../osgi/entities/SimpleApplicationImpl.java    |  27 ++
 .../test/osgi/entities/SimpleEntity.java        |  28 ++
 .../test/osgi/entities/SimpleEntityImpl.java    |  26 ++
 .../test/osgi/entities/SimpleLocation.java      |  35 +++
 .../test/osgi/entities/SimplePolicy.java        |  36 +++
 .../apache/brooklyn/test/osgi/entities/icon.gif | Bin 0 -> 43 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |  82 ++++++
 .../test/osgi/entities/more/MoreEntity.java     |  37 +++
 .../test/osgi/entities/more/MoreEntityImpl.java |  43 ++++
 .../test/osgi/entities/more/MoreLocation.java   |  24 ++
 .../test/osgi/entities/more/MorePolicy.java     |  25 ++
 .../test/osgi/entities/more/MoreTemplate.java   |  24 ++
 .../osgi/more-entities-v2-evil-twin/pom.xml     |  88 +++++++
 .../test/osgi/entities/more/MoreEntity.java     |  37 +++
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ++++
 .../dependencies/osgi/more-entities-v2/pom.xml  |  88 +++++++
 .../test/osgi/entities/more/MoreEntity.java     |  40 +++
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ++++
 .../test/osgi/entities/more/MoreLocation.java   |  26 ++
 .../test/osgi/entities/more/MorePolicy.java     |  29 +++
 .../test/osgi/entities/more/MoreTemplate.java   |  26 ++
 99 files changed, 2104 insertions(+), 1828 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 222ccfd..f7f59c0 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -42,7 +42,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-    
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rt-felix</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
             <artifactId>brooklyn-api</artifactId>
@@ -98,11 +102,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.framework</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.reflections</groupId>
             <artifactId>reflections</artifactId>
             <exclusions>
@@ -212,6 +211,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rt-osgi</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
             <artifactId>brooklyn-utils-common</artifactId>
             <version>${project.version}</version>
             <classifier>tests</classifier>
@@ -248,6 +254,24 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <supportedProjectTypes>
+                        <supportedProjectType>jar</supportedProjectType>
+                    </supportedProjectTypes>
+                    <instructions>
+                        <Export-Package>brooklyn.*,org.apache.brooklyn.*</Export-Package>
+                        <Import-Package>
+                            !org.apache.brooklyn.rt.felix,
+                            *
+                        </Import-Package>
+                        <Implementation-SHA-1>${buildNumber}</Implementation-SHA-1>
+                        <Implementation-Branch>${scmBranch}</Implementation-Branch>
+                    </instructions>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
index 5da8cee..3e0a1a7 100644
--- a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
+++ b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
@@ -52,7 +52,7 @@ import org.apache.brooklyn.core.mgmt.classloading.OsgiBrooklynClassLoadingContex
 import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.osgi.ManifestHelper;
+import org.apache.brooklyn.rt.felix.ManifestHelper;
 import org.apache.brooklyn.util.core.osgi.Osgis;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.guava.Maybe;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/main/java/org/apache/brooklyn/util/core/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/ResourceUtils.java b/core/src/main/java/org/apache/brooklyn/util/core/ResourceUtils.java
index 26c143d..a53b8e4 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/ResourceUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/ResourceUtils.java
@@ -69,6 +69,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
+import org.apache.brooklyn.util.osgi.OsgiUtils;
 
 public class ResourceUtils {
     
@@ -559,36 +560,7 @@ public class ResourceUtils {
     }
 
     public static URL getContainerUrl(URL url, String resourceInThatDir) {
-        //Switching from manual parsing of jar: and file: URLs to java provided functionality.
-        //The old code was breaking on any Windows path and instead of fixing it, using
-        //the provided Java APIs seemed like the better option since they are already tested
-        //on multiple platforms.
-        boolean isJar = "jar".equals(url.getProtocol());
-        if(isJar) {
-            try {
-                //let java handle the parsing of jar URL, no network connection is established.
-                //Strips the jar protocol:
-                //  jar:file:/<path to jar>!<resourceInThatDir>
-                //  becomes
-                //  file:/<path to jar>
-                JarURLConnection connection = (JarURLConnection) url.openConnection();
-                url = connection.getJarFileURL();
-            } catch (IOException e) {
-                throw new IllegalStateException(e);
-            }
-        } else {
-            //Remove the trailing resouceInThatDir path from the URL, thus getting the parent folder.
-            String path = url.toString();
-            int i = path.indexOf(resourceInThatDir);
-            if (i==-1) throw new IllegalStateException("Resource path ("+resourceInThatDir+") not in url substring ("+url+")");
-            String parent = path.substring(0, i);
-            try {
-                url = new URL(parent);
-            } catch (MalformedURLException e) {
-                throw new IllegalStateException("Resource ("+resourceInThatDir+") found at invalid URL parent (" + parent + ")", e);
-            }
-        }
-        return url;
+        return OsgiUtils.getContainerUrl(url, resourceInThatDir);
     }
     
     /** @deprecated since 0.7.0 use {@link Streams#readFullyString(InputStream) */ @Deprecated

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
deleted file mode 100644
index 356fb20..0000000
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright 2015 The Apache Software Foundation.
- *
- * Licensed 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.util.core.osgi;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.Attributes;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-
-import org.apache.felix.framework.FrameworkFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.launch.Framework;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.ReferenceWithError;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
-
-import com.google.common.base.Stopwatch;
-import java.util.Set;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Functions for starting an Apache Felix OSGi framework inside a non-OSGi Brooklyn distro.
- * 
- * @author Ciprian Ciubotariu <ch...@gmx.net>
- */
-public class EmbeddedFelixFramework {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EmbeddedFelixFramework.class);
-
-    private static final String EXTENSION_PROTOCOL = "system";
-    private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
-    private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
-
-
-    // -------- creating
-
-    /*
-     * loading framework factory and starting framework based on:
-     * http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html
-     */
-
-    public static FrameworkFactory newFrameworkFactory() {
-        URL url = Osgis.class.getClassLoader().getResource(
-                "META-INF/services/org.osgi.framework.launch.FrameworkFactory");
-        if (url != null) {
-            try {
-                BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
-                try {
-                    for (String s = br.readLine(); s != null; s = br.readLine()) {
-                        s = s.trim();
-                        // load the first non-empty, non-commented line
-                        if ((s.length() > 0) && (s.charAt(0) != '#')) {
-                            return (FrameworkFactory) Class.forName(s).newInstance();
-                        }
-                    }
-                } finally {
-                    if (br != null) br.close();
-                }
-            } catch (Exception e) {
-                // class creation exceptions are not interesting to caller...
-                throw Exceptions.propagate(e);
-            }
-        }
-        throw new IllegalStateException("Could not find framework factory.");
-    }
-
-    public static Framework newFrameworkStarted(String felixCacheDir, boolean clean, Map<?,?> extraStartupConfig) {
-        Map<Object,Object> cfg = MutableMap.copyOf(extraStartupConfig);
-        if (clean) cfg.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit");
-        if (felixCacheDir!=null) cfg.put(Constants.FRAMEWORK_STORAGE, felixCacheDir);
-        cfg.put(Constants.FRAMEWORK_BSNVERSION, Constants.FRAMEWORK_BSNVERSION_MULTIPLE);
-        FrameworkFactory factory = newFrameworkFactory();
-
-        Stopwatch timer = Stopwatch.createStarted();
-        Framework framework = factory.newFramework(cfg);
-        try {
-            framework.init();
-            installBootBundles(framework);
-            framework.start();
-        } catch (Exception e) {
-            // framework bundle start exceptions are not interesting to caller...
-            throw Exceptions.propagate(e);
-        }
-        LOG.debug("System bundles are: "+SYSTEM_BUNDLES);
-        LOG.debug("OSGi framework started in " + Duration.of(timer));
-        return framework;
-    }
-
-    private static void installBootBundles(Framework framework) {
-        Stopwatch timer = Stopwatch.createStarted();
-        LOG.debug("Installing OSGi boot bundles from "+Osgis.class.getClassLoader()+"...");
-        Enumeration<URL> resources;
-        try {
-            resources = Osgis.class.getClassLoader().getResources(MANIFEST_PATH);
-        } catch (IOException e) {
-            throw Exceptions.propagate(e);
-        }
-        BundleContext bundleContext = framework.getBundleContext();
-        Map<String, Bundle> installedBundles = getInstalledBundlesById(bundleContext);
-        while(resources.hasMoreElements()) {
-            URL url = resources.nextElement();
-            ReferenceWithError<?> installResult = installExtensionBundle(bundleContext, url, installedBundles, Osgis.getVersionedId(framework));
-            if (installResult.hasError() && !installResult.masksErrorIfPresent()) {
-                // it's reported as a critical error, so warn here
-                LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError());
-            } else {
-                Object result = installResult.getWithoutError();
-                if (result instanceof Bundle) {
-                    String v = Osgis.getVersionedId( (Bundle)result );
-                    SYSTEM_BUNDLES.add(v);
-                    if (installResult.hasError()) {
-                        LOG.debug(installResult.getError().getMessage()+(result!=null ? " ("+result+"/"+v+")" : ""));
-                    } else {
-                        LOG.debug("Installed "+v+" from "+url);
-                    }
-                } else if (installResult.hasError()) {
-                    LOG.debug(installResult.getError().getMessage());
-                }
-            }
-        }
-        LOG.debug("Installed OSGi boot bundles in "+Time.makeTimeStringRounded(timer)+": "+Arrays.asList(framework.getBundleContext().getBundles()));
-    }
-
-    private static Map<String, Bundle> getInstalledBundlesById(BundleContext bundleContext) {
-        Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
-        Bundle[] bundles = bundleContext.getBundles();
-        for (Bundle b : bundles) {
-            installedBundles.put(Osgis.getVersionedId(b), b);
-        }
-        return installedBundles;
-    }
-
-    /** Wraps the bundle if successful or already installed, wraps TRUE if it's the system entry,
-     * wraps null if the bundle is already installed from somewhere else;
-     * in all these cases <i>masking</i> an explanatory error if already installed or it's the system entry.
-     * <p>
-     * Returns an instance wrapping null and <i>throwing</i> an error if the bundle could not be installed.
-     */
-    private static ReferenceWithError<?> installExtensionBundle(BundleContext bundleContext, URL manifestUrl, Map<String, Bundle> installedBundles, String frameworkVersionedId) {
-        //ignore http://felix.extensions:9/ system entry
-        if("felix.extensions".equals(manifestUrl.getHost()))
-            return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Skipping install of internal extension bundle from "+manifestUrl));
-
-        try {
-            Manifest manifest = readManifest(manifestUrl);
-            if (!isValidBundle(manifest))
-                return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Resource at "+manifestUrl+" is not an OSGi bundle: no valid manifest"));
-
-            String versionedId = Osgis.getVersionedId(manifest);
-            URL bundleUrl = ResourceUtils.getContainerUrl(manifestUrl, MANIFEST_PATH);
-
-            Bundle existingBundle = installedBundles.get(versionedId);
-            if (existingBundle != null) {
-                if (!bundleUrl.equals(existingBundle.getLocation()) &&
-                        //the framework bundle is always pre-installed, don't display duplicate info
-                        !versionedId.equals(frameworkVersionedId)) {
-                    return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Bundle "+versionedId+" (from manifest " + manifestUrl + ") is already installed, from " + existingBundle.getLocation()));
-                }
-                return ReferenceWithError.newInstanceMaskingError(existingBundle, new IllegalArgumentException("Bundle "+versionedId+" from manifest " + manifestUrl + " is already installed"));
-            }
-
-            byte[] jar = buildExtensionBundle(manifest);
-            LOG.debug("Installing boot bundle " + bundleUrl);
-            //mark the bundle as extension so we can detect it later using the "system:" protocol
-            //(since we cannot access BundleImpl.isExtension)
-            Bundle newBundle = bundleContext.installBundle(EXTENSION_PROTOCOL + ":" + bundleUrl.toString(), new ByteArrayInputStream(jar));
-            installedBundles.put(versionedId, newBundle);
-            return ReferenceWithError.newInstanceWithoutError(newBundle);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            return ReferenceWithError.newInstanceThrowingError(null,
-                new IllegalStateException("Problem installing extension bundle " + manifestUrl + ": "+e, e));
-        }
-    }
-
-    private static Manifest readManifest(URL manifestUrl) throws IOException {
-        Manifest manifest;
-        InputStream in = null;
-        try {
-            in = manifestUrl.openStream();
-            manifest = new Manifest(in);
-        } finally {
-            if (in != null) {
-                try {in.close();}
-                catch (Exception e) {};
-            }
-        }
-        return manifest;
-    }
-
-    private static byte[] buildExtensionBundle(Manifest manifest) throws IOException {
-        Attributes atts = manifest.getMainAttributes();
-
-        //the following properties are invalid in extension bundles
-        atts.remove(new Attributes.Name(Constants.IMPORT_PACKAGE));
-        atts.remove(new Attributes.Name(Constants.REQUIRE_BUNDLE));
-        atts.remove(new Attributes.Name(Constants.BUNDLE_NATIVECODE));
-        atts.remove(new Attributes.Name(Constants.DYNAMICIMPORT_PACKAGE));
-        atts.remove(new Attributes.Name(Constants.BUNDLE_ACTIVATOR));
-
-        //mark as extension bundle
-        atts.putValue(Constants.FRAGMENT_HOST, "system.bundle; extension:=framework");
-
-        //create the jar containing the manifest
-        ByteArrayOutputStream jar = new ByteArrayOutputStream();
-        JarOutputStream out = new JarOutputStream(jar, manifest);
-        out.close();
-        return jar.toByteArray();
-    }
-
-    private static boolean isValidBundle(Manifest manifest) {
-        Attributes atts = manifest.getMainAttributes();
-        return atts.containsKey(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
deleted file mode 100644
index ea528e9..0000000
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2015 The Apache Software Foundation.
- *
- * Licensed 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.util.core.osgi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-import java.util.jar.Manifest;
-import javax.annotation.Nullable;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.stream.Streams;
-import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Version;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
-
-/**
- * The class is not used, staying for future reference.
- * Remove after OSGi transition is completed.
- */
-public class ManifestHelper {
-    private static ManifestParser parse;
-    private Manifest manifest;
-    private String source;
-    private static final String WIRING_PACKAGE = PackageNamespace.PACKAGE_NAMESPACE;
-
-    public static ManifestHelper forManifestContents(String contents) throws IOException, BundleException {
-        ManifestHelper result = forManifest(Streams.newInputStreamWithContents(contents));
-        result.source = contents;
-        return result;
-    }
-
-    public static ManifestHelper forManifest(URL url) throws IOException, BundleException {
-        InputStream in = null;
-        try {
-            in = url.openStream();
-            return forManifest(in);
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-        }
-    }
-
-    public static ManifestHelper forManifest(InputStream in) throws IOException, BundleException {
-        return forManifest(new Manifest(in));
-    }
-
-    public static ManifestHelper forManifest(Manifest manifest) throws BundleException {
-        ManifestHelper result = new ManifestHelper();
-        result.manifest = manifest;
-        parse = new ManifestParser(null, null, null, new StringMap(manifest.getMainAttributes()));
-        return result;
-    }
-
-    public String getSymbolicName() {
-        return parse.getSymbolicName();
-    }
-
-    public Version getVersion() {
-        return parse.getBundleVersion();
-    }
-
-    public String getSymbolicNameVersion() {
-        return getSymbolicName() + ":" + getVersion();
-    }
-
-    public List<String> getExportedPackages() {
-        MutableList<String> result = MutableList.of();
-        for (BundleCapability c : parse.getCapabilities()) {
-            if (WIRING_PACKAGE.equals(c.getNamespace())) {
-                result.add((String) c.getAttributes().get(WIRING_PACKAGE));
-            }
-        }
-        return result;
-    }
-
-    @Nullable
-    public String getSource() {
-        return source;
-    }
-
-    public Manifest getManifest() {
-        return manifest;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/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 39bcc68..f3603d8 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
@@ -27,19 +27,18 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
-import java.util.jar.Attributes;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.framework.launch.Framework;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
+import org.apache.brooklyn.rt.felix.EmbeddedFelixFramework;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.core.ResourceUtils;
@@ -47,14 +46,15 @@ import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.guava.Maybe;
 import org.apache.brooklyn.util.net.Urls;
 import org.apache.brooklyn.util.os.Os;
+import org.apache.brooklyn.util.osgi.VersionedName;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Strings;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
+import org.apache.brooklyn.util.osgi.OsgiUtils;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
 
@@ -71,43 +71,6 @@ public class Osgis {
     private static final String EXTENSION_PROTOCOL = "system";
     private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
 
-    public static class VersionedName {
-        private final String symbolicName;
-        private final Version version;
-        public VersionedName(Bundle b) {
-            this.symbolicName = b.getSymbolicName();
-            this.version = b.getVersion();
-        }
-        public VersionedName(String symbolicName, Version version) {
-            this.symbolicName = symbolicName;
-            this.version = version;
-        }
-        @Override public String toString() {
-            return symbolicName + ":" + Strings.toString(version);
-        }
-        public boolean equals(String sn, String v) {
-            return symbolicName.equals(sn) && (version == null && v == null || version != null && version.toString().equals(v));
-        }
-        public boolean equals(String sn, Version v) {
-            return symbolicName.equals(sn) && (version == null && v == null || version != null && version.equals(v));
-        }
-        public String getSymbolicName() {
-            return symbolicName;
-        }
-        public Version getVersion() {
-            return version;
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(symbolicName, version);
-        }
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof VersionedName)) return false;
-            VersionedName o = (VersionedName) other;
-            return Objects.equal(symbolicName, o.symbolicName) && Objects.equal(version, o.version);
-        }
-    }
     
     public static class BundleFinder {
         protected final Framework framework;
@@ -135,7 +98,7 @@ public class Osgis {
             if (Strings.isBlank(symbolicNameOptionallyWithVersion))
                 return this;
             
-            Maybe<VersionedName> nv = parseOsgiIdentifier(symbolicNameOptionallyWithVersion);
+            Maybe<VersionedName> nv = OsgiUtils.parseOsgiIdentifier(symbolicNameOptionallyWithVersion);
             if (nv.isAbsent())
                 throw new IllegalArgumentException("Cannot parse symbolic-name:version string '"+symbolicNameOptionallyWithVersion+"'");
 
@@ -356,33 +319,16 @@ public class Osgis {
             final ServiceReference<?> ref = ctx.getServiceReference(Framework.class);
             ctx.ungetService(ref);
         } else {
-            // not running inside OSGi container
-            try {
-                if (framework!=null) {
-                    framework.stop();
-                    framework.waitForStop(0); // 0 means indefinite
-                }
-            } catch (BundleException | InterruptedException e) {
-                throw Exceptions.propagate(e);
-            }
+            EmbeddedFelixFramework.stopFramework(framework);
         }
     }
 
+
     /** Tells if Brooklyn is running in an OSGi environment or not. */
     public static boolean isBrooklynInsideFramework() {
         return FrameworkUtil.getBundle(Framework.class) != null;
     }
 
-    public static String getVersionedId(Bundle b) {
-        return b.getSymbolicName() + ":" + b.getVersion();
-    }
-
-    public static String getVersionedId(Manifest manifest) {
-        Attributes atts = manifest.getMainAttributes();
-        return atts.getValue(Constants.BUNDLE_SYMBOLICNAME) + ":" +
-            atts.getValue(Constants.BUNDLE_VERSION);
-    }
-
     /**
      * Installs a bundle from the given URL, doing a check if already installed, and
      * using the {@link ResourceUtils} loader for this project (brooklyn core)
@@ -452,9 +398,9 @@ public class Osgis {
         if (manifest == null) {
             throw new IllegalStateException("Missing manifest file in bundle or not a jar file.");
         }
-        String versionedId = getVersionedId(manifest);
+        String versionedId = OsgiUtils.getVersionedId(manifest);
         for (Bundle installedBundle : framework.getBundleContext().getBundles()) {
-            if (versionedId.equals(getVersionedId(installedBundle))) {
+            if (versionedId.equals(OsgiUtils.getVersionedId(installedBundle))) {
                 if (SYSTEM_BUNDLES.contains(versionedId)) {
                     LOG.debug("Already have system bundle "+versionedId+" from "+installedBundle+"/"+installedBundle.getLocation()+" when requested "+url+"; not installing");
                     // "System bundles" (ie things on the classpath) cannot be overridden
@@ -479,27 +425,4 @@ public class Osgis {
                 EXTENSION_PROTOCOL.equals(Urls.getProtocol(location));
     }
 
-    /** Takes a string which might be of the form "symbolic-name" or "symbolic-name:version" (or something else entirely)
-     * and returns a VersionedName. The versionedName.getVersion() will be null if if there was no version in the input
-     * (or returning {@link Maybe#absent()} if not valid, with a suitable error message). */
-    public static Maybe<VersionedName> parseOsgiIdentifier(String symbolicNameOptionalWithVersion) {
-        if (Strings.isBlank(symbolicNameOptionalWithVersion))
-            return Maybe.absent("OSGi identifier is blank");
-        
-        String[] parts = symbolicNameOptionalWithVersion.split(":");
-        if (parts.length>2)
-            return Maybe.absent("OSGi identifier has too many parts; max one ':' symbol");
-        
-        Version v = null;
-        if (parts.length == 2) {
-            try {
-                v = Version.parseVersion(parts[1]);
-            } catch (IllegalArgumentException e) {
-                return Maybe.absent("OSGi identifier has invalid version string ("+e.getMessage()+")");
-            }
-        }
-        
-        return Maybe.of(new VersionedName(parts[0], v));
-    }
-    
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/README.md
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/README.md b/core/src/test/dependencies/osgi/README.md
deleted file mode 100644
index bda2287..0000000
--- a/core/src/test/dependencies/osgi/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-This directory contains source code for OSGi bundle files 
-used for testing.
-
-Binaries are included under src/test/resources.  They are
-copied there when these projects are built, and the binaries
-are included in source control to speed up build times
-(as these projects do not change much).  These projects are
-NOT built as part of the normal brooklyn build.
-
-To rebuild all:
-
-    for x in *entities* ; do pushd $x ; mvn clean install ; popd ; done
-
-See OsgiTestResources.java for information on the bundles.
-
-----
-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.
-

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/pom.xml
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/pom.xml b/core/src/test/dependencies/osgi/entities/pom.xml
deleted file mode 100644
index 42fd5ab..0000000
--- a/core/src/test/dependencies/osgi/entities/pom.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
-    <artifactId>brooklyn-test-osgi-entities</artifactId>
-    <version>0.1.0</version>
-
-    <name>OSGi bundled test entities</name>
-
-    <description>
-        Simple entities for testing the OSGi functionality
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../../../../../parent/pom.xml</relativePath>
-    </parent>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-    </dependencies>
-    
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
-                    <finalName>brooklyn-test-osgi-entities</finalName>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.5.3</version>
-                <configuration>
-                    <instructions>
-                        <Bundle-Version>${project.version}</Bundle-Version>
-                        <Brooklyn-Feature-BuildId>${buildNumber}</Brooklyn-Feature-BuildId>
-                        <Brooklyn-Feature-BuildBranch>${scmBranch}</Brooklyn-Feature-BuildBranch>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
deleted file mode 100644
index dcfb495..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.core.entity.StartableApplication;
-
-@ImplementedBy(SimpleApplicationImpl.class)
-public interface SimpleApplication extends StartableApplication {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
deleted file mode 100644
index fe6f1a2..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-
-import org.apache.brooklyn.core.entity.AbstractApplication;
-import org.apache.brooklyn.core.entity.StartableApplication;
-
-public class SimpleApplicationImpl extends AbstractApplication implements StartableApplication, SimpleApplication {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
deleted file mode 100644
index 87cd944..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-
-@ImplementedBy(SimpleEntityImpl.class)
-public interface SimpleEntity extends Entity {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
deleted file mode 100644
index 2595c39..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-import org.apache.brooklyn.core.entity.AbstractEntity;
-
-
-public class SimpleEntityImpl extends AbstractEntity implements SimpleEntity {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
deleted file mode 100644
index 60749cf..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.location.AbstractLocation;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-public class SimpleLocation extends AbstractLocation {
-    @SetFromFlag("config1")
-    public static final ConfigKey<String> CONFIG1 = ConfigKeys.newStringConfigKey("config1");
-
-    @SetFromFlag("config2")
-    public static final ConfigKey<String> CONFIG2 = ConfigKeys.newStringConfigKey("config2");
-
-    @SetFromFlag("config3")
-    public static final ConfigKey<String> CONFIG3 = ConfigKeys.newStringConfigKey("config3");
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java b/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
deleted file mode 100644
index fdea821..0000000
--- a/core/src/test/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.test.osgi.entities;
-
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-
-public class SimplePolicy extends AbstractPolicy {
-    @SetFromFlag("config1")
-    public static final ConfigKey<String> CONFIG1 = ConfigKeys.newStringConfigKey("config1");
-
-    @SetFromFlag("config2")
-    public static final ConfigKey<String> CONFIG2 = ConfigKeys.newStringConfigKey("config2");
-
-    @SetFromFlag("config3")
-    public static final ConfigKey<String> CONFIG3 = ConfigKeys.newStringConfigKey("config3");
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif b/core/src/test/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif
deleted file mode 100644
index e565824..0000000
Binary files a/core/src/test/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/pom.xml
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/pom.xml b/core/src/test/dependencies/osgi/more-entities-v1/pom.xml
deleted file mode 100644
index 2bf4ff6..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
-    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
-    <version>0.1.0</version>
-
-    <name>OSGi bundled test entities</name>
-
-    <description>
-        Simple entities for testing the OSGi functionality
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../../../../../parent/pom.xml</relativePath>
-    </parent>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-    </dependencies>
-    
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
-                    <finalName>brooklyn-test-osgi-more-entities_${project.version}</finalName>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.5.3</version>
-                <configuration>
-                    <instructions>
-                        <Bundle-Version>${project.version}</Bundle-Version>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
deleted file mode 100644
index 4efd1e3..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.core.effector.Effectors;
-
-@ImplementedBy(MoreEntityImpl.class)
-public interface MoreEntity extends Entity {
-
-    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
-        .description("says HI to an uppercased name")
-        .parameter(String.class, "name")
-        .buildAbstract();
-
-    /** Makes a string saying hi to the given name, in uppercase, for testing. */
-    String sayHI(String name);
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
deleted file mode 100644
index c1eecd3..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
-
-    @Override
-    public void init() {
-        super.init();
-        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
-            @Override
-            public String call(ConfigBag parameters) {
-                return sayHI((String)parameters.getStringKey("name"));
-            }
-        });
-    }
-    
-    @Override
-    public String sayHI(String name) {
-        return "Hi "+name.toUpperCase()+" from V1";
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java b/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
deleted file mode 100644
index 943c53c..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.core.location.AbstractLocation;
-
-public class MoreLocation extends AbstractLocation {
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java b/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
deleted file mode 100644
index b72768b..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-
-public class MorePolicy extends AbstractPolicy {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java b/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
deleted file mode 100644
index c66ed32..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.core.entity.AbstractApplication;
-
-public class MoreTemplate extends AbstractApplication {
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml b/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
deleted file mode 100644
index ae70461..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId>
-    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
-    <version>0.2.0</version>
-
-    <name>OSGi bundled test entities</name>
-
-    <description>
-        Simple entities for testing the OSGi functionality
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../../../../../parent/pom.xml</relativePath>
-    </parent>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
-            <artifactId>brooklyn-test-osgi-entities</artifactId>
-            <version>0.1.0</version>
-        </dependency>
-    </dependencies>
-    
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
-                    <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.5.3</version>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-more-entities</Bundle-SymbolicName>
-                        <Bundle-Version>${project.version}</Bundle-Version>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
deleted file mode 100644
index f0ace90..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.core.effector.Effectors;
-
-@ImplementedBy(MoreEntityImpl.class)
-public interface MoreEntity extends Entity {
-
-    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
-        .description("says HO to an uppercased name")
-        .parameter(String.class, "name")
-        .buildAbstract();
-
-    /** Makes a string saying HO to the given name, in contrast to v1 and v2. */
-    String sayHI(String name);
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
deleted file mode 100644
index d2cfa08..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
-
-    /** Unlike v1, this declares an explicit dependency on SimplePolicy */
-    @Override
-    public void init() {
-        super.init();
-        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
-            @Override
-            public String call(ConfigBag parameters) {
-                return sayHI((String)parameters.getStringKey("name"));
-            }
-        });
-        addPolicy(PolicySpec.create(org.apache.brooklyn.test.osgi.entities.SimplePolicy.class));
-    }
-    
-    /** Returns HO instead of HI (like v2 non-evil twin) or Hi (like v1) */
-    public String sayHI(String name) {
-        return "HO "+name.toUpperCase()+" FROM V2 EVIL TWIN";
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/pom.xml
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/pom.xml b/core/src/test/dependencies/osgi/more-entities-v2/pom.xml
deleted file mode 100644
index ae70461..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-
-    <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId>
-    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
-    <version>0.2.0</version>
-
-    <name>OSGi bundled test entities</name>
-
-    <description>
-        Simple entities for testing the OSGi functionality
-    </description>
-
-    <parent>
-        <groupId>org.apache.brooklyn</groupId>
-        <artifactId>brooklyn-parent</artifactId>
-        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
-        <relativePath>../../../../../../parent/pom.xml</relativePath>
-    </parent>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-core</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-api</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-utils-common</artifactId>
-            <version>${brooklyn.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
-            <artifactId>brooklyn-test-osgi-entities</artifactId>
-            <version>0.1.0</version>
-        </dependency>
-    </dependencies>
-    
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
-                    <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.5.3</version>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-more-entities</Bundle-SymbolicName>
-                        <Bundle-Version>${project.version}</Bundle-Version>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
deleted file mode 100644
index 2124f86..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.effector.Effector;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.core.effector.Effectors;
-
-@Catalog(name="More Entity v2")
-@ImplementedBy(MoreEntityImpl.class)
-public interface MoreEntity extends Entity {
-
-    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
-        .description("says HI to an uppercased name")
-        .parameter(String.class, "name")
-        .buildAbstract();
-
-    /** Makes a string saying hi to the given name, in uppercase, for testing. 
-     * In contrast to v1, impl here returns HI not Hi. */
-    String sayHI(String name);
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
deleted file mode 100644
index 0aff562..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.core.effector.EffectorBody;
-import org.apache.brooklyn.core.entity.AbstractEntity;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
-
-    /** Unlike v1, this declares an explicit dependency on SimplePolicy */
-    @Override
-    public void init() {
-        super.init();
-        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
-            @Override
-            public String call(ConfigBag parameters) {
-                return sayHI((String)parameters.getStringKey("name"));
-            }
-        });
-        addPolicy(PolicySpec.create(org.apache.brooklyn.test.osgi.entities.SimplePolicy.class));
-    }
-    
-    /** Unlike v1, this returns "HI " rather than "Hi " */
-    public String sayHI(String name) {
-        return "HI "+name.toUpperCase()+" FROM V2";
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java b/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
deleted file mode 100644
index ed10541..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.core.location.AbstractLocation;
-
-@Catalog(name="More Location", description="Cataliog item OSGi test location")
-public class MoreLocation extends AbstractLocation {
-}



[03/12] incubator-brooklyn git commit: [BROOKLYN-183] Move Apache Felix code into specific jar

Posted by ha...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
new file mode 100644
index 0000000..e6dde72
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
@@ -0,0 +1,26 @@
+# 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.
+
+The file brooklyn-osgi-test-a_0.1.0.jar is an extremely simple OSGi bundle,
+used in brooklyn.management.osgi.OsgiStandaloneTest.
+
+The jar contains its source.
+
+Under Apache conventions, binary files are not part of the source
+release. If you are using the source release, you may add this file
+by copying it from the master repository, which is accessible on the
+web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
new file mode 100644
index 0000000..c76d03b
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
new file mode 100644
index 0000000..9cf43a4
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
@@ -0,0 +1,26 @@
+# 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.
+
+The file brooklyn-test-osgi-entities.jar is for testing a deployment of
+an OSGi bundle containing entities.
+
+The source is in core/src/test/dependencies/osgi/entities
+
+Under Apache conventions, binary files are not part of the source
+release. If you are using the source release, you may add this file
+by copying it from the master repository, which is accessible on the
+web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar
new file mode 100644
index 0000000..1101112
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
new file mode 100644
index 0000000..80067a4
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
@@ -0,0 +1,26 @@
+# 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.
+
+The file brooklyn-test-osgi-entities.jar is for testing a deployment of
+an OSGi bundle containing entities.
+
+The source is in core/src/test/dependencies/osgi/more-entities-v1
+
+Under Apache conventions, binary files are not part of the source
+release. If you are using the source release, you may add this file
+by copying it from the master repository, which is accessible on the
+web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
new file mode 100644
index 0000000..5587e25
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
new file mode 100644
index 0000000..3fb2d31
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
@@ -0,0 +1,26 @@
+# 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.
+
+The file brooklyn-test-osgi-entities.jar is for testing a deployment of
+an OSGi bundle containing entities.
+
+The source is in core/src/test/dependencies/osgi/more-entities-v2
+
+Under Apache conventions, binary files are not part of the source
+release. If you are using the source release, you may add this file
+by copying it from the master repository, which is accessible on the
+web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar
new file mode 100644
index 0000000..95d697b
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
new file mode 100644
index 0000000..1b9c2ab
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
@@ -0,0 +1,26 @@
+# 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.
+
+The file brooklyn-test-osgi-entities.jar is for testing a deployment of
+an OSGi bundle containing entities.
+
+The source is in core/src/test/dependencies/osgi/more-entities-v2-evil-twin
+
+Under Apache conventions, binary files are not part of the source
+release. If you are using the source release, you may add this file
+by copying it from the master repository, which is accessible on the
+web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/README.md
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/README.md b/utils/rt-osgi/src/test/resources/dependencies/osgi/README.md
new file mode 100644
index 0000000..bda2287
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/README.md
@@ -0,0 +1,33 @@
+This directory contains source code for OSGi bundle files 
+used for testing.
+
+Binaries are included under src/test/resources.  They are
+copied there when these projects are built, and the binaries
+are included in source control to speed up build times
+(as these projects do not change much).  These projects are
+NOT built as part of the normal brooklyn build.
+
+To rebuild all:
+
+    for x in *entities* ; do pushd $x ; mvn clean install ; popd ; done
+
+See OsgiTestResources.java for information on the bundles.
+
+----
+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.
+

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/pom.xml b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/pom.xml
new file mode 100644
index 0000000..42fd5ab
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
+    <artifactId>brooklyn-test-osgi-entities</artifactId>
+    <version>0.1.0</version>
+
+    <name>OSGi bundled test entities</name>
+
+    <description>
+        Simple entities for testing the OSGi functionality
+    </description>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
+        <relativePath>../../../../../../parent/pom.xml</relativePath>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-api</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
+                    <finalName>brooklyn-test-osgi-entities</finalName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>${project.version}</Bundle-Version>
+                        <Brooklyn-Feature-BuildId>${buildNumber}</Brooklyn-Feature-BuildId>
+                        <Brooklyn-Feature-BuildBranch>${scmBranch}</Brooklyn-Feature-BuildBranch>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
new file mode 100644
index 0000000..dcfb495
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplication.java
@@ -0,0 +1,28 @@
+/*
+ * 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.test.osgi.entities;
+
+
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.core.entity.StartableApplication;
+
+@ImplementedBy(SimpleApplicationImpl.class)
+public interface SimpleApplication extends StartableApplication {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
new file mode 100644
index 0000000..fe6f1a2
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleApplicationImpl.java
@@ -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.
+ */
+package org.apache.brooklyn.test.osgi.entities;
+
+
+import org.apache.brooklyn.core.entity.AbstractApplication;
+import org.apache.brooklyn.core.entity.StartableApplication;
+
+public class SimpleApplicationImpl extends AbstractApplication implements StartableApplication, SimpleApplication {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
new file mode 100644
index 0000000..87cd944
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntity.java
@@ -0,0 +1,28 @@
+/*
+ * 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.test.osgi.entities;
+
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.ImplementedBy;
+
+@ImplementedBy(SimpleEntityImpl.class)
+public interface SimpleEntity extends Entity {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
new file mode 100644
index 0000000..2595c39
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleEntityImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.test.osgi.entities;
+
+import org.apache.brooklyn.core.entity.AbstractEntity;
+
+
+public class SimpleEntityImpl extends AbstractEntity implements SimpleEntity {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
new file mode 100644
index 0000000..60749cf
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimpleLocation.java
@@ -0,0 +1,35 @@
+/*
+ * 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.test.osgi.entities;
+
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.location.AbstractLocation;
+import org.apache.brooklyn.util.core.flags.SetFromFlag;
+
+public class SimpleLocation extends AbstractLocation {
+    @SetFromFlag("config1")
+    public static final ConfigKey<String> CONFIG1 = ConfigKeys.newStringConfigKey("config1");
+
+    @SetFromFlag("config2")
+    public static final ConfigKey<String> CONFIG2 = ConfigKeys.newStringConfigKey("config2");
+
+    @SetFromFlag("config3")
+    public static final ConfigKey<String> CONFIG3 = ConfigKeys.newStringConfigKey("config3");
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
new file mode 100644
index 0000000..fdea821
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/java/org/apache/brooklyn/test/osgi/entities/SimplePolicy.java
@@ -0,0 +1,36 @@
+/*
+ * 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.test.osgi.entities;
+
+
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.core.flags.SetFromFlag;
+
+public class SimplePolicy extends AbstractPolicy {
+    @SetFromFlag("config1")
+    public static final ConfigKey<String> CONFIG1 = ConfigKeys.newStringConfigKey("config1");
+
+    @SetFromFlag("config2")
+    public static final ConfigKey<String> CONFIG2 = ConfigKeys.newStringConfigKey("config2");
+
+    @SetFromFlag("config3")
+    public static final ConfigKey<String> CONFIG3 = ConfigKeys.newStringConfigKey("config3");
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif
new file mode 100644
index 0000000..e565824
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/dependencies/osgi/entities/src/main/resources/org/apache/brooklyn/test/osgi/entities/icon.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/pom.xml b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/pom.xml
new file mode 100644
index 0000000..2bf4ff6
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
+    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
+    <version>0.1.0</version>
+
+    <name>OSGi bundled test entities</name>
+
+    <description>
+        Simple entities for testing the OSGi functionality
+    </description>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
+        <relativePath>../../../../../../parent/pom.xml</relativePath>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-api</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
+                    <finalName>brooklyn-test-osgi-more-entities_${project.version}</finalName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>${project.version}</Bundle-Version>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
new file mode 100644
index 0000000..4efd1e3
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
@@ -0,0 +1,37 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.core.effector.Effectors;
+
+@ImplementedBy(MoreEntityImpl.class)
+public interface MoreEntity extends Entity {
+
+    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
+        .description("says HI to an uppercased name")
+        .parameter(String.class, "name")
+        .buildAbstract();
+
+    /** Makes a string saying hi to the given name, in uppercase, for testing. */
+    String sayHI(String name);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
new file mode 100644
index 0000000..c1eecd3
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.core.effector.EffectorBody;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+
+public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
+
+    @Override
+    public void init() {
+        super.init();
+        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
+            @Override
+            public String call(ConfigBag parameters) {
+                return sayHI((String)parameters.getStringKey("name"));
+            }
+        });
+    }
+    
+    @Override
+    public String sayHI(String name) {
+        return "Hi "+name.toUpperCase()+" from V1";
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
new file mode 100644
index 0000000..943c53c
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
@@ -0,0 +1,24 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.core.location.AbstractLocation;
+
+public class MoreLocation extends AbstractLocation {
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
new file mode 100644
index 0000000..b72768b
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
@@ -0,0 +1,25 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+
+public class MorePolicy extends AbstractPolicy {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
new file mode 100644
index 0000000..c66ed32
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v1/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
@@ -0,0 +1,24 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.core.entity.AbstractApplication;
+
+public class MoreTemplate extends AbstractApplication {
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/pom.xml b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
new file mode 100644
index 0000000..ae70461
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId>
+    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
+    <version>0.2.0</version>
+
+    <name>OSGi bundled test entities</name>
+
+    <description>
+        Simple entities for testing the OSGi functionality
+    </description>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
+        <relativePath>../../../../../../parent/pom.xml</relativePath>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-api</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
+            <artifactId>brooklyn-test-osgi-entities</artifactId>
+            <version>0.1.0</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
+                    <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-more-entities</Bundle-SymbolicName>
+                        <Bundle-Version>${project.version}</Bundle-Version>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
new file mode 100644
index 0000000..f0ace90
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
@@ -0,0 +1,37 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.core.effector.Effectors;
+
+@ImplementedBy(MoreEntityImpl.class)
+public interface MoreEntity extends Entity {
+
+    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
+        .description("says HO to an uppercased name")
+        .parameter(String.class, "name")
+        .buildAbstract();
+
+    /** Makes a string saying HO to the given name, in contrast to v1 and v2. */
+    String sayHI(String name);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
new file mode 100644
index 0000000..d2cfa08
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2-evil-twin/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.core.effector.EffectorBody;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+
+public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
+
+    /** Unlike v1, this declares an explicit dependency on SimplePolicy */
+    @Override
+    public void init() {
+        super.init();
+        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
+            @Override
+            public String call(ConfigBag parameters) {
+                return sayHI((String)parameters.getStringKey("name"));
+            }
+        });
+        addPolicy(PolicySpec.create(org.apache.brooklyn.test.osgi.entities.SimplePolicy.class));
+    }
+    
+    /** Returns HO instead of HI (like v2 non-evil twin) or Hi (like v1) */
+    public String sayHI(String name) {
+        return "HO "+name.toUpperCase()+" FROM V2 EVIL TWIN";
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/pom.xml b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/pom.xml
new file mode 100644
index 0000000..ae70461
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId>
+    <artifactId>brooklyn-test-osgi-more-entities</artifactId>
+    <version>0.2.0</version>
+
+    <name>OSGi bundled test entities</name>
+
+    <description>
+        Simple entities for testing the OSGi functionality
+    </description>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version><!-- BROOKLYN_VERSION -->
+        <relativePath>../../../../../../parent/pom.xml</relativePath>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-core</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-api</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${brooklyn.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn.test.resources.osgi</groupId>
+            <artifactId>brooklyn-test-osgi-entities</artifactId>
+            <version>0.1.0</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory>
+                    <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-more-entities</Bundle-SymbolicName>
+                        <Bundle-Version>${project.version}</Bundle-Version>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
new file mode 100644
index 0000000..2124f86
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntity.java
@@ -0,0 +1,40 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.catalog.Catalog;
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.core.effector.Effectors;
+
+@Catalog(name="More Entity v2")
+@ImplementedBy(MoreEntityImpl.class)
+public interface MoreEntity extends Entity {
+
+    public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI")
+        .description("says HI to an uppercased name")
+        .parameter(String.class, "name")
+        .buildAbstract();
+
+    /** Makes a string saying hi to the given name, in uppercase, for testing. 
+     * In contrast to v1, impl here returns HI not Hi. */
+    String sayHI(String name);
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
new file mode 100644
index 0000000..0aff562
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreEntityImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.core.effector.EffectorBody;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+
+public class MoreEntityImpl extends AbstractEntity implements MoreEntity {
+
+    /** Unlike v1, this declares an explicit dependency on SimplePolicy */
+    @Override
+    public void init() {
+        super.init();
+        getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() {
+            @Override
+            public String call(ConfigBag parameters) {
+                return sayHI((String)parameters.getStringKey("name"));
+            }
+        });
+        addPolicy(PolicySpec.create(org.apache.brooklyn.test.osgi.entities.SimplePolicy.class));
+    }
+    
+    /** Unlike v1, this returns "HI " rather than "Hi " */
+    public String sayHI(String name) {
+        return "HI "+name.toUpperCase()+" FROM V2";
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
new file mode 100644
index 0000000..ed10541
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreLocation.java
@@ -0,0 +1,26 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.catalog.Catalog;
+import org.apache.brooklyn.core.location.AbstractLocation;
+
+@Catalog(name="More Location", description="Cataliog item OSGi test location")
+public class MoreLocation extends AbstractLocation {
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
new file mode 100644
index 0000000..7909d5b
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
@@ -0,0 +1,29 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.catalog.Catalog;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+
+@Catalog(name="More Policy", description="Cataliog item OSGi test policy")
+public class MorePolicy extends AbstractPolicy {
+    public String sayHI(String name) {
+        return "HI "+name.toUpperCase()+" FROM V2";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
new file mode 100644
index 0000000..9e0fc85
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
@@ -0,0 +1,26 @@
+/*
+ * 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.test.osgi.entities.more;
+
+import org.apache.brooklyn.api.catalog.Catalog;
+import org.apache.brooklyn.core.entity.AbstractApplication;
+
+@Catalog(name="More Template", description="Cataliog item OSGi test template")
+public class MoreTemplate extends AbstractApplication {
+}


[04/12] incubator-brooklyn git commit: [BROOKLYN-183] Move Apache Felix code into specific jar

Posted by ha...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java b/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
deleted file mode 100644
index 7909d5b..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MorePolicy.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.core.policy.AbstractPolicy;
-
-@Catalog(name="More Policy", description="Cataliog item OSGi test policy")
-public class MorePolicy extends AbstractPolicy {
-    public String sayHI(String name) {
-        return "HI "+name.toUpperCase()+" FROM V2";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
----------------------------------------------------------------------
diff --git a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java b/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
deleted file mode 100644
index 9e0fc85..0000000
--- a/core/src/test/dependencies/osgi/more-entities-v2/src/main/java/org/apache/brooklyn/test/osgi/entities/more/MoreTemplate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.test.osgi.entities.more;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.core.entity.AbstractApplication;
-
-@Catalog(name="More Template", description="Cataliog item OSGi test template")
-public class MoreTemplate extends AbstractApplication {
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/core/BrooklynVersionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/BrooklynVersionTest.java b/core/src/test/java/org/apache/brooklyn/core/BrooklynVersionTest.java
index 424e176..87121bf 100644
--- a/core/src/test/java/org/apache/brooklyn/core/BrooklynVersionTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/BrooklynVersionTest.java
@@ -29,7 +29,7 @@ import org.apache.brooklyn.core.catalog.internal.CatalogEntityItemDto;
 import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder;
 import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
 import org.apache.brooklyn.util.text.Strings;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
index 5fdcc3a..e48ff70 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
@@ -18,34 +18,29 @@
  */
 package org.apache.brooklyn.core.mgmt.osgi;
 
-import java.io.File;
-import java.io.IOException;
 
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
 import org.apache.brooklyn.util.core.ResourceUtils;
+import org.apache.brooklyn.util.core.osgi.OsgiTestBase;
 import org.apache.brooklyn.util.core.osgi.Osgis;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.maven.MavenArtifact;
 import org.apache.brooklyn.util.maven.MavenRetriever;
 import org.apache.brooklyn.util.net.Urls;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.commons.io.FileUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 /** 
  * Tests some assumptions about OSGi behaviour, in standalone mode (not part of brooklyn).
  * See {@link OsgiTestResources} for description of test resources.
  */
-public class OsgiStandaloneTest {
+public class OsgiStandaloneTest extends OsgiTestBase {
 
     private static final Logger log = LoggerFactory.getLogger(OsgiStandaloneTest.class);
 
@@ -57,28 +52,6 @@ public class OsgiStandaloneTest {
     public static final String BROOKLYN_TEST_OSGI_ENTITIES_NAME = "org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-entities";
     public static final String BROOKLYN_TEST_OSGI_ENTITIES_VERSION = "0.1.0";
 
-    protected Framework framework = null;
-    private File storageTempDir;
-
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() throws Exception {
-        storageTempDir = Os.newTempDir("osgi-standalone");
-        framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), true);
-    }
-
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws BundleException, IOException, InterruptedException {
-        tearDownOsgiFramework(framework, storageTempDir);
-    }
-
-    public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException {
-        Osgis.ungetFramework(framework);
-        framework = null;
-        if (storageTempDir!=null) {
-            FileUtils.deleteDirectory(storageTempDir);
-            storageTempDir = null;
-        }
-    }
 
     protected Bundle install(String url) throws BundleException {
         try {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiTestResources.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiTestResources.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiTestResources.java
deleted file mode 100644
index 3def0ed..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiTestResources.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.mgmt.osgi;
-
-/**
- * Many OSGi tests require OSGi bundles (of course). Test bundles have been collected here
- * for convenience and clarity. Available bundles (on the classpath, with source code
- * either embedded or in /src/dependencies) are described by the constants in this class.
- * <p>
- * Some of these bundles are also used in REST API tests, as that stretches catalog further
- * (using CAMP) and that is one area where OSGi is heavily used. 
- */
-public class OsgiTestResources {
-
-
-    /**
-     * brooklyn-osgi-test-a_0.1.0 -
-     * defines TestA which has a "times" method and a static multiplier field;
-     * we set the multiplier to determine when we are sharing versions and when not
-     */
-    public static final String BROOKLYN_OSGI_TEST_A_0_1_0_PATH = "/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar";
-
-    /**
-     * brooklyn-test-osgi-entities (v 0.1.0) -
-     * defines an entity and an application, to confirm it can be read and used by brooklyn
-     */
-    public static final String BROOKLYN_TEST_OSGI_ENTITIES_PATH = "/brooklyn/osgi/brooklyn-test-osgi-entities.jar";
-    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_APPLICATION = "org.apache.brooklyn.test.osgi.entities.SimpleApplication";
-    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY = "org.apache.brooklyn.test.osgi.entities.SimpleEntity";
-    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_POLICY = "org.apache.brooklyn.test.osgi.entities.SimplePolicy";
-
-    /**
-     * brooklyn-test-osgi-more-entities_0.1.0 -
-     * another bundle with a minimal sayHi effector, used to test versioning and dependencies
-     * (this one has no dependencies, but see also {@value #BROOKLYN_TEST_MORE_ENTITIES_V2_PATH})
-     */
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART = "brooklyn-test-osgi-more-entities";
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FULL = 
-        "org.apache.brooklyn.test.resources.osgi."+BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART;
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_V1_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_0.1.0.jar";
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY = "org.apache.brooklyn.test.osgi.entities.more.MoreEntity";
-    
-    /**
-     * brooklyn-test-osgi-more-entities_0.2.0 -
-     * similar to {@link #BROOKLYN_TEST_MORE_ENTITIES_V1_PATH} but saying "HI NAME" rather than "Hi NAME",
-     * and declaring an explicit dependency on SimplePolicy from {@link #BROOKLYN_TEST_OSGI_ENTITIES_PATH}
-     */
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_V2_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_0.2.0.jar";
-    
-    /**
-     * bundle with identical metadata (same symbolic name and version -- hence being an evil twin) 
-     * as {@link #BROOKLYN_TEST_MORE_ENTITIES_V2_PATH},
-     * but slightly different behaviour -- saying "HO NAME" -- in order to make sure we can differentiate two two
-     * at runtime.
-     */
-    public static final String BROOKLYN_TEST_MORE_ENTITIES_V2_EVIL_TWIN_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_evil-twin_0.2.0.jar";
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
index 9445b7c..b434aa1 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.brooklyn.core.mgmt.osgi;
 
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
@@ -59,6 +60,7 @@ import org.apache.brooklyn.util.os.Os;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
+import org.apache.brooklyn.util.core.osgi.OsgiTestBase;
 
 
 /** 
@@ -129,7 +131,7 @@ public class OsgiVersionMoreEntityTest {
 
             if (managementContext != null) Entities.destroyAll(managementContext);
         } finally {
-            OsgiStandaloneTest.tearDownOsgiFramework(framework, storageTempDir);
+            OsgiTestBase.tearDownOsgiFramework(framework, storageTempDir);
         }
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java
index 8f1a248..246e214 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java
@@ -48,7 +48,7 @@ import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract;
 import org.apache.brooklyn.core.catalog.internal.CatalogTestUtils;
 import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.location.SimulatedLocation;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.core.test.entity.TestApplication;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
deleted file mode 100644
index f48bbca..0000000
--- a/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2015 The Apache Software Foundation.
- *
- * Licensed 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.util.core.osgi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarInputStream;
-
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.apache.brooklyn.util.core.osgi.ManifestHelper;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.stream.Streams;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-/**
- *
- * @author Ciprian Ciubotariu <ch...@gmx.net>
- */
-public class EmbeddedFelixFrameworkTest {
-
-    private static final Logger log = LoggerFactory.getLogger(OsgiStandaloneTest.class);
-
-    public static final String BROOKLYN_TEST_OSGI_ENTITIES_PATH = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH;
-
-    protected Framework framework = null;
-    private File storageTempDir;
-
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() throws Exception {
-        storageTempDir = Os.newTempDir("osgi-standalone");
-        framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), false);
-    }
-
-    @AfterMethod(alwaysRun = true)
-    public void tearDown() throws BundleException, IOException, InterruptedException {
-        OsgiStandaloneTest.tearDownOsgiFramework(framework, storageTempDir);
-    }
-
-    @org.testng.annotations.Test
-    public void testReadAManifest() throws Exception {
-        Enumeration<URL> manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
-        log.info("Bundles and exported packages:");
-        MutableSet<String> allPackages = MutableSet.of();
-        while (manifests.hasMoreElements()) {
-            ManifestHelper mf = ManifestHelper.forManifestContents(Streams.readFullyString(manifests.nextElement().openStream()));
-            List<String> mfPackages = mf.getExportedPackages();
-            log.info("  " + mf.getSymbolicNameVersion() + ": " + mfPackages);
-            allPackages.addAll(mfPackages);
-        }
-        log.info("Total export package count: " + allPackages.size());
-        Assert.assertTrue(allPackages.size() > 20, "did not find enough packages"); // probably much larger
-        Assert.assertTrue(allPackages.contains(Osgis.class.getPackage().getName()));
-    }
-
-    @org.testng.annotations.Test
-    public void testReadKnownManifest() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        InputStream in = this.getClass().getResourceAsStream(BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        JarInputStream jarIn = new JarInputStream(in);
-        ManifestHelper helper = ManifestHelper.forManifest(jarIn.getManifest());
-        jarIn.close();
-        Assert.assertEquals(helper.getVersion().toString(), "0.1.0");
-        Assert.assertTrue(helper.getExportedPackages().contains("org.apache.brooklyn.test.osgi.entities"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java
new file mode 100644
index 0000000..db66c13
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.core.osgi;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.brooklyn.util.os.Os;
+import org.apache.commons.io.FileUtils;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ *
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class OsgiTestBase {
+
+    protected Framework framework = null;
+    private File storageTempDir;
+
+    @BeforeMethod(alwaysRun = true)
+    public void setUp() throws Exception {
+        storageTempDir = Os.newTempDir("osgi-standalone");
+        framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), true);
+    }
+
+    @AfterMethod(alwaysRun = true)
+    public void tearDown() throws BundleException, IOException, InterruptedException {
+        tearDownOsgiFramework(framework, storageTempDir);
+    }
+
+    public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException {
+        Osgis.ungetFramework(framework);
+        framework = null;
+        if (storageTempDir != null) {
+            FileUtils.deleteDirectory(storageTempDir);
+            storageTempDir = null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgisTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgisTest.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgisTest.java
deleted file mode 100644
index cac9f40..0000000
--- a/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgisTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.util.core.osgi;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import org.apache.brooklyn.util.core.osgi.Osgis;
-import org.apache.brooklyn.util.core.osgi.Osgis.VersionedName;
-import org.osgi.framework.Version;
-import org.testng.annotations.Test;
-
-public class OsgisTest {
-
-    @Test
-    public void testParseOsgiIdentifier() throws Exception {
-        assertEquals(Osgis.parseOsgiIdentifier("a.b").get(), new VersionedName("a.b", null));
-        assertEquals(Osgis.parseOsgiIdentifier("a.b:0.1.2").get(), new VersionedName("a.b", Version.parseVersion("0.1.2")));
-        assertEquals(Osgis.parseOsgiIdentifier("a.b:0.0.0.SNAPSHOT").get(), new VersionedName("a.b", Version.parseVersion("0.0.0.SNAPSHOT")));
-        assertFalse(Osgis.parseOsgiIdentifier("a.b:0.notanumber.2").isPresent()); // invalid version
-        assertFalse(Osgis.parseOsgiIdentifier("a.b:0.1.2:3.4.5").isPresent());    // too many colons
-        assertFalse(Osgis.parseOsgiIdentifier("a.b:0.0.0_SNAPSHOT").isPresent()); // invalid version
-        assertFalse(Osgis.parseOsgiIdentifier("").isPresent());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/README.md
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/README.md b/core/src/test/resources/brooklyn/osgi/README.md
deleted file mode 100644
index 1d78ddb..0000000
--- a/core/src/test/resources/brooklyn/osgi/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-This directory contains OSGi bundle files used for testing.
-
-Source code including pom.xml is contained in the bundles,
-or in /src/dependencies, or both.
-
-See OsgiTestResources.java for information on the bundles.
-
-----
-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.
-

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar b/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar
deleted file mode 100644
index b4c777c..0000000
Binary files a/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt b/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
deleted file mode 100644
index e6dde72..0000000
--- a/core/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-The file brooklyn-osgi-test-a_0.1.0.jar is an extremely simple OSGi bundle,
-used in brooklyn.management.osgi.OsgiStandaloneTest.
-
-The jar contains its source.
-
-Under Apache conventions, binary files are not part of the source
-release. If you are using the source release, you may add this file
-by copying it from the master repository, which is accessible on the
-web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar
deleted file mode 100644
index c76d03b..0000000
Binary files a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
deleted file mode 100644
index 9cf43a4..0000000
--- a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-entities.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-The file brooklyn-test-osgi-entities.jar is for testing a deployment of
-an OSGi bundle containing entities.
-
-The source is in core/src/test/dependencies/osgi/entities
-
-Under Apache conventions, binary files are not part of the source
-release. If you are using the source release, you may add this file
-by copying it from the master repository, which is accessible on the
-web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar
deleted file mode 100644
index 1101112..0000000
Binary files a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
deleted file mode 100644
index 80067a4..0000000
--- a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-The file brooklyn-test-osgi-entities.jar is for testing a deployment of
-an OSGi bundle containing entities.
-
-The source is in core/src/test/dependencies/osgi/more-entities-v1
-
-Under Apache conventions, binary files are not part of the source
-release. If you are using the source release, you may add this file
-by copying it from the master repository, which is accessible on the
-web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar
deleted file mode 100644
index 5587e25..0000000
Binary files a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
deleted file mode 100644
index 3fb2d31..0000000
--- a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-The file brooklyn-test-osgi-entities.jar is for testing a deployment of
-an OSGi bundle containing entities.
-
-The source is in core/src/test/dependencies/osgi/more-entities-v2
-
-Under Apache conventions, binary files are not part of the source
-release. If you are using the source release, you may add this file
-by copying it from the master repository, which is accessible on the
-web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar
deleted file mode 100644
index 95d697b..0000000
Binary files a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt b/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
deleted file mode 100644
index 1b9c2ab..0000000
--- a/core/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-The file brooklyn-test-osgi-entities.jar is for testing a deployment of
-an OSGi bundle containing entities.
-
-The source is in core/src/test/dependencies/osgi/more-entities-v2-evil-twin
-
-Under Apache conventions, binary files are not part of the source
-release. If you are using the source release, you may add this file
-by copying it from the master repository, which is accessible on the
-web at https://github.com/apache/incubator-brooklyn

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
index f2db8c2..7da5c63 100644
--- a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
+++ b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
@@ -22,6 +22,12 @@
 # All the values specified here will override the default value.
 #
 
+# Brooklyn used to bundle Apache Felix, so force felix
+karaf.framework=felix
+
+# brooklyn used 4.4.0 at the time of osgification, which differs from karaf's bundled felix version
+#karaf.framework.felix=mvn\:org.apache.felix/org.apache.felix.framework/${felix.framework.version}
+
 #karaf.systemBundlesStartLevel=50
 #
 #org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0461e7a..804b9e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -245,6 +245,10 @@
         <module>utils/jmx/jmxrmi-agent</module>
         <module>utils/test-support</module>
         <module>utils/rest-swagger</module>
+
+        <module>utils/rt-osgi</module>
+        <module>utils/rt-felix</module>
+
     </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/usage/camp/pom.xml
----------------------------------------------------------------------
diff --git a/usage/camp/pom.xml b/usage/camp/pom.xml
index 9173a58..35ceca2 100644
--- a/usage/camp/pom.xml
+++ b/usage/camp/pom.xml
@@ -127,6 +127,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rt-osgi</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
             <artifactId>brooklyn-software-base</artifactId>
             <version>${project.version}</version>
             <classifier>tests</classifier>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
index 8575202..7985bb8 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
@@ -22,7 +22,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.core.server.BrooklynServerConfig;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
index b62ba60..20d0a1d 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
@@ -32,7 +32,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.core.test.entity.TestEntityImpl;
 import org.apache.brooklyn.entity.stock.BasicEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
index 3bf299a..bc55be9 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
@@ -28,7 +28,7 @@ import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
 import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
 import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-felix/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-felix/pom.xml b/utils/rt-felix/pom.xml
new file mode 100644
index 0000000..147e1de
--- /dev/null
+++ b/utils/rt-felix/pom.xml
@@ -0,0 +1,61 @@
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <name>Brooklyn Felix Runtime</name>
+    <artifactId>brooklyn-rt-felix</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rt-osgi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-test-support</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-rt-osgi</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFramework.java
----------------------------------------------------------------------
diff --git a/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFramework.java b/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFramework.java
new file mode 100644
index 0000000..6d2bb5f
--- /dev/null
+++ b/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFramework.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.rt.felix;
+
+import com.google.common.base.Stopwatch;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.collections.MutableSet;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.exceptions.ReferenceWithError;
+import org.apache.brooklyn.util.osgi.OsgiUtils;
+import org.apache.brooklyn.util.time.Duration;
+import org.apache.brooklyn.util.time.Time;
+import org.apache.felix.framework.FrameworkFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Functions for starting an Apache Felix OSGi framework inside a non-OSGi Brooklyn distro.
+ * 
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class EmbeddedFelixFramework {
+
+    private static final Logger LOG = LoggerFactory.getLogger(EmbeddedFelixFramework.class);
+
+    private static final String EXTENSION_PROTOCOL = "system";
+    private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
+    private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
+
+
+    // -------- creating
+
+    /*
+     * loading framework factory and starting framework based on:
+     * http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html
+     */
+
+    public static FrameworkFactory newFrameworkFactory() {
+        URL url = EmbeddedFelixFramework.class.getClassLoader().getResource(
+                "META-INF/services/org.osgi.framework.launch.FrameworkFactory");
+        if (url != null) {
+            try {
+                BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+                try {
+                    for (String s = br.readLine(); s != null; s = br.readLine()) {
+                        s = s.trim();
+                        // load the first non-empty, non-commented line
+                        if ((s.length() > 0) && (s.charAt(0) != '#')) {
+                            return (FrameworkFactory) Class.forName(s).newInstance();
+                        }
+                    }
+                } finally {
+                    if (br != null) br.close();
+                }
+            } catch (Exception e) {
+                // class creation exceptions are not interesting to caller...
+                throw Exceptions.propagate(e);
+            }
+        }
+        throw new IllegalStateException("Could not find framework factory.");
+    }
+
+    public static Framework newFrameworkStarted(String felixCacheDir, boolean clean, Map<?,?> extraStartupConfig) {
+        Map<Object,Object> cfg = MutableMap.copyOf(extraStartupConfig);
+        if (clean) cfg.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit");
+        if (felixCacheDir!=null) cfg.put(Constants.FRAMEWORK_STORAGE, felixCacheDir);
+        cfg.put(Constants.FRAMEWORK_BSNVERSION, Constants.FRAMEWORK_BSNVERSION_MULTIPLE);
+        FrameworkFactory factory = newFrameworkFactory();
+
+        Stopwatch timer = Stopwatch.createStarted();
+        Framework framework = factory.newFramework(cfg);
+        try {
+            framework.init();
+            installBootBundles(framework);
+            framework.start();
+        } catch (Exception e) {
+            // framework bundle start exceptions are not interesting to caller...
+            throw Exceptions.propagate(e);
+        }
+        LOG.debug("System bundles are: "+SYSTEM_BUNDLES);
+        LOG.debug("OSGi framework started in " + Duration.of(timer));
+        return framework;
+    }
+
+        public static void stopFramework(Framework framework) throws RuntimeException {
+        try {
+            if (framework != null) {
+                framework.stop();
+                framework.waitForStop(0);
+            }
+        } catch (BundleException | InterruptedException e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+
+    /* --- helper functions */
+
+    private static void installBootBundles(Framework framework) {
+        Stopwatch timer = Stopwatch.createStarted();
+        LOG.debug("Installing OSGi boot bundles from "+EmbeddedFelixFramework.class.getClassLoader()+"...");
+        Enumeration<URL> resources;
+        try {
+            resources = EmbeddedFelixFramework.class.getClassLoader().getResources(MANIFEST_PATH);
+        } catch (IOException e) {
+            throw Exceptions.propagate(e);
+        }
+        BundleContext bundleContext = framework.getBundleContext();
+        Map<String, Bundle> installedBundles = getInstalledBundlesById(bundleContext);
+        while(resources.hasMoreElements()) {
+            URL url = resources.nextElement();
+            ReferenceWithError<?> installResult = installExtensionBundle(bundleContext, url, installedBundles, OsgiUtils.getVersionedId(framework));
+            if (installResult.hasError() && !installResult.masksErrorIfPresent()) {
+                // it's reported as a critical error, so warn here
+                LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError());
+            } else {
+                Object result = installResult.getWithoutError();
+                if (result instanceof Bundle) {
+                    String v = OsgiUtils.getVersionedId( (Bundle)result );
+                    SYSTEM_BUNDLES.add(v);
+                    if (installResult.hasError()) {
+                        LOG.debug(installResult.getError().getMessage()+(result!=null ? " ("+result+"/"+v+")" : ""));
+                    } else {
+                        LOG.debug("Installed "+v+" from "+url);
+                    }
+                } else if (installResult.hasError()) {
+                    LOG.debug(installResult.getError().getMessage());
+                }
+            }
+        }
+        LOG.debug("Installed OSGi boot bundles in "+Time.makeTimeStringRounded(timer)+": "+Arrays.asList(framework.getBundleContext().getBundles()));
+    }
+
+    private static Map<String, Bundle> getInstalledBundlesById(BundleContext bundleContext) {
+        Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
+        Bundle[] bundles = bundleContext.getBundles();
+        for (Bundle b : bundles) {
+            installedBundles.put(OsgiUtils.getVersionedId(b), b);
+        }
+        return installedBundles;
+    }
+
+    /** Wraps the bundle if successful or already installed, wraps TRUE if it's the system entry,
+     * wraps null if the bundle is already installed from somewhere else;
+     * in all these cases <i>masking</i> an explanatory error if already installed or it's the system entry.
+     * <p>
+     * Returns an instance wrapping null and <i>throwing</i> an error if the bundle could not be installed.
+     */
+    private static ReferenceWithError<?> installExtensionBundle(BundleContext bundleContext, URL manifestUrl, Map<String, Bundle> installedBundles, String frameworkVersionedId) {
+        //ignore http://felix.extensions:9/ system entry
+        if("felix.extensions".equals(manifestUrl.getHost()))
+            return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Skipping install of internal extension bundle from "+manifestUrl));
+
+        try {
+            Manifest manifest = readManifest(manifestUrl);
+            if (!isValidBundle(manifest))
+                return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Resource at "+manifestUrl+" is not an OSGi bundle: no valid manifest"));
+
+            String versionedId = OsgiUtils.getVersionedId(manifest);
+            URL bundleUrl = OsgiUtils.getContainerUrl(manifestUrl, MANIFEST_PATH);
+
+            Bundle existingBundle = installedBundles.get(versionedId);
+            if (existingBundle != null) {
+                if (!bundleUrl.equals(existingBundle.getLocation()) &&
+                        //the framework bundle is always pre-installed, don't display duplicate info
+                        !versionedId.equals(frameworkVersionedId)) {
+                    return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Bundle "+versionedId+" (from manifest " + manifestUrl + ") is already installed, from " + existingBundle.getLocation()));
+                }
+                return ReferenceWithError.newInstanceMaskingError(existingBundle, new IllegalArgumentException("Bundle "+versionedId+" from manifest " + manifestUrl + " is already installed"));
+            }
+
+            byte[] jar = buildExtensionBundle(manifest);
+            LOG.debug("Installing boot bundle " + bundleUrl);
+            //mark the bundle as extension so we can detect it later using the "system:" protocol
+            //(since we cannot access BundleImpl.isExtension)
+            Bundle newBundle = bundleContext.installBundle(EXTENSION_PROTOCOL + ":" + bundleUrl.toString(), new ByteArrayInputStream(jar));
+            installedBundles.put(versionedId, newBundle);
+            return ReferenceWithError.newInstanceWithoutError(newBundle);
+        } catch (Exception e) {
+            Exceptions.propagateIfFatal(e);
+            return ReferenceWithError.newInstanceThrowingError(null,
+                new IllegalStateException("Problem installing extension bundle " + manifestUrl + ": "+e, e));
+        }
+    }
+
+    private static Manifest readManifest(URL manifestUrl) throws IOException {
+        Manifest manifest;
+        InputStream in = null;
+        try {
+            in = manifestUrl.openStream();
+            manifest = new Manifest(in);
+        } finally {
+            if (in != null) {
+                try {in.close();}
+                catch (Exception e) {};
+            }
+        }
+        return manifest;
+    }
+
+    private static byte[] buildExtensionBundle(Manifest manifest) throws IOException {
+        Attributes atts = manifest.getMainAttributes();
+
+        //the following properties are invalid in extension bundles
+        atts.remove(new Attributes.Name(Constants.IMPORT_PACKAGE));
+        atts.remove(new Attributes.Name(Constants.REQUIRE_BUNDLE));
+        atts.remove(new Attributes.Name(Constants.BUNDLE_NATIVECODE));
+        atts.remove(new Attributes.Name(Constants.DYNAMICIMPORT_PACKAGE));
+        atts.remove(new Attributes.Name(Constants.BUNDLE_ACTIVATOR));
+
+        //mark as extension bundle
+        atts.putValue(Constants.FRAGMENT_HOST, "system.bundle; extension:=framework");
+
+        //create the jar containing the manifest
+        ByteArrayOutputStream jar = new ByteArrayOutputStream();
+        JarOutputStream out = new JarOutputStream(jar, manifest);
+        out.close();
+        return jar.toByteArray();
+    }
+
+    private static boolean isValidBundle(Manifest manifest) {
+        Attributes atts = manifest.getMainAttributes();
+        return atts.containsKey(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/ManifestHelper.java
----------------------------------------------------------------------
diff --git a/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/ManifestHelper.java b/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/ManifestHelper.java
new file mode 100644
index 0000000..164a96f
--- /dev/null
+++ b/utils/rt-felix/src/main/java/org/apache/brooklyn/rt/felix/ManifestHelper.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.rt.felix;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.jar.Manifest;
+import javax.annotation.Nullable;
+import org.apache.brooklyn.util.collections.MutableList;
+import org.apache.brooklyn.util.stream.Streams;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.framework.wiring.BundleCapability;
+
+/**
+ * The class is not used, staying for future reference.
+ * Remove after OSGi transition is completed.
+ */
+public class ManifestHelper {
+    private static ManifestParser parse;
+    private Manifest manifest;
+    private String source;
+    private static final String WIRING_PACKAGE = PackageNamespace.PACKAGE_NAMESPACE;
+
+    public static ManifestHelper forManifestContents(String contents) throws IOException, BundleException {
+        ManifestHelper result = forManifest(Streams.newInputStreamWithContents(contents));
+        result.source = contents;
+        return result;
+    }
+
+    public static ManifestHelper forManifest(URL url) throws IOException, BundleException {
+        InputStream in = null;
+        try {
+            in = url.openStream();
+            return forManifest(in);
+        } finally {
+            if (in != null) {
+                in.close();
+            }
+        }
+    }
+
+    public static ManifestHelper forManifest(InputStream in) throws IOException, BundleException {
+        return forManifest(new Manifest(in));
+    }
+
+    public static ManifestHelper forManifest(Manifest manifest) throws BundleException {
+        ManifestHelper result = new ManifestHelper();
+        result.manifest = manifest;
+        parse = new ManifestParser(null, null, null, new StringMap(manifest.getMainAttributes()));
+        return result;
+    }
+
+    public String getSymbolicName() {
+        return parse.getSymbolicName();
+    }
+
+    public Version getVersion() {
+        return parse.getBundleVersion();
+    }
+
+    public String getSymbolicNameVersion() {
+        return getSymbolicName() + ":" + getVersion();
+    }
+
+    public List<String> getExportedPackages() {
+        MutableList<String> result = MutableList.of();
+        for (BundleCapability c : parse.getCapabilities()) {
+            if (WIRING_PACKAGE.equals(c.getNamespace())) {
+                result.add((String) c.getAttributes().get(WIRING_PACKAGE));
+            }
+        }
+        return result;
+    }
+
+    @Nullable
+    public String getSource() {
+        return source;
+    }
+
+    public Manifest getManifest() {
+        return manifest;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java
----------------------------------------------------------------------
diff --git a/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java
new file mode 100644
index 0000000..c1730d0
--- /dev/null
+++ b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.rt.felix;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarInputStream;
+
+import org.apache.brooklyn.test.support.TestResourceUnavailableException;
+import org.apache.brooklyn.util.collections.MutableSet;
+import org.apache.brooklyn.util.os.Os;
+import org.apache.brooklyn.util.osgi.OsgiTestResources;
+import org.apache.brooklyn.util.stream.Streams;
+import org.apache.commons.io.FileUtils;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class EmbeddedFelixFrameworkTest {
+
+    private static final Logger log = LoggerFactory.getLogger(EmbeddedFelixFrameworkTest.class);
+
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_PATH = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH;
+
+    protected Framework framework = null;
+    private File storageTempDir;
+
+    @BeforeMethod(alwaysRun = true)
+    public void setUp() throws Exception {
+        storageTempDir = Os.newTempDir("osgi-standalone");
+        framework = EmbeddedFelixFramework.newFrameworkStarted(storageTempDir.getAbsolutePath(), true, null);
+    }
+
+    @AfterMethod(alwaysRun = true)
+    public void tearDown() throws BundleException, IOException, InterruptedException {
+        tearDownOsgiFramework(framework, storageTempDir);
+    }
+
+    public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException {
+        EmbeddedFelixFramework.stopFramework(framework);
+        framework = null;
+        if (storageTempDir != null) {
+            FileUtils.deleteDirectory(storageTempDir);
+            storageTempDir = null;
+        }
+    }
+
+    @Test
+    public void testReadAManifest() throws Exception {
+        Enumeration<URL> manifests = this.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
+        log.info("Bundles and exported packages:");
+        MutableSet<String> allPackages = MutableSet.of();
+        while (manifests.hasMoreElements()) {
+            ManifestHelper mf = ManifestHelper.forManifestContents(Streams.readFullyString(manifests.nextElement().openStream()));
+            List<String> mfPackages = mf.getExportedPackages();
+            log.info("  " + mf.getSymbolicNameVersion() + ": " + mfPackages);
+            allPackages.addAll(mfPackages);
+        }
+        log.info("Total export package count: " + allPackages.size());
+        Assert.assertTrue(allPackages.size() > 20, "did not find enough packages"); // probably much larger
+        Assert.assertTrue(allPackages.contains(EmbeddedFelixFramework.class.getPackage().getName()));
+    }
+
+    @Test
+    public void testReadKnownManifest() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+        InputStream in = this.getClass().getResourceAsStream(BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+        JarInputStream jarIn = new JarInputStream(in);
+        ManifestHelper helper = ManifestHelper.forManifest(jarIn.getManifest());
+        jarIn.close();
+        Assert.assertEquals(helper.getVersion().toString(), "0.1.0");
+        Assert.assertTrue(helper.getExportedPackages().contains("org.apache.brooklyn.test.osgi.entities"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/pom.xml b/utils/rt-osgi/pom.xml
new file mode 100644
index 0000000..2cac7f0
--- /dev/null
+++ b/utils/rt-osgi/pom.xml
@@ -0,0 +1,53 @@
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-parent</artifactId>
+        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <name>Brooklyn OSGi Utils</name>
+    <artifactId>brooklyn-rt-osgi</artifactId>
+    <packaging>jar</packaging>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.brooklyn</groupId>
+            <artifactId>brooklyn-utils-test-support</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/OsgiUtils.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/OsgiUtils.java b/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/OsgiUtils.java
new file mode 100644
index 0000000..4e28720
--- /dev/null
+++ b/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/OsgiUtils.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.osgi;
+
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * Simple OSGi utilities.
+ * 
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class OsgiUtils {
+
+    public static URL getContainerUrl(URL url, String resourceInThatDir) {
+        //Switching from manual parsing of jar: and file: URLs to java provided functionality.
+        //The old code was breaking on any Windows path and instead of fixing it, using
+        //the provided Java APIs seemed like the better option since they are already tested
+        //on multiple platforms.
+        boolean isJar = "jar".equals(url.getProtocol());
+        if(isJar) {
+            try {
+                //let java handle the parsing of jar URL, no network connection is established.
+                //Strips the jar protocol:
+                //  jar:file:/<path to jar>!<resourceInThatDir>
+                //  becomes
+                //  file:/<path to jar>
+                JarURLConnection connection = (JarURLConnection) url.openConnection();
+                url = connection.getJarFileURL();
+            } catch (IOException e) {
+                throw new IllegalStateException(e);
+            }
+        } else {
+            //Remove the trailing resouceInThatDir path from the URL, thus getting the parent folder.
+            String path = url.toString();
+            int i = path.indexOf(resourceInThatDir);
+            if (i==-1) throw new IllegalStateException("Resource path ("+resourceInThatDir+") not in url substring ("+url+")");
+            String parent = path.substring(0, i);
+            try {
+                url = new URL(parent);
+            } catch (MalformedURLException e) {
+                throw new IllegalStateException("Resource ("+resourceInThatDir+") found at invalid URL parent (" + parent + ")", e);
+            }
+        }
+        return url;
+    }
+
+    public static String getVersionedId(Manifest manifest) {
+        Attributes atts = manifest.getMainAttributes();
+        return atts.getValue(Constants.BUNDLE_SYMBOLICNAME) + ":" + atts.getValue(Constants.BUNDLE_VERSION);
+    }
+
+    public static String getVersionedId(Bundle b) {
+        return b.getSymbolicName() + ":" + b.getVersion();
+    }
+
+    /** Takes a string which might be of the form "symbolic-name" or "symbolic-name:version" (or something else entirely)
+     * and returns a VersionedName. The versionedName.getVersion() will be null if if there was no version in the input
+     * (or returning {@link Maybe#absent()} if not valid, with a suitable error message). */
+    public static Maybe<VersionedName> parseOsgiIdentifier(String symbolicNameOptionalWithVersion) {
+        if (Strings.isBlank(symbolicNameOptionalWithVersion)) {
+            return Maybe.absent("OSGi identifier is blank");
+        }
+        String[] parts = symbolicNameOptionalWithVersion.split(":");
+        if (parts.length > 2) {
+            return Maybe.absent("OSGi identifier has too many parts; max one ':' symbol");
+        }
+        Version v = null;
+        if (parts.length == 2) {
+            try {
+                v = Version.parseVersion(parts[1]);
+            } catch (IllegalArgumentException e) {
+                return Maybe.absent("OSGi identifier has invalid version string (" + e.getMessage() + ")");
+            }
+        }
+        return Maybe.of(new VersionedName(parts[0], v));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java b/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java
new file mode 100644
index 0000000..df36a80
--- /dev/null
+++ b/utils/rt-osgi/src/main/java/org/apache/brooklyn/util/osgi/VersionedName.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.osgi;
+
+import com.google.common.base.Objects;
+import org.apache.brooklyn.util.text.Strings;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * Versioned name of an OSGi bundle.
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class VersionedName {
+    private final String symbolicName;
+    private final Version version;
+
+    public VersionedName(Bundle b) {
+        this.symbolicName = b.getSymbolicName();
+        this.version = b.getVersion();
+    }
+
+    public VersionedName(String symbolicName, Version version) {
+        this.symbolicName = symbolicName;
+        this.version = version;
+    }
+
+    @Override
+    public String toString() {
+        return symbolicName + ":" + Strings.toString(version);
+    }
+
+    public boolean equals(String sn, String v) {
+        return symbolicName.equals(sn) && (version == null && v == null || version != null && version.toString().equals(v));
+    }
+
+    public boolean equals(String sn, Version v) {
+        return symbolicName.equals(sn) && (version == null && v == null || version != null && version.equals(v));
+    }
+
+    public String getSymbolicName() {
+        return symbolicName;
+    }
+
+    public Version getVersion() {
+        return version;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(symbolicName, version);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof VersionedName)) {
+            return false;
+        }
+        VersionedName o = (VersionedName) other;
+        return Objects.equal(symbolicName, o.symbolicName) && Objects.equal(version, o.version);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgiTestResources.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgiTestResources.java b/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgiTestResources.java
new file mode 100644
index 0000000..21827a0
--- /dev/null
+++ b/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgiTestResources.java
@@ -0,0 +1,74 @@
+/*
+ * 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.util.osgi;
+
+/**
+ * Many OSGi tests require OSGi bundles (of course). Test bundles have been collected here
+ * for convenience and clarity. Available bundles (on the classpath, with source code
+ * either embedded or in /src/dependencies) are described by the constants in this class.
+ * <p>
+ * Some of these bundles are also used in REST API tests, as that stretches catalog further
+ * (using CAMP) and that is one area where OSGi is heavily used. 
+ */
+public class OsgiTestResources {
+
+
+    /**
+     * brooklyn-osgi-test-a_0.1.0 -
+     * defines TestA which has a "times" method and a static multiplier field;
+     * we set the multiplier to determine when we are sharing versions and when not
+     */
+    public static final String BROOKLYN_OSGI_TEST_A_0_1_0_PATH = "/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar";
+
+    /**
+     * brooklyn-test-osgi-entities (v 0.1.0) -
+     * defines an entity and an application, to confirm it can be read and used by brooklyn
+     */
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_PATH = "/brooklyn/osgi/brooklyn-test-osgi-entities.jar";
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_APPLICATION = "org.apache.brooklyn.test.osgi.entities.SimpleApplication";
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY = "org.apache.brooklyn.test.osgi.entities.SimpleEntity";
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_POLICY = "org.apache.brooklyn.test.osgi.entities.SimplePolicy";
+
+    /**
+     * brooklyn-test-osgi-more-entities_0.1.0 -
+     * another bundle with a minimal sayHi effector, used to test versioning and dependencies
+     * (this one has no dependencies, but see also {@value #BROOKLYN_TEST_MORE_ENTITIES_V2_PATH})
+     */
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART = "brooklyn-test-osgi-more-entities";
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FULL = 
+        "org.apache.brooklyn.test.resources.osgi."+BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART;
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_V1_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_0.1.0.jar";
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY = "org.apache.brooklyn.test.osgi.entities.more.MoreEntity";
+    
+    /**
+     * brooklyn-test-osgi-more-entities_0.2.0 -
+     * similar to {@link #BROOKLYN_TEST_MORE_ENTITIES_V1_PATH} but saying "HI NAME" rather than "Hi NAME",
+     * and declaring an explicit dependency on SimplePolicy from {@link #BROOKLYN_TEST_OSGI_ENTITIES_PATH}
+     */
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_V2_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_0.2.0.jar";
+    
+    /**
+     * bundle with identical metadata (same symbolic name and version -- hence being an evil twin) 
+     * as {@link #BROOKLYN_TEST_MORE_ENTITIES_V2_PATH},
+     * but slightly different behaviour -- saying "HO NAME" -- in order to make sure we can differentiate two two
+     * at runtime.
+     */
+    public static final String BROOKLYN_TEST_MORE_ENTITIES_V2_EVIL_TWIN_PATH = "/brooklyn/osgi/" + BROOKLYN_TEST_MORE_ENTITIES_SYMBOLIC_NAME_FINAL_PART + "_evil-twin_0.2.0.jar";
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgisTest.java
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgisTest.java b/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgisTest.java
new file mode 100644
index 0000000..c86670a
--- /dev/null
+++ b/utils/rt-osgi/src/test/java/org/apache/brooklyn/util/osgi/OsgisTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.util.osgi;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import org.osgi.framework.Version;
+import org.testng.annotations.Test;
+
+public class OsgisTest {
+
+    @Test
+    public void testParseOsgiIdentifier() throws Exception {
+        assertEquals(OsgiUtils.parseOsgiIdentifier("a.b").get(), new VersionedName("a.b", null));
+        assertEquals(OsgiUtils.parseOsgiIdentifier("a.b:0.1.2").get(), new VersionedName("a.b", Version.parseVersion("0.1.2")));
+        assertEquals(OsgiUtils.parseOsgiIdentifier("a.b:0.0.0.SNAPSHOT").get(), new VersionedName("a.b", Version.parseVersion("0.0.0.SNAPSHOT")));
+        assertFalse(OsgiUtils.parseOsgiIdentifier("a.b:0.notanumber.2").isPresent()); // invalid version
+        assertFalse(OsgiUtils.parseOsgiIdentifier("a.b:0.1.2:3.4.5").isPresent());    // too many colons
+        assertFalse(OsgiUtils.parseOsgiIdentifier("a.b:0.0.0_SNAPSHOT").isPresent()); // invalid version
+        assertFalse(OsgiUtils.parseOsgiIdentifier("").isPresent());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/README.md
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/README.md b/utils/rt-osgi/src/test/resources/brooklyn/osgi/README.md
new file mode 100644
index 0000000..1d78ddb
--- /dev/null
+++ b/utils/rt-osgi/src/test/resources/brooklyn/osgi/README.md
@@ -0,0 +1,25 @@
+This directory contains OSGi bundle files used for testing.
+
+Source code including pom.xml is contained in the bundles,
+or in /src/dependencies, or both.
+
+See OsgiTestResources.java for information on the bundles.
+
+----
+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.
+

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/04bb1f2d/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar
----------------------------------------------------------------------
diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar
new file mode 100644
index 0000000..b4c777c
Binary files /dev/null and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar differ



[10/12] incubator-brooklyn git commit: [BROOKLYN-183] Allow use of OSGi framework provided by karaf

Posted by ha...@apache.org.
[BROOKLYN-183] Allow use of OSGi framework provided by karaf

Test if we are running inside an OSGi container and use container
services instead of relying on manifest resource on classpath.
Defer to previous implementation when not running inside a container.

Disable failing test on duplicate bundles, since the bundle installation
is subject to change during osgification; it will be handled by karaf.


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

Branch: refs/heads/master
Commit: 636d6965ffa6e2d99b3fc84ad9d97f550ed9c1f5
Parents: 3f4c2ac
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Mon Oct 12 18:05:58 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/core/BrooklynVersion.java   | 188 +++++++----
 .../brooklyn/core/mgmt/ha/OsgiManager.java      |  16 +-
 .../util/core/osgi/EmbeddedFelixFramework.java  | 247 +++++++++++++++
 .../brooklyn/util/core/osgi/ManifestHelper.java | 103 ++++++
 .../apache/brooklyn/util/core/osgi/Osgis.java   | 316 +++----------------
 .../core/mgmt/osgi/OsgiStandaloneTest.java      |  48 +--
 .../mgmt/osgi/OsgiVersionMoreEntityTest.java    |   2 +-
 .../core/osgi/EmbeddedFelixFrameworkTest.java   |  92 ++++++
 8 files changed, 624 insertions(+), 388 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
index f7580d9..5da8cee 100644
--- a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
+++ b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
@@ -41,16 +41,25 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Maps;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
 
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.core.mgmt.classloading.OsgiBrooklynClassLoadingContext;
+import org.apache.brooklyn.core.mgmt.ha.OsgiManager;
+import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 import org.apache.brooklyn.util.core.ResourceUtils;
+import org.apache.brooklyn.util.core.osgi.ManifestHelper;
 import org.apache.brooklyn.util.core.osgi.Osgis;
-import org.apache.brooklyn.util.core.osgi.Osgis.ManifestHelper;
 import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Strings;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
 
 /**
  * Wraps the version of Brooklyn.
@@ -84,7 +93,7 @@ public class BrooklynVersion {
         // we read the maven pom metadata and osgi metadata and make sure it's sensible
         // everything is put into a single map for now (good enough, but should be cleaned up)
         readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader());
-        readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), BROOKLYN_CORE_SYMBOLIC_NAME);
+        readPropertiesFromOsgiResource();
         // TODO there is also build-metadata.properties used in ServerResource /v1/server/version endpoint
         // see comments on that about folding it into this class instead
 
@@ -166,42 +175,50 @@ public class BrooklynVersion {
     }
 
     /**
-     * reads properties from brooklyn-core's manifest
+     * Reads main attributes properties from brooklyn-core's bundle manifest.
      */
-    private void readPropertiesFromOsgiResource(ClassLoader resourceLoader, String symbolicName) {
-        Enumeration<URL> paths;
-        try {
-            paths = BrooklynVersion.class.getClassLoader().getResources(MANIFEST_PATH);
-        } catch (IOException e) {
-            // shouldn't happen
-            throw Exceptions.propagate(e);
-        }
-        while (paths.hasMoreElements()) {
-            URL u = paths.nextElement();
-            InputStream us = null;
+    private void readPropertiesFromOsgiResource() {
+        if (Osgis.isBrooklynInsideFramework()) {
+            Dictionary<String, String> headers = FrameworkUtil.getBundle(BrooklynVersion.class).getHeaders();
+            for (Enumeration<String> keys = headers.keys(); keys.hasMoreElements();) {
+                String key = keys.nextElement();
+                versionProperties.put(key, headers.get(key));
+            }
+        } else {
+            Enumeration<URL> paths;
             try {
-                us = u.openStream();
-                ManifestHelper mh = Osgis.ManifestHelper.forManifest(us);
-                if (BROOKLYN_CORE_SYMBOLIC_NAME.equals(mh.getSymbolicName())) {
-                    Attributes attrs = mh.getManifest().getMainAttributes();
-                    for (Object key : attrs.keySet()) {
-                        // key is an Attribute.Name; toString converts to string
-                        versionProperties.put(key.toString(), attrs.getValue(key.toString()));
+                paths = BrooklynVersion.class.getClassLoader().getResources(MANIFEST_PATH);
+            } catch (IOException e) {
+                // shouldn't happen
+                throw Exceptions.propagate(e);
+            }
+            while (paths.hasMoreElements()) {
+                URL u = paths.nextElement();
+                InputStream us = null;
+                try {
+                    us = u.openStream();
+                    ManifestHelper mh = ManifestHelper.forManifest(us);
+                    if (BROOKLYN_CORE_SYMBOLIC_NAME.equals(mh.getSymbolicName())) {
+                        Attributes attrs = mh.getManifest().getMainAttributes();
+                        for (Object key : attrs.keySet()) {
+                            // key is an Attribute.Name; toString converts to string
+                            versionProperties.put(key.toString(), attrs.getValue(key.toString()));
+                        }
+                        return;
                     }
-                    return;
+                } catch (Exception e) {
+                    Exceptions.propagateIfFatal(e);
+                    log.warn("Error reading OSGi manifest from " + u + " when determining version properties: " + e, e);
+                } finally {
+                    Streams.closeQuietly(us);
                 }
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                log.warn("Error reading OSGi manifest from " + u + " when determining version properties: " + e, e);
-            } finally {
-                Streams.closeQuietly(us);
             }
-        }
-        if (isDevelopmentEnvironment()) {
-            // allowed for dev env
-            log.trace("No OSGi manifest available to determine version properties");
-        } else {
-            log.warn("No OSGi manifest available to determine version properties");
+            if (isDevelopmentEnvironment()) {
+                // allowed for dev env
+                log.trace("No OSGi manifest available to determine version properties");
+            } else {
+                log.warn("No OSGi manifest available to determine version properties");
+            }
         }
     }
 
@@ -271,33 +288,65 @@ public class BrooklynVersion {
      * @return An iterable containing all features found in the management context's classpath and catalogue.
      */
     public static Iterable<BrooklynFeature> getFeatures(ManagementContext mgmt) {
-        Iterable<URL> manifests = ResourceUtils.create(mgmt).getResources(MANIFEST_PATH);
+        if (Osgis.isBrooklynInsideFramework()) {
+            List<Bundle> bundles = Arrays.asList(
+                    FrameworkUtil.getBundle(BrooklynVersion.class)
+                            .getBundleContext()
+                            .getBundles()
+            );
+
+            Maybe<OsgiManager> osgi = ((ManagementContextInternal)mgmt).getOsgiManager();
+            for (CatalogItem<?, ?> catalogItem : mgmt.getCatalog().getCatalogItems()) {
+                if (osgi.isPresentAndNonNull()) {
+                    for (CatalogItem.CatalogBundle catalogBundle : catalogItem.getLibraries()) {
+                        Maybe<Bundle> osgiBundle = osgi.get().findBundle(catalogBundle);
+                        if (osgiBundle.isPresentAndNonNull()) {
+                            bundles.add(osgiBundle.get());
+                        }
+                    }
+                }
 
-        for (CatalogItem<?, ?> catalogItem : mgmt.getCatalog().getCatalogItems()) {
-            OsgiBrooklynClassLoadingContext osgiContext = new OsgiBrooklynClassLoadingContext(
-                    mgmt, catalogItem.getCatalogItemId(), catalogItem.getLibraries());
-            manifests = Iterables.concat(manifests, osgiContext.getResources(MANIFEST_PATH));
-        }
+            }
 
-        // Set over list in case a bundle is reported more than once (e.g. from classpath and from OSGi).
-        // Not sure of validity of this approach over just reporting duplicates.
-        ImmutableSet.Builder<BrooklynFeature> features = ImmutableSet.builder();
-        for (URL manifest : manifests) {
-            ManifestHelper mh = null;
-            try {
-                mh = Osgis.ManifestHelper.forManifest(manifest);
-            } catch (Exception e) {
-                Exceptions.propagateIfFatal(e);
-                log.debug("Error reading OSGi manifest from " + manifest + " when determining version properties: " + e, e);
+            // Set over list in case a bundle is reported more than once (e.g. from classpath and from OSGi).
+            // Not sure of validity of this approach over just reporting duplicates.
+            ImmutableSet.Builder<BrooklynFeature> features = ImmutableSet.builder();
+            for(Bundle bundle : bundles) {
+                Optional<BrooklynFeature> fs = BrooklynFeature.newFeature(bundle.getHeaders());
+                if (fs.isPresent()) {
+                    features.add(fs.get());
+                }
             }
-            if (mh == null) continue;
-            Attributes attrs = mh.getManifest().getMainAttributes();
-            Optional<BrooklynFeature> fs = BrooklynFeature.newFeature(attrs);
-            if (fs.isPresent()) {
-                features.add(fs.get());
+            return features.build();
+        } else {
+            Iterable<URL> manifests = ResourceUtils.create(mgmt).getResources(MANIFEST_PATH);
+
+            for (CatalogItem<?, ?> catalogItem : mgmt.getCatalog().getCatalogItems()) {
+                OsgiBrooklynClassLoadingContext osgiContext = new OsgiBrooklynClassLoadingContext(
+                        mgmt, catalogItem.getCatalogItemId(), catalogItem.getLibraries());
+                manifests = Iterables.concat(manifests, osgiContext.getResources(MANIFEST_PATH));
             }
+
+            // Set over list in case a bundle is reported more than once (e.g. from classpath and from OSGi).
+            // Not sure of validity of this approach over just reporting duplicates.
+            ImmutableSet.Builder<BrooklynFeature> features = ImmutableSet.builder();
+            for (URL manifest : manifests) {
+                ManifestHelper mh = null;
+                try {
+                    mh = ManifestHelper.forManifest(manifest);
+                } catch (Exception e) {
+                    Exceptions.propagateIfFatal(e);
+                    log.debug("Error reading OSGi manifest from " + manifest + " when determining version properties: " + e, e);
+                }
+                if (mh == null) continue;
+                Attributes attrs = mh.getManifest().getMainAttributes();
+                Optional<BrooklynFeature> fs = BrooklynFeature.newFeature(attrs);
+                if (fs.isPresent()) {
+                    features.add(fs.get());
+                }
+            }
+            return features.build();
         }
-        return features.build();
     }
 
     public static class BrooklynFeature {
@@ -315,15 +364,24 @@ public class BrooklynVersion {
             this.additionalData = ImmutableMap.copyOf(additionalData);
         }
 
+        private static Optional<BrooklynFeature> newFeature(Attributes attrs) {
+            // unfortunately Attributes is a Map<Object,Object>
+            Dictionary<String,String> headers = new Hashtable<>();
+            for (Map.Entry<Object, Object> entry : attrs.entrySet()) {
+                headers.put(entry.getKey().toString(), entry.getValue().toString());
+            }
+            return newFeature(headers);
+        }
+
         /** @return Present if any attribute name begins with {@link #BROOKLYN_FEATURE_PREFIX}, absent otherwise. */
-        private static Optional<BrooklynFeature> newFeature(Attributes attributes) {
+        private static Optional<BrooklynFeature> newFeature(Dictionary<String,String> headers) {
             Map<String, String> additionalData = Maps.newHashMap();
-            for (Object key : attributes.keySet()) {
-                if (key instanceof Attributes.Name && key.toString().startsWith(BROOKLYN_FEATURE_PREFIX)) {
-                    Attributes.Name name = Attributes.Name.class.cast(key);
-                    String value = attributes.getValue(name);
+            for (Enumeration<String> keys = headers.keys(); keys.hasMoreElements();) {
+                String key = keys.nextElement();
+                if (key.startsWith(BROOKLYN_FEATURE_PREFIX)) {
+                    String value = headers.get(key);
                     if (!Strings.isBlank(value)) {
-                        additionalData.put(name.toString(), value);
+                        additionalData.put(key, value);
                     }
                 }
             }
@@ -335,13 +393,13 @@ public class BrooklynVersion {
             String nameKey = BROOKLYN_FEATURE_PREFIX + "Name";
             String name = Optional.fromNullable(additionalData.remove(nameKey))
                     .or(Optional.fromNullable(Constants.BUNDLE_NAME))
-                    .or(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME));
+                    .or(headers.get(Constants.BUNDLE_SYMBOLICNAME));
 
             return Optional.of(new BrooklynFeature(
                     name,
-                    attributes.getValue(Constants.BUNDLE_SYMBOLICNAME),
-                    attributes.getValue(Constants.BUNDLE_VERSION),
-                    attributes.getValue("Bnd-LastModified"),
+                    headers.get(Constants.BUNDLE_SYMBOLICNAME),
+                    headers.get(Constants.BUNDLE_VERSION),
+                    headers.get("Bnd-LastModified"),
                     additionalData));
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
index c85c3ba..2afb17c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiManager.java
@@ -30,7 +30,6 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
 import org.osgi.framework.launch.Framework;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,7 +51,6 @@ import org.apache.brooklyn.util.repeat.Repeater;
 import org.apache.brooklyn.util.text.Strings;
 import org.apache.brooklyn.util.time.Duration;
 
-import com.google.common.base.Throwables;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 
@@ -77,24 +75,14 @@ public class OsgiManager {
             osgiCacheDir = BrooklynServerPaths.getOsgiCacheDirCleanedIfNeeded(mgmt);
             
             // any extra OSGi startup args could go here
-            framework = Osgis.newFrameworkStarted(osgiCacheDir.getAbsolutePath(), false, MutableMap.of());
-            
+            framework = Osgis.getFramework(osgiCacheDir.getAbsolutePath(), false);
         } catch (Exception e) {
             throw Exceptions.propagate(e);
         }
     }
 
     public void stop() {
-        try {
-            if (framework!=null) {
-                framework.stop();
-                framework.waitForStop(0); // 0 means indefinite
-            }
-        } catch (BundleException e) {
-            throw Exceptions.propagate(e);
-        } catch (InterruptedException e) {
-            throw Exceptions.propagate(e);
-        }
+        Osgis.ungetFramework(framework);
         if (BrooklynServerPaths.isOsgiCacheForCleaning(mgmt, osgiCacheDir)) {
             // See exception reported in https://issues.apache.org/jira/browse/BROOKLYN-72
             // We almost always fail to delete he OSGi temp directory due to a concurrent modification.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
new file mode 100644
index 0000000..356fb20
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFramework.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.core.osgi;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+
+import org.apache.felix.framework.FrameworkFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.core.ResourceUtils;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.exceptions.ReferenceWithError;
+import org.apache.brooklyn.util.time.Duration;
+import org.apache.brooklyn.util.time.Time;
+
+import com.google.common.base.Stopwatch;
+import java.util.Set;
+import org.apache.brooklyn.util.collections.MutableSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Functions for starting an Apache Felix OSGi framework inside a non-OSGi Brooklyn distro.
+ * 
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class EmbeddedFelixFramework {
+
+    private static final Logger LOG = LoggerFactory.getLogger(EmbeddedFelixFramework.class);
+
+    private static final String EXTENSION_PROTOCOL = "system";
+    private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
+    private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
+
+
+    // -------- creating
+
+    /*
+     * loading framework factory and starting framework based on:
+     * http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html
+     */
+
+    public static FrameworkFactory newFrameworkFactory() {
+        URL url = Osgis.class.getClassLoader().getResource(
+                "META-INF/services/org.osgi.framework.launch.FrameworkFactory");
+        if (url != null) {
+            try {
+                BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+                try {
+                    for (String s = br.readLine(); s != null; s = br.readLine()) {
+                        s = s.trim();
+                        // load the first non-empty, non-commented line
+                        if ((s.length() > 0) && (s.charAt(0) != '#')) {
+                            return (FrameworkFactory) Class.forName(s).newInstance();
+                        }
+                    }
+                } finally {
+                    if (br != null) br.close();
+                }
+            } catch (Exception e) {
+                // class creation exceptions are not interesting to caller...
+                throw Exceptions.propagate(e);
+            }
+        }
+        throw new IllegalStateException("Could not find framework factory.");
+    }
+
+    public static Framework newFrameworkStarted(String felixCacheDir, boolean clean, Map<?,?> extraStartupConfig) {
+        Map<Object,Object> cfg = MutableMap.copyOf(extraStartupConfig);
+        if (clean) cfg.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit");
+        if (felixCacheDir!=null) cfg.put(Constants.FRAMEWORK_STORAGE, felixCacheDir);
+        cfg.put(Constants.FRAMEWORK_BSNVERSION, Constants.FRAMEWORK_BSNVERSION_MULTIPLE);
+        FrameworkFactory factory = newFrameworkFactory();
+
+        Stopwatch timer = Stopwatch.createStarted();
+        Framework framework = factory.newFramework(cfg);
+        try {
+            framework.init();
+            installBootBundles(framework);
+            framework.start();
+        } catch (Exception e) {
+            // framework bundle start exceptions are not interesting to caller...
+            throw Exceptions.propagate(e);
+        }
+        LOG.debug("System bundles are: "+SYSTEM_BUNDLES);
+        LOG.debug("OSGi framework started in " + Duration.of(timer));
+        return framework;
+    }
+
+    private static void installBootBundles(Framework framework) {
+        Stopwatch timer = Stopwatch.createStarted();
+        LOG.debug("Installing OSGi boot bundles from "+Osgis.class.getClassLoader()+"...");
+        Enumeration<URL> resources;
+        try {
+            resources = Osgis.class.getClassLoader().getResources(MANIFEST_PATH);
+        } catch (IOException e) {
+            throw Exceptions.propagate(e);
+        }
+        BundleContext bundleContext = framework.getBundleContext();
+        Map<String, Bundle> installedBundles = getInstalledBundlesById(bundleContext);
+        while(resources.hasMoreElements()) {
+            URL url = resources.nextElement();
+            ReferenceWithError<?> installResult = installExtensionBundle(bundleContext, url, installedBundles, Osgis.getVersionedId(framework));
+            if (installResult.hasError() && !installResult.masksErrorIfPresent()) {
+                // it's reported as a critical error, so warn here
+                LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError());
+            } else {
+                Object result = installResult.getWithoutError();
+                if (result instanceof Bundle) {
+                    String v = Osgis.getVersionedId( (Bundle)result );
+                    SYSTEM_BUNDLES.add(v);
+                    if (installResult.hasError()) {
+                        LOG.debug(installResult.getError().getMessage()+(result!=null ? " ("+result+"/"+v+")" : ""));
+                    } else {
+                        LOG.debug("Installed "+v+" from "+url);
+                    }
+                } else if (installResult.hasError()) {
+                    LOG.debug(installResult.getError().getMessage());
+                }
+            }
+        }
+        LOG.debug("Installed OSGi boot bundles in "+Time.makeTimeStringRounded(timer)+": "+Arrays.asList(framework.getBundleContext().getBundles()));
+    }
+
+    private static Map<String, Bundle> getInstalledBundlesById(BundleContext bundleContext) {
+        Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
+        Bundle[] bundles = bundleContext.getBundles();
+        for (Bundle b : bundles) {
+            installedBundles.put(Osgis.getVersionedId(b), b);
+        }
+        return installedBundles;
+    }
+
+    /** Wraps the bundle if successful or already installed, wraps TRUE if it's the system entry,
+     * wraps null if the bundle is already installed from somewhere else;
+     * in all these cases <i>masking</i> an explanatory error if already installed or it's the system entry.
+     * <p>
+     * Returns an instance wrapping null and <i>throwing</i> an error if the bundle could not be installed.
+     */
+    private static ReferenceWithError<?> installExtensionBundle(BundleContext bundleContext, URL manifestUrl, Map<String, Bundle> installedBundles, String frameworkVersionedId) {
+        //ignore http://felix.extensions:9/ system entry
+        if("felix.extensions".equals(manifestUrl.getHost()))
+            return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Skipping install of internal extension bundle from "+manifestUrl));
+
+        try {
+            Manifest manifest = readManifest(manifestUrl);
+            if (!isValidBundle(manifest))
+                return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Resource at "+manifestUrl+" is not an OSGi bundle: no valid manifest"));
+
+            String versionedId = Osgis.getVersionedId(manifest);
+            URL bundleUrl = ResourceUtils.getContainerUrl(manifestUrl, MANIFEST_PATH);
+
+            Bundle existingBundle = installedBundles.get(versionedId);
+            if (existingBundle != null) {
+                if (!bundleUrl.equals(existingBundle.getLocation()) &&
+                        //the framework bundle is always pre-installed, don't display duplicate info
+                        !versionedId.equals(frameworkVersionedId)) {
+                    return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Bundle "+versionedId+" (from manifest " + manifestUrl + ") is already installed, from " + existingBundle.getLocation()));
+                }
+                return ReferenceWithError.newInstanceMaskingError(existingBundle, new IllegalArgumentException("Bundle "+versionedId+" from manifest " + manifestUrl + " is already installed"));
+            }
+
+            byte[] jar = buildExtensionBundle(manifest);
+            LOG.debug("Installing boot bundle " + bundleUrl);
+            //mark the bundle as extension so we can detect it later using the "system:" protocol
+            //(since we cannot access BundleImpl.isExtension)
+            Bundle newBundle = bundleContext.installBundle(EXTENSION_PROTOCOL + ":" + bundleUrl.toString(), new ByteArrayInputStream(jar));
+            installedBundles.put(versionedId, newBundle);
+            return ReferenceWithError.newInstanceWithoutError(newBundle);
+        } catch (Exception e) {
+            Exceptions.propagateIfFatal(e);
+            return ReferenceWithError.newInstanceThrowingError(null,
+                new IllegalStateException("Problem installing extension bundle " + manifestUrl + ": "+e, e));
+        }
+    }
+
+    private static Manifest readManifest(URL manifestUrl) throws IOException {
+        Manifest manifest;
+        InputStream in = null;
+        try {
+            in = manifestUrl.openStream();
+            manifest = new Manifest(in);
+        } finally {
+            if (in != null) {
+                try {in.close();}
+                catch (Exception e) {};
+            }
+        }
+        return manifest;
+    }
+
+    private static byte[] buildExtensionBundle(Manifest manifest) throws IOException {
+        Attributes atts = manifest.getMainAttributes();
+
+        //the following properties are invalid in extension bundles
+        atts.remove(new Attributes.Name(Constants.IMPORT_PACKAGE));
+        atts.remove(new Attributes.Name(Constants.REQUIRE_BUNDLE));
+        atts.remove(new Attributes.Name(Constants.BUNDLE_NATIVECODE));
+        atts.remove(new Attributes.Name(Constants.DYNAMICIMPORT_PACKAGE));
+        atts.remove(new Attributes.Name(Constants.BUNDLE_ACTIVATOR));
+
+        //mark as extension bundle
+        atts.putValue(Constants.FRAGMENT_HOST, "system.bundle; extension:=framework");
+
+        //create the jar containing the manifest
+        ByteArrayOutputStream jar = new ByteArrayOutputStream();
+        JarOutputStream out = new JarOutputStream(jar, manifest);
+        out.close();
+        return jar.toByteArray();
+    }
+
+    private static boolean isValidBundle(Manifest manifest) {
+        Attributes atts = manifest.getMainAttributes();
+        return atts.containsKey(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
new file mode 100644
index 0000000..ea528e9
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/ManifestHelper.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.core.osgi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.jar.Manifest;
+import javax.annotation.Nullable;
+import org.apache.brooklyn.util.collections.MutableList;
+import org.apache.brooklyn.util.stream.Streams;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.framework.wiring.BundleCapability;
+
+/**
+ * The class is not used, staying for future reference.
+ * Remove after OSGi transition is completed.
+ */
+public class ManifestHelper {
+    private static ManifestParser parse;
+    private Manifest manifest;
+    private String source;
+    private static final String WIRING_PACKAGE = PackageNamespace.PACKAGE_NAMESPACE;
+
+    public static ManifestHelper forManifestContents(String contents) throws IOException, BundleException {
+        ManifestHelper result = forManifest(Streams.newInputStreamWithContents(contents));
+        result.source = contents;
+        return result;
+    }
+
+    public static ManifestHelper forManifest(URL url) throws IOException, BundleException {
+        InputStream in = null;
+        try {
+            in = url.openStream();
+            return forManifest(in);
+        } finally {
+            if (in != null) {
+                in.close();
+            }
+        }
+    }
+
+    public static ManifestHelper forManifest(InputStream in) throws IOException, BundleException {
+        return forManifest(new Manifest(in));
+    }
+
+    public static ManifestHelper forManifest(Manifest manifest) throws BundleException {
+        ManifestHelper result = new ManifestHelper();
+        result.manifest = manifest;
+        parse = new ManifestParser(null, null, null, new StringMap(manifest.getMainAttributes()));
+        return result;
+    }
+
+    public String getSymbolicName() {
+        return parse.getSymbolicName();
+    }
+
+    public Version getVersion() {
+        return parse.getBundleVersion();
+    }
+
+    public String getSymbolicNameVersion() {
+        return getSymbolicName() + ":" + getVersion();
+    }
+
+    public List<String> getExportedPackages() {
+        MutableList<String> result = MutableList.of();
+        for (BundleCapability c : parse.getCapabilities()) {
+            if (WIRING_PACKAGE.equals(c.getNamespace())) {
+                result.add((String) c.getAttributes().get(WIRING_PACKAGE));
+            }
+        }
+        return result;
+    }
+
+    @Nullable
+    public String getSource() {
+        return source;
+    }
+
+    public Manifest getManifest() {
+        return manifest;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/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 65e2640..39bcc68 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
@@ -18,66 +18,45 @@
  */
 package org.apache.brooklyn.util.core.osgi;
 
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.jar.Attributes;
 import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
-import javax.annotation.Nullable;
-
-import org.apache.felix.framework.FrameworkFactory;
-import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.framework.util.manifestparser.ManifestParser;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.framework.launch.Framework;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
 import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.osgi.Osgis;
 import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.exceptions.ReferenceWithError;
 import org.apache.brooklyn.util.guava.Maybe;
 import org.apache.brooklyn.util.net.Urls;
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.Joiner;
 import com.google.common.base.Objects;
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
-import com.google.common.base.Stopwatch;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
 
 /** 
  * utilities for working with osgi.
@@ -90,7 +69,6 @@ public class Osgis {
     private static final Logger LOG = LoggerFactory.getLogger(Osgis.class);
 
     private static final String EXTENSION_PROTOCOL = "system";
-    private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
     private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
 
     public static class VersionedName {
@@ -336,192 +314,70 @@ public class Osgis {
         return bundleFinder(framework).symbolicName(symbolicName).version(Predicates.equalTo(version)).findUnique();
     }
 
-    // -------- creating
-    
-    /*
-     * loading framework factory and starting framework based on:
-     * http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html
+    /** 
+     * Provides an OSGI framework.
+     *
+     * When running inside an OSGi container, the container framework is returned.
+     * When running standalone a new Apache Felix container is created.
+     * 
+     * Calling {@link #ungetFramework(Framework) } is needed in both cases, either to stop
+     * the embedded framework or to release the service reference.
+     *
+     * @param felixCacheDir
+     * @param clean
+     * @return
+     * @todo Use felixCacheDir ?
      */
-    
-    public static FrameworkFactory newFrameworkFactory() {
-        URL url = Osgis.class.getClassLoader().getResource(
-                "META-INF/services/org.osgi.framework.launch.FrameworkFactory");
-        if (url != null) {
-            try {
-                BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
-                try {
-                    for (String s = br.readLine(); s != null; s = br.readLine()) {
-                        s = s.trim();
-                        // load the first non-empty, non-commented line
-                        if ((s.length() > 0) && (s.charAt(0) != '#')) {
-                            return (FrameworkFactory) Class.forName(s).newInstance();
-                        }
-                    }
-                } finally {
-                    if (br != null) br.close();
-                }
-            } catch (Exception e) {
-                // class creation exceptions are not interesting to caller...
-                throw Exceptions.propagate(e);
-            }
-        }
-        throw new IllegalStateException("Could not find framework factory.");
-    }
-    
-    public static Framework newFrameworkStarted(String felixCacheDir, boolean clean, Map<?,?> extraStartupConfig) {
-        Map<Object,Object> cfg = MutableMap.copyOf(extraStartupConfig);
-        if (clean) cfg.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit");
-        if (felixCacheDir!=null) cfg.put(Constants.FRAMEWORK_STORAGE, felixCacheDir);
-        cfg.put(Constants.FRAMEWORK_BSNVERSION, Constants.FRAMEWORK_BSNVERSION_MULTIPLE);
-        FrameworkFactory factory = newFrameworkFactory();
-
-        Stopwatch timer = Stopwatch.createStarted();
-        Framework framework = factory.newFramework(cfg);
-        try {
-            framework.init();
-            installBootBundles(framework);
-            framework.start();
-        } catch (Exception e) {
-            // framework bundle start exceptions are not interesting to caller...
-            throw Exceptions.propagate(e);
-        }
-        LOG.debug("System bundles are: "+SYSTEM_BUNDLES);
-        LOG.debug("OSGi framework started in " + Duration.of(timer));
-        return framework;
-    }
-
-    private static void installBootBundles(Framework framework) {
-        Stopwatch timer = Stopwatch.createStarted();
-        LOG.debug("Installing OSGi boot bundles from "+Osgis.class.getClassLoader()+"...");
-        Enumeration<URL> resources;
-        try {
-            resources = Osgis.class.getClassLoader().getResources(MANIFEST_PATH);
-        } catch (IOException e) {
-            throw Exceptions.propagate(e);
+    public static Framework getFramework(String felixCacheDir, boolean clean) {
+        final Bundle frameworkBundle = FrameworkUtil.getBundle(Framework.class);
+        if (frameworkBundle != null) {
+            // already running inside an OSGi container
+            final BundleContext ctx = frameworkBundle.getBundleContext();
+            final ServiceReference<?> ref = ctx.getServiceReference(Framework.class);
+            return (Framework) ctx.getService(ref);
+        } else {
+            // not running inside OSGi container
+            return EmbeddedFelixFramework.newFrameworkStarted(felixCacheDir, clean, null);
         }
-        BundleContext bundleContext = framework.getBundleContext();
-        Map<String, Bundle> installedBundles = getInstalledBundlesById(bundleContext);
-        while(resources.hasMoreElements()) {
-            URL url = resources.nextElement();
-            ReferenceWithError<?> installResult = installExtensionBundle(bundleContext, url, installedBundles, getVersionedId(framework));
-            if (installResult.hasError() && !installResult.masksErrorIfPresent()) {
-                // it's reported as a critical error, so warn here
-                LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError());
-            } else {
-                Object result = installResult.getWithoutError();
-                if (result instanceof Bundle) {
-                    String v = getVersionedId( (Bundle)result );
-                    SYSTEM_BUNDLES.add(v);
-                    if (installResult.hasError()) {
-                        LOG.debug(installResult.getError().getMessage()+(result!=null ? " ("+result+"/"+v+")" : ""));
-                    } else {
-                        LOG.debug("Installed "+v+" from "+url);
-                    }
-                } else if (installResult.hasError()) {
-                    LOG.debug(installResult.getError().getMessage());
-                }
-            }
-        }
-        LOG.debug("Installed OSGi boot bundles in "+Time.makeTimeStringRounded(timer)+": "+Arrays.asList(framework.getBundleContext().getBundles()));
     }
 
-    private static Map<String, Bundle> getInstalledBundlesById(BundleContext bundleContext) {
-        Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
-        Bundle[] bundles = bundleContext.getBundles();
-        for (Bundle b : bundles) {
-            installedBundles.put(getVersionedId(b), b);
-        }
-        return installedBundles;
-    }
-
-    /** Wraps the bundle if successful or already installed, wraps TRUE if it's the system entry,
-     * wraps null if the bundle is already installed from somewhere else;
-     * in all these cases <i>masking</i> an explanatory error if already installed or it's the system entry.
-     * <p>
-     * Returns an instance wrapping null and <i>throwing</i> an error if the bundle could not be installed.
+    /**
+     * Stops/ungets the OSGi framework.
+     *
+     * See {@link #getFramework(java.lang.String, boolean)}
+     *
+     * @param framework
      */
-    private static ReferenceWithError<?> installExtensionBundle(BundleContext bundleContext, URL manifestUrl, Map<String, Bundle> installedBundles, String frameworkVersionedId) {
-        //ignore http://felix.extensions:9/ system entry
-        if("felix.extensions".equals(manifestUrl.getHost())) 
-            return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Skipping install of internal extension bundle from "+manifestUrl));
-
-        try {
-            Manifest manifest = readManifest(manifestUrl);
-            if (!isValidBundle(manifest)) 
-                return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Resource at "+manifestUrl+" is not an OSGi bundle: no valid manifest"));
-            
-            String versionedId = getVersionedId(manifest);
-            URL bundleUrl = ResourceUtils.getContainerUrl(manifestUrl, MANIFEST_PATH);
-
-            Bundle existingBundle = installedBundles.get(versionedId);
-            if (existingBundle != null) {
-                if (!bundleUrl.equals(existingBundle.getLocation()) &&
-                        //the framework bundle is always pre-installed, don't display duplicate info
-                        !versionedId.equals(frameworkVersionedId)) {
-                    return ReferenceWithError.newInstanceMaskingError(null, new IllegalArgumentException("Bundle "+versionedId+" (from manifest " + manifestUrl + ") is already installed, from " + existingBundle.getLocation()));
+    public static void ungetFramework(Framework framework) {
+        final Bundle frameworkBundle = FrameworkUtil.getBundle(Framework.class);
+        if (frameworkBundle != null) {
+            // already running inside an OSGi container
+            final BundleContext ctx = frameworkBundle.getBundleContext();
+            final ServiceReference<?> ref = ctx.getServiceReference(Framework.class);
+            ctx.ungetService(ref);
+        } else {
+            // not running inside OSGi container
+            try {
+                if (framework!=null) {
+                    framework.stop();
+                    framework.waitForStop(0); // 0 means indefinite
                 }
-                return ReferenceWithError.newInstanceMaskingError(existingBundle, new IllegalArgumentException("Bundle "+versionedId+" from manifest " + manifestUrl + " is already installed"));
+            } catch (BundleException | InterruptedException e) {
+                throw Exceptions.propagate(e);
             }
-            
-            byte[] jar = buildExtensionBundle(manifest);
-            LOG.debug("Installing boot bundle " + bundleUrl);
-            //mark the bundle as extension so we can detect it later using the "system:" protocol
-            //(since we cannot access BundleImpl.isExtension)
-            Bundle newBundle = bundleContext.installBundle(EXTENSION_PROTOCOL + ":" + bundleUrl.toString(), new ByteArrayInputStream(jar));
-            installedBundles.put(versionedId, newBundle);
-            return ReferenceWithError.newInstanceWithoutError(newBundle);
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            return ReferenceWithError.newInstanceThrowingError(null, 
-                new IllegalStateException("Problem installing extension bundle " + manifestUrl + ": "+e, e));
         }
     }
 
-    private static Manifest readManifest(URL manifestUrl) throws IOException {
-        Manifest manifest;
-        InputStream in = null;
-        try {
-            in = manifestUrl.openStream();
-            manifest = new Manifest(in);
-        } finally {
-            if (in != null) {
-                try {in.close();} 
-                catch (Exception e) {};
-            }
-        }
-        return manifest;
+    /** Tells if Brooklyn is running in an OSGi environment or not. */
+    public static boolean isBrooklynInsideFramework() {
+        return FrameworkUtil.getBundle(Framework.class) != null;
     }
 
-    private static byte[] buildExtensionBundle(Manifest manifest) throws IOException {
-        Attributes atts = manifest.getMainAttributes();
-
-        //the following properties are invalid in extension bundles
-        atts.remove(new Attributes.Name(Constants.IMPORT_PACKAGE));
-        atts.remove(new Attributes.Name(Constants.REQUIRE_BUNDLE));
-        atts.remove(new Attributes.Name(Constants.BUNDLE_NATIVECODE));
-        atts.remove(new Attributes.Name(Constants.DYNAMICIMPORT_PACKAGE));
-        atts.remove(new Attributes.Name(Constants.BUNDLE_ACTIVATOR));
-        
-        //mark as extension bundle
-        atts.putValue(Constants.FRAGMENT_HOST, "system.bundle; extension:=framework");
-
-        //create the jar containing the manifest
-        ByteArrayOutputStream jar = new ByteArrayOutputStream();
-        JarOutputStream out = new JarOutputStream(jar, manifest);
-        out.close();
-        return jar.toByteArray();
-    }
-
-    private static boolean isValidBundle(Manifest manifest) {
-        Attributes atts = manifest.getMainAttributes();
-        return atts.containsKey(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION));
-    }
-
-    private static String getVersionedId(Bundle b) {
+    public static String getVersionedId(Bundle b) {
         return b.getSymbolicName() + ":" + b.getVersion();
     }
 
-    private static String getVersionedId(Manifest manifest) {
+    public static String getVersionedId(Manifest manifest) {
         Attributes atts = manifest.getMainAttributes();
         return atts.getValue(Constants.BUNDLE_SYMBOLICNAME) + ":" +
             atts.getValue(Constants.BUNDLE_VERSION);
@@ -645,75 +501,5 @@ public class Osgis {
         
         return Maybe.of(new VersionedName(parts[0], v));
     }
-
-    /**
-     * The class is not used, staying for future reference.
-     * Remove after OSGi transition is completed.
-     */
-    public static class ManifestHelper {
-        
-        private static ManifestParser parse;
-        private Manifest manifest;
-        private String source;
-
-        private static final String WIRING_PACKAGE = PackageNamespace.PACKAGE_NAMESPACE;
-        
-        public static ManifestHelper forManifestContents(String contents) throws IOException, BundleException {
-            ManifestHelper result = forManifest(Streams.newInputStreamWithContents(contents));
-            result.source = contents;
-            return result;
-        }
-        
-        public static ManifestHelper forManifest(URL url) throws IOException, BundleException {
-            InputStream in = null;
-            try {
-                in = url.openStream();
-                return forManifest(in);
-            } finally {
-                if (in != null) in.close();
-            }
-        }
-        
-        public static ManifestHelper forManifest(InputStream in) throws IOException, BundleException {
-            return forManifest(new Manifest(in));
-        }
-
-        public static ManifestHelper forManifest(Manifest manifest) throws BundleException {
-            ManifestHelper result = new ManifestHelper();
-            result.manifest = manifest;
-            parse = new ManifestParser(null, null, null, new StringMap(manifest.getMainAttributes()));
-            return result;
-        }
-        
-        public String getSymbolicName() {
-            return parse.getSymbolicName();
-        }
-
-        public Version getVersion() {
-            return parse.getBundleVersion();
-        }
-
-        public String getSymbolicNameVersion() {
-            return getSymbolicName()+":"+getVersion();
-        }
-
-        public List<String> getExportedPackages() {
-            MutableList<String> result = MutableList.of();
-            for (BundleCapability c: parse.getCapabilities()) {
-                if (WIRING_PACKAGE.equals(c.getNamespace())) {
-                    result.add((String)c.getAttributes().get(WIRING_PACKAGE));
-                }
-            }
-            return result;
-        }
-        
-        @Nullable public String getSource() {
-            return source;
-        }
-        
-        public Manifest getManifest() {
-            return manifest;
-        }
-    }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
index fef17d7..5fdcc3a 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiStandaloneTest.java
@@ -20,28 +20,19 @@ package org.apache.brooklyn.core.mgmt.osgi;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarInputStream;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.core.ResourceUtils;
 import org.apache.brooklyn.util.core.osgi.Osgis;
-import org.apache.brooklyn.util.core.osgi.Osgis.ManifestHelper;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.maven.MavenArtifact;
 import org.apache.brooklyn.util.maven.MavenRetriever;
 import org.apache.brooklyn.util.net.Urls;
 import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.stream.Streams;
 import org.apache.commons.io.FileUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.launch.Framework;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -72,7 +63,7 @@ public class OsgiStandaloneTest {
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         storageTempDir = Os.newTempDir("osgi-standalone");
-        framework = Osgis.newFrameworkStarted(storageTempDir.getAbsolutePath(), true, null);
+        framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), true);
     }
 
     @AfterMethod(alwaysRun=true)
@@ -81,11 +72,8 @@ public class OsgiStandaloneTest {
     }
 
     public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException {
-        if (framework!=null) {
-            framework.stop();
-            Assert.assertEquals(framework.waitForStop(1000).getType(), FrameworkEvent.STOPPED);
-            framework = null;
-        }
+        Osgis.ungetFramework(framework);
+        framework = null;
         if (storageTempDir!=null) {
             FileUtils.deleteDirectory(storageTempDir);
             storageTempDir = null;
@@ -123,7 +111,8 @@ public class OsgiStandaloneTest {
         Assert.assertEquals(Entity.class, bundleCls.getClassLoader().loadClass(Entity.class.getName()));
     }
 
-    @Test
+    // FIXME re-enable
+    @Test(enabled = false)
     public void testDuplicateBundle() throws Exception {
         MavenArtifact artifact = new MavenArtifact("org.apache.brooklyn", "brooklyn-api", "jar", "0.9.0-SNAPSHOT"); // BROOKLYN_VERSION
         String localUrl = MavenRetriever.localUrl(artifact);
@@ -200,33 +189,6 @@ public class OsgiStandaloneTest {
         Class<?> aClass = bundle.loadClass("brooklyn.test.osgi.TestA");
         aClass.getField("multiplier").set(null, newMultiplier);
     }
-
-    @Test
-    public void testReadAManifest() throws Exception {
-        Enumeration<URL> manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
-        log.info("Bundles and exported packages:");
-        MutableSet<String> allPackages = MutableSet.of();
-        while (manifests.hasMoreElements()) {
-            ManifestHelper mf = Osgis.ManifestHelper.forManifestContents(Streams.readFullyString( manifests.nextElement().openStream() ));
-            List<String> mfPackages = mf.getExportedPackages();
-            log.info("  "+mf.getSymbolicNameVersion()+": "+mfPackages);
-            allPackages.addAll(mfPackages);
-        }
-        log.info("Total export package count: "+allPackages.size());
-        Assert.assertTrue(allPackages.size()>20, "did not find enough packages"); // probably much larger
-        Assert.assertTrue(allPackages.contains(Osgis.class.getPackage().getName()));
-    }
-    
-    @Test
-    public void testReadKnownManifest() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        InputStream in = this.getClass().getResourceAsStream(BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        JarInputStream jarIn = new JarInputStream(in);
-        ManifestHelper helper = Osgis.ManifestHelper.forManifest(jarIn.getManifest());
-        jarIn.close();
-        Assert.assertEquals(helper.getVersion().toString(), "0.1.0");
-        Assert.assertTrue(helper.getExportedPackages().contains("org.apache.brooklyn.test.osgi.entities"));
-    }
     
     @Test
     public void testLoadOsgiBundleDependencies() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
index ad878da..9445b7c 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java
@@ -105,7 +105,7 @@ public class OsgiVersionMoreEntityTest {
     @Test
     public void testEntityProxy() throws Exception {
         File storageTempDir = Os.newTempDir("osgi-standalone");
-        Framework framework = Osgis.newFrameworkStarted(storageTempDir.getAbsolutePath(), true, null);
+        Framework framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), true);
         
         try {
             ManagementContextInternal managementContext;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636d6965/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
new file mode 100644
index 0000000..f48bbca
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/util/core/osgi/EmbeddedFelixFrameworkTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.util.core.osgi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarInputStream;
+
+import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
+import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
+import org.apache.brooklyn.test.support.TestResourceUnavailableException;
+import org.apache.brooklyn.util.collections.MutableSet;
+import org.apache.brooklyn.util.core.osgi.ManifestHelper;
+import org.apache.brooklyn.util.os.Os;
+import org.apache.brooklyn.util.stream.Streams;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ *
+ * @author Ciprian Ciubotariu <ch...@gmx.net>
+ */
+public class EmbeddedFelixFrameworkTest {
+
+    private static final Logger log = LoggerFactory.getLogger(OsgiStandaloneTest.class);
+
+    public static final String BROOKLYN_TEST_OSGI_ENTITIES_PATH = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH;
+
+    protected Framework framework = null;
+    private File storageTempDir;
+
+    @BeforeMethod(alwaysRun = true)
+    public void setUp() throws Exception {
+        storageTempDir = Os.newTempDir("osgi-standalone");
+        framework = Osgis.getFramework(storageTempDir.getAbsolutePath(), false);
+    }
+
+    @AfterMethod(alwaysRun = true)
+    public void tearDown() throws BundleException, IOException, InterruptedException {
+        OsgiStandaloneTest.tearDownOsgiFramework(framework, storageTempDir);
+    }
+
+    @org.testng.annotations.Test
+    public void testReadAManifest() throws Exception {
+        Enumeration<URL> manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
+        log.info("Bundles and exported packages:");
+        MutableSet<String> allPackages = MutableSet.of();
+        while (manifests.hasMoreElements()) {
+            ManifestHelper mf = ManifestHelper.forManifestContents(Streams.readFullyString(manifests.nextElement().openStream()));
+            List<String> mfPackages = mf.getExportedPackages();
+            log.info("  " + mf.getSymbolicNameVersion() + ": " + mfPackages);
+            allPackages.addAll(mfPackages);
+        }
+        log.info("Total export package count: " + allPackages.size());
+        Assert.assertTrue(allPackages.size() > 20, "did not find enough packages"); // probably much larger
+        Assert.assertTrue(allPackages.contains(Osgis.class.getPackage().getName()));
+    }
+
+    @org.testng.annotations.Test
+    public void testReadKnownManifest() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+        InputStream in = this.getClass().getResourceAsStream(BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+        JarInputStream jarIn = new JarInputStream(in);
+        ManifestHelper helper = ManifestHelper.forManifest(jarIn.getManifest());
+        jarIn.close();
+        Assert.assertEquals(helper.getVersion().toString(), "0.1.0");
+        Assert.assertTrue(helper.getExportedPackages().contains("org.apache.brooklyn.test.osgi.entities"));
+    }
+
+}


[12/12] incubator-brooklyn git commit: This closes #962

Posted by ha...@apache.org.
This closes #962


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

Branch: refs/heads/master
Commit: 8457515f60f4487dce8e21ca7f845dc5b9fef0ba
Parents: 25e1c31 dadf87a
Author: Hadrian Zbarcea <ha...@apache.org>
Authored: Mon Oct 26 19:27:04 2015 -0400
Committer: Hadrian Zbarcea <ha...@apache.org>
Committed: Mon Oct 26 19:27:04 2015 -0400

----------------------------------------------------------------------
 core/pom.xml                                    |  36 +-
 .../apache/brooklyn/core/BrooklynVersion.java   | 188 +++++----
 .../brooklyn/core/mgmt/ha/OsgiManager.java      |  16 +-
 .../core/mgmt/persist/XmlMementoSerializer.java |  35 +-
 .../brooklyn/util/core/ResourceUtils.java       |  32 +-
 .../apache/brooklyn/util/core/osgi/Osgis.java   | 389 +++----------------
 core/src/test/dependencies/osgi/README.md       |  33 --
 .../src/test/dependencies/osgi/entities/pom.xml |  84 ----
 .../test/osgi/entities/SimpleApplication.java   |  28 --
 .../osgi/entities/SimpleApplicationImpl.java    |  27 --
 .../test/osgi/entities/SimpleEntity.java        |  28 --
 .../test/osgi/entities/SimpleEntityImpl.java    |  26 --
 .../test/osgi/entities/SimpleLocation.java      |  35 --
 .../test/osgi/entities/SimplePolicy.java        |  36 --
 .../apache/brooklyn/test/osgi/entities/icon.gif | Bin 43 -> 0 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |  82 ----
 .../test/osgi/entities/more/MoreEntity.java     |  37 --
 .../test/osgi/entities/more/MoreEntityImpl.java |  43 --
 .../test/osgi/entities/more/MoreLocation.java   |  24 --
 .../test/osgi/entities/more/MorePolicy.java     |  25 --
 .../test/osgi/entities/more/MoreTemplate.java   |  24 --
 .../osgi/more-entities-v2-evil-twin/pom.xml     |  88 -----
 .../test/osgi/entities/more/MoreEntity.java     |  37 --
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ---
 .../dependencies/osgi/more-entities-v2/pom.xml  |  88 -----
 .../test/osgi/entities/more/MoreEntity.java     |  40 --
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 ---
 .../test/osgi/entities/more/MoreLocation.java   |  26 --
 .../test/osgi/entities/more/MorePolicy.java     |  29 --
 .../test/osgi/entities/more/MoreTemplate.java   |  26 --
 .../brooklyn/core/BrooklynVersionTest.java      |   2 +-
 .../core/mgmt/osgi/OsgiStandaloneTest.java      |  75 +---
 .../core/mgmt/osgi/OsgiTestResources.java       |  74 ----
 .../mgmt/osgi/OsgiVersionMoreEntityTest.java    |   6 +-
 .../mgmt/persist/XmlMementoSerializerTest.java  |   2 +-
 .../brooklyn/util/core/osgi/OsgiTestBase.java   |  56 +++
 .../brooklyn/util/core/osgi/OsgisTest.java      |  41 --
 core/src/test/resources/brooklyn/osgi/README.md |  25 --
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         | Bin 2055 -> 0 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |  26 --
 .../osgi/brooklyn-test-osgi-entities.jar        | Bin 14454 -> 0 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |  26 --
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  | Bin 14964 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |  26 --
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  | Bin 15622 -> 0 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |  26 --
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 13922 -> 0 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |  26 --
 karaf/apache-brooklyn/pom.xml                   | 124 ++++++
 .../filtered-resources/etc/branding.properties  |  35 ++
 .../src/main/resources/etc/custom.properties    | 120 ++++++
 .../resources/etc/org.ops4j.pax.logging.cfg     |  46 +++
 .../src/main/resources/etc/system.properties    | 133 +++++++
 karaf/commands/pom.xml                          |  77 ++++
 .../apache/brooklyn/karaf/commands/Catalog.java |  44 +++
 karaf/feature.xml                               |  51 +++
 karaf/features/pom.xml                          |  64 +++
 karaf/features/src/main/feature/feature.xml     |  89 +++++
 .../features/src/main/history/dependencies.xml  |  47 +++
 karaf/itest/pom.xml                             | 188 +++++++++
 .../java/org/apache/brooklyn/AssemblyTest.java  | 117 ++++++
 karaf/itest/src/test/resources/exam.properties  |  21 +
 karaf/itest/src/test/resources/logback.xml      |  43 ++
 karaf/pom.xml                                   | 143 +++++++
 parent/pom.xml                                  | 133 +------
 pom.xml                                         | 118 +++++-
 usage/camp/pom.xml                              |   7 +
 .../catalog/AbstractCatalogXmlTest.java         |   2 +-
 .../brooklyn/catalog/CatalogYamlEntityTest.java |   2 +-
 .../catalog/CatalogYamlTemplateTest.java        |   2 +-
 utils/rt-felix/pom.xml                          |  61 +++
 .../rt/felix/EmbeddedFelixFramework.java        | 258 ++++++++++++
 .../brooklyn/rt/felix/ManifestHelper.java       | 103 +++++
 .../rt/felix/EmbeddedFelixFrameworkTest.java    | 101 +++++
 utils/rt-osgi/pom.xml                           |  53 +++
 .../apache/brooklyn/util/osgi/OsgiUtils.java    | 101 +++++
 .../brooklyn/util/osgi/VersionedName.java       |  76 ++++
 .../brooklyn/util/osgi/OsgiTestResources.java   |  74 ++++
 .../apache/brooklyn/util/osgi/OsgisTest.java    |  39 ++
 .../src/test/resources/brooklyn/osgi/README.md  |  25 ++
 .../osgi/brooklyn-osgi-test-a_0.1.0.jar         | Bin 0 -> 2055 bytes
 .../osgi/brooklyn-osgi-test-a_0.1.0.txt         |  26 ++
 .../osgi/brooklyn-test-osgi-entities.jar        | Bin 0 -> 14454 bytes
 .../osgi/brooklyn-test-osgi-entities.txt        |  26 ++
 .../brooklyn-test-osgi-more-entities_0.1.0.jar  | Bin 0 -> 14964 bytes
 .../brooklyn-test-osgi-more-entities_0.1.0.txt  |  26 ++
 .../brooklyn-test-osgi-more-entities_0.2.0.jar  | Bin 0 -> 15622 bytes
 .../brooklyn-test-osgi-more-entities_0.2.0.txt  |  26 ++
 ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 0 -> 13922 bytes
 ...-test-osgi-more-entities_evil-twin_0.2.0.txt |  26 ++
 .../test/resources/dependencies/osgi/README.md  |  33 ++
 .../dependencies/osgi/entities/pom.xml          |  84 ++++
 .../test/osgi/entities/SimpleApplication.java   |  28 ++
 .../osgi/entities/SimpleApplicationImpl.java    |  27 ++
 .../test/osgi/entities/SimpleEntity.java        |  28 ++
 .../test/osgi/entities/SimpleEntityImpl.java    |  26 ++
 .../test/osgi/entities/SimpleLocation.java      |  35 ++
 .../test/osgi/entities/SimplePolicy.java        |  36 ++
 .../apache/brooklyn/test/osgi/entities/icon.gif | Bin 0 -> 43 bytes
 .../dependencies/osgi/more-entities-v1/pom.xml  |  82 ++++
 .../test/osgi/entities/more/MoreEntity.java     |  37 ++
 .../test/osgi/entities/more/MoreEntityImpl.java |  43 ++
 .../test/osgi/entities/more/MoreLocation.java   |  24 ++
 .../test/osgi/entities/more/MorePolicy.java     |  25 ++
 .../test/osgi/entities/more/MoreTemplate.java   |  24 ++
 .../osgi/more-entities-v2-evil-twin/pom.xml     |  88 +++++
 .../test/osgi/entities/more/MoreEntity.java     |  37 ++
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 +++
 .../dependencies/osgi/more-entities-v2/pom.xml  |  88 +++++
 .../test/osgi/entities/more/MoreEntity.java     |  40 ++
 .../test/osgi/entities/more/MoreEntityImpl.java |  46 +++
 .../test/osgi/entities/more/MoreLocation.java   |  26 ++
 .../test/osgi/entities/more/MorePolicy.java     |  29 ++
 .../test/osgi/entities/more/MoreTemplate.java   |  26 ++
 114 files changed, 3774 insertions(+), 1876 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8457515f/core/pom.xml
----------------------------------------------------------------------
diff --cc core/pom.xml
index 1a0e04b,f7f59c0..aafc73e
--- a/core/pom.xml
+++ b/core/pom.xml
@@@ -251,19 -253,25 +257,37 @@@
                          </configuration>
                      </execution>
                  </executions>
 +                <dependencies>
 +                    <dependency>
 +                        <groupId>org.codehaus.groovy</groupId>
 +                        <artifactId>groovy-eclipse-compiler</artifactId>
 +                        <version>2.9.0-01</version>
 +                    </dependency>
 +                    <dependency>
 +                        <groupId>org.codehaus.groovy</groupId>
 +                        <artifactId>groovy-eclipse-batch</artifactId>
 +                        <version>2.3.4-01</version>
 +                    </dependency>
 +                </dependencies>
              </plugin>
+             <plugin>
+                 <groupId>org.apache.felix</groupId>
+                 <artifactId>maven-bundle-plugin</artifactId>
+                 <configuration>
+                     <supportedProjectTypes>
+                         <supportedProjectType>jar</supportedProjectType>
+                     </supportedProjectTypes>
+                     <instructions>
+                         <Export-Package>brooklyn.*,org.apache.brooklyn.*</Export-Package>
+                         <Import-Package>
+                             !org.apache.brooklyn.rt.felix,
+                             *
+                         </Import-Package>
+                         <Implementation-SHA-1>${buildNumber}</Implementation-SHA-1>
+                         <Implementation-Branch>${scmBranch}</Implementation-Branch>
+                     </instructions>
+                 </configuration>
+             </plugin>
          </plugins>
      </build>
  </project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8457515f/parent/pom.xml
----------------------------------------------------------------------


[11/12] incubator-brooklyn git commit: [BROOKLYN-183] Workaround use of private package in XmlMementoSerializer

Posted by ha...@apache.org.
[BROOKLYN-183] Workaround use of private package in XmlMementoSerializer

Copy bundle-private code from xstreams into XmlMementoSerializer

Temporarily until osgification is complete.


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

Branch: refs/heads/master
Commit: 3f4c2ac202a67e75bc32f56f55dc6ca5be134155
Parents: 06b186f
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Fri Oct 9 00:38:14 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 .../core/mgmt/persist/XmlMementoSerializer.java | 35 ++++++++++++++++++--
 1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3f4c2ac2/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
index ec7fb6f..6e1ac65 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
@@ -71,7 +71,6 @@ import com.thoughtworks.xstream.converters.SingleValueConverter;
 import com.thoughtworks.xstream.converters.UnmarshallingContext;
 import com.thoughtworks.xstream.converters.reflection.ReflectionConverter;
 import com.thoughtworks.xstream.core.ReferencingMarshallingContext;
-import com.thoughtworks.xstream.core.util.HierarchicalStreams;
 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
 import com.thoughtworks.xstream.io.path.PathTrackingReader;
@@ -335,7 +334,8 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T> implements Memento
         @Override
         public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
             if (reader.hasMoreChildren()) {
-                Class<?> type = HierarchicalStreams.readClassType(reader, mapper);
+                Class<?> type = readClassType(reader, mapper);
+//                Class<?> type2 = context.getRequiredType();
                 reader.moveDown();
                 Object result = context.convertAnother(null, type);
                 reader.moveUp();
@@ -345,7 +345,36 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T> implements Memento
             }
         }
     }
-    
+
+    // TODO: readClassType() and readClassAttribute()
+    // Temporarily copied until osgification is finished from bundle-private class
+    //   com.thoughtworks.xstream.core.util.HierarchicalStreams
+    // Perhaps context.getRequiredType(); can be used instead?
+    // Other users of xstream (e.g. jenkinsci) manually check for resoved-to and class attributes
+    //   for compatibility with older versions of xstream
+    public static Class readClassType(HierarchicalStreamReader reader, Mapper mapper) {
+        String classAttribute = readClassAttribute(reader, mapper);
+        Class type;
+        if (classAttribute == null) {
+            type = mapper.realClass(reader.getNodeName());
+        } else {
+            type = mapper.realClass(classAttribute);
+        }
+        return type;
+    }
+
+    public static String readClassAttribute(HierarchicalStreamReader reader, Mapper mapper) {
+        String attributeName = mapper.aliasForSystemAttribute("resolves-to");
+        String classAttribute = attributeName == null ? null : reader.getAttribute(attributeName);
+        if (classAttribute == null) {
+            attributeName = mapper.aliasForSystemAttribute("class");
+            if (attributeName != null) {
+                classAttribute = reader.getAttribute(attributeName);
+            }
+        }
+        return classAttribute;
+    }
+
     public class ManagementContextConverter implements Converter {
         @Override
         public boolean canConvert(@SuppressWarnings("rawtypes") Class type) {


[07/12] incubator-brooklyn git commit: [BROOKLYN-183] More on karaf integration

Posted by ha...@apache.org.
[BROOKLYN-183] More on karaf integration

* convert karaf feature project to use karaf-maven-plugin
* add feature descriptions
* add license files as directed by rat plugin
* add version properties to transitive dependencies within features
* move version properties from brooklyn-parent to brooklyn root pom, so
  they are accessible within karaf's tree


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

Branch: refs/heads/master
Commit: c8161a64c76890560cfec91e016792f6910cb3ee
Parents: 99c8218
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Thu Oct 1 14:46:06 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/karaf/commands/Catalog.java |  19 ++-
 karaf/feature.xml                               |  51 +++++++
 karaf/features/pom.xml                          | 102 +++++++-------
 karaf/features/src/main/feature/feature.xml     |  54 ++++++++
 .../features/src/main/history/dependencies.xml  |  23 ++++
 karaf/features/src/main/resources/features.xml  |  16 ---
 karaf/pom.xml                                   |  11 +-
 parent/pom.xml                                  | 133 +++----------------
 pom.xml                                         | 113 +++++++++++++++-
 9 files changed, 340 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
----------------------------------------------------------------------
diff --git a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
index 3df948a..406df8f 100644
--- a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
+++ b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java
@@ -1,4 +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.
+ */
 package org.apache.brooklyn.karaf.commands;
 
 import org.apache.karaf.shell.api.action.Action;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/feature.xml b/karaf/feature.xml
new file mode 100644
index 0000000..fdb959d
--- /dev/null
+++ b/karaf/feature.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="org.apache.brooklyn-${project.version}">
+
+    <repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
+    <repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
+    <repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
+  
+    <!-- TODO: complete the features set -->
+    <feature name="brooklyn-core" version="${project.version}" description="Brooklyn Core">
+        <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-api/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-groovy/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/${project.version}</bundle>
+    
+        <!-- TODO: via geoip -->
+        <bundle dependency="true">wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
+        <!-- TODO: why it does not come automagically? -->
+        <bundle dependency="true">mvn:com.google.guava/guava/${guava.version}</bundle>
+        <bundle dependency="true">mvn:com.google.code.gson/gson/${gson.version}</bundle>
+        <bundle dependency="true">mvn:com.jayway.jsonpath/json-path/${jsonPath.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:net.minidev/json-smart/${jsonSmart.version}</bundle>
+        <bundle dependency="true">mvn:net.minidev/asm/${minidev.asm.version}</bundle>
+    </feature>
+  
+    <feature name="brooklyn-commands"  version="${project.version}"  description="Brooklyn Shell Commands">
+        <bundle>mvn:org.apache.brooklyn/brooklyn-commands/${project.version}</bundle>
+        <!--<feature version="${project.version}">brooklyn-core</feature>-->
+    </feature>
+  
+</features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/features/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/features/pom.xml b/karaf/features/pom.xml
index 50dd5a7..03cd932 100755
--- a/karaf/features/pom.xml
+++ b/karaf/features/pom.xml
@@ -1,54 +1,64 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+    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
 
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.brooklyn</groupId>
-    <artifactId>brooklyn-karaf</artifactId>
-    <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
-  </parent>
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.brooklyn</groupId>
+        <artifactId>brooklyn-karaf</artifactId>
+        <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+    </parent>
 
-  <artifactId>brooklyn-features</artifactId>
-  <name>Brooklyn Karaf Features</name>
+    <artifactId>brooklyn-features</artifactId>
+    <name>Brooklyn Karaf Features</name>
+    <packaging>feature</packaging>
 
-  <build>
-    <resources>
-      <resource>
-	<directory>src/main/resources</directory>
-	<filtering>true</filtering>
-	<includes>
-	  <include>**/*</include>
-	</includes>
-      </resource>
-    </resources>
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <version>4.0.1</version>
+                    <extensions>true</extensions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
 
-    <plugins>
-      <plugin>
-	<groupId>org.codehaus.mojo</groupId>
-	<artifactId>build-helper-maven-plugin</artifactId>
-	<version>1.9.1</version>
-	<executions>
-	  <execution>
-	    <id>attach-artifacts</id>
-	    <phase>process-resources</phase>
-	    <goals>
-	      <goal>attach-artifact</goal>
-	    </goals>
-	    <configuration>
-	      <artifacts>
-		<artifact>
-		  <file>${project.build.outputDirectory}/features.xml</file>
-		  <type>xml</type>
-		  <classifier>features</classifier>
-		</artifact>
-	      </artifacts>
-	    </configuration>
-	  </execution>
-	</executions>
-      </plugin>
-    </plugins>
-  </build>
+                <configuration>
+                    <startLevel>50</startLevel>
+                    <aggregateFeatures>true</aggregateFeatures>
+                    <resolver>(obr)</resolver>
+                    <checkDependencyChange>true</checkDependencyChange>
+                    <failOnDependencyChange>false</failOnDependencyChange>
+                    <logDependencyChanges>true</logDependencyChanges>
+                    <overwriteChangedDependencies>true</overwriteChangedDependencies>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
 </project>
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/features/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml
new file mode 100644
index 0000000..d308bce
--- /dev/null
+++ b/karaf/features/src/main/feature/feature.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="org.apache.brooklyn-${project.version}">
+
+    <repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
+    <repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
+    <repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
+  
+    <!-- TODO: complete the features set -->
+    <feature name="brooklyn-core" version="${project.version}" description="Brooklyn Core">
+        <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-api/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-groovy/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/${project.version}</bundle>
+    
+        <bundle dependency="true">mvn:com.google.guava/guava/${guava.version}</bundle>
+        <bundle dependency="true">mvn:com.google.code.gson/gson/${gson.version}</bundle>
+        <bundle dependency="true">mvn:com.jayway.jsonpath/json-path/${jsonPath.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version}</bundle>
+        <bundle dependency="true">mvn:net.minidev/json-smart/${jsonSmart.version}</bundle>
+        <bundle dependency="true">mvn:net.minidev/asm/${minidev.asm.version}</bundle>
+        <bundle dependency="true">mvn:com.thoughtworks.xstream/xstream/${xstream.version}</bundle>
+
+        <!-- TODO: don't use wrap: -->
+        <bundle dependency="true">wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle> <!-- from geoip -->
+        <bundle dependency="true">wrap:mvn:com.maxmind.geoip2/geoip2/${maxmind.version}</bundle> <!-- from geoip2 -->
+        <bundle dependency="true">wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle> <!-- from com.thoughtworks.xstream/xstream -->
+    </feature>
+  
+    <feature name="brooklyn-commands"  version="${project.version}"  description="Brooklyn Shell Commands">
+        <bundle>mvn:org.apache.brooklyn/brooklyn-commands/${project.version}</bundle>
+        <!--<feature version="${project.version}">brooklyn-core</feature>-->
+    </feature>
+  
+</features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/features/src/main/history/dependencies.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/history/dependencies.xml b/karaf/features/src/main/history/dependencies.xml
new file mode 100644
index 0000000..d90b75f
--- /dev/null
+++ b/karaf/features/src/main/history/dependencies.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org.apache.brooklyn-0.9.0-SNAPSHOT">
+    <feature version="0.0.0">
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.2</bundle>
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.4.2</bundle>
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.4.2</bundle>
+        <bundle>mvn:com.google.code.gson/gson/2.3</bundle>
+        <bundle>mvn:com.google.guava/guava/17.0</bundle>
+        <bundle>mvn:com.jayway.jsonpath/json-path/2.0.0</bundle>
+        <bundle>mvn:com.thoughtworks.xstream/xstream/1.4.7</bundle>
+        <bundle>mvn:net.minidev/asm/1.0.2</bundle>
+        <bundle>mvn:net.minidev/json-smart/2.1.1</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-api/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-commands/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-core/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-groovy/0.9.0-SNAPSHOT</bundle>
+        <bundle>wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
+        <bundle>wrap:mvn:com.maxmind.geoip2/geoip2/0.8.1</bundle>
+        <bundle>wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle>
+    </feature>
+</features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/resources/features.xml b/karaf/features/src/main/resources/features.xml
deleted file mode 100755
index ccbd649..0000000
--- a/karaf/features/src/main/resources/features.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="org.apache.brooklyn-${project.version}">
-
-  <repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
-  <repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
-  <repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
-
-  <!-- TODO: complete the features set -->
-  <feature name="brooklyn-core" version="${project.version}" resolver="(obr)">
-    <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
-  </feature>
-
-  <feature name="brooklyn-commands"  version="${project.version}">
-      <bundle>mvn:org.apache.brooklyn/brooklyn-commands/${project.version}</bundle>
-  </feature>
-</features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/pom.xml b/karaf/pom.xml
index b5c70d8..e30adc3 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -16,8 +16,7 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
   <parent>
@@ -68,7 +67,7 @@
                     </goals>
                   </pluginExecutionFilter>
                   <action>
-                    <ignore />
+                    <ignore/>
                   </action>
                 </pluginExecution>
                 <pluginExecution>
@@ -81,7 +80,7 @@
                     </goals>
                   </pluginExecutionFilter>
                   <action>
-                    <ignore />
+                    <ignore/>
                   </action>
                 </pluginExecution>
                 <pluginExecution>
@@ -95,7 +94,7 @@
                     </goals>
                   </pluginExecutionFilter>
                   <action>
-                    <ignore />
+                    <ignore/>
                   </action>
                 </pluginExecution>
                 
@@ -120,4 +119,4 @@
       </snapshots>
     </repository>
   </repositories>
-</project>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1ca10ad..6f350c1 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -51,118 +51,6 @@
       http://stackoverflow.com/questions/5309379/how-to-keep-maven-profiles-which-are-activebydefault-active-even-if-another-prof )
     -->
 
-    <properties>
-        <!-- Compilation -->
-        <java.version>1.7</java.version>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-
-        <!-- Testing -->
-        <cobertura.plugin.version>2.7</cobertura.plugin.version>
-        <surefire.version>2.18.1</surefire.version>
-        <plantuml.version>6121</plantuml.version>
-        <ant.version>1.8.4</ant.version>
-        <includedTestGroups />
-        <excludedTestGroups>Integration,Acceptance,Live,WIP</excludedTestGroups>
-        <surefire.failIfNoSpecifiedTests>false</surefire.failIfNoSpecifiedTests>
-
-        <!-- Dependencies -->
-        <brooklyn.version>0.9.0-SNAPSHOT</brooklyn.version>  <!-- BROOKLYN_VERSION -->
-        <jclouds.groupId>org.apache.jclouds</jclouds.groupId> <!-- JCLOUDS_GROUPID_VERSION -->
-
-        <!-- These dependencies also appear in usage/downstream-parent/pom.xml -
-           - please synchronise versions between these two pom files -->
-        <jclouds.version>1.9.1</jclouds.version> <!-- JCLOUDS_VERSION -->
-        <logback.version>1.0.7</logback.version>
-        <slf4j.version>1.6.6</slf4j.version>  <!-- used for java.util.logging jul-to-slf4j interception -->
-        <guava.version>17.0</guava.version>
-        <xstream.version>1.4.7</xstream.version>
-        <jackson.version>1.9.13</jackson.version>  <!-- codehaus jackson, used by brooklyn rest server -->
-        <fasterxml.jackson.version>2.4.2</fasterxml.jackson.version>  <!-- more recent jackson, but not compatible with old annotations! -->
-        <jersey.version>1.18.1</jersey.version>
-        <httpclient.version>4.4.1</httpclient.version>
-        <commons-lang3.version>3.1</commons-lang3.version>
-        <groovy.version>2.3.4</groovy.version> <!-- Version supported by https://github.com/groovy/groovy-eclipse/wiki/Groovy-Eclipse-2.9.0-Release-Notes -->
-        <jsr305.version>2.0.1</jsr305.version>
-        <snakeyaml.version>1.11</snakeyaml.version>
-
-        <!-- Ordinary dependencies -->
-        <testng.version>6.8.8</testng.version>
-        <mockito.version>1.10.8</mockito.version>
-        <swagger.version>1.0.1</swagger.version>
-        <jansi.version>1.2.1</jansi.version>
-        <gson.version>2.3</gson.version>
-        <ivy.version>2.2.0</ivy.version>
-        <mx4j.version>3.0.1</mx4j.version>
-        <bouncycastle.version>1.49</bouncycastle.version>
-        <sshj.version>0.8.1</sshj.version>
-        <felix.framework.version>4.4.0</felix.framework.version>
-        <reflections.version>0.9.9-RC1</reflections.version>
-        <jetty.version>8.1.17.v20150415</jetty.version>
-        <airline.version>0.6</airline.version>
-        <mockwebserver.version>20121111</mockwebserver.version>
-        <freemarker.version>2.3.22</freemarker.version>
-        <commons-io.version>2.4</commons-io.version>
-        <hazelcast.version>3.0</hazelcast.version>
-        <jsonPath.version>2.0.0</jsonPath.version>
-        <commons-compress.version>1.4</commons-compress.version>
-        <qpid.version>0.20</qpid.version>
-        <mongodb.version>3.0.3</mongodb.version>
-        <riak.version>1.4.0</riak.version>
-        <maven-war-plugin.version>2.4</maven-war-plugin.version>
-        <validation-api.version>1.0.0.GA</validation-api.version>
-        <geronimo-jms_1.1_spec.version>1.1.1</geronimo-jms_1.1_spec.version>
-        <sleepycat-je.version>5.0.34</sleepycat-je.version>
-        <org.marre.smsj.version>1.0.0-20051126</org.marre.smsj.version>
-        <mysql-connector-java.version>5.1.18</mysql-connector-java.version>
-        <hadoop.version>1.0.2</hadoop.version>
-        <commons-cli.version>1.2</commons-cli.version>
-        <postgresql.version>9.1-901.jdbc4</postgresql.version>
-        <activemq.version>5.10.0</activemq.version>
-        <rabbitmq-version>2.8.7</rabbitmq-version>
-        <kafka.version>0.8.2.1</kafka.version>
-        <storm.version>0.8.2</storm.version>
-        <redis.version>1.5.2</redis.version>
-        <astyanax.version>1.56.24</astyanax.version>
-        <jcouchdb.version>0.11.0-1</jcouchdb.version>
-        <solr.version>4.7.0</solr.version>
-        <jtidy.version>r8-20060801</jtidy.version>
-        <opendmk_jmxremote_optional_jar.version>1.0-b01-ea</opendmk_jmxremote_optional_jar.version>
-        <resteasy.version>3.0.8.Final</resteasy.version>
-        <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
-        <jopt.version>4.3</jopt.version>
-        <concurrentlinkedhashmap.version>1.0_jdk5</concurrentlinkedhashmap.version>
-        <maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version>
-        <nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version>
-        <nodejs-maven-binaries.version>0.10.25</nodejs-maven-binaries.version>
-        <jasmine-maven-plugin.version>1.3.1.5</jasmine-maven-plugin.version>
-        <requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version>
-        <maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
-        <jetty-orbit-javax-servlet.version>3.0.0.v201112011016</jetty-orbit-javax-servlet.version>
-        <jcommander.version>1.27</jcommander.version>
-        <jsr250-api.version>1.0</jsr250-api.version>
-        <guice.version>3.0</guice.version>
-        <javax-inject.version>1</javax-inject.version>
-        <aopalliance.version>1.0</aopalliance.version>
-        <commons-configuration.version>1.7</commons-configuration.version>
-        <commons-lang.version>2.4</commons-lang.version>
-        <hamcrest.version>1.1</hamcrest.version>
-        <jsr311-api.version>1.1.1</jsr311-api.version>
-        <maxmind.version>0.8.1</maxmind.version>
-        <jna.version>4.0.0</jna.version>
-        <winrm4j.version>0.1.0</winrm4j.version>
-        <coverage.target>${working.dir}</coverage.target>
-
-        <!-- Transitive dependencies, declared explicitly to avoid version mismatch -->
-        <clojure.version>1.4.0</clojure.version>
-        <zookeeper.version>3.3.4</zookeeper.version>
-        <ring-core.version>1.1.5</ring-core.version>
-        <clj-time.version>0.4.1</clj-time.version>
-        <commons-codec.version>1.9</commons-codec.version>
-        <log4j.version>1.2.17</log4j.version>
-        <commons-logging.version>1.2</commons-logging.version>
-    </properties>
-
     <dependencyManagement>
         <dependencies>
             <dependency>
@@ -345,6 +233,11 @@
                 <version>${httpclient.version}</version>
             </dependency>
             <dependency>
+                <groupId>xml-apis</groupId>
+                <artifactId>xml-apis</artifactId>
+                <version>${xml-apis.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>javax.annotation</groupId>
                 <artifactId>jsr250-api</artifactId>
                 <version>${jsr250-api.version}</version>
@@ -575,6 +468,21 @@
                 <artifactId>jna-platform</artifactId>
                 <version>${jna.version}</version>
             </dependency>
+            <dependency>
+                <groupId>jline</groupId>
+                <artifactId>jline</artifactId>
+                <version>${jline.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>net.minidev</groupId>
+                <artifactId>json-smart</artifactId>
+                <version>${jsonSmart.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>net.minidev</groupId>
+                <artifactId>asm</artifactId>
+                <version>${minidev.asm.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -1148,6 +1056,7 @@
                   <exclude>**/src/test/resources/org/apache/brooklyn/entity/software/base/template_with_extra_substitutions.txt</exclude>
                   <exclude>**/src/main/resources/banner.txt</exclude>
                   <exclude>**/src/test/resources/ssl/certs/localhost/info.txt</exclude>
+                  <exclude>**/src/main/history/dependencies.xml</exclude>
                   <exclude>**/sandbox/examples/src/main/scripts/amis.txt</exclude>
                   <!-- see notes in https://issues.apache.org/jira/browse/BROOKLYN-18 -->
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c8161a64/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1b55f7b..0461e7a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,11 +72,122 @@
     </mailingLists>
 
     <properties>
+        <brooklyn.version>0.9.0-SNAPSHOT</brooklyn.version>  <!-- BROOKLYN_VERSION -->
+
         <!-- Compilation -->
         <java.version>1.7</java.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <brooklyn.version>0.9.0-SNAPSHOT</brooklyn.version>  <!-- BROOKLYN_VERSION -->
+
+        <!-- Testing -->
+        <cobertura.plugin.version>2.7</cobertura.plugin.version>
+        <surefire.version>2.18.1</surefire.version>
+        <plantuml.version>6121</plantuml.version>
+        <ant.version>1.8.4</ant.version>
+        <includedTestGroups />
+        <excludedTestGroups>Integration,Acceptance,Live,WIP</excludedTestGroups>
+        <surefire.failIfNoSpecifiedTests>false</surefire.failIfNoSpecifiedTests>
+
+        <!-- Dependencies -->
+        <jclouds.groupId>org.apache.jclouds</jclouds.groupId> <!-- JCLOUDS_GROUPID_VERSION -->
+
+        <!-- These dependencies also appear in usage/downstream-parent/pom.xml -
+           - please synchronise versions between these two pom files -->
+        <jclouds.version>1.9.1</jclouds.version> <!-- JCLOUDS_VERSION -->
+        <logback.version>1.0.7</logback.version>
+        <slf4j.version>1.6.6</slf4j.version>  <!-- used for java.util.logging jul-to-slf4j interception -->
+        <guava.version>17.0</guava.version>
+        <xstream.version>1.4.7</xstream.version>
+        <jackson.version>1.9.13</jackson.version>  <!-- codehaus jackson, used by brooklyn rest server -->
+        <fasterxml.jackson.version>2.4.2</fasterxml.jackson.version>  <!-- more recent jackson, but not compatible with old annotations! -->
+        <jersey.version>1.18.1</jersey.version>
+        <httpclient.version>4.4.1</httpclient.version>
+        <commons-lang3.version>3.1</commons-lang3.version>
+        <groovy.version>2.3.4</groovy.version> <!-- Version supported by https://github.com/groovy/groovy-eclipse/wiki/Groovy-Eclipse-2.9.0-Release-Notes -->
+        <jsr305.version>2.0.1</jsr305.version>
+        <snakeyaml.version>1.11</snakeyaml.version>
+
+        <!-- Ordinary dependencies -->
+        <testng.version>6.8.8</testng.version>
+        <mockito.version>1.10.8</mockito.version>
+        <swagger.version>1.0.1</swagger.version>
+        <jansi.version>1.2.1</jansi.version>
+        <gson.version>2.3</gson.version>
+        <ivy.version>2.2.0</ivy.version>
+        <mx4j.version>3.0.1</mx4j.version>
+        <bouncycastle.version>1.49</bouncycastle.version>
+        <sshj.version>0.8.1</sshj.version>
+        <felix.framework.version>4.4.0</felix.framework.version>
+        <reflections.version>0.9.9-RC1</reflections.version>
+        <jetty.version>8.1.17.v20150415</jetty.version>
+        <airline.version>0.6</airline.version>
+        <mockwebserver.version>20121111</mockwebserver.version>
+        <freemarker.version>2.3.22</freemarker.version>
+        <commons-io.version>2.4</commons-io.version>
+        <hazelcast.version>3.0</hazelcast.version>
+        <jsonPath.version>2.0.0</jsonPath.version>
+        <commons-compress.version>1.4</commons-compress.version>
+        <qpid.version>0.20</qpid.version>
+        <mongodb.version>3.0.3</mongodb.version>
+        <riak.version>1.4.0</riak.version>
+        <maven-war-plugin.version>2.4</maven-war-plugin.version>
+        <validation-api.version>1.0.0.GA</validation-api.version>
+        <geronimo-jms_1.1_spec.version>1.1.1</geronimo-jms_1.1_spec.version>
+        <sleepycat-je.version>5.0.34</sleepycat-je.version>
+        <org.marre.smsj.version>1.0.0-20051126</org.marre.smsj.version>
+        <mysql-connector-java.version>5.1.18</mysql-connector-java.version>
+        <hadoop.version>1.0.2</hadoop.version>
+        <commons-cli.version>1.2</commons-cli.version>
+        <postgresql.version>9.1-901.jdbc4</postgresql.version>
+        <activemq.version>5.10.0</activemq.version>
+        <rabbitmq-version>2.8.7</rabbitmq-version>
+        <kafka.version>0.8.2.1</kafka.version>
+        <storm.version>0.8.2</storm.version>
+        <redis.version>1.5.2</redis.version>
+        <astyanax.version>1.56.24</astyanax.version>
+        <jcouchdb.version>0.11.0-1</jcouchdb.version>
+        <solr.version>4.7.0</solr.version>
+        <jtidy.version>r8-20060801</jtidy.version>
+        <opendmk_jmxremote_optional_jar.version>1.0-b01-ea</opendmk_jmxremote_optional_jar.version>
+        <resteasy.version>3.0.8.Final</resteasy.version>
+        <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
+        <jopt.version>4.3</jopt.version>
+        <concurrentlinkedhashmap.version>1.0_jdk5</concurrentlinkedhashmap.version>
+        <maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version>
+        <nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version>
+        <nodejs-maven-binaries.version>0.10.25</nodejs-maven-binaries.version>
+        <jasmine-maven-plugin.version>1.3.1.5</jasmine-maven-plugin.version>
+        <requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version>
+        <maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
+        <jetty-orbit-javax-servlet.version>3.0.0.v201112011016</jetty-orbit-javax-servlet.version>
+        <jcommander.version>1.27</jcommander.version>
+        <xml-apis.version>1.0.b2</xml-apis.version>
+        <jsr250-api.version>1.0</jsr250-api.version>
+        <guice.version>3.0</guice.version>
+        <javax-inject.version>1</javax-inject.version>
+        <aopalliance.version>1.0</aopalliance.version>
+        <commons-configuration.version>1.7</commons-configuration.version>
+        <commons-lang.version>2.4</commons-lang.version>
+        <hamcrest.version>1.1</hamcrest.version>
+        <jsr311-api.version>1.1.1</jsr311-api.version>
+        <maxmind.version>0.8.1</maxmind.version>
+        <jna.version>4.0.0</jna.version>
+        <winrm4j.version>0.1.0</winrm4j.version>
+        <coverage.target>${working.dir}</coverage.target>
+
+        <!-- Transitive dependencies, declared explicitly to avoid version mismatch -->
+        <clojure.version>1.4.0</clojure.version>
+        <zookeeper.version>3.3.4</zookeeper.version>
+        <ring-core.version>1.1.5</ring-core.version>
+        <clj-time.version>0.4.1</clj-time.version>
+        <commons-codec.version>1.9</commons-codec.version>
+        <log4j.version>1.2.17</log4j.version>
+        <commons-logging.version>1.2</commons-logging.version>
+        <jline.version>2.12</jline.version>
+        <jsonSmart.version>2.1.1</jsonSmart.version>
+        <minidev.asm.version>1.0.2</minidev.asm.version>
+
+        <!-- Compilation -->
     </properties>
 
     <modules>


[02/12] incubator-brooklyn git commit: [BROOKLYN-183] Skeleton for karaf container

Posted by ha...@apache.org.
[BROOKLYN-183] Skeleton for karaf container


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

Branch: refs/heads/master
Commit: b9d5a46f383ee3e13cabce74725db04baede2b24
Parents: 9a80ebe
Author: Hadrian Zbarcea <ha...@apache.org>
Authored: Tue Sep 22 20:05:01 2015 -0400
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 00:58:37 2015 +0300

----------------------------------------------------------------------
 karaf/apache-brooklyn/pom.xml                   | 123 +++++++++++++++++
 .../filtered-resources/etc/branding.properties  |  35 +++++
 .../src/main/resources/etc/custom.properties    | 114 ++++++++++++++++
 .../resources/etc/org.ops4j.pax.logging.cfg     |  46 +++++++
 .../src/main/resources/etc/system.properties    | 133 +++++++++++++++++++
 karaf/features/pom.xml                          |  54 ++++++++
 karaf/features/src/main/resources/features.xml  |  12 ++
 karaf/pom.xml                                   | 123 +++++++++++++++++
 pom.xml                                         |   1 +
 9 files changed, 641 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/apache-brooklyn/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/pom.xml b/karaf/apache-brooklyn/pom.xml
new file mode 100755
index 0000000..f3374a6
--- /dev/null
+++ b/karaf/apache-brooklyn/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn-karaf</artifactId>
+    <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+  </parent>
+
+  <artifactId>apache-brooklyn</artifactId>
+  <packaging>karaf-assembly</packaging>
+  <name>Brooklyn Karaf Distro</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>framework</artifactId>
+      <version>${karaf.version}</version>
+      <type>kar</type>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>standard</artifactId>
+      <classifier>features</classifier>
+      <version>${karaf.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>enterprise</artifactId>
+      <classifier>features</classifier>
+      <version>${karaf.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!--dependency>
+      <groupId>org.apache.brooklyn</groupId>
+      <artifactId>features</artifactId>
+      <version>${project.version}</version>
+      <type>xml</type>
+      <classifier>features</classifier>
+      <scope>runtime</scope>
+    </dependency-->
+
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+        <includes>
+         <include>**/*</include>
+        </includes>
+      </resource>
+      <resource>
+	<directory>src/main/filtered-resources</directory>
+	<filtering>true</filtering>
+	<includes>
+         <include>**/*</include>
+	</includes>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <bootFeatures>
+            <bootFeature>aries-blueprint</bootFeature>
+            <bootFeature>bundle</bootFeature>
+            <bootFeature>config</bootFeature>
+            <bootFeature>deployer</bootFeature>
+            <bootFeature>diagnostic</bootFeature>
+            <bootFeature>feature</bootFeature>
+            <bootFeature>instance</bootFeature>
+            <bootFeature>jaas</bootFeature>
+            <bootFeature>kar</bootFeature>
+            <bootFeature>log</bootFeature>
+            <bootFeature>management</bootFeature>
+            <bootFeature>package</bootFeature>
+            <bootFeature>service</bootFeature>
+            <bootFeature>shell</bootFeature>
+            <bootFeature>shell-compat</bootFeature>
+            <bootFeature>ssh</bootFeature>
+            <bootFeature>system</bootFeature>
+            <bootFeature>wrap</bootFeature>
+            <!--bootFeature>brooklyn-core</bootFeature-->
+          </bootFeatures>
+	    </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/apache-brooklyn/src/main/filtered-resources/etc/branding.properties
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/filtered-resources/etc/branding.properties b/karaf/apache-brooklyn/src/main/filtered-resources/etc/branding.properties
new file mode 100755
index 0000000..714c7db
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/filtered-resources/etc/branding.properties
@@ -0,0 +1,35 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+welcome = \
+\u001B[33m\u001B[0m\n\
+\u001B[33m  _                     _    _              \u001B[0m\n\
+\u001B[33m | |__  _ __ ___   ___ | | _| |_   _ _ __ (R) \u001B[0m\n\
+\u001B[33m | '_ \\| '__/ _ \\ / _ \\| |/ / | | | | '_ \\  \u001B[0m\n\
+\u001B[33m | |_) | | | (_) | (_) |   <| | |_| | | | |  \u001B[0m\n\
+\u001B[33m |_.__/|_|  \\___/ \\___/|_|\\_\\_|\\__, |_| |_|  \u001B[0m\n\
+\u001B[33m                               |___/              \u001B[0m\n\
+\u001B[33m                                             \u001B[0m\n\
+\u001B[33m http://brooklyn.incubator.apache.org \u001B[0m\n\
+\u001B[33m (version ${project.version})\u001B[0m\n\
+\u001B[33m\u001B[0m\n\
+\u001B[33mHit '\u001B[1m<tab>\u001B[0m' for a list of available commands\u001B[0m\n\
+\u001B[33mand '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\u001B[0m\n\
+\u001B[33mHit '\u001B[1m<ctrl-d>\u001B[0m' or '\u001B[1mosgi:shutdown\u001B[0m' to shutdown\u001B[0m\n\
+\u001B[33m\u001B[0m\n\

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
new file mode 100644
index 0000000..912207f
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties
@@ -0,0 +1,114 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+#
+# You can place any customized configuration here.
+# All the values specified here will override the default value.
+#
+
+karaf.systemBundlesStartLevel=50
+
+org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom
+
+org.osgi.framework.system.packages.extra = \
+  org.apache.karaf.branding, \
+  com.sun.org.apache.xalan.internal.xsltc.trax, \
+  com.sun.org.apache.xerces.internal.dom, \
+  com.sun.org.apache.xerces.internal.jaxp, \
+  com.sun.org.apache.xerces.internal.xni, \
+  com.sun.jndi.ldap, \
+  org.apache.xalan.extensions; version="2.7.1", \
+  org.apache.xalan.xsltc.compiler; version="2.7.1", \
+  org.apache.xalan.xsltc.cmdline.getopt; version="2.7.1", \
+  org.apache.xalan.xsltc.util; version="2.7.1", \
+  org.apache.xalan.transformer; version="2.7.1", \
+  org.apache.xalan.xsltc.trax; version="2.7.1", \
+  org.apache.xalan.processor; version="2.7.1", \
+  org.apache.xalan.lib; version="2.7.1", \
+  org.apache.xalan.trace; version="2.7.1", \
+  org.apache.xalan.xsltc.compiler.util; version="2.7.1", \
+  org.apache.xalan.templates; version="2.7.1", \
+  org.apache.xalan.xsltc; version="2.7.1", \
+  org.apache.xalan.xsltc.runtime; version="2.7.1", \
+  org.apache.xalan; version="2.7.1", \
+  org.apache.xalan.xslt; version="2.7.1", \
+  org.apache.xalan.lib.sql; version="2.7.1", \
+  org.apache.xalan.xsltc.runtime.output; version="2.7.1", \
+  org.apache.xalan.xsltc.dom; version="2.7.1", \
+  org.apache.xalan.client; version="2.7.1", \
+  org.apache.xalan.xsltc.cmdline; version="2.7.1", \
+  org.apache.xalan.serialize; version="2.7.1", \
+  org.apache.xalan.res; version="2.7.1", \
+  org.apache.xml.dtm.ref; version="2.7.1", \
+  org.apache.xml.dtm; version="2.7.1", \
+  org.apache.xml.dtm.ref.sax2dtm; version="2.7.1", \
+  org.apache.xml.dtm.ref.dom2dtm; version="2.7.1", \
+  org.apache.xml.res; version="2.7.1", \
+  org.apache.xml.serializer.dom3; version="2.7.1", \
+  org.apache.xml.serializer; version="2.7.1", \
+  org.apache.xml.serializer.utils; version="2.7.1", \
+  org.apache.xml.utils.res; version="2.7.1", \
+  org.apache.xml.utils; version="2.7.1", \
+  org.apache.xpath.functions; version="2.7.1", \
+  org.apache.xpath.jaxp; version="2.7.1", \
+  org.apache.xpath.patterns; version="2.7.1", \
+  org.apache.xpath.objects; version="2.7.1", \
+  org.apache.xpath.res; version="2.7.1", \
+  org.apache.xpath; version="2.7.1", \
+  org.apache.xpath.axes; version="2.7.1", \
+  org.apache.xpath.compiler; version="2.7.1", \
+  org.apache.xpath.operations; version="2.7.1", \
+  org.apache.xpath.domapi; version="2.7.1", \
+  org.apache.html.dom; version="2.11.0", \
+  org.apache.wml.dom; version="2.11.0", \
+  org.apache.wml; version="2.11.0", \
+  org.apache.xerces.parsers; version="2.11.0", \
+  org.apache.xerces.impl.dtd.models; version="2.11.0", \
+  org.apache.xerces.xni.parser; version="2.11.0", \
+  org.apache.xerces.impl.dv.xs; version="2.11.0", \
+  org.apache.xerces.impl.xs.traversers; version="2.11.0", \
+  org.apache.xerces.util; version="2.11.0", \
+  org.apache.xerces.impl.dtd; version="2.11.0", \
+  org.apache.xerces.jaxp.validation; version="2.11.0", \
+  org.apache.xerces.dom3.as; version="2.11.0", \
+  org.apache.xerces.impl.dv; version="2.11.0", \
+  org.apache.xerces.jaxp; version="2.11.0", \
+  org.apache.xerces.jaxp.datatype; version="2.11.0", \
+  org.apache.xerces.impl.xpath.regex; version="2.11.0", \
+  org.apache.xerces.xni; version="2.11.0", \
+  org.apache.xerces.impl.msg; version="2.11.0", \
+  org.apache.xerces.impl.dv.util; version="2.11.0", \
+  org.apache.xerces.impl.xs.util; version="2.11.0", \
+  org.apache.xerces.dom; version="2.11.0", \
+  org.apache.xerces.dom.events; version="2.11.0", \
+  org.apache.xerces.impl.xs.opti; version="2.11.0", \
+  org.apache.xerces.impl; version="2.11.0", \
+  org.apache.xerces.xs; version="2.11.0", \
+  org.apache.xerces.impl.io; version="2.11.0", \
+  org.apache.xerces.xpointer; version="2.11.0", \
+  org.apache.xerces.impl.dv.dtd; version="2.11.0", \
+  org.apache.xerces.xinclude; version="2.11.0", \
+  org.apache.xerces.impl.xpath; version="2.11.0", \
+  org.apache.xerces.xs.datatypes; version="2.11.0", \
+  org.apache.xerces.impl.xs.identity; version="2.11.0", \
+  org.apache.xerces.impl.xs.models; version="2.11.0", \
+  org.apache.xerces.xni.grammars; version="2.11.0", \
+  org.apache.xerces.impl.xs; version="2.11.0", \
+  org.apache.xerces.impl.validation; version="2.11.0", \
+  org.apache.xml.serialize; version="2.11.0"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/apache-brooklyn/src/main/resources/etc/org.ops4j.pax.logging.cfg
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/etc/org.ops4j.pax.logging.cfg b/karaf/apache-brooklyn/src/main/resources/etc/org.ops4j.pax.logging.cfg
new file mode 100755
index 0000000..26de433
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/resources/etc/org.ops4j.pax.logging.cfg
@@ -0,0 +1,46 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+# Root logger
+log4j.rootLogger=INFO, out, osgi:VmLogAppender
+log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.RollingFileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+log4j.appender.out.file=${karaf.home}/log/brooklyn.log
+log4j.appender.out.append=true
+log4j.appender.out.maxFileSize=1MB
+log4j.appender.out.maxBackupIndex=10
+
+# Sift appender
+log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
+log4j.appender.sift.key=bundle.name
+log4j.appender.sift.default=brooklyn
+log4j.appender.sift.appender=org.apache.log4j.FileAppender
+log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
+log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n
+log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
+log4j.appender.sift.appender.append=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/apache-brooklyn/src/main/resources/etc/system.properties
----------------------------------------------------------------------
diff --git a/karaf/apache-brooklyn/src/main/resources/etc/system.properties b/karaf/apache-brooklyn/src/main/resources/etc/system.properties
new file mode 100644
index 0000000..a95f167
--- /dev/null
+++ b/karaf/apache-brooklyn/src/main/resources/etc/system.properties
@@ -0,0 +1,133 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+#
+# The properties defined in this file will be made available through system
+# properties at the very beginning of the Karaf's boot process.
+#
+
+
+# Log level when the pax-logging service is not available
+# This level will only be used while the pax-logging service bundle
+# is not fully available.
+# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
+# instead.
+org.ops4j.pax.logging.DefaultServiceLog.level = ERROR
+
+#
+# Name of this Karaf instance.
+#
+karaf.name = brooklyn
+
+#
+# Default repository where bundles will be loaded from before using
+# other Maven repositories.  For the full Maven configuration, see
+# the org.ops4j.pax.url.mvn.cfg file.
+#
+karaf.default.repository = system
+
+#
+# Location of a shell script that will be run when starting a shell
+# session.  This script can be used to create aliases and define
+# additional commands.
+#
+karaf.shell.init.script = ${karaf.etc}/shell.init.script
+
+#
+# Sets the maximum size of the shell command history. If not set,
+# defaults to 500 entries. Setting to 0 will disable history.
+#
+# karaf.shell.history.maxSize = 0
+
+#
+# Deletes the entire karaf.data directory at every start
+#
+karaf.clean.all = false
+
+#
+# Deletes the karaf.data/cache directory at every start
+#
+karaf.clean.cache = false
+
+#
+# Roles to use when logging into a local Karaf console.
+#
+# The syntax is the following:
+#   [classname:]principal
+# where classname is the class name of the principal object
+# (defaults to org.apache.karaf.jaas.modules.RolePrincipal)
+# and principal is the name of the principal of that class
+# (defaults to instance).
+#
+karaf.local.roles = admin,manager,viewer,systembundles
+
+#
+# Set this empty property to avoid errors when validating xml documents.
+#
+xml.catalog.files =
+
+#
+# Suppress the bell in the console when hitting backspace too many times
+# for example
+#
+jline.nobell = true
+
+#
+# ServiceMix specs options
+#
+org.apache.servicemix.specs.debug = false
+org.apache.servicemix.specs.timeout = 0
+
+#
+# Settings for the OSGi 4.3 Weaving
+# By default, we will not weave any classes. Change this setting to include classes
+# that you application needs to have woven.
+#
+org.apache.aries.proxy.weaving.enabled = none
+# Classes not to weave - Aries default + Xerces which is known to have issues.
+org.apache.aries.proxy.weaving.disabled = org.objectweb.asm.*,org.slf4j.*,org.apache.log4j.*,javax.*,org.apache.xerces.*
+
+#
+# By default, only Karaf shell commands are secured, but additional services can be
+# secured by expanding this filter
+#
+karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*))
+
+#
+# Security properties
+#
+# To enable OSGi security, uncomment the properties below,
+# install the framework-security feature and restart.
+#
+#java.security.policy=${karaf.etc}/all.policy
+#org.osgi.framework.security=osgi
+#org.osgi.framework.trust.repositories=${karaf.etc}/trustStore.ks
+
+#
+# HA/Lock configuration
+#
+# Karaf uses a lock mechanism to know which instance is the master (HA)
+# The lock can be on the filesystem (default) or on a database.
+#
+# See http://karaf.apache.org/manual/latest/users-guide/failover.html for details.
+#
+# Even using a single instance, Karaf creates the lock file
+# You can specify the location of the lock file using the
+# karaf.lock.dir=/path/to/the/directory/containing/the/lock
+#

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/features/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/features/pom.xml b/karaf/features/pom.xml
new file mode 100755
index 0000000..50dd5a7
--- /dev/null
+++ b/karaf/features/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn-karaf</artifactId>
+    <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+  </parent>
+
+  <artifactId>brooklyn-features</artifactId>
+  <name>Brooklyn Karaf Features</name>
+
+  <build>
+    <resources>
+      <resource>
+	<directory>src/main/resources</directory>
+	<filtering>true</filtering>
+	<includes>
+	  <include>**/*</include>
+	</includes>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+	<groupId>org.codehaus.mojo</groupId>
+	<artifactId>build-helper-maven-plugin</artifactId>
+	<version>1.9.1</version>
+	<executions>
+	  <execution>
+	    <id>attach-artifacts</id>
+	    <phase>process-resources</phase>
+	    <goals>
+	      <goal>attach-artifact</goal>
+	    </goals>
+	    <configuration>
+	      <artifacts>
+		<artifact>
+		  <file>${project.build.outputDirectory}/features.xml</file>
+		  <type>xml</type>
+		  <classifier>features</classifier>
+		</artifact>
+	      </artifacts>
+	    </configuration>
+	  </execution>
+	</executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/resources/features.xml b/karaf/features/src/main/resources/features.xml
new file mode 100755
index 0000000..ff843f9
--- /dev/null
+++ b/karaf/features/src/main/resources/features.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="org.apache.brooklyn-${project.version}">
+
+  <repository>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</repository>
+  <repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
+  <repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
+
+  <!-- TODO: complete the features set -->
+  <feature name="brooklyn-core" version="${project.version}" resolver="(obr)">
+    <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
+  </feature>
+</features>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/pom.xml b/karaf/pom.xml
new file mode 100644
index 0000000..94b7750
--- /dev/null
+++ b/karaf/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn</artifactId>
+    <version>0.9.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+  </parent>
+
+  <artifactId>brooklyn-karaf</artifactId>
+  <name>Brooklyn Karaf</name>
+  <packaging>pom</packaging>
+
+  <properties>
+    <karaf.version>4.0.1</karaf.version>
+
+    <org.osgi.core.version>6.0.0</org.osgi.core.version>
+    <org.osgi.compendium.version>5.0.0</org.osgi.compendium.version>
+    
+    <lifecycle-mapping-plugin.version>1.0.0</lifecycle-mapping-plugin.version>
+
+    <maven.compiler.source>${java.version}</maven.compiler.source>
+    <maven.compiler.target>${java.version}</maven.compiler.target>
+  </properties>
+
+  <modules>
+    <module>features</module>
+    <module>apache-brooklyn</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+	<plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>${lifecycle-mapping-plugin.version}</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <versionRange>[0,)</versionRange>
+                    <goals>
+                      <goal>enforce</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>build-helper-maven-plugin</artifactId>
+                    <versionRange>[0,)</versionRange>
+                    <goals>
+                      <goal>attach-artifact</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <versionRange>[0,)</versionRange>
+                    <goals>
+                      <goal>assembly</goal>
+                      <goal>commands-generate-help</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+                
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  
+  <repositories>
+    <repository>
+      <id>servicemix</id>
+      <name>Apache ServiceMix Repository</name>
+      <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d5a46f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8e4c265..1b55f7b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,6 +90,7 @@
         <module>policy</module>
 
         <module>locations/jclouds</module>
+        <module>karaf</module>
 
         <!-- module>sandbox/cassandra-multicloud-snitch</module -->
         <!-- module>sandbox/database</module -->


[09/12] incubator-brooklyn git commit: [BROOKLYN-183] Completed brooklyn-core as karaf feature

Posted by ha...@apache.org.
[BROOKLYN-183] Completed brooklyn-core as karaf feature

* also split brooklyn-* bundles into different standalone features
* clean up bundle dependencies


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

Branch: refs/heads/master
Commit: dadf87ac6ec765244573f0edb4ab8d0d66a9a52a
Parents: 04bb1f2
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Sat Oct 10 23:43:19 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Sun Oct 25 01:04:51 2015 +0300

----------------------------------------------------------------------
 karaf/features/src/main/feature/feature.xml     | 45 +++++++++++++++++---
 .../features/src/main/history/dependencies.xml  | 24 +++++++++++
 2 files changed, 64 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/dadf87ac/karaf/features/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml
index d308bce..c6cfed6 100644
--- a/karaf/features/src/main/feature/feature.xml
+++ b/karaf/features/src/main/feature/feature.xml
@@ -22,15 +22,37 @@
     <repository>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</repository>
     <repository>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</repository>
   
-    <!-- TODO: complete the features set -->
+    <feature name="brooklyn-utils-common" version="${project.version}" description="Brooklyn Common Utils">
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/${project.version}</bundle>
+
+        <bundle dependency="true">mvn:com.google.guava/guava/${guava.version}</bundle>
+        <bundle dependency="true">mvn:org.codehaus.groovy/groovy-all/${groovy.version}</bundle>
+        <bundle dependency="true">mvn:commons-io/commons-io/${commons-io.version}</bundle>
+        <bundle dependency="true">mvn:org.slf4j/jul-to-slf4j/${slf4j.version}</bundle>
+        <bundle dependency="true">mvn:org.yaml/snakeyaml/${snakeyaml.version}</bundle>
+
+        <bundle dependency="true">mvn:ch.qos.logback/logback-classic/${logback.version}</bundle>
+        <bundle dependency="true">mvn:ch.qos.logback/logback-core/${logback.version}</bundle>
+    </feature>
+
+    <feature name="brooklyn-utils-groovy" version="${project.version}" description="Brooklyn Groovy Utils">
+        <feature>brooklyn-utils-common</feature>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/${project.version}</bundle>
+    </feature>
+
+    <feature name="brooklyn-api"  version="${project.version}" description="Brooklyn API">
+        <feature>brooklyn-utils-common</feature>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-api/${project.version}</bundle>
+    </feature>
+
     <feature name="brooklyn-core" version="${project.version}" description="Brooklyn Core">
+        <feature>brooklyn-api</feature>
+
         <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle>
-        <bundle>mvn:org.apache.brooklyn/brooklyn-api/${project.version}</bundle>
-        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/${project.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-rt-osgi/${project.version}</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-utils-groovy/${project.version}</bundle>
-        <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/${project.version}</bundle>
     
-        <bundle dependency="true">mvn:com.google.guava/guava/${guava.version}</bundle>
         <bundle dependency="true">mvn:com.google.code.gson/gson/${gson.version}</bundle>
         <bundle dependency="true">mvn:com.jayway.jsonpath/json-path/${jsonPath.version}</bundle>
         <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version}</bundle>
@@ -39,11 +61,24 @@
         <bundle dependency="true">mvn:net.minidev/json-smart/${jsonSmart.version}</bundle>
         <bundle dependency="true">mvn:net.minidev/asm/${minidev.asm.version}</bundle>
         <bundle dependency="true">mvn:com.thoughtworks.xstream/xstream/${xstream.version}</bundle>
+        <bundle dependency="true">mvn:org.freemarker/freemarker/${freemarker.version}</bundle>
+        <bundle dependency="true">mvn:net.schmizz/sshj/${sshj.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jzlib/1.1.3_2</bundle> <!-- jzlib version is 1.1.3, but bundle is 1.1.3_2 -->
+        <bundle dependency="true">mvn:org.bouncycastle/bcprov-ext-jdk15on/${bouncycastle.version}</bundle>
+        <bundle dependency="true">mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
+        <bundle dependency="true">mvn:commons-codec/commons-codec/${commons-codec.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.commons/commons-lang3/${commons-lang3.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.httpcomponents/httpcore-osgi/${httpclient.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient.version}</bundle>
+        <bundle dependency="true">mvn:org.codehaus.jackson/jackson-core-asl/${jackson.version}</bundle>
+        <bundle dependency="true">mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson.version}</bundle>
+        <bundle dependency="true">mvn:org.codehaus.jackson/jackson-jaxrs/${jackson.version}</bundle>
 
         <!-- TODO: don't use wrap: -->
         <bundle dependency="true">wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle> <!-- from geoip -->
         <bundle dependency="true">wrap:mvn:com.maxmind.geoip2/geoip2/${maxmind.version}</bundle> <!-- from geoip2 -->
         <bundle dependency="true">wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle> <!-- from com.thoughtworks.xstream/xstream -->
+        <bundle dependency="true">wrap:mvn:org.reflections/reflections/${reflections.version}</bundle>
     </feature>
   
     <feature name="brooklyn-commands"  version="${project.version}"  description="Brooklyn Shell Commands">

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/dadf87ac/karaf/features/src/main/history/dependencies.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/history/dependencies.xml b/karaf/features/src/main/history/dependencies.xml
index d90b75f..a77e8ad 100644
--- a/karaf/features/src/main/history/dependencies.xml
+++ b/karaf/features/src/main/history/dependencies.xml
@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org.apache.brooklyn-0.9.0-SNAPSHOT">
     <feature version="0.0.0">
+        <feature prerequisite="false" dependency="false">brooklyn-api</feature>
+        <feature prerequisite="false" dependency="false">brooklyn-utils-common</feature>
+        <feature prerequisite="false" dependency="false">brooklyn-utils-common</feature>
+        <bundle>mvn:ch.qos.logback/logback-classic/1.0.7</bundle>
+        <bundle>mvn:ch.qos.logback/logback-core/1.0.7</bundle>
         <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.2</bundle>
         <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.4.2</bundle>
         <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.4.2</bundle>
@@ -8,16 +13,35 @@
         <bundle>mvn:com.google.guava/guava/17.0</bundle>
         <bundle>mvn:com.jayway.jsonpath/json-path/2.0.0</bundle>
         <bundle>mvn:com.thoughtworks.xstream/xstream/1.4.7</bundle>
+        <bundle>mvn:commons-codec/commons-codec/1.9</bundle>
+        <bundle>mvn:commons-io/commons-io/2.4</bundle>
         <bundle>mvn:net.minidev/asm/1.0.2</bundle>
         <bundle>mvn:net.minidev/json-smart/2.1.1</bundle>
+        <bundle>mvn:net.schmizz/sshj/0.8.1</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-api/0.9.0-SNAPSHOT</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-commands/0.9.0-SNAPSHOT</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-core/0.9.0-SNAPSHOT</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-logback-includes/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-rt-osgi/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/0.9.0-SNAPSHOT</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-utils-common/0.9.0-SNAPSHOT</bundle>
         <bundle>mvn:org.apache.brooklyn/brooklyn-utils-groovy/0.9.0-SNAPSHOT</bundle>
+        <bundle>mvn:org.apache.commons/commons-lang3/3.1</bundle>
+        <bundle>mvn:org.apache.httpcomponents/httpclient-osgi/4.4.1</bundle>
+        <bundle>mvn:org.apache.httpcomponents/httpcore-osgi/4.4.1</bundle>
+        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jzlib/1.1.3_2</bundle>
+        <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/1.49</bundle>
+        <bundle>mvn:org.bouncycastle/bcprov-ext-jdk15on/1.49</bundle>
+        <bundle>mvn:org.codehaus.groovy/groovy-all/2.3.4</bundle>
+        <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.13</bundle>
+        <bundle>mvn:org.codehaus.jackson/jackson-jaxrs/1.9.13</bundle>
+        <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
+        <bundle>mvn:org.freemarker/freemarker/2.3.22</bundle>
+        <bundle>mvn:org.slf4j/jul-to-slf4j/1.6.6</bundle>
+        <bundle>mvn:org.yaml/snakeyaml/1.11</bundle>
         <bundle>wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
         <bundle>wrap:mvn:com.maxmind.geoip2/geoip2/0.8.1</bundle>
+        <bundle>wrap:mvn:org.reflections/reflections/0.9.9-RC1</bundle>
         <bundle>wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle>
     </feature>
 </features>