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:23 UTC
[05/12] incubator-brooklyn git commit: [BROOKLYN-183] Move Apache
Felix code into specific jar
[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 {
-}