felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1702030 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
Date Wed, 09 Sep 2015 14:41:42 GMT
Author: cziegeler
Date: Wed Sep  9 14:41:42 2015
New Revision: 1702030

URL: http://svn.apache.org/r1702030
Log:
FELIX-5001 : scr:list Gogo command should display component configurations

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java?rev=1702030&r1=1702029&r2=1702030&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java Wed Sep  9 14:41:42
2015
@@ -265,21 +265,30 @@ public class ScrCommand implements ScrIn
 
         Collections.sort( descriptions, DESCRIPTION_COMP);
 
-        out.println(" BundleId Component Name Id    State");
+        out.println(" BundleId Component Name Default State");
+        out.println("    Component Id State      PIDs (Factory PID)");
         for(final ComponentDescriptionDTO desc : descriptions)
         {
+            out.println( String.format( " [%1$4d]   %2$s  %3$s", desc.bundle.id, desc.name,
desc.defaultEnabled ? "enabled" : "disabled" ) );
             final List<ComponentConfigurationDTO> configs = new ArrayList<ComponentConfigurationDTO>(this.scrService.getComponentConfigurationDTOs(desc));
-            if ( configs.isEmpty() )
+            Collections.sort( configs, CONFIGURATION_COMP);
+            for ( final ComponentConfigurationDTO component : configs )
             {
-                out.println( String.format( " [%1$4d]   %2$s  --    --", desc.bundle.id,
desc.name  ) );            }
-            else
-            {
-                Collections.sort( configs, CONFIGURATION_COMP);
-                for ( final ComponentConfigurationDTO component : configs )
-                {
-                    out.println( String.format( " [%1$4d]   %2$s [%3$4d] [%4$s]", desc.bundle.id,
desc.name, component.id,
-                          toStateString( component.state )  ) );
+                final Object servicePid = component.properties.get(Constants.SERVICE_PID);
+                final String factoryPid = (String)component.properties.get("service.factoryPid");
+
+                final StringBuilder pid = new StringBuilder();
+                if ( servicePid != null ) {
+                    pid.append(servicePid);
+                }
+                if ( factoryPid != null ) {
+                    pid.append(" (");
+                    pid.append(factoryPid);
+                    pid.append(" )");
                 }
+                out.println( String.format( "    [%1$4d] [%2$s] %3$s", component.id,
+                          toStateString( component.state ),
+                          pid.toString()) );
             }
         }
         out.flush();



Mime
View raw message