karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject karaf git commit: [KARAF-4357] OBR R5 Resources do not have Presentation Names Patch provided by Stephen Kahmann
Date Tue, 01 Mar 2016 13:01:34 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 074b4fbbf -> 3dde697b2


[KARAF-4357] OBR R5 Resources do not have Presentation Names
Patch provided by Stephen Kahmann

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

Branch: refs/heads/karaf-4.0.x
Commit: 3dde697b2025ea20e335f9e24ef358fb579cdac7
Parents: 074b4fb
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Mar 1 13:52:14 2016 +0100
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Mar 1 14:01:28 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/karaf/obr/command/InfoCommand.java |  9 ++++++---
 .../apache/karaf/obr/command/ObrCommandSupport.java    | 13 +++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/3dde697b/obr/src/main/java/org/apache/karaf/obr/command/InfoCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/obr/command/InfoCommand.java b/obr/src/main/java/org/apache/karaf/obr/command/InfoCommand.java
index 905e7dd..616e8cb 100644
--- a/obr/src/main/java/org/apache/karaf/obr/command/InfoCommand.java
+++ b/obr/src/main/java/org/apache/karaf/obr/command/InfoCommand.java
@@ -62,9 +62,12 @@ public class InfoCommand extends ObrCommandSupport {
 
     private void printResource(PrintStream out, Resource resource)
     {
-        printUnderline(out, resource.getPresentationName().length());
-        out.println(resource.getPresentationName());
-        printUnderline(out, resource.getPresentationName().length());
+        // OBR R5 per Spec has no presentation name
+        String resourceId = getResourceId(resource);
+
+        printUnderline(out, resourceId.length());
+        out.println(resourceId);
+        printUnderline(out, resourceId.length());
 
         Map map = resource.getProperties();
         for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); )

http://git-wip-us.apache.org/repos/asf/karaf/blob/3dde697b/obr/src/main/java/org/apache/karaf/obr/command/ObrCommandSupport.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/obr/command/ObrCommandSupport.java b/obr/src/main/java/org/apache/karaf/obr/command/ObrCommandSupport.java
index 5f038b4..83e7e90 100644
--- a/obr/src/main/java/org/apache/karaf/obr/command/ObrCommandSupport.java
+++ b/obr/src/main/java/org/apache/karaf/obr/command/ObrCommandSupport.java
@@ -140,7 +140,7 @@ public abstract class ObrCommandSupport implements Action {
                 printUnderline(System.out, 19);
                 Resource[] resources = resolver.getAddedResources();
                 for (int resIdx = 0; (resources != null) && (resIdx < resources.length);
resIdx++) {
-                    System.out.println("   " + resources[resIdx].getPresentationName()
+                    System.out.println("   " + getResourceId(resources[resIdx])
                             + " (" + resources[resIdx].getVersion() + ")");
                 }
                 resources = resolver.getRequiredResources();
@@ -148,7 +148,7 @@ public abstract class ObrCommandSupport implements Action {
                     System.out.println("\nRequired resource(s):");
                     printUnderline(System.out, 21);
                     for (int resIdx = 0; resIdx < resources.length; resIdx++) {
-                        System.out.println("   " + resources[resIdx].getPresentationName()
+                        System.out.println("   " + getResourceId(resources[resIdx])
                                 + " (" + resources[resIdx].getVersion() + ")");
                     }
                 }
@@ -158,7 +158,7 @@ public abstract class ObrCommandSupport implements Action {
                         System.out.println("\nOptional resource(s):");
                         printUnderline(System.out, 21);
                         for (int resIdx = 0; resIdx < resources.length; resIdx++) {
-                            System.out.println("   " + resources[resIdx].getPresentationName()
+ " (" + resources[resIdx].getVersion() + ")");
+                            System.out.println("   " + getResourceId(resources[resIdx]) +
" (" + resources[resIdx].getVersion() + ")");
                         }
                     }
                 }
@@ -177,7 +177,7 @@ public abstract class ObrCommandSupport implements Action {
                     printUnderline(System.out, 27);
                     for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++) {
                         System.out.println("   " + reqs[reqIdx].getRequirement().getFilter());
-                        System.out.println("      " + reqs[reqIdx].getResource().getPresentationName());
+                        System.out.println("      " + getResourceId(reqs[reqIdx].getResource()));
                     }
                 } else {
                     System.out.println("Could not resolve targets.");
@@ -187,6 +187,9 @@ public abstract class ObrCommandSupport implements Action {
 
     }
 
+    protected String getResourceId(Resource resource) {
+        return resource.getPresentationName() != null ? resource.getPresentationName() :
resource.getSymbolicName();
+    }
 
     protected Requirement parseRequirement(RepositoryAdmin admin, String req) throws InvalidSyntaxException
{
         int p = req.indexOf(':');
@@ -200,6 +203,8 @@ public abstract class ObrCommandSupport implements Action {
                 name = "package";
             } else if (req.contains("service")) {
                 name = "service";
+            } else if (req.contains("osgi.extender")) {
+                name = "osgi.extender";
             } else {
                 name = "bundle";
             }


Mime
View raw message