Renamed "packages" command to "exports" and made it more consistent with
"imports" command. (FELIX-1008)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@759199 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/Activator.java b/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
index da555b8..3e52769 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
@@ -95,7 +95,7 @@
         // Register "exports" command service.
         context.registerService(
             org.apache.felix.shell.Command.class.getName(),
-            new PackagesCommandImpl(m_context), null);
+            new ExportsCommandImpl(m_context), null);
 
         // Register "headers" command service.
         context.registerService(
diff --git a/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java b/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
similarity index 83%
rename from shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
rename to shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
index 2cf9395..3636c99 100644
--- a/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
+++ b/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
@@ -26,23 +26,23 @@
 import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.packageadmin.PackageAdmin;
 
-public class PackagesCommandImpl implements Command
+public class ExportsCommandImpl implements Command
 {
     private BundleContext m_context = null;
 
-    public PackagesCommandImpl(BundleContext context)
+    public ExportsCommandImpl(BundleContext context)
     {
         m_context = context;
     }
 
     public String getName()
     {
-        return "packages";
+        return "exports";
     }
 
     public String getUsage()
     {
-        return "packages [<id> ...]";
+        return "exports <id> ...";
     }
 
     public String getShortDescription()
@@ -76,6 +76,7 @@
 
         if (st.hasMoreTokens())
         {
+            boolean separatorNeeded = false;
             while (st.hasMoreTokens())
             {
                 String id = st.nextToken();
@@ -84,7 +85,12 @@
                     long l = Long.parseLong(id);
                     Bundle bundle = m_context.getBundle(l);
                     ExportedPackage[] exports = pa.getExportedPackages(bundle);
+                    if (separatorNeeded)
+                    {
+                        out.println("");
+                    }
                     printExports(out, bundle, exports);
+                    separatorNeeded = true;
                 }
                 catch (NumberFormatException ex)
                 {
@@ -96,28 +102,23 @@
                 }
             }
         }
-        else
-        {
-            ExportedPackage[] exports = pa.getExportedPackages((Bundle) null);
-            printExports(out, null, exports);
-        }
     }
 
     private void printExports(PrintStream out, Bundle target, ExportedPackage[] exports)
     {
+        String title = target + " exports:";
+        out.println(title);
+        out.println(Util.getUnderlineString(title));
         if ((exports != null) && (exports.length > 0))
         {
             for (int i = 0; i < exports.length; i++)
             {
-                Bundle bundle = exports[i].getExportingBundle();
-                out.print(Util.getBundleName(bundle));
-                out.println(": " + exports[i]);
+                out.println(exports[i]);
             }
         }
         else
         {
-            out.println(Util.getBundleName(target)
-                + ": No active exported packages.");
+            out.println("Nothing");
         }
     }
 }
\ No newline at end of file