You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2021/02/08 23:49:21 UTC

[felix-atomos] branch master updated: Add a default install() method that takes no prefix

This is an automated email from the ASF dual-hosted git repository.

tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d56cac  Add a default install() method that takes no prefix
9d56cac is described below

commit 9d56cac8921faf04b70dcd101a81d25cb40de5d7
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Mon Feb 8 17:42:05 2021 -0600

    Add a default install() method that takes no prefix
---
 README.md                                                      |  7 +++----
 .../src/main/java/org/apache/felix/atomos/AtomosContent.java   | 10 ++++++++++
 .../java/org/apache/felix/atomos/impl/base/AtomosBase.java     |  2 +-
 .../java/org/apache/felix/atomos/impl/base/AtomosCommands.java |  2 +-
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 34b1a98..8b928a1 100644
--- a/README.md
+++ b/README.md
@@ -129,10 +129,9 @@ As mentioned, `AtomosContent` is contained with an `AtomosLayer`. The following
     framework.init();
     List<Bundle> bundles = new ArrayList<>();
     for (AtomosContent content: atomos.getBootLayer().getAtomosContents()) {
-        // The parameter to install is a prefix that will be used for the bundle
-        // location Atomos designates for the installed bundle.  If null
-        // is used then the prefix of "atomos" is used.
-        bundles.add(content.install(null));
+        // The resulting bundle will use a bundle location of
+        // "atomos:" + atomosContent.getAtomosLocation();
+        bundles.add(content.install());
     }
     for (Bundle b : bundles) {
         b.start();
diff --git a/atomos/src/main/java/org/apache/felix/atomos/AtomosContent.java b/atomos/src/main/java/org/apache/felix/atomos/AtomosContent.java
index 59ba39f..660e50a 100644
--- a/atomos/src/main/java/org/apache/felix/atomos/AtomosContent.java
+++ b/atomos/src/main/java/org/apache/felix/atomos/AtomosContent.java
@@ -100,6 +100,16 @@ public interface AtomosContent extends Comparable<AtomosContent>
      */
     Bundle install(String prefix) throws BundleException;
 
+    /**
+     * Same as {@link #install(String)} using a null prefix.
+     * @return the installed connected bundle
+     * @throws BundleException if an error occurs installing the Atomos content
+     */
+    default Bundle install() throws BundleException
+    {
+        return install(null);
+    }
+
     /** 
      * Returns the connect content for this Atomos content. The returned {@link ConnectContent} can
      * be used to lookup entries from the content directly. If possible, it is preferred to used the bundle
diff --git a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java
index 727b9be..9ee0aa2 100644
--- a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java
+++ b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java
@@ -1624,7 +1624,7 @@ public abstract class AtomosBase implements Atomos, SynchronousBundleListener, F
                     debug("Installing AtomosContent: %s", atomosContent);
                     try
                     {
-                        Bundle b = atomosContent.install("atomos");
+                        Bundle b = atomosContent.install();
                         if (b != null && b.getBundleId() != 0)
                         {
                             bundles.add(b);
diff --git a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosCommands.java b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosCommands.java
index f433e83..a5936bd 100644
--- a/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosCommands.java
+++ b/atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosCommands.java
@@ -136,7 +136,7 @@ public class AtomosCommands
         List<Bundle> bundles = new ArrayList<>();
         for (final AtomosContent atomosBundle : layer.getAtomosContents())
         {
-            bundles.add(atomosBundle.install(null));
+            bundles.add(atomosBundle.install());
         }
         for (final Bundle b : bundles)
         {