You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2014/12/18 10:00:28 UTC

karaf git commit: Add convenient methods to get features repository

Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x 8c802b3df -> 08cbaf434


Add convenient methods to get features repository


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/08cbaf43
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/08cbaf43
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/08cbaf43

Branch: refs/heads/karaf-2.x
Commit: 08cbaf4347138af091e21a4e94933ab0a00456d1
Parents: 8c802b3
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Thu Dec 18 10:00:05 2014 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Thu Dec 18 10:00:05 2014 +0100

----------------------------------------------------------------------
 .../apache/karaf/features/FeaturesService.java  |  6 ++++
 .../features/internal/FeaturesServiceImpl.java  | 38 ++++++++++++++++++++
 .../karaf/tooling/features/InstallKarsMojo.java |  6 ++++
 3 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/08cbaf43/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java b/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
index 14d2c1a..3a39b48 100644
--- a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
+++ b/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
@@ -55,6 +55,12 @@ public interface FeaturesService {
 
     Repository[] listRepositories();
 
+    Repository getRepository(String name);
+
+    Repository getRepository(URI url);
+
+    String getRepositoryName(URI url);
+
     void installFeature(String name) throws Exception;
 
     void installFeature(String name, EnumSet<Option> options) throws Exception;

http://git-wip-us.apache.org/repos/asf/karaf/blob/08cbaf43/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
index f9be300..1b74006 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
@@ -349,6 +349,44 @@ public class FeaturesServiceImpl implements FeaturesService {
     }
 
     /**
+     * Get the repository identified by the given URI.
+     *
+     * @param uri the repository URI.
+     * @return the repository.
+     */
+    public Repository getRepository(URI uri) {
+        return repositories.get(uri);
+    }
+
+    /**
+     * Get the repository identified by the given name.
+     *
+     * @param name the repository name.
+     * @return the repository.
+     */
+    public Repository getRepository(String name) {
+        for (Repository repo : repositories.values()) {
+            if (repo.getName().equals(name)) {
+                return repo;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Get the repository name for the given URI.
+     *
+     * @param uri the repository URI.
+     * @return the repository name.
+     */
+    public String getRepositoryName(URI uri) {
+        if (repositories.get(uri) != null) {
+            return repositories.get(uri).getName();
+        }
+        return null;
+    }
+
+    /**
      * Install a feature identified by a name.
      *
      * @param name the name of the feature.

http://git-wip-us.apache.org/repos/asf/karaf/blob/08cbaf43/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
----------------------------------------------------------------------
diff --git a/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java b/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
index d647160..d406eb1 100644
--- a/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
+++ b/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
@@ -141,6 +141,12 @@ public class InstallKarsMojo extends MojoSupport {
             return new Repository[0];
         }
 
+        public Repository getRepository(URI url) { return null; }
+
+        public Repository getRepository(String name) { return null; }
+
+        public String getRepositoryName(URI url) { return null; }
+
         public void installFeature(String name) throws Exception {
         }