This is an automated email from the ASF dual-hosted git repository. ggrzybek pushed a commit to branch KARAF-5376-overrides_v2 in repository https://gitbox.apache.org/repos/asf/karaf.git
commit 3cdb1ca0bedf1d8237b535799521d494f7ec5269 Author: Grzegorz Grzybek <[email protected]> AuthorDate: Fri Dec 8 13:23:46 2017 +0100 [KARAF-5376] support -t, -v, --features-wiring and --all-wiring options for feature:refresh command --- .../features/command/RefreshFeaturesCommand.java | 19 ++++++++++++++++++- .../org/apache/karaf/features/FeaturesService.java | 2 +- .../internal/service/FeaturesServiceImpl.java | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/features/command/src/main/java/org/apache/karaf/features/command/RefreshFeaturesCommand.java b/features/command/src/main/java/org/apache/karaf/features/command/RefreshFeaturesCommand.java index 6a89978..4ecfad4 100644 --- a/features/command/src/main/java/org/apache/karaf/features/command/RefreshFeaturesCommand.java +++ b/features/command/src/main/java/org/apache/karaf/features/command/RefreshFeaturesCommand.java @@ -18,15 +18,32 @@ package org.apache.karaf.features.command; import org.apache.karaf.features.FeaturesService; import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.Option; import org.apache.karaf.shell.api.action.lifecycle.Service; @Command(scope = "feature", name = "refresh", description = "Reloads features processing instructions and reprovisions existing features.") @Service public class RefreshFeaturesCommand extends FeaturesCommandSupport { + @Option(name = "-v", aliases = "--verbose", description = "Explain what is being done", required = false, multiValued = false) + boolean verbose; + + @Option(name = "-t", aliases = "--simulate", description = "Perform a simulation only", required = false, multiValued = false) + boolean simulate; + + @Option(name = "--features-wiring", description = "Print the wiring between features") + boolean featuresWiring; + + @Option(name = "--all-wiring", description = "Print the full wiring") + boolean allWiring; + protected void doExecute(FeaturesService featuresService) throws Exception { + addOption(FeaturesService.Option.Simulate, simulate); + addOption(FeaturesService.Option.Verbose, verbose); + addOption(FeaturesService.Option.DisplayFeaturesWiring, featuresWiring); + addOption(FeaturesService.Option.DisplayAllWiring, allWiring); try { - featuresService.refreshFeatures(); + featuresService.refreshFeatures(options); } catch (Exception e) { System.err.println("Error refreshing features: " + e.getMessage()); } 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 0a7ebaa..34da205 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 @@ -222,6 +222,6 @@ public interface FeaturesService { String getFeatureXml(Feature feature); - void refreshFeatures() throws Exception; + void refreshFeatures(EnumSet<Option> options) throws Exception; } diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java index f4b8a00..c6626a3 100644 --- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java +++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java @@ -1169,7 +1169,7 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall } @Override - public void refreshFeatures() throws Exception { + public void refreshFeatures(EnumSet<Option> options) throws Exception { Set<URI> uris = new LinkedHashSet<>(); for (Repository r : this.repositories.listRepositories()) { uris.add(r.getURI()); @@ -1179,7 +1179,7 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall this.repositories = new RepositoryCacheImpl(featuresProcessor); State state = copyState(); - doProvisionInThread(state.requirements, emptyMap(), state, getFeaturesById(), EnumSet.noneOf(Option.class)); + doProvisionInThread(state.requirements, emptyMap(), state, getFeaturesById(), options); } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
