You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/11 19:20:45 UTC

[23/33] Revert "[KARAF-2852] Merge features/core and features/command"

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/FeaturesService.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/FeaturesService.java b/features/src/main/java/org/apache/karaf/features/FeaturesService.java
deleted file mode 100644
index ef3dbcf..0000000
--- a/features/src/main/java/org/apache/karaf/features/FeaturesService.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-import java.net.URI;
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * The service managing features repositories.
- */
-public interface FeaturesService {
-
-    enum Option {
-        NoFailOnFeatureNotFound,
-        NoAutoRefreshManagedBundles,
-        NoAutoRefreshUnmanagedBundles,
-        NoAutoRefreshBundles,
-        NoAutoStartBundles,
-        Simulate,
-        Verbose
-    }
-
-    /**
-     * Validate repository contents.
-     * 
-     * @param uri Repository uri.
-     * @throws Exception When validation fails.
-     */
-    void validateRepository(URI uri) throws Exception;
-
-    void addRepository(URI uri) throws Exception;
-
-    void addRepository(URI uri, boolean install) throws Exception;
-
-    void removeRepository(URI uri) throws Exception;
-
-    void removeRepository(URI uri, boolean uninstall) throws Exception;
-    
-    void restoreRepository(URI uri) throws Exception;
-
-    Repository[] listRequiredRepositories() throws Exception;
-
-    Repository[] listRepositories() throws Exception;
-    
-    Repository getRepository(String repoName) throws Exception;
-
-    void installFeature(String name) throws Exception;
-
-    void installFeature(String name, EnumSet<Option> options) throws Exception;
-    
-    void installFeature(String name, String version) throws Exception;
-
-    void installFeature(String name, String version, EnumSet<Option> options) throws Exception;
-
-    void installFeature(Feature f, EnumSet<Option> options) throws Exception;
-
-    void installFeatures(Set<String> features, EnumSet<Option> options) throws Exception;
-
-    void uninstallFeature(String name, EnumSet<Option> options) throws Exception;
-
-    void uninstallFeature(String name) throws Exception;
-
-    void uninstallFeature(String name, String version, EnumSet<Option> options) throws Exception;
-    
-    void uninstallFeature(String name, String version) throws Exception;
-
-    void uninstallFeatures(Set<String> features, EnumSet<Option> options) throws Exception;
-
-    Feature[] listFeatures() throws Exception;
-
-    Feature[] listRequiredFeatures() throws Exception;
-
-    Feature[] listInstalledFeatures() throws Exception;
-
-    boolean isRequired(Feature f);
-
-    boolean isInstalled(Feature f);
-
-    Feature getFeature(String name, String version) throws Exception;
-
-    Feature getFeature(String name) throws Exception;
-
-	void refreshRepository(URI uri) throws Exception;
-
-    public URI getRepositoryUriFor(String name, String version);
-
-    public String[] getRepositoryNames();
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/RegionsPersistence.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/RegionsPersistence.java b/features/src/main/java/org/apache/karaf/features/RegionsPersistence.java
deleted file mode 100644
index 96ca7da..0000000
--- a/features/src/main/java/org/apache/karaf/features/RegionsPersistence.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.karaf.features;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-public interface RegionsPersistence {
-    void install(Bundle b, String regionName) throws BundleException;
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/Repository.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/Repository.java b/features/src/main/java/org/apache/karaf/features/Repository.java
deleted file mode 100644
index 3ea12ec..0000000
--- a/features/src/main/java/org/apache/karaf/features/Repository.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * A repository of features.
- */
-public interface Repository {
-
-    String getName() throws IOException;
-
-    URI getURI();
-
-    URI[] getRepositories() throws Exception;
-
-    Feature[] getFeatures() throws Exception;
-    
-    boolean isValid();
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/RepositoryEvent.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/RepositoryEvent.java b/features/src/main/java/org/apache/karaf/features/RepositoryEvent.java
deleted file mode 100644
index 68f287b..0000000
--- a/features/src/main/java/org/apache/karaf/features/RepositoryEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-import java.util.EventObject;
-
-public class RepositoryEvent extends EventObject {
-
-    public static enum EventType {
-        RepositoryAdded,
-        RepositoryRemoved,
-    }
-
-    private final EventType type;
-    private final Repository repository;
-    private final boolean replay;
-
-    public RepositoryEvent(Repository repository, EventType type, boolean replay) {
-        super(repository);
-        this.type = type;
-        this.repository = repository;
-        this.replay = replay;
-    }
-
-    public EventType getType() {
-        return type;
-    }
-
-    public Repository getRepository() {
-        return repository;
-    }
-
-    public boolean isReplay() {
-        return replay;
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/Requirement.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/Requirement.java b/features/src/main/java/org/apache/karaf/features/Requirement.java
deleted file mode 100644
index 4446335..0000000
--- a/features/src/main/java/org/apache/karaf/features/Requirement.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-public interface Requirement {
-
-    String getValue();
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/Resolver.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/Resolver.java b/features/src/main/java/org/apache/karaf/features/Resolver.java
deleted file mode 100644
index d2fa941..0000000
--- a/features/src/main/java/org/apache/karaf/features/Resolver.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features;
-
-import java.util.List;
-
-public interface Resolver {
-
-    List<BundleInfo> resolve(Feature feature) throws Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/FeaturesCommandSupport.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/FeaturesCommandSupport.java b/features/src/main/java/org/apache/karaf/features/command/FeaturesCommandSupport.java
deleted file mode 100644
index 076650d..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/FeaturesCommandSupport.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-
-public abstract class FeaturesCommandSupport implements Action {
-
-    @Reference
-    private FeaturesService featuresService;
-
-    @Override
-    public Object execute() throws Exception {
-        if (featuresService == null) {
-            throw new IllegalStateException("FeaturesService not found");
-        }
-        doExecute(featuresService);
-        return null;
-    }
-
-    protected abstract void doExecute(FeaturesService admin) throws Exception;
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java b/features/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
deleted file mode 100644
index 5ad855c..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/InfoFeatureCommand.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.karaf.features.BundleInfo;
-import org.apache.karaf.features.Conditional;
-import org.apache.karaf.features.ConfigFileInfo;
-import org.apache.karaf.features.Dependency;
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.command.completers.AllFeatureCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "feature", name = "info", description = "Shows information about selected feature.")
-@Service
-public class InfoFeatureCommand extends FeaturesCommandSupport {
-
-    private static final String INDENT = "  ";
-    private static final String FEATURE_CONTENT = "Feature";
-    private static final String CONDITIONAL_CONTENT = "Conditional(%s)";
-
-	@Argument(index = 0, name = "name", description = "The name of the feature", required = true, multiValued = false)
-    @Completion(AllFeatureCompleter.class)
-    private String name;
-
-    @Argument(index = 1, name = "version", description = "The version of the feature", required = false, multiValued = false)
-    private String version;
-
-    @Option(name = "-c", aliases={"--configuration"}, description="Display configuration info", required = false, multiValued = false)
-    private boolean config;
-
-    @Option(name = "-d", aliases={"--dependency"}, description="Display dependencies info", required = false, multiValued = false)
-    private boolean dependency;
-
-    @Option(name = "-b", aliases={"--bundle"}, description="Display bundles info", required = false, multiValued = false)
-    private boolean bundle;
-
-    @Option(name = "--conditional", description="Display conditional info", required = false, multiValued = false)
-    private boolean conditional;
-
-    @Option(name = "-t", aliases={"--tree"}, description="Display feature tree", required = false, multiValued = false)
-    private boolean tree;
-
-    protected void doExecute(FeaturesService admin) throws Exception {
-        Feature feature = null;
-
-        if (version != null && version.length() > 0) {
-            feature = admin.getFeature(name, version);
-        } else {
-            feature = admin.getFeature(name);
-        }
-
-        if (feature == null) {
-            System.out.println("Feature not found");
-            return;
-        }
-
-        // default behavior
-        if (!config && !dependency && !bundle && !conditional) {
-            config = true;
-            dependency = true;
-            bundle = true;
-            conditional = true;
-        }
-
-        System.out.println("Feature " + feature.getName() + " " + feature.getVersion());
-        if (feature.getDescription() != null) {
-        	System.out.println("Description:");
-        	System.out.println(INDENT + feature.getDescription());
-        }
-        
-        if(feature.getDetails() != null) {
-        	System.out.println("Details:");
-        	printWithIndent(feature.getDetails());
-        }
-
-        if (config) {
-            displayConfigInformation(feature, FEATURE_CONTENT);
-            displayConfigFileInformation(feature, FEATURE_CONTENT);
-        }
-
-        if (dependency) {
-            displayDependencyInformation(feature, FEATURE_CONTENT);
-        }
-
-        if (bundle) {
-            displayBundleInformation(feature, FEATURE_CONTENT);
-        }
-
-        if(conditional) {
-           displayConditionalInfo(feature);
-        }
-
-        if (tree) {
-            if (config || dependency || bundle) {
-                System.out.println("\nFeature tree");
-            }
-
-            int unresolved = displayFeatureTree(admin, feature.getName(), feature.getVersion(), "");
-            if (unresolved > 0) {
-                System.out.println("Tree contains " + unresolved + " unresolved dependencies");
-                System.out.println(" * means that node declares dependency but the dependent feature is not available.");
-            }
-        }
-    }
-
-    private void printWithIndent(String details) {
-    	String[] lines = details.split("\r?\n");
-    	for (String line : lines) {
-			System.out.println(INDENT + line);
-		}
-	}
-
-	private void displayBundleInformation(Feature feature, String contentType) {
-        List<BundleInfo> bundleInfos = feature.getBundles();
-        if (bundleInfos.isEmpty()) {
-            System.out.println(contentType + " has no bundles.");
-        } else {
-            System.out.println(contentType + " contains followed bundles:");
-            for (BundleInfo featureBundle : bundleInfos) {
-                int startLevel = featureBundle.getStartLevel();
-                StringBuilder sb = new StringBuilder();
-                sb.append(INDENT).append(featureBundle.getLocation());
-                if(startLevel > 0) {
-                    sb.append(" start-level=").append(startLevel);
-                }
-                System.out.println(sb.toString());
-            }
-        }
-    }
-
-    private void displayDependencyInformation(Feature feature, String contentType) {
-        List<Dependency> dependencies = feature.getDependencies();
-        if (dependencies.isEmpty()) {
-            System.out.println(contentType + " has no dependencies.");
-        } else {
-            System.out.println(contentType + " depends on:");
-            for (Dependency featureDependency : dependencies) {
-                System.out.println(INDENT + featureDependency.getName() + " " + featureDependency.getVersion());
-            }
-        }
-    }
-
-    private void displayConfigInformation(Feature feature, String contentType) {
-        Map<String, Map<String, String>> configurations = feature.getConfigurations();
-        if (configurations.isEmpty()) {
-            System.out.println(contentType + " has no configuration");
-        } else {
-            System.out.println(contentType + " configuration:");
-            for (String name : configurations.keySet()) {
-                System.out.println(INDENT + name);
-            }
-        }
-    }
-    
-    private void displayConfigFileInformation(Feature feature, String contentType) {
-    	List<ConfigFileInfo> configurationFiles = feature.getConfigurationFiles();
-    	if (configurationFiles.isEmpty()) {
-    		System.out.println(contentType + " has no configuration files");
-    	} else {
-    		System.out.println(contentType + " configuration files: ");
-    		for (ConfigFileInfo configFileInfo : configurationFiles) {
-				System.out.println(INDENT + configFileInfo.getFinalname());
-			}
-    	}    	
-    }
-
-    /**
-     * Called originally with featureName and featureVersion that have already been resolved successfully.
-     *
-     * @param admin
-     * @param featureName
-     * @param featureVersion
-     * @param prefix
-     * @return
-     * @throws Exception
-     */
-    private int displayFeatureTree(FeaturesService admin, String featureName, String featureVersion, String prefix) throws Exception {
-        int unresolved = 0;
-
-        Feature resolved = admin.getFeature(featureName, featureVersion);
-        if (resolved != null) {
-            System.out.println(prefix + " " + resolved.getName() + " " + resolved.getVersion());
-        } else {
-            System.out.println(prefix + " " + featureName + " " + featureVersion + " *");
-            unresolved++;
-        }
-
-        if (resolved != null) {
-            if (bundle) {
-                List<String> bundleLocation = new LinkedList<String>();
-                List<BundleInfo> bundles = resolved.getBundles();
-                for (BundleInfo bundleInfo : bundles) {
-                    bundleLocation.add(bundleInfo.getLocation());
-                }
-
-                if (conditional) {
-                    for (Conditional cond : resolved.getConditional()) {
-                        List<String> condition = cond.getCondition();
-                        List<BundleInfo> conditionalBundles = cond.getBundles();
-                        for (BundleInfo bundleInfo : conditionalBundles) {
-                            bundleLocation.add(bundleInfo.getLocation() + "(condition:"+condition+")");
-                        }
-                    }
-                }
-                for (int i = 0, j = bundleLocation.size(); i < j; i++) {
-                    System.out.println(prefix + " " + (i + 1 == j ? "\\" : "+") + " " + bundleLocation.get(i));
-                }
-            }
-            prefix += "   ";
-            List<Dependency> dependencies = resolved.getDependencies();
-            for (int i = 0, j = dependencies.size(); i < j; i++) {
-                Dependency toDisplay =  dependencies.get(i);
-                unresolved += displayFeatureTree(admin, toDisplay.getName(), toDisplay.getVersion(), prefix +1);
-            }
-
-            if (conditional) {
-                for (Conditional cond : resolved.getConditional()) {
-                    List<Dependency> conditionDependencies = cond.getDependencies();
-                    for (int i = 0, j = conditionDependencies.size(); i < j; i++) {
-                        Dependency toDisplay =  dependencies.get(i);
-                        unresolved += displayFeatureTree(admin, toDisplay.getName(), toDisplay.getVersion(), prefix +1);
-                    }
-                }
-            }
-        }
-
-        return unresolved;
-    }
-
-    private void displayConditionalInfo(Feature feature) {
-        List<? extends Conditional> conditionals = feature.getConditional();
-        if (conditionals.isEmpty()) {
-            System.out.println("Feature has no conditionals.");
-        } else {
-            System.out.println("Feature contains followed conditionals:");
-            for (Conditional featureConditional : conditionals) {
-                String conditionDescription = getConditionDescription(featureConditional);
-                Feature wrappedConditional = featureConditional.asFeature(feature.getName(), feature.getVersion());
-                if (config) {
-                    displayConfigInformation(wrappedConditional, String.format(CONDITIONAL_CONTENT, conditionDescription));
-                    displayConfigFileInformation(wrappedConditional, String.format(CONDITIONAL_CONTENT, conditionDescription));
-                }
-
-                if (dependency) {
-                    displayDependencyInformation(wrappedConditional, String.format(CONDITIONAL_CONTENT, conditionDescription));
-                }
-
-                if (bundle) {
-                    displayBundleInformation(wrappedConditional, String.format(CONDITIONAL_CONTENT, conditionDescription));
-                }
-            }
-        }
-    }
-
-    private String getConditionDescription(Conditional cond) {
-        StringBuffer sb = new StringBuffer();
-        for (String dep : cond.getCondition()) {
-            if (sb.length() > 0) {
-                sb.append(" ");
-            }
-            sb.append(dep);
-        }
-        return sb.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
deleted file mode 100644
index b7f8184..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/InstallFeatureCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.command.completers.AvailableFeatureCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "feature", name = "install", description = "Installs a feature with the specified name and version.")
-@Service
-public class InstallFeatureCommand extends FeaturesCommandSupport {
-
-    private static String DEFAULT_VERSION = "0.0.0";
-
-    @Argument(index = 0, name = "feature", description = "The name and version of the features to install. A feature id looks like name/version. The version is optional.", required = true, multiValued = true)
-    @Completion(AvailableFeatureCompleter.class)
-    List<String> features;
-
-    @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 start the bundles", required = false, multiValued = false)
-    boolean noStart;
-
-    @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;
-
-    protected void doExecute(FeaturesService admin) throws Exception {
-        EnumSet<FeaturesService.Option> options = EnumSet.noneOf(FeaturesService.Option.class);
-        if (simulate) {
-            options.add(FeaturesService.Option.Simulate);
-        }
-        if (noStart) {
-            options.add(FeaturesService.Option.NoAutoStartBundles);
-        }
-        if (noRefresh) {
-            options.add(FeaturesService.Option.NoAutoRefreshBundles);
-        }
-        if (verbose) {
-            options.add(FeaturesService.Option.Verbose);
-        }
-        admin.installFeatures(new HashSet<String>(features), options);
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/ListFeatureVersionsCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/ListFeatureVersionsCommand.java b/features/src/main/java/org/apache/karaf/features/command/ListFeatureVersionsCommand.java
deleted file mode 100644
index b2c5e42..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/ListFeatureVersionsCommand.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.Arrays;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.features.command.completers.AllFeatureCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.support.table.ShellTable;
-
-@Command(scope = "feature", name = "version-list", description = "Lists all versions of a feature available from the currently available repositories.")
-@Service
-public class ListFeatureVersionsCommand extends FeaturesCommandSupport {
-
-	@Argument(index = 0, name = "feature", description = "Name of feature.", required = true, multiValued = false)
-    @Completion(AllFeatureCompleter.class)
-	String feature;
-
-    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
-    boolean noFormat;
-
-    protected void doExecute(FeaturesService admin) throws Exception {
-        ShellTable table = new ShellTable();
-        table.column("Version");
-        table.column("Repository");
-        table.column("Repository URL");
-        table.emptyTableText("No versions available for features '" + feature + "'");
-             
-        for (Repository r : Arrays.asList(admin.listRepositories())) {
-            for (Feature f : r.getFeatures()) {
-
-                if (f.getName().equals(feature)) {
-                    table.addRow().addContent(f.getVersion(), r.getName(), r.getURI());
-                }
-            }
-        }
-
-        table.print(System.out, !noFormat);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java b/features/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
deleted file mode 100644
index e86ff64..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/ListFeaturesCommand.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-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;
-import org.apache.karaf.shell.support.table.ShellTable;
-
-@Command(scope = "feature", name = "list", description = "Lists all existing features available from the defined repositories.")
-@Service
-public class ListFeaturesCommand extends FeaturesCommandSupport {
-
-    @Option(name = "-i", aliases = {"--installed"}, description = "Display a list of all installed features only", required = false, multiValued = false)
-    boolean onlyInstalled;
-
-    @Option(name = "-r", aliases = {"--required"}, description = "Display a list of all required features only", required = false, multiValued = false)
-    boolean onlyRequired;
-
-    @Option(name = "-o", aliases = {"--ordered"}, description = "Display a list using alphabetical order ", required = false, multiValued = false)
-    boolean ordered;
-
-    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
-    boolean noFormat;
-
-    protected void doExecute(FeaturesService featuresService) throws Exception {
-        boolean needsLegend = false;
-        
-        ShellTable table = new ShellTable();
-        table.column("Name");
-        table.column("Version");
-        table.column("Required");
-        table.column("Installed");
-        table.column("Repository");
-        table.column("Description").maxSize(50);
-        table.emptyTableText(onlyInstalled ? "No features installed" : "No features available");
-
-        List<Repository> repos = Arrays.asList(featuresService.listRepositories());
-        for (Repository r : repos) {
-            List<Feature> features = Arrays.asList(r.getFeatures());
-            if (ordered) {
-                Collections.sort(features, new FeatureComparator());
-            }
-            for (Feature f : features) {
-                if (onlyInstalled && !featuresService.isInstalled(f)) {
-                    // Filter out not installed features if we only want to see the installed ones
-                    continue;
-                }
-                if (onlyRequired && !featuresService.isRequired(f)) {
-                    // Filter out not installed features if we only want to see the installed ones
-                    continue;
-                }
-                table.addRow().addContent(
-                        f.getName(),
-                        f.getVersion(),
-                        featuresService.isRequired(f) ? "x" : "",
-                        featuresService.isInstalled(f) ? "x" : "",
-                        r.getName(),
-                        f.getDescription());
-                if (isInstalledViaDeployDir(r.getName())) {
-                    needsLegend = true;
-                }
-            }
-        }
-
-        table.print(System.out, !noFormat);
-
-        if (needsLegend) {
-            System.out.println("* Installed via deploy directory");
-        }
-
-    }
-
-    private boolean isInstalledViaDeployDir(String st) {
-        return (st == null || st.length() <= 1) ? false : (st.charAt(st.length() - 1) == '*');
-    }
-
-    class FeatureComparator implements Comparator<Feature> {
-        public int compare(Feature o1, Feature o2) {
-            return o1.getName().toLowerCase().compareTo( o2.getName().toLowerCase() );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/RepoAddCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/RepoAddCommand.java b/features/src/main/java/org/apache/karaf/features/command/RepoAddCommand.java
deleted file mode 100644
index 16faf42..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/RepoAddCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.net.URI;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.command.completers.AvailableRepoNameCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "feature", name = "repo-add", description = "Add a features repository")
-@Service
-public class RepoAddCommand extends FeaturesCommandSupport {
-
-    @Argument(index = 0, name = "name/url", description = "Shortcut name of the features repository or the full URL", required = true, multiValued = false)
-    @Completion(AvailableRepoNameCompleter.class)
-    private String nameOrUrl;
-    
-    @Argument(index = 1, name = "version", description = "The version of the features repository if using features repository name as first argument. It should be empty if using the URL", required = false, multiValued = false)
-    private String version;
-
-    @Option(name = "-i", aliases = { "--install" }, description = "Install all features contained in the features repository", required = false, multiValued = false)
-    private boolean install;
-
-    @Override
-    protected void doExecute(FeaturesService featuresService) throws Exception {
-        String effectiveVersion = (version == null) ? "LATEST" : version;
-        URI uri = featuresService.getRepositoryUriFor(nameOrUrl, effectiveVersion);
-        if (uri == null) {
-            uri = new URI(nameOrUrl);
-        }
-        System.out.println("Adding feature url " + uri);
-        featuresService.addRepository(uri, install);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/RepoListCommand.java b/features/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
deleted file mode 100644
index 55acf79..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/RepoListCommand.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-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;
-import org.apache.karaf.shell.support.MultiException;
-import org.apache.karaf.shell.support.table.ShellTable;
-
-@Command(scope = "feature", name = "repo-list", description = "Displays a list of all defined repositories.")
-@Service
-public class RepoListCommand extends FeaturesCommandSupport {
-
-    @Option(name="-r", description="Reload all feature urls", required = false, multiValued = false)
-    boolean reload;
-
-    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
-    boolean noFormat;
-    
-    protected void doExecute(FeaturesService featuresService) throws Exception {
-        if (reload) {
-            reloadAllRepos(featuresService);
-        }
-        
-        ShellTable table = new ShellTable();
-        table.column("Repository");
-        table.column("URL");
-        table.emptyTableText("No repositories available");
-
-        Repository[] repos = featuresService.listRepositories();
-     	for (Repository repo : repos) {
-            if (repo != null) {
-     	        table.addRow().addContent(repo.getName(), repo.getURI().toString()); 
-            }
-     	}
-     	table.print(System.out, !noFormat);
-    }
-
-    private void reloadAllRepos(FeaturesService featuresService) throws Exception {
-        System.out.println("Reloading all repositories from their urls");
-        System.out.println();
-        List<Exception> exceptions = new ArrayList<Exception>();
-        for (Repository repo : featuresService.listRepositories()) {
-            try {
-                featuresService.addRepository(repo.getURI());
-            } catch (Exception e) {
-                exceptions.add(e);
-            }
-        }
-        MultiException.throwIf("Unable to reload repositories", exceptions);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java b/features/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
deleted file mode 100644
index 8c7ed79..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.features.command.completers.InstalledRepoUriCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-
-@Command(scope = "feature", name = "repo-refresh", description = "Refresh a features repository")
-public class RepoRefreshCommand extends FeaturesCommandSupport {
-    @Argument(index = 0, name = "Feature name or uri", description = "Shortcut name of the feature repository or the full URI", required = false, multiValued = false)
-    @Completion(InstalledRepoUriCompleter.class)
-    private String nameOrUrl;
-    
-    @Argument(index = 1, name = "Feature version", description = "The version of the feature if using the feature name. Should be empty if using the uri", required = false, multiValued = false)
-    private String version;
-
-    @Override
-    protected void doExecute(FeaturesService featuresService) throws Exception {
-        List<URI> uris = new ArrayList<URI>();
-    	if (nameOrUrl != null) {
-    		String effectiveVersion = (version == null) ? "LATEST" : version;
-        	URI uri = featuresService.getRepositoryUriFor(nameOrUrl, effectiveVersion);
-        	if (uri == null) {
-        		uri = new URI(nameOrUrl);
-        	}
-            uris.add(uri);
-    	} else {
-            Repository[] repos = featuresService.listRepositories();
-            for (Repository repo : repos) {
-                uris.add(repo.getURI());
-            }
-    	}
-        for (URI uri : uris) {
-            try {
-                System.out.println("Refreshing feature url " + uri);
-                featuresService.refreshRepository(uri);
-            } catch (Exception e) {
-                System.err.println("Error refreshing " + uri.toString() + ": " + e.getMessage());
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/RepoRemoveCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/RepoRemoveCommand.java b/features/src/main/java/org/apache/karaf/features/command/RepoRemoveCommand.java
deleted file mode 100644
index 0710b72..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/RepoRemoveCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.net.URI;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.features.command.completers.InstalledRepoNameCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "feature", name = "repo-remove", description = "Removes the specified repository features service.")
-@Service
-public class RepoRemoveCommand extends FeaturesCommandSupport {
-
-    @Argument(index = 0, name = "repository", description = "Name or url of the repository to remove.", required = true, multiValued = false)
-    @Completion(InstalledRepoNameCompleter.class)
-    private String repository;
-
-    @Option(name = "-u", aliases = { "--uninstall-all" }, description = "Uninstall all features from the repository", required = false, multiValued = false)
-    private boolean uninstall;
-
-    protected void doExecute(FeaturesService featuresService) throws Exception {
-    	URI uri = null;
-    	for (Repository r : featuresService.listRepositories()) {
-    		if (r.getName() != null && r.getName().equals(repository)) {
-    			uri = r.getURI();
-    			break;
-    		}
-    	}
-
-    	if (uri == null) {
-    	    uri = new URI(repository);
-    	}
-
-    	featuresService.removeRepository(uri, uninstall);
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/UninstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/UninstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/features/command/UninstallFeatureCommand.java
deleted file mode 100644
index e62f697..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/UninstallFeatureCommand.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command;
-
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.command.completers.RequiredFeatureCompleter;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "feature", name = "uninstall", description = "Uninstalls a feature with the specified name and version.")
-@Service
-public class UninstallFeatureCommand extends FeaturesCommandSupport {
-
-    @Argument(index = 0, name = "features", description = "The name and version of the features to uninstall. A feature id looks like name/version. The version is optional.", required = true, multiValued = true)
-    @Completion(RequiredFeatureCompleter.class)
-    List<String> features;
-
-    @Option(name = "-r", aliases = "--no-auto-refresh", description = "Do not automatically refresh bundles", required = false, multiValued = false)
-    boolean noRefresh;
-
-    @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;
-
-    protected void doExecute(FeaturesService admin) throws Exception {
-        // iterate in the provided feature
-        EnumSet<FeaturesService.Option> options = EnumSet.noneOf(FeaturesService.Option.class);
-        if (simulate) {
-            options.add(FeaturesService.Option.Simulate);
-        }
-        if (noRefresh) {
-            options.add(FeaturesService.Option.NoAutoRefreshBundles);
-        }
-        if (verbose) {
-            options.add(FeaturesService.Option.Verbose);
-        }
-        admin.uninstallFeatures(new HashSet<String>(features), options);
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/AllFeatureCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/AllFeatureCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/AllFeatureCompleter.java
deleted file mode 100644
index 7444b95..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/AllFeatureCompleter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-/**
- * {@link org.apache.karaf.shell.console.Completer} for available features.
- */
-@Service
-public class AllFeatureCompleter extends FeatureCompleterSupport {
-
-    @Override
-    protected boolean acceptsFeature(Feature feature) {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/AvailableFeatureCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/AvailableFeatureCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/AvailableFeatureCompleter.java
deleted file mode 100644
index 79cd280..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/AvailableFeatureCompleter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-/**
- * {@link org.apache.karaf.shell.console.Completer} for features not installed yet.
- */
-@Service
-public class AvailableFeatureCompleter extends FeatureCompleterSupport {
-
-    @Override
-    protected boolean acceptsFeature(Feature feature) {
-        return !featuresService.isInstalled(feature);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/AvailableRepoNameCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/AvailableRepoNameCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/AvailableRepoNameCompleter.java
deleted file mode 100644
index acefe77..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/AvailableRepoNameCompleter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-/**
- * Shows the list of feature repos that can be installed with their short name
- */
-@Service
-public class AvailableRepoNameCompleter implements Completer {
-
-    @Reference
-    private FeaturesService featuresService;
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-
-    public int complete(Session session, CommandLine commandLine, final List<String> candidates) {
-        StringsCompleter delegate = new StringsCompleter(Arrays.asList(featuresService.getRepositoryNames()));
-        return delegate.complete(session, commandLine, candidates);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java b/features/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
deleted file mode 100644
index d01e5af..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import java.util.List;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-/**
- * Base completer for feature commands.
- */
-public abstract class FeatureCompleterSupport implements Completer {
-
-    /**
-     * Feature service.
-     */
-    @Reference
-    protected FeaturesService featuresService;
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-
-    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
-        StringsCompleter delegate = new StringsCompleter();
-        try {
-            for (Feature feature : featuresService.listFeatures()) {
-                if (acceptsFeature(feature)) {
-                    delegate.getStrings().add(feature.getName());
-                }
-            }
-        } catch (Exception e) {
-            // Ignore
-        }
-        return delegate.complete(session, commandLine, candidates);
-    }
-
-    /**
-     * Method for filtering features.
-     *
-     * @param feature The feature.
-     * @return True if feature should be available in completer.
-     */
-    protected abstract boolean acceptsFeature(Feature feature);
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
deleted file mode 100644
index 94e4cf7..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-/**
- * {@link Completer} for Feature Repository URLs.
- *
- * Displays a list of currently installed Feature repositories.
- *
- */
-@Service
-public class InstalledRepoNameCompleter implements Completer {
-
-    @Reference
-    private FeaturesService featuresService;
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-
-    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
-        StringsCompleter delegate = new StringsCompleter();
-        try {
-            for (Repository repository : featuresService.listRepositories()) {
-                delegate.getStrings().add(repository.getName());
-            }
-        } catch (Exception e) {
-            // Ignore
-        }
-        return delegate.complete(session, commandLine, candidates);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
deleted file mode 100644
index 7a760c2..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import java.util.List;
-
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-/**
- * {@link Completer} for Feature Repository URLs.
- *
- * Displays a list of currently installed Feature repositories.
- *
- */
-
-@Service
-public class InstalledRepoUriCompleter implements Completer {
-
-    @Reference
-    private FeaturesService featuresService;
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-
-    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
-        StringsCompleter delegate = new StringsCompleter();
-        try {
-            for (Repository repository : featuresService.listRepositories()) {
-                delegate.getStrings().add(repository.getURI().toString());
-            }
-        } catch (Exception e) {
-            // Ignore
-        }
-        return delegate.complete(session, commandLine, candidates);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/command/completers/RequiredFeatureCompleter.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/command/completers/RequiredFeatureCompleter.java b/features/src/main/java/org/apache/karaf/features/command/completers/RequiredFeatureCompleter.java
deleted file mode 100644
index a51f75f..0000000
--- a/features/src/main/java/org/apache/karaf/features/command/completers/RequiredFeatureCompleter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.command.completers;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-/**
- * {@link org.apache.karaf.shell.console.Completer} for installed features.
- */
-@Service
-public class RequiredFeatureCompleter extends FeatureCompleterSupport {
-
-    @Override
-    protected boolean acceptsFeature(Feature feature) {
-        return featuresService.isRequired(feature);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/0c8e8a81/features/src/main/java/org/apache/karaf/features/internal/deployment/DeploymentBuilder.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/features/internal/deployment/DeploymentBuilder.java b/features/src/main/java/org/apache/karaf/features/internal/deployment/DeploymentBuilder.java
deleted file mode 100644
index c3ac2b7..0000000
--- a/features/src/main/java/org/apache/karaf/features/internal/deployment/DeploymentBuilder.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.features.internal.deployment;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.felix.resolver.ResolverImpl;
-import org.apache.felix.utils.version.VersionRange;
-import org.apache.felix.utils.version.VersionTable;
-import org.apache.karaf.features.BundleInfo;
-import org.apache.karaf.features.Conditional;
-import org.apache.karaf.features.Dependency;
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.Repository;
-import org.apache.karaf.features.internal.repository.AggregateRepository;
-import org.apache.karaf.features.internal.repository.StaticRepository;
-import org.apache.karaf.features.internal.resolver.FeatureNamespace;
-import org.apache.karaf.features.internal.resolver.FeatureResource;
-import org.apache.karaf.features.internal.resolver.RequirementImpl;
-import org.apache.karaf.features.internal.resolver.ResolveContextImpl;
-import org.apache.karaf.features.internal.resolver.ResourceBuilder;
-import org.apache.karaf.features.internal.resolver.ResourceImpl;
-import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
-import org.apache.karaf.features.internal.service.Overrides;
-import org.apache.karaf.features.internal.util.Macro;
-import org.apache.karaf.features.internal.util.MultiException;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Version;
-import org.osgi.framework.namespace.IdentityNamespace;
-import org.osgi.resource.Capability;
-import org.osgi.resource.Requirement;
-import org.osgi.resource.Resource;
-import org.osgi.resource.Wire;
-import org.osgi.service.resolver.ResolutionException;
-import org.osgi.service.resolver.ResolveContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- */
-public class DeploymentBuilder {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(DeploymentBuilder.class);
-
-    public static final String REQ_PROTOCOL = "req:";
-
-    private final Collection<Repository> repositories;
-
-    private final List<org.osgi.service.repository.Repository> resourceRepos;
-
-    String featureRange = "${range;[====,====]}";
-
-    Downloader downloader;
-    ResourceImpl requirements;
-    Map<String, Resource> resources;
-    Set<Resource> optionals;
-    Map<String, StreamProvider> providers;
-
-    Set<Feature> featuresToRegister = new HashSet<Feature>();
-
-    public DeploymentBuilder(Downloader downloader,
-                             Collection<Repository> repositories) {
-        this.downloader = downloader;
-        this.repositories = repositories;
-        this.resourceRepos = new ArrayList<org.osgi.service.repository.Repository>();
-    }
-
-    public void addResourceRepository(org.osgi.service.repository.Repository repository) {
-        resourceRepos.add(repository);
-    }
-
-    public Map<String, StreamProvider> getProviders() {
-        return providers;
-    }
-
-    public void setFeatureRange(String featureRange) {
-        this.featureRange = featureRange;
-    }
-
-    public Map<String, Resource> download(
-                         Set<String> features,
-                         Set<String> bundles,
-                         Set<String> reqs,
-                         Set<String> overrides,
-                         Set<String> optionals)
-                throws IOException, MultiException, InterruptedException, ResolutionException, BundleException {
-        this.resources = new ConcurrentHashMap<String, Resource>();
-        this.optionals = new HashSet<Resource>();
-        this.providers = new ConcurrentHashMap<String, StreamProvider>();
-        this.requirements = new ResourceImpl("dummy", "dummy", Version.emptyVersion);
-        // First, gather all bundle resources
-        for (String feature : features) {
-            registerMatchingFeatures(feature);
-        }
-        for (String bundle : bundles) {
-            downloadAndBuildResource(bundle);
-        }
-        for (String req : reqs) {
-            buildRequirement(req);
-        }
-        for (String override : overrides) {
-            // TODO: ignore download failures for overrides
-            downloadAndBuildResource(Overrides.extractUrl(override));
-        }
-        for (String optional : optionals) {
-            downloadAndBuildResource(optional);
-        }
-        // Wait for all resources to be created
-        downloader.await();
-        // Do override replacement
-        Overrides.override(resources, overrides);
-        // Build features resources
-        for (Feature feature : featuresToRegister) {
-            Resource resource = FeatureResource.build(feature, featureRange, resources);
-            resources.put("feature:" + feature.getName() + "/" + feature.getVersion(), resource);
-            for (Conditional cond : feature.getConditional()) {
-                this.optionals.add(FeatureResource.build(feature, cond, featureRange, resources));
-            }
-        }
-        // Build requirements
-        for (String feature : features) {
-            requireFeature(feature);
-        }
-        for (String bundle : bundles) {
-            requireResource(bundle);
-        }
-        for (String req : reqs) {
-            requireResource(REQ_PROTOCOL + req);
-        }
-        return resources;
-    }
-
-    public Map<Resource, List<Wire>> resolve(List<Resource> systemBundles) throws ResolutionException {
-        // Resolve
-        for (int i = 0; i < systemBundles.size(); i++) {
-            resources.put("system-bundle-" + i, systemBundles.get(i));
-        }
-
-        List<org.osgi.service.repository.Repository> repos = new ArrayList<org.osgi.service.repository.Repository>();
-        repos.add(new StaticRepository(resources.values()));
-        repos.addAll(resourceRepos);
-
-        ResolverImpl resolver = new ResolverImpl(new Slf4jResolverLog(LOGGER));
-        ResolveContext context = new ResolveContextImpl(
-                Collections.<Resource>singleton(requirements),
-                Collections.<Resource>emptySet(),
-                new AggregateRepository(repos),
-                false);
-        Map<Resource, List<Wire>> best = resolver.resolve(context);
-
-        // TODO: we actually need to use multiple passes for conditionals
-        // TODO: but it may be optimized by passing the old wiring instead
-        // TODO: of computing everything again
-        Set<Resource> resources = new HashSet<Resource>();
-        resources.add(requirements);
-        for (Resource optional : optionals) {
-            try {
-                Set<Resource> newSet = new HashSet<Resource>(resources);
-                newSet.add(optional);
-                context = new ResolveContextImpl(
-                        newSet,
-                        Collections.<Resource>emptySet(),
-                        new AggregateRepository(repos),
-                        false);
-                best = resolver.resolve(context);
-                resources = newSet;
-            } catch (ResolutionException e) {
-                // Ignore this resource
-            }
-        }
-        return best;
-    }
-
-    public void requireFeature(String feature) throws IOException {
-        // Find name and version range
-        String[] split = feature.split("/");
-        String name = split[0].trim();
-        String version = (split.length > 1) ? split[1].trim() : null;
-        if (version != null && !version.equals("0.0.0") && !version.startsWith("[") && !version.startsWith("(")) {
-            version = Macro.transform(featureRange, version);
-        }
-        VersionRange range = version != null ? new VersionRange(version) : VersionRange.ANY_VERSION;
-        // Add requirement
-        Map<String, Object> attrs = new HashMap<String, Object>();
-        attrs.put(IdentityNamespace.IDENTITY_NAMESPACE, name);
-        attrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, FeatureNamespace.TYPE_FEATURE);
-        attrs.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, range);
-        requirements.addRequirement(
-                new RequirementImpl(requirements, IdentityNamespace.IDENTITY_NAMESPACE,
-                        Collections.<String, String>emptyMap(), attrs)
-        );
-    }
-
-    public void requireResource(String location) {
-        Resource res = resources.get(location);
-        if (res == null) {
-            throw new IllegalStateException("Could not find resource for " + location);
-        }
-        List<Capability> caps = res.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
-        if (caps.size() != 1) {
-            throw new IllegalStateException("Resource does not have a single " + IdentityNamespace.IDENTITY_NAMESPACE + " capability");
-        }
-        Capability cap = caps.get(0);
-        // Add requirement
-        Map<String, Object> attrs = new HashMap<String, Object>();
-        attrs.put(IdentityNamespace.IDENTITY_NAMESPACE, cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE));
-        attrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, cap.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE));
-        attrs.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, new VersionRange((Version) cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE), true));
-        requirements.addRequirement(
-                new RequirementImpl(requirements, IdentityNamespace.IDENTITY_NAMESPACE,
-                        Collections.<String, String>emptyMap(), attrs));
-
-    }
-
-    public void registerMatchingFeatures(String feature) throws IOException {
-        // Find name and version range
-        String[] split = feature.split("/");
-        String name = split[0].trim();
-        String version = (split.length > 1)
-                ? split[1].trim() : Version.emptyVersion.toString();
-        // Register matching features
-        registerMatchingFeatures(name, new VersionRange(version));
-    }
-
-    public void registerMatchingFeatures(String name, String version) throws IOException {
-        if (version != null && !version.equals("0.0.0") && !version.startsWith("[") && !version.startsWith("(")) {
-            version = Macro.transform(featureRange, version);
-        }
-        registerMatchingFeatures(name, version != null ? new VersionRange(version) : VersionRange.ANY_VERSION);
-    }
-
-    public void registerMatchingFeatures(String name, VersionRange range) throws IOException {
-        for (Repository repo : repositories) {
-            Feature[] features;
-            try {
-                features = repo.getFeatures();
-            } catch (Exception e) {
-                // This should not happen as the repository has been loaded already
-                throw new IllegalStateException(e);
-            }
-            for (Feature f : features) {
-                if (name.equals(f.getName())) {
-                    Version v = VersionTable.getVersion(f.getVersion());
-                    if (range.contains(v)) {
-                        featuresToRegister.add(f);
-                        for (Dependency dep : f.getDependencies()) {
-                            registerMatchingFeatures(dep.getName(), dep.getVersion());
-                        }
-                        for (BundleInfo bundle : f.getBundles()) {
-                            downloadAndBuildResource(bundle.getLocation());
-                        }
-                        for (Conditional cond : f.getConditional()) {
-                            Feature c = cond.asFeature(f.getName(), f.getVersion());
-                            featuresToRegister.add(c);
-                            for (BundleInfo bundle : c.getBundles()) {
-                                downloadAndBuildResource(bundle.getLocation());
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public void buildRequirement(String requirement) {
-        try {
-            String location = REQ_PROTOCOL + requirement;
-            ResourceImpl resource = new ResourceImpl(location, "dummy", Version.emptyVersion);
-            for (Requirement req : ResourceBuilder.parseRequirement(resource, requirement)) {
-                resource.addRequirement(req);
-            }
-            resources.put(location, resource);
-        } catch (BundleException e) {
-            throw new IllegalArgumentException("Error parsing requirement: " + requirement, e);
-        }
-    }
-
-    public void downloadAndBuildResource(final String location) throws IOException {
-        if (!resources.containsKey(location)) {
-            downloader.download(location, new Downloader.DownloadCallback() {
-                @Override
-                public void downloaded(StreamProvider provider) throws Exception {
-                    manageResource(location, provider);
-                }
-            });
-        }
-    }
-
-    private void manageResource(String location, StreamProvider provider) throws Exception {
-        if (!resources.containsKey(location)) {
-            Attributes attributes = getAttributes(location, provider);
-            Resource resource = createResource(location, attributes);
-            resources.put(location, resource);
-            providers.put(location, provider);
-        }
-    }
-
-    private Resource createResource(String uri, Attributes attributes) throws Exception {
-        Map<String, String> headers = new HashMap<String, String>();
-        for (Map.Entry attr : attributes.entrySet()) {
-            headers.put(attr.getKey().toString(), attr.getValue().toString());
-        }
-        try {
-            return ResourceBuilder.build(uri, headers);
-        } catch (BundleException e) {
-            throw new Exception("Unable to create resource for bundle " + uri, e);
-        }
-    }
-
-    protected Attributes getAttributes(String uri, StreamProvider provider) throws Exception {
-        InputStream is = provider.open();
-        try {
-            ZipInputStream zis = new ZipInputStream(is);
-            ZipEntry entry;
-            while ( (entry = zis.getNextEntry()) != null ) {
-                if ("META-INF/MANIFEST.MF".equals(entry.getName())) {
-                    return new Manifest(zis).getMainAttributes();
-                }
-            }
-        } finally {
-            is.close();
-        }
-        throw new IllegalArgumentException("Resource " + uri + " does not contain a manifest");
-    }
-
-}