karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject git commit: [KARAF-2842] Add a new option to just install bundles (without starting) while installing a feature
Date Tue, 08 Apr 2014 12:47:21 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 2ce5574c9 -> 059c755ac


[KARAF-2842] Add a new option to just install bundles (without starting) while installing
a feature


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

Branch: refs/heads/karaf-3.0.x
Commit: 059c755ac328672ceaaefd2c7b996c1e3cbf962d
Parents: 2ce5574
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Tue Apr 8 14:46:33 2014 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Tue Apr 8 14:46:33 2014 +0200

----------------------------------------------------------------------
 .../features/command/InstallFeatureCommand.java |  5 ++++
 .../apache/karaf/features/FeaturesService.java  |  1 +
 .../features/internal/FeaturesServiceImpl.java  |  4 ++-
 .../management/FeaturesServiceMBean.java        |  4 +++
 .../internal/FeaturesServiceMBeanImpl.java      | 28 ++++++++++++++++++++
 5 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/059c755a/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
b/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
index 371ce2f..1fa6885 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
@@ -35,6 +35,8 @@ public class InstallFeatureCommand extends FeaturesCommandSupport {
     boolean noClean;
     @Option(name = "-r", aliases = "--no-auto-refresh", description = "Do not automatically
refresh bundles", required = false, multiValued = false)
     boolean noRefresh;
+    @Option(name = "-s", aliases = "--no-auto-start", description = "Do not automatically
start bundles", required = false, multiValued = false)
+    boolean noStart;
     @Option(name = "-v", aliases = "--verbose", description = "Explain what is being done",
required = false, multiValued = false)
     boolean verbose;
 
@@ -56,6 +58,9 @@ public class InstallFeatureCommand extends FeaturesCommandSupport {
             if (noClean) {
                 options.add(FeaturesService.Option.NoCleanIfFailure);
             }
+            if (noStart) {
+                options.add(FeaturesService.Option.NoAutoStartBundles);
+            }
             if (verbose) {
                 options.add(FeaturesService.Option.Verbose);
             }

http://git-wip-us.apache.org/repos/asf/karaf/blob/059c755a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java b/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
index 25e3baa..28123e3 100644
--- a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
+++ b/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
@@ -29,6 +29,7 @@ public interface FeaturesService {
         NoCleanIfFailure,
         PrintBundlesToRefresh,
         NoAutoRefreshBundles,
+        NoAutoStartBundles,
         ContinueBatchOnFailure,
         Verbose
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/059c755a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
index 68c7714..a6f9462 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
@@ -429,7 +429,9 @@ public class FeaturesServiceImpl implements FeaturesService {
             }
             for (Bundle b : bundlesSortedByStartLvl) {
                 LOGGER.debug("Starting bundle: {}", b.getSymbolicName());
-                startBundle(state, b);
+                if (!options.contains(Option.NoAutoStartBundles)) {
+                    startBundle(state, b);
+                }
             }
             // Clean up for batch
             if (!options.contains(Option.NoCleanIfFailure)) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/059c755a/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
b/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
index da4a36e..bf8768a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
@@ -36,10 +36,14 @@ public interface FeaturesServiceMBean {
 
     void installFeature(String name, boolean noClean, boolean noRefresh) throws Exception;
 
+    void installFeature(String name, boolean noClean, boolean noRefresh, boolean noStart)
throws Exception;
+
     void installFeature(String name, String version) throws Exception;
 
     void installFeature(String name, String version, boolean noClean, boolean noRefresh)
throws Exception;
 
+    void installFeature(String name, String version, boolean noClean, boolean noRefresh,
boolean noStart) throws Exception;
+
     TabularData infoFeature(String name) throws Exception;
 
     TabularData infoFeature(String name, String version) throws Exception;

http://git-wip-us.apache.org/repos/asf/karaf/blob/059c755a/features/core/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
b/features/core/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
index 700e835..3479586 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
@@ -150,6 +150,20 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
         featuresService.installFeature(name, options);
     }
 
+    public void installFeature(String name, boolean noClean, boolean noRefresh, boolean noStart)
throws Exception {
+        EnumSet<org.apache.karaf.features.FeaturesService.Option> options = EnumSet.noneOf(org.apache.karaf.features.FeaturesService.Option.class);
+        if (noClean) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoCleanIfFailure);
+        }
+        if (noRefresh) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoRefreshBundles);
+        }
+        if (noStart) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoStartBundles);
+        }
+        featuresService.installFeature(name, options);
+    }
+
     public void installFeature(String name, String version) throws Exception {
         featuresService.installFeature(name, version);
     }
@@ -165,6 +179,20 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
         featuresService.installFeature(name, version, options);
     }
 
+    public void installFeature(String name, String version, boolean noClean, boolean noRefresh,
boolean noStart) throws Exception {
+        EnumSet<org.apache.karaf.features.FeaturesService.Option> options = EnumSet.noneOf(org.apache.karaf.features.FeaturesService.Option.class);
+        if (noClean) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoCleanIfFailure);
+        }
+        if (noRefresh) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoRefreshBundles);
+        }
+        if (noStart) {
+            options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoStartBundles);
+        }
+        featuresService.installFeature(name, version, options);
+    }
+
     public TabularData infoFeature(String name) throws Exception {
         try {
             Feature feature = featuresService.getFeature(name);


Mime
View raw message