You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/09/19 21:36:54 UTC

svn commit: r1172770 - /felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java

Author: rickhall
Date: Mon Sep 19 19:36:53 2011
New Revision: 1172770

URL: http://svn.apache.org/viewvc?rev=1172770&view=rev
Log:
Apply patch FELIX-3118 to add "required" option to OBR deploy command.

Modified:
    felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java

Modified: felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java?rev=1172770&r1=1172769&r2=1172770&view=diff
==============================================================================
--- felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java (original)
+++ felix/trunk/gogo/command/src/main/java/org/apache/felix/gogo/command/OBR.java Mon Sep 19 19:36:53 2011
@@ -295,6 +295,9 @@ public class OBR
         @Descriptor("start deployed bundles")
         @Parameter(names={ "-s", "--start" }, presentValue="true",
             absentValue="false") boolean start,
+        @Descriptor("deploy required bundles only")
+        @Parameter(names={ "-r", "--required" }, presentValue="true",
+            absentValue="false") boolean required,
         @Descriptor("( <bundle-name> | <symbolic-name> | <bundle-id> )[@<version>] ...")
             String[] args)
         throws IOException, InvalidSyntaxException
@@ -354,22 +357,34 @@ public class OBR
                             + " (" + resources[resIdx].getVersion() + ")");
                     }
                 }
-                resources = resolver.getOptionalResources();
-                if ((resources != null) && (resources.length > 0))
+                if (!required)
                 {
-                    System.out.println("\nOptional resource(s):");
-                    System.out.println(Util.getUnderlineString(21));
-                    for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                    resources = resolver.getOptionalResources();
+                    if ((resources != null) && (resources.length > 0))
                     {
-                        System.out.println("   " + resources[resIdx].getPresentationName()
-                            + " (" + resources[resIdx].getVersion() + ")");
+                        System.out.println("\nOptional resource(s):");
+                        System.out.println(Util.getUnderlineString(21));
+                        for (int resIdx = 0; resIdx < resources.length; resIdx++)
+                        {
+                            System.out.println("   " + resources[resIdx].getPresentationName()
+                                + " (" + resources[resIdx].getVersion() + ")");
+                        }
                     }
                 }
 
                 try
                 {
-                    System.out.print("\nDeploying...");
-                    resolver.deploy(start ? Resolver.START : 0);
+                    System.out.print("\nDeploying...\n");
+                    int options = 0;
+                    if (start)
+                    {
+                        options |= Resolver.START;
+                    }
+                    if (required)
+                    {
+                        options |= Resolver.NO_OPTIONAL_RESOURCES;
+                    }
+                    resolver.deploy(options);
                     System.out.println("done.");
                 }
                 catch (IllegalStateException ex)
@@ -649,4 +664,4 @@ public class OBR
         }
         return sorted;
     }
-}
\ No newline at end of file
+}