felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r759199 - in /felix/trunk/shell/src/main/java/org/apache/felix/shell/impl: Activator.java ExportsCommandImpl.java PackagesCommandImpl.java
Date Fri, 27 Mar 2009 16:27:20 GMT
Author: rickhall
Date: Fri Mar 27 16:27:20 2009
New Revision: 759199

URL: http://svn.apache.org/viewvc?rev=759199&view=rev
Log:
Renamed "packages" command to "exports" and made it more consistent with
"imports" command. (FELIX-1008)

Added:
    felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
      - copied, changed from r758717, felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
Removed:
    felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
Modified:
    felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/Activator.java

Modified: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/Activator.java?rev=759199&r1=759198&r2=759199&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/Activator.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/Activator.java Fri Mar 27
16:27:20 2009
@@ -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(

Copied: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java
(from r758717, felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java)
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java?p2=felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java&p1=felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java&r1=758717&r2=759199&rev=759199&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ExportsCommandImpl.java Fri
Mar 27 16:27:20 2009
@@ -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



Mime
View raw message