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/29 01:33:57 UTC

[1/7] Code formatting and other checkstyle issues

Repository: karaf
Updated Branches:
  refs/heads/master 06b62c086 -> 5ca04ca67


http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/EventAdminListener.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/EventAdminListener.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/EventAdminListener.java
index b6eaae5..c16613d 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/EventAdminListener.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/EventAdminListener.java
@@ -53,14 +53,14 @@ public class EventAdminListener implements FeaturesListener {
         props.put(EventConstants.FEATURE_VERSION, event.getFeature().getVersion());
         String topic;
         switch (event.getType()) {
-            case FeatureInstalled:
-                topic = EventConstants.TOPIC_FEATURES_INSTALLED;
-                break;
-            case FeatureUninstalled:
-                topic = EventConstants.TOPIC_FEATURES_UNINSTALLED;
-                break;
-            default:
-                throw new IllegalStateException("Unknown features event type: " + event.getType());
+        case FeatureInstalled:
+            topic = EventConstants.TOPIC_FEATURES_INSTALLED;
+            break;
+        case FeatureUninstalled:
+            topic = EventConstants.TOPIC_FEATURES_UNINSTALLED;
+            break;
+        default:
+            throw new IllegalStateException("Unknown features event type: " + event.getType());
         }
         eventAdmin.postEvent(new Event(topic, props));
     }
@@ -77,14 +77,14 @@ public class EventAdminListener implements FeaturesListener {
         props.put(EventConstants.REPOSITORY_URI, event.getRepository().getURI().toString());
         String topic;
         switch (event.getType()) {
-            case RepositoryAdded:
-                topic = EventConstants.TOPIC_REPOSITORY_ADDED;
-                break;
-            case RepositoryRemoved:
-                topic = EventConstants.TOPIC_REPOSITORY_REMOVED;
-                break;
-            default:
-                throw new IllegalStateException("Unknown repository event type: " + event.getType());
+        case RepositoryAdded:
+            topic = EventConstants.TOPIC_REPOSITORY_ADDED;
+            break;
+        case RepositoryRemoved:
+            topic = EventConstants.TOPIC_REPOSITORY_REMOVED;
+            break;
+        default:
+            throw new IllegalStateException("Unknown repository event type: " + event.getType());
         }
         eventAdmin.postEvent(new Event(topic, props));
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
index 7a1fe80..5201e0c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureConfigInstaller.java
@@ -37,18 +37,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class FeatureConfigInstaller {
-	private static final Logger LOGGER = LoggerFactory.getLogger(FeaturesServiceImpl.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(FeaturesServiceImpl.class);
     private static final String CONFIG_KEY = "org.apache.karaf.features.configKey";
 
     private final ConfigurationAdmin configAdmin;
-    
+
     public FeatureConfigInstaller(ConfigurationAdmin configAdmin) {
-		this.configAdmin = configAdmin;
-	}
+        this.configAdmin = configAdmin;
+    }
 
     public void installFeatureConfigs(Feature feature) throws IOException, InvalidSyntaxException {
         for (String config : feature.getConfigurations().keySet()) {
-            Dictionary<String,String> props = new Hashtable<String, String>(feature.getConfigurations().get(config));
+            Dictionary<String, String> props = new Hashtable<String, String>(feature.getConfigurations().get(config));
             String[] pid = parsePid(config);
             Configuration cfg = findExistingConfiguration(configAdmin, pid[0], pid[1]);
             if (cfg == null) {
@@ -78,7 +78,7 @@ public class FeatureConfigInstaller {
     }
 
     private Configuration createConfiguration(ConfigurationAdmin configurationAdmin,
-                                                String pid, String factoryPid) throws IOException, InvalidSyntaxException {
+                                              String pid, String factoryPid) throws IOException, InvalidSyntaxException {
         if (factoryPid != null) {
             return configurationAdmin.createFactoryConfiguration(factoryPid, null);
         } else {
@@ -87,7 +87,7 @@ public class FeatureConfigInstaller {
     }
 
     private Configuration findExistingConfiguration(ConfigurationAdmin configurationAdmin,
-                                                      String pid, String factoryPid) throws IOException, InvalidSyntaxException {
+                                                    String pid, String factoryPid) throws IOException, InvalidSyntaxException {
         String filter;
         if (factoryPid == null) {
             filter = "(" + Constants.SERVICE_PID + "=" + pid + ")";
@@ -107,39 +107,40 @@ public class FeatureConfigInstaller {
     }
 
     private void installConfigurationFile(String fileLocation, String finalname, boolean override) throws IOException {
-    	String basePath = System.getProperty("karaf.base");
-    	
-    	if (finalname.contains("${")) {
-    		//remove any placeholder or variable part, this is not valid.
-    		int marker = finalname.indexOf("}");
-    		finalname = finalname.substring(marker+1);
-    	}
-    	
-    	finalname = basePath + File.separator + finalname;
-    	
-    	File file = new File(finalname); 
-    	if (file.exists()) {
+        String basePath = System.getProperty("karaf.base");
+
+        if (finalname.contains("${")) {
+            //remove any placeholder or variable part, this is not valid.
+            int marker = finalname.indexOf("}");
+            finalname = finalname.substring(marker + 1);
+        }
+
+        finalname = basePath + File.separator + finalname;
+
+        File file = new File(finalname);
+        if (file.exists()) {
             if (!override) {
                 LOGGER.debug("Configuration file {} already exist, don't override it", finalname);
                 return;
             } else {
                 LOGGER.info("Configuration file {} already exist, overriding it", finalname);
             }
-    	} else {
+        } else {
             LOGGER.info("Creating configuration file {}", finalname);
         }
 
         try (
-            InputStream is = new BufferedInputStream(new URL(fileLocation).openStream())
+                InputStream is = new BufferedInputStream(new URL(fileLocation).openStream())
         ) {
             if (!file.exists()) {
                 File parentFile = file.getParentFile();
-                if (parentFile != null)
+                if (parentFile != null) {
                     parentFile.mkdirs();
+                }
                 file.createNewFile();
             }
             try (
-                FileOutputStream fop = new FileOutputStream(file)
+                    FileOutputStream fop = new FileOutputStream(file)
             ) {
                 StreamUtils.copy(is, fop);
             }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureValidationUtil.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureValidationUtil.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureValidationUtil.java
index 6903dc0..f0b24a6 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureValidationUtil.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeatureValidationUtil.java
@@ -5,13 +5,14 @@
  * 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.
+ * 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.service;
 
@@ -22,11 +23,14 @@ import org.apache.karaf.features.internal.model.JaxbUtil;
 /**
  * Utility class which fires XML Schema validation.
  */
-public class FeatureValidationUtil {
+public final class FeatureValidationUtil {
+
+    private FeatureValidationUtil() {
+    }
 
     /**
      * Runs schema validation.
-     * 
+     *
      * @param uri Uri to validate.
      * @throws Exception When validation fails.
      */

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
----------------------------------------------------------------------
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 5ed76a1..d406726 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
@@ -158,9 +158,9 @@ public class FeaturesServiceImpl implements FeaturesService {
     /**
      * Use CRC to check snapshot bundles and update them if changed.
      * Either:
-     *   - none : never update snapshots
-     *   - always : always update snapshots
-     *   - crc : use CRC to detect changes
+     * - none : never update snapshots
+     * - always : always update snapshots
+     * - crc : use CRC to detect changes
      */
     private final String updateSnaphots;
 
@@ -169,7 +169,7 @@ public class FeaturesServiceImpl implements FeaturesService {
      */
     private final org.osgi.service.repository.Repository globalRepository;
 
-    private final List<FeaturesListener> listeners = new CopyOnWriteArrayIdentityList<FeaturesListener>();
+    private final List<FeaturesListener> listeners = new CopyOnWriteArrayIdentityList<>();
 
     // Synchronized on lock
     private final Object lock = new Object();
@@ -216,8 +216,8 @@ public class FeaturesServiceImpl implements FeaturesService {
             return;
         }
         Map<String, Object> request;
-        try(
-            FileInputStream fis = new FileInputStream(resolveFile)
+        try (
+                FileInputStream fis = new FileInputStream(resolveFile)
         ) {
             request = (Map<String, Object>) JsonReader.read(fis);
         } catch (IOException e) {
@@ -247,7 +247,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         }
         request.put("features", requestedFeatures);
         request.put("options", opts);
-        try(
+        try (
                 FileOutputStream fos = new FileOutputStream(resolveFile);
         ) {
             JsonWriter.write(fos, request);
@@ -511,9 +511,9 @@ public class FeaturesServiceImpl implements FeaturesService {
             Feature feature = version.isEmpty() ? null : versions.get(version);
             if (feature == null) {
                 // Compute version range. If an version has been given, assume exact range
-                VersionRange versionRange = version.isEmpty() ?
-                        new VersionRange(Version.emptyVersion) :
-                        new VersionRange(version, true, true);
+                VersionRange versionRange = version.isEmpty()
+                        ? new VersionRange(Version.emptyVersion)
+                        : new VersionRange(version, true, true);
                 Version latest = Version.emptyVersion;
                 for (String available : versions.keySet()) {
                     Version availableVersion = VersionTable.getVersion(available);
@@ -585,8 +585,8 @@ public class FeaturesServiceImpl implements FeaturesService {
             }
         }
         synchronized (lock) {
-            if (uris.size() == state.repositories.size() &&
-                    state.repositories.containsAll(uris)) {
+            if (uris.size() == state.repositories.size()
+                    && state.repositories.containsAll(uris)) {
                 featureCache = map;
             }
         }
@@ -753,7 +753,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         Set<String> fl = required.get(region);
         if (fl == null) {
             fl = new HashSet<>();
-            required.put(region,fl);
+            required.put(region, fl);
         }
         fl.addAll(featuresToAdd);
         doInstallFeaturesInThread(required, state, options);
@@ -859,9 +859,9 @@ public class FeaturesServiceImpl implements FeaturesService {
         } catch (ExecutionException e) {
             Throwable t = e.getCause();
             if (t instanceof RuntimeException) {
-                throw ((RuntimeException) t);
+                throw (RuntimeException) t;
             } else if (t instanceof Error) {
-                throw ((Error) t);
+                throw (Error) t;
             } else if (t instanceof Exception) {
                 throw (Exception) t;
             } else {
@@ -878,7 +878,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         Map<String, Set<Long>> bundlesPerRegion;
         Map<String, Map<String, Map<String, Set<String>>>> filtersPerRegion;
     }
-    
+
     protected DeploymentState getDeploymentState() throws Exception {
         DeploymentState state = new DeploymentState();
         // Bundles
@@ -921,9 +921,9 @@ public class FeaturesServiceImpl implements FeaturesService {
     }
 
     public void doInstallFeatures(Map<String, Set<String>> requestedFeatures,  // all request features
-                                  State                    state,              // current state
-                                  EnumSet<Option>          options             // installation options
-                    ) throws Exception {
+                                  State state,              // current state
+                                  EnumSet<Option> options             // installation options
+    ) throws Exception {
 
         boolean noRefreshUnmanaged = options.contains(Option.NoAutoRefreshUnmanagedBundles);
         boolean noRefreshManaged = options.contains(Option.NoAutoRefreshManagedBundles);
@@ -934,11 +934,11 @@ public class FeaturesServiceImpl implements FeaturesService {
         boolean noManageBundles = options.contains(Option.NoAutoManageBundles);
 
         DeploymentState dstate = getDeploymentState();
-        
+
         Map<String, Set<Long>> managedBundles = copy(state.managedBundles);
 
         Map<String, Set<Bundle>> unmanagedBundles = apply(diff(dstate.bundlesPerRegion, state.managedBundles),
-                                                          map(dstate.bundles));
+                map(dstate.bundles));
 
         // Resolve
         // TODO: requirements
@@ -1117,9 +1117,9 @@ public class FeaturesServiceImpl implements FeaturesService {
                     dstate.bundles.values(),
                     Collections.<Resource, Bundle>emptyMap(),
                     Collections.<Resource, List<Wire>>emptyMap());
-            bundle.stop(Bundle.STOP_TRANSIENT);
+            bundle.stop(STOP_TRANSIENT);
             try (
-                InputStream is = getBundleInputStream(resource, providers)
+                    InputStream is = getBundleInputStream(resource, providers)
             ) {
                 bundle.update(is);
             }
@@ -1193,7 +1193,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         //
         boolean hasToDelete = false;
         for (RegionDeployment regionDeployment : deployment.regions.values()) {
-            if ((hasToDelete = !regionDeployment.toDelete.isEmpty())) {
+            if (hasToDelete = !regionDeployment.toDelete.isEmpty()) {
                 break;
             }
         }
@@ -1289,7 +1289,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         //
         boolean hasToUpdate = false;
         for (RegionDeployment regionDeployment : deployment.regions.values()) {
-            if ((hasToUpdate = !regionDeployment.toUpdate.isEmpty())) {
+            if (hasToUpdate = !regionDeployment.toUpdate.isEmpty()) {
                 break;
             }
         }
@@ -1302,7 +1302,7 @@ public class FeaturesServiceImpl implements FeaturesService {
                     String uri = getUri(resource);
                     print("  " + uri, verbose);
                     try (
-                        InputStream is = getBundleInputStream(resource, providers)
+                            InputStream is = getBundleInputStream(resource, providers)
                     ) {
                         bundle.update(is);
                     }
@@ -1323,7 +1323,7 @@ public class FeaturesServiceImpl implements FeaturesService {
         //
         boolean hasToInstall = false;
         for (RegionDeployment regionDeployment : deployment.regions.values()) {
-            if ((hasToInstall = !regionDeployment.toInstall.isEmpty())) {
+            if (hasToInstall = !regionDeployment.toInstall.isEmpty()) {
                 break;
             }
         }
@@ -1339,7 +1339,7 @@ public class FeaturesServiceImpl implements FeaturesService {
                     Bundle bundle;
                     long crc;
                     try (
-                        ChecksumUtils.CRCInputStream is = new ChecksumUtils.CRCInputStream (getBundleInputStream(resource, providers))
+                            ChecksumUtils.CRCInputStream is = new ChecksumUtils.CRCInputStream(getBundleInputStream(resource, providers))
                     ) {
                         if (ROOT_REGION.equals(name)) {
                             bundle = region.installBundleAtLocation(uri, is);
@@ -1362,16 +1362,14 @@ public class FeaturesServiceImpl implements FeaturesService {
                     toResolve.add(bundle);
                     if (resourceLinkedToOldFeatures.contains(resource)) {
                         toStart.add(bundle);
-                    } else if (!noStart) {
-                        if (bi == null || bi.isStart()) {
-                            toStart.add(bundle);
-                        }
+                    } else if (!noStart && (bi == null || bi.isStart())) {
+                        toStart.add(bundle);
                     }
                 }
             }
         }
 
-       //
+        //
         // Update and save state
         //
         synchronized (lock) {
@@ -1568,9 +1566,9 @@ public class FeaturesServiceImpl implements FeaturesService {
     }
 
     protected Deployment computeDeployment(
-                                DeploymentState dstate,
-                                SubsystemResolver resolver,
-                                State state) throws IOException {
+            DeploymentState dstate,
+            SubsystemResolver resolver,
+            State state) throws IOException {
 
         Deployment result = new Deployment();
 
@@ -1594,7 +1592,7 @@ public class FeaturesServiceImpl implements FeaturesService {
             // Compute the list of resources to deploy in the region
             Set<Resource> bundlesInRegion = bundlesPerRegions.get(region);
             List<Resource> toDeploy = bundlesInRegion != null
-                            ? new ArrayList<>(bundlesInRegion) : new ArrayList<Resource>();
+                    ? new ArrayList<>(bundlesInRegion) : new ArrayList<Resource>();
 
             // First pass: go through all installed bundles and mark them
             // as either to ignore or delete
@@ -1606,11 +1604,10 @@ public class FeaturesServiceImpl implements FeaturesService {
                     // Look for a matching resource
                     Resource resource = null;
                     for (Resource res : toDeploy) {
-                        if (bundle.getSymbolicName().equals(getSymbolicName(res))) {
-                            if (bundle.getVersion().equals(getVersion(res))) {
-                                resource = res;
-                                break;
-                            }
+                        if (bundle.getSymbolicName().equals(getSymbolicName(res))
+                                && bundle.getVersion().equals(getVersion(res))) {
+                            resource = res;
+                            break;
                         }
                     }
                     // We found a matching bundle
@@ -1625,10 +1622,10 @@ public class FeaturesServiceImpl implements FeaturesService {
                             } else if (UPDATE_SNAPSHOTS_CRC.equalsIgnoreCase(updateSnaphots)) {
                                 // if the checksum are different
                                 try (
-                                    InputStream is = getBundleInputStream(resource, resolver.getProviders())
+                                        InputStream is = getBundleInputStream(resource, resolver.getProviders())
                                 ) {
                                     long newCrc = ChecksumUtils.checksum(is);
-                                    long oldCrc = state.bundleChecksums.containsKey(bundle.getBundleId()) ? state.bundleChecksums.get(bundle.getBundleId()) : 0l;
+                                    long oldCrc = state.bundleChecksums.containsKey(bundle.getBundleId()) ? state.bundleChecksums.get(bundle.getBundleId()) : 0L;
                                     if (newCrc != oldCrc) {
                                         LOGGER.debug("New snapshot available for " + bundle.getLocation());
                                         deployment.toUpdate.put(bundle, resource);
@@ -1700,8 +1697,8 @@ public class FeaturesServiceImpl implements FeaturesService {
 
     protected boolean isUpdateable(Resource resource) {
         String uri = getUri(resource);
-        return getVersion(resource).getQualifier().endsWith(SNAPSHOT) 
-                || uri.contains(SNAPSHOT) 
+        return getVersion(resource).getQualifier().endsWith(SNAPSHOT)
+                || uri.contains(SNAPSHOT)
                 || !uri.contains(MAVEN);
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/Overrides.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Overrides.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/Overrides.java
index 0e02871..69fea30 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Overrides.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Overrides.java
@@ -40,22 +40,25 @@ import static org.apache.felix.resolver.Util.getVersion;
 /**
  * Helper class to deal with overriden bundles at feature installation time.
  */
-public class Overrides {
+public final class Overrides {
+
+    protected static final String OVERRIDE_RANGE = "range";
 
     private static final Logger LOGGER = LoggerFactory.getLogger(Overrides.class);
 
-    protected static final String OVERRIDE_RANGE = "range";
+    private Overrides() {
+    }
 
     /**
      * Compute a list of bundles to install, taking into account overrides.
-     *
+     * <p/>
      * The file containing the overrides will be loaded from the given url.
      * Blank lines and lines starting with a '#' will be ignored, all other lines
      * are considered as urls to override bundles.
-     *
+     * <p/>
      * The list of resources to resolve will be scanned and for each bundle,
      * if a bundle override matches that resource, it will be used instead.
-     *
+     * <p/>
      * Matching is done on bundle symbolic name (they have to be the same)
      * and version (the bundle override version needs to be greater than the
      * resource to be resolved, and less than the next minor version.  A range
@@ -69,7 +72,7 @@ public class Overrides {
         // Do override replacement
         for (Clause override : Parser.parseClauses(overrides.toArray(new String[overrides.size()]))) {
             String url = override.getName();
-            String vr  = override.getAttribute(OVERRIDE_RANGE);
+            String vr = override.getAttribute(OVERRIDE_RANGE);
             T over = resources.get(url);
             if (over == null) {
                 // Ignore invalid overrides
@@ -102,7 +105,7 @@ public class Overrides {
         try {
             if (overridesUrl != null) {
                 try (
-                    InputStream is = new URL(overridesUrl).openStream()
+                        InputStream is = new URL(overridesUrl).openStream()
                 ) {
                     BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                     String line;
@@ -121,7 +124,7 @@ public class Overrides {
     }
 
     public static String extractUrl(String override) {
-        Clause[] cs = Parser.parseClauses(new String[] { override });
+        Clause[] cs = Parser.parseClauses(new String[]{override});
         if (cs.length != 1) {
             throw new IllegalStateException("Override contains more than one clause: " + override);
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/RepositoryImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/RepositoryImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/RepositoryImpl.java
index 2b32161..d713b6c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/RepositoryImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/RepositoryImpl.java
@@ -71,7 +71,7 @@ public class RepositoryImpl implements Repository {
     public void load(boolean validate) throws IOException {
         if (features == null) {
             try (
-                InputStream inputStream = new InterruptibleInputStream(uri.toURL().openStream())
+                    InputStream inputStream = new InterruptibleInputStream(uri.toURL().openStream())
             ) {
                 features = JaxbUtil.unmarshal(uri.toASCIIString(), inputStream, validate);
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/RequirementSort.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/RequirementSort.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/RequirementSort.java
index 96b99ee..99cb12f 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/RequirementSort.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/RequirementSort.java
@@ -29,7 +29,10 @@ import org.osgi.resource.Capability;
 import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
 
-public class RequirementSort<T extends Resource>  {
+public final class RequirementSort<T extends Resource> {
+
+    private RequirementSort() {
+    }
 
     /**
      * Sorts {@link Resource} based on their {@link Requirement}s and {@link Capability}s.

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/StateStorage.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/StateStorage.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/StateStorage.java
index e6adab0..c94bb0b 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/StateStorage.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/StateStorage.java
@@ -36,7 +36,7 @@ public abstract class StateStorage {
         state.installedFeatures.clear();
         state.managedBundles.clear();
         try (
-            InputStream is = getInputStream()
+                InputStream is = getInputStream()
         ) {
             if (is != null) {
                 Map json = (Map) JsonReader.read(is);
@@ -52,7 +52,7 @@ public abstract class StateStorage {
 
     public void save(State state) throws IOException {
         try (
-            OutputStream os = getOutputStream()
+                OutputStream os = getOutputStream()
         ) {
             if (os != null) {
                 Map<String, Object> json = new HashMap<>();
@@ -68,9 +68,10 @@ public abstract class StateStorage {
     }
 
     protected abstract InputStream getInputStream() throws IOException;
+
     protected abstract OutputStream getOutputStream() throws IOException;
 
-    static Map<String, Set<String>> toStringStringSetMap(Map<?,?> map) {
+    static Map<String, Set<String>> toStringStringSetMap(Map<?, ?> map) {
         Map<String, Set<String>> nm = new HashMap<>();
         for (Map.Entry entry : map.entrySet()) {
             nm.put(entry.getKey().toString(), toStringSet((Collection) entry.getValue()));
@@ -78,7 +79,7 @@ public abstract class StateStorage {
         return nm;
     }
 
-    static  Map<String, Set<Long>> toStringLongSetMap(Map<?,?> map) {
+    static Map<String, Set<Long>> toStringLongSetMap(Map<?, ?> map) {
         Map<String, Set<Long>> nm = new HashMap<>();
         for (Map.Entry entry : map.entrySet()) {
             nm.put(entry.getKey().toString(), toLongSet((Collection) entry.getValue()));
@@ -86,7 +87,7 @@ public abstract class StateStorage {
         return nm;
     }
 
-    static  Set<String> toStringSet(Collection<?> col) {
+    static Set<String> toStringSet(Collection<?> col) {
         Set<String> ns = new TreeSet<>();
         for (Object o : col) {
             ns.add(o.toString());
@@ -94,7 +95,7 @@ public abstract class StateStorage {
         return ns;
     }
 
-    static  Set<Long> toLongSet(Collection<?> set) {
+    static Set<Long> toLongSet(Collection<?> set) {
         Set<Long> ns = new TreeSet<>();
         for (Object o : set) {
             ns.add(toLong(o));
@@ -102,7 +103,7 @@ public abstract class StateStorage {
         return ns;
     }
 
-    static  Map<Long, Long> toLongLongMap(Map<?,?> map) {
+    static Map<Long, Long> toLongLongMap(Map<?, ?> map) {
         Map<Long, Long> nm = new HashMap<>();
         for (Map.Entry entry : map.entrySet()) {
             nm.put(toLong(entry.getKey()), toLong(entry.getValue()));
@@ -110,7 +111,7 @@ public abstract class StateStorage {
         return nm;
     }
 
-    static Map<String, Long> toStringLongMap(Map<?,?> map) {
+    static Map<String, Long> toStringLongMap(Map<?, ?> map) {
         Map<String, Long> nm = new HashMap<>();
         for (Map.Entry entry : map.entrySet()) {
             nm.put(entry.getKey().toString(), toLong(entry.getValue()));

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/ChecksumUtils.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/ChecksumUtils.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/ChecksumUtils.java
index f18f10a..ea8eab1 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/ChecksumUtils.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/ChecksumUtils.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.zip.CRC32;
 
-public class ChecksumUtils {
+public final class ChecksumUtils {
 
     private ChecksumUtils() {
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonReader.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonReader.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonReader.java
index a53d8a5..7ce1b76 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonReader.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonReader.java
@@ -27,15 +27,7 @@ import java.util.Map;
 
 /**
  */
-public class JsonReader {
-
-    public static Object read(Reader reader) throws IOException {
-        return new JsonReader(reader).parse();
-    }
-
-    public static Object read(InputStream is) throws IOException {
-        return new JsonReader(new InputStreamReader(is)).parse();
-    }
+public final class JsonReader {
 
     //
     // Implementation
@@ -45,14 +37,22 @@ public class JsonReader {
     private final StringBuilder recorder;
     private int current;
     private int line = 1;
-    private int column = 0;
+    private int column;
 
-    JsonReader(Reader reader) {
+    private JsonReader(Reader reader) {
         this.reader = reader;
         recorder = new StringBuilder();
     }
 
-    public Object parse() throws IOException {
+    public static Object read(Reader reader) throws IOException {
+        return new JsonReader(reader).parse();
+    }
+
+    public static Object read(InputStream is) throws IOException {
+        return new JsonReader(new InputStreamReader(is)).parse();
+    }
+
+    private Object parse() throws IOException {
         read();
         skipWhiteSpace();
         Object result = readValue();
@@ -65,38 +65,38 @@ public class JsonReader {
 
     private Object readValue() throws IOException {
         switch (current) {
-            case 'n':
-                return readNull();
-            case 't':
-                return readTrue();
-            case 'f':
-                return readFalse();
-            case '"':
-                return readString();
-            case '[':
-                return readArray();
-            case '{':
-                return readObject();
-            case '-':
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                return readNumber();
-            default:
-                throw expected("value");
+        case 'n':
+            return readNull();
+        case 't':
+            return readTrue();
+        case 'f':
+            return readFalse();
+        case '"':
+            return readString();
+        case '[':
+            return readArray();
+        case '{':
+            return readObject();
+        case '-':
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+            return readNumber();
+        default:
+            throw expected("value");
         }
     }
 
     private Collection<?> readArray() throws IOException {
         read();
-        Collection<Object> array = new ArrayList<Object>();
+        Collection<Object> array = new ArrayList<>();
         skipWhiteSpace();
         if (readChar(']')) {
             return array;
@@ -114,7 +114,7 @@ public class JsonReader {
 
     private Map<String, Object> readObject() throws IOException {
         read();
-        Map<String, Object> object = new HashMap<String, Object>();
+        Map<String, Object> object = new HashMap<>();
         skipWhiteSpace();
         if (readChar('}')) {
             return object;
@@ -187,39 +187,39 @@ public class JsonReader {
     private void readEscape() throws IOException {
         read();
         switch (current) {
-            case '"':
-            case '/':
-            case '\\':
-                recorder.append((char) current);
-                break;
-            case 'b':
-                recorder.append('\b');
-                break;
-            case 'f':
-                recorder.append('\f');
-                break;
-            case 'n':
-                recorder.append('\n');
-                break;
-            case 'r':
-                recorder.append('\r');
-                break;
-            case 't':
-                recorder.append('\t');
-                break;
-            case 'u':
-                char[] hexChars = new char[4];
-                for (int i = 0; i < 4; i++) {
-                    read();
-                    if (!isHexDigit(current)) {
-                        throw expected("hexadecimal digit");
-                    }
-                    hexChars[i] = (char) current;
+        case '"':
+        case '/':
+        case '\\':
+            recorder.append((char) current);
+            break;
+        case 'b':
+            recorder.append('\b');
+            break;
+        case 'f':
+            recorder.append('\f');
+            break;
+        case 'n':
+            recorder.append('\n');
+            break;
+        case 'r':
+            recorder.append('\r');
+            break;
+        case 't':
+            recorder.append('\t');
+            break;
+        case 'u':
+            char[] hexChars = new char[4];
+            for (int i = 0; i < 4; i++) {
+                read();
+                if (!isHexDigit(current)) {
+                    throw expected("hexadecimal digit");
                 }
-                recorder.append((char) Integer.parseInt(String.valueOf(hexChars), 16));
-                break;
-            default:
-                throw expected("valid escape sequence");
+                hexChars[i] = (char) current;
+            }
+            recorder.append((char) Integer.parseInt(String.valueOf(hexChars), 16));
+            break;
+        default:
+            throw expected("valid escape sequence");
         }
         read();
     }
@@ -233,6 +233,7 @@ public class JsonReader {
         }
         if (firstDigit != '0') {
             while (readAndAppendDigit()) {
+                // Do nothing
             }
         }
         readFraction();
@@ -248,6 +249,7 @@ public class JsonReader {
             throw expected("digit");
         }
         while (readAndAppendDigit()) {
+            // Do nothing
         }
         return true;
     }
@@ -263,6 +265,7 @@ public class JsonReader {
             throw expected("digit");
         }
         while (readAndAppendDigit()) {
+            // Do nothing
         }
         return true;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
index 78a85dc..d65bc35 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/JsonWriter.java
@@ -25,7 +25,10 @@ import java.util.Map;
 
 /**
  */
-public class JsonWriter {
+public final class JsonWriter {
+
+    private JsonWriter() {
+    }
 
     public static void write(OutputStream stream, Object value) throws IOException {
         Writer writer = new OutputStreamWriter(stream);
@@ -72,29 +75,29 @@ public class JsonWriter {
         for (int i = 0; i < value.length(); i++) {
             char c = value.charAt(i);
             switch (c) {
-                case '\"':
-                case '\\':
-                case '\b':
-                case '\f':
-                case '\n':
-                case '\r':
-                case '\t':
+            case '\"':
+            case '\\':
+            case '\b':
+            case '\f':
+            case '\n':
+            case '\r':
+            case '\t':
+                writer.append('\\');
+                writer.append(c);
+                break;
+            default:
+                if (c < ' ' || (c >= '\u0080' && c < '\u00a0') || (c >= '\u2000' && c < '\u2100')) {
+                    String s = Integer.toHexString(c);
                     writer.append('\\');
-                    writer.append(c);
-                    break;
-                default:
-                    if (c < ' ' || (c >= '\u0080' && c < '\u00a0') || (c >= '\u2000' && c < '\u2100')) {
-                        String s = Integer.toHexString(c);
-                        writer.append('\\');
-                        writer.append('u');
-                        for (int j = s.length(); j < 4; j++) {
-                            writer.append('0');
-                        }
-                        writer.append(s);
-                    } else {
-                        writer.append(c);
+                    writer.append('u');
+                    for (int j = s.length(); j < 4; j++) {
+                        writer.append('0');
                     }
-                    break;
+                    writer.append(s);
+                } else {
+                    writer.append(c);
+                }
+                break;
             }
         }
         writer.append('"');

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/Macro.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/Macro.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/Macro.java
index d30b7b5..7c963d6 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/Macro.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/Macro.java
@@ -22,22 +22,29 @@ import java.util.regex.Pattern;
 import org.apache.felix.utils.version.VersionTable;
 import org.osgi.framework.Version;
 
-public class Macro {
+public final class Macro {
+
+    static final String MASK_STRING = "[\\-+=~0123456789]{0,3}[=~]?";
+    static final Pattern RANGE_MASK = Pattern.compile("(\\[|\\()(" + MASK_STRING + "),(" + MASK_STRING + ")(\\]|\\))");
+
+    private Macro() {
+    }
 
     public static String transform(String macro, String value) {
         if (macro.startsWith("${") && macro.endsWith("}")) {
             String[] args = macro.substring(2, macro.length() - 1).split(";");
-            if ("version".equals(args[0])) {
+            switch (args[0]) {
+            case "version":
                 if (args.length != 2) {
                     throw new IllegalArgumentException("Invalid syntax for macro: " + macro);
                 }
                 return version(args[1], VersionTable.getVersion(value));
-            } else if ("range".equals(args[0])) {
+            case "range":
                 if (args.length != 2) {
                     throw new IllegalArgumentException("Invalid syntax for macro: " + macro);
                 }
                 return range(args[1], VersionTable.getVersion(value));
-            } else {
+            default:
                 throw new IllegalArgumentException("Unknown macro: " + macro);
             }
         }
@@ -47,7 +54,7 @@ public class Macro {
     /**
      * Modify a version to set a version policy. Thed policy is a mask that is
      * mapped to a version.
-     *
+     * <p/>
      * <pre>
      * +           increment
      * -           decrement
@@ -56,14 +63,10 @@ public class Macro {
      *
      * ==+      = maintain major, minor, increment micro, discard qualifier
      * &tilde;&tilde;&tilde;=     = just get the qualifier
-     * version=&quot;[${version;==;${@}},${version;=+;${@}})&quot;
-	 * </pre>
-	 *
-	 * @param args
-     * @return
+     * version=&quot;[${version;==;${{@literal @}}},${version;=+;${{@literal @}}})&quot;
+     * </pre>
+     *
      */
-    final static String	MASK_STRING			= "[\\-+=~0123456789]{0,3}[=~]?";
-
     static String version(String mask, Version version) {
         StringBuilder sb = new StringBuilder();
         String del = "";
@@ -85,19 +88,29 @@ public class Macro {
                 } else {
                     int x = 0;
                     switch (i) {
-                        case 0: x = version.getMajor(); break;
-                        case 1: x = version.getMinor(); break;
-                        case 2: x = version.getMicro(); break;
+                    case 0:
+                        x = version.getMajor();
+                        break;
+                    case 1:
+                        x = version.getMinor();
+                        break;
+                    case 2:
+                        x = version.getMicro();
+                        break;
+                    default:
+                        throw new IllegalStateException();
                     }
                     switch (c) {
-                        case '+' :
-                            x++;
-                            break;
-                        case '-' :
-                            x--;
-                            break;
-                        case '=' :
-                            break;
+                    case '+':
+                        x++;
+                        break;
+                    case '-':
+                        x--;
+                        break;
+                    case '=':
+                        break;
+                    default:
+                        throw new IllegalStateException();
                     }
                     result = Integer.toString(x);
                 }
@@ -113,18 +126,14 @@ public class Macro {
 
     /**
      * Schortcut for version policy
-     *
+     * <p/>
      * <pre>
      * -provide-policy : ${policy;[==,=+)}
      * -consume-policy : ${policy;[==,+)}
      * </pre>
      *
-     * @param args
-     * @return
      */
 
-    static Pattern	RANGE_MASK		= Pattern.compile("(\\[|\\()(" + MASK_STRING + "),(" + MASK_STRING + ")(\\]|\\))");
-
     static String range(String spec, Version version) {
         Matcher m = RANGE_MASK.matcher(spec);
         m.matches();

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/MapUtils.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/MapUtils.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/MapUtils.java
index 6437d10..efde48d 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/MapUtils.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/MapUtils.java
@@ -25,7 +25,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class MapUtils {
+public final class MapUtils {
+
+    private MapUtils() {
+    }
 
     public interface Function<T, U> {
         U apply(T t);
@@ -151,7 +154,7 @@ public class MapUtils {
             return (S) r;
         } else if (obj instanceof Map) {
             Map r = new HashMap();
-            for (Map.Entry<?,?> e : ((Map<?,?>) obj).entrySet()) {
+            for (Map.Entry<?, ?> e : ((Map<?, ?>) obj).entrySet()) {
                 r.put(copy(e.getKey()), copy(e.getValue()));
             }
             return (S) r;
@@ -165,7 +168,7 @@ public class MapUtils {
                 ((Collection) s2).add(copy(o));
             }
         } else if (s1 instanceof Map) {
-            for (Map.Entry<?,?> e : ((Map<?,?>) s1).entrySet()) {
+            for (Map.Entry<?, ?> e : ((Map<?, ?>) s1).entrySet()) {
                 ((Map) s2).put(copy(e.getKey()), copy(e.getValue()));
             }
         } else {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/util/MultiException.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/util/MultiException.java b/features/core/src/main/java/org/apache/karaf/features/internal/util/MultiException.java
index 36af452..6673c4f 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/util/MultiException.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/util/MultiException.java
@@ -24,10 +24,11 @@ import java.util.List;
 @SuppressWarnings("serial")
 public class MultiException extends Exception {
 
-    private List<Exception> exceptions = new ArrayList<Exception>();
+    private final List<Exception> exceptions;
 
     public MultiException(String message) {
         super(message);
+        this.exceptions = new ArrayList<>();
     }
 
     public MultiException(String message, List<Exception> exceptions) {
@@ -44,14 +45,13 @@ public class MultiException extends Exception {
             throw this;
         }
     }
-    
+
     public Throwable[] getCauses() {
         return exceptions.toArray(new Throwable[exceptions.size()]);
     }
 
     @Override
-    public void printStackTrace()
-    {
+    public void printStackTrace() {
         super.printStackTrace();
         for (Exception e : exceptions) {
             e.printStackTrace();
@@ -60,12 +60,12 @@ public class MultiException extends Exception {
 
 
     /* ------------------------------------------------------------------------------- */
+
     /**
      * @see Throwable#printStackTrace(java.io.PrintStream)
      */
     @Override
-    public void printStackTrace(PrintStream out)
-    {
+    public void printStackTrace(PrintStream out) {
         super.printStackTrace(out);
         for (Exception e : exceptions) {
             e.printStackTrace(out);
@@ -73,8 +73,7 @@ public class MultiException extends Exception {
     }
 
     @Override
-    public void printStackTrace(PrintWriter out)
-    {
+    public void printStackTrace(PrintWriter out) {
         super.printStackTrace(out);
         for (Exception e : exceptions) {
             e.printStackTrace(out);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java b/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
index 6afbbed..60e0f9b 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/FeaturesServiceMBean.java
@@ -20,42 +20,6 @@ import javax.management.openmbean.TabularData;
 
 public interface FeaturesServiceMBean {
 
-    TabularData getFeatures() throws Exception;
-
-    TabularData getRepositories() throws Exception;
-
-    void addRepository(String url) throws Exception;
-
-    void addRepository(String url, boolean install) throws Exception;
-
-    void removeRepository(String url) throws Exception;
-
-    void removeRepository(String url, boolean uninstall) throws Exception;
-
-    void installFeature(String name) throws Exception;
-
-    void installFeature(String name, boolean noRefresh) throws Exception;
-
-    void installFeature(String name, boolean noRefresh, boolean noStart) throws Exception;
-
-    void installFeature(String name, String version) throws Exception;
-
-    void installFeature(String name, String version, boolean noRefresh) throws Exception;
-
-    void installFeature(String name, String version, boolean noRefresh, boolean noStart) throws Exception;
-
-    TabularData infoFeature(String name) throws Exception;
-
-    TabularData infoFeature(String name, String version) throws Exception;
-
-    void uninstallFeature(String name) throws Exception;
-
-    void uninstallFeature(String name, boolean noRefresh) throws Exception;
-
-    void uninstallFeature(String name, String version) throws Exception;
-
-    void uninstallFeature(String name, String version, boolean noRefresh) throws Exception;
-
     String FEATURE_NAME = "Name";
 
     String FEATURE_VERSION = "Version";
@@ -65,7 +29,7 @@ public interface FeaturesServiceMBean {
     String FEATURE_BUNDLES = "Bundles";
 
     String FEATURE_CONFIGURATIONS = "Configurations";
-    
+
     String FEATURE_CONFIGURATIONFILES = "Configuration Files";
 
     String FEATURE_INSTALLED = "Installed";
@@ -74,7 +38,7 @@ public interface FeaturesServiceMBean {
     String FEATURE_CONFIG_ELEMENTS = "Elements";
     String FEATURE_CONFIG_ELEMENT_KEY = "Key";
     String FEATURE_CONFIG_ELEMENT_VALUE = "Value";
-    
+
     String FEATURE_CONFIG_FILES_ELEMENTS = "Files";
 
     /**
@@ -91,22 +55,22 @@ public interface FeaturesServiceMBean {
     /**
      * The item names in the CompositeData representing a feature
      */
-    String[] FEATURE = { FEATURE_NAME, FEATURE_VERSION, FEATURE_DEPENDENCIES, FEATURE_BUNDLES,
-                         FEATURE_CONFIGURATIONS, FEATURE_CONFIGURATIONFILES, FEATURE_INSTALLED };
+    String[] FEATURE = {FEATURE_NAME, FEATURE_VERSION, FEATURE_DEPENDENCIES, FEATURE_BUNDLES,
+        FEATURE_CONFIGURATIONS, FEATURE_CONFIGURATIONFILES, FEATURE_INSTALLED};
 
-    String[] FEATURE_IDENTIFIER = { FEATURE_NAME, FEATURE_VERSION };
+    String[] FEATURE_IDENTIFIER = {FEATURE_NAME, FEATURE_VERSION};
 
-    String[] FEATURE_CONFIG = { FEATURE_CONFIG_PID, FEATURE_CONFIG_ELEMENTS };
-    
-    String[] FEATURE_CONFIG_FILES = { FEATURE_CONFIG_FILES_ELEMENTS };
+    String[] FEATURE_CONFIG = {FEATURE_CONFIG_PID, FEATURE_CONFIG_ELEMENTS};
 
-    String[] FEATURE_CONFIG_ELEMENT = { FEATURE_CONFIG_ELEMENT_KEY, FEATURE_CONFIG_ELEMENT_VALUE };
+    String[] FEATURE_CONFIG_FILES = {FEATURE_CONFIG_FILES_ELEMENTS};
+
+    String[] FEATURE_CONFIG_ELEMENT = {FEATURE_CONFIG_ELEMENT_KEY, FEATURE_CONFIG_ELEMENT_VALUE};
 
     /**
      * The item names in the CompositeData representing the event raised for
      * feature events within the OSGi container by this bean
      */
-    String[] FEATURE_EVENT = { FEATURE_NAME, FEATURE_VERSION, FEATURE_EVENT_EVENT_TYPE };
+    String[] FEATURE_EVENT = {FEATURE_NAME, FEATURE_VERSION, FEATURE_EVENT_EVENT_TYPE};
 
 
     String REPOSITORY_NAME = "Name";
@@ -131,12 +95,48 @@ public interface FeaturesServiceMBean {
     /**
      * The item names in the CompositeData representing a feature
      */
-    String[] REPOSITORY = { REPOSITORY_NAME, REPOSITORY_URI,  REPOSITORY_REPOSITORIES, REPOSITORY_FEATURES };
+    String[] REPOSITORY = {REPOSITORY_NAME, REPOSITORY_URI, REPOSITORY_REPOSITORIES, REPOSITORY_FEATURES};
 
     /**
      * The item names in the CompositeData representing the event raised for
      * feature events within the OSGi container by this bean
      */
-    String[] REPOSITORY_EVENT = { REPOSITORY_URI, REPOSITORY_EVENT_EVENT_TYPE };
+    String[] REPOSITORY_EVENT = {REPOSITORY_URI, REPOSITORY_EVENT_EVENT_TYPE};
+
+    TabularData getFeatures() throws Exception;
+
+    TabularData getRepositories() throws Exception;
+
+    void addRepository(String url) throws Exception;
+
+    void addRepository(String url, boolean install) throws Exception;
+
+    void removeRepository(String url) throws Exception;
+
+    void removeRepository(String url, boolean uninstall) throws Exception;
+
+    void installFeature(String name) throws Exception;
+
+    void installFeature(String name, boolean noRefresh) throws Exception;
+
+    void installFeature(String name, boolean noRefresh, boolean noStart) throws Exception;
+
+    void installFeature(String name, String version) throws Exception;
+
+    void installFeature(String name, String version, boolean noRefresh) throws Exception;
+
+    void installFeature(String name, String version, boolean noRefresh, boolean noStart) throws Exception;
+
+    TabularData infoFeature(String name) throws Exception;
+
+    TabularData infoFeature(String name, String version) throws Exception;
+
+    void uninstallFeature(String name) throws Exception;
+
+    void uninstallFeature(String name, boolean noRefresh) throws Exception;
+
+    void uninstallFeature(String name, String version) throws Exception;
+
+    void uninstallFeature(String name, String version, boolean noRefresh) throws Exception;
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeature.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeature.java b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeature.java
index 54fa3c0..eabc8ad 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeature.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeature.java
@@ -22,16 +22,16 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
 import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
 
 import org.apache.karaf.features.BundleInfo;
 import org.apache.karaf.features.ConfigFileInfo;
@@ -44,29 +44,29 @@ public class JmxFeature {
     /**
      * The CompositeType which represents a single feature
      */
-    public final static CompositeType FEATURE;
+    public static final CompositeType FEATURE;
 
     /**
      * The TabularType which represents a list of features
      */
-    public final static TabularType FEATURE_TABLE;
+    public static final TabularType FEATURE_TABLE;
+
+    public static final CompositeType FEATURE_IDENTIFIER;
 
-    public final static CompositeType FEATURE_IDENTIFIER;
+    public static final TabularType FEATURE_IDENTIFIER_TABLE;
 
-    public final static TabularType FEATURE_IDENTIFIER_TABLE;
+    public static final CompositeType FEATURE_CONFIG_ELEMENT;
 
-    public final static CompositeType FEATURE_CONFIG_ELEMENT;
+    public static final TabularType FEATURE_CONFIG_ELEMENT_TABLE;
 
-    public final static TabularType FEATURE_CONFIG_ELEMENT_TABLE;
+    public static final CompositeType FEATURE_CONFIG;
 
-    public final static CompositeType FEATURE_CONFIG;
+    public static final TabularType FEATURE_CONFIG_TABLE;
 
-    public final static TabularType FEATURE_CONFIG_TABLE;
+    public static final CompositeType FEATURE_CONFIG_FILES;
+
+    public static final TabularType FEATURE_CONFIG_FILES_TABLE;
 
-    public final static CompositeType FEATURE_CONFIG_FILES;
-    
-    public final static TabularType FEATURE_CONFIG_FILES_TABLE;
-    
     private final CompositeData data;
 
     public JmxFeature(Feature feature, boolean installed) {
@@ -98,17 +98,17 @@ public class JmxFeature {
         return table;
     }
 
-     private static TabularData getDependencyIdentifierTable(List<Dependency> features) throws OpenDataException {
+    private static TabularData getDependencyIdentifierTable(List<Dependency> features) throws OpenDataException {
         TabularDataSupport table = new TabularDataSupport(FEATURE_IDENTIFIER_TABLE);
-        Set<String> featureSet = new HashSet<String>();
+        Set<String> featureSet = new HashSet<>();
         for (Dependency feature : features) {
             if (featureSet.contains(feature.getName() + feature.getVersion())) {
                 continue;
             } else {
                 featureSet.add(feature.getName() + feature.getVersion());
             }
-            String[] itemNames = new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION };
-            Object[] itemValues = new Object[] { feature.getName(), feature.getVersion() };
+            String[] itemNames = new String[]{FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION};
+            Object[] itemValues = new Object[]{feature.getName(), feature.getVersion()};
             CompositeData ident = new CompositeDataSupport(FEATURE_IDENTIFIER, itemNames, itemValues);
             table.put(ident);
         }
@@ -135,12 +135,12 @@ public class JmxFeature {
         }
         return table;
     }
-    
+
     static TabularData getConfigFileList(List<ConfigFileInfo> configFiles) throws OpenDataException {
         TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_FILES_TABLE);
         for (ConfigFileInfo configFile : configFiles) {
             String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG_FILES;
-            Object[] itemValues = { configFile.getFinalname() };
+            Object[] itemValues = {configFile.getFinalname()};
             CompositeData config = new CompositeDataSupport(FEATURE_CONFIG_FILES, itemNames, itemValues);
             table.put(config);
         }
@@ -151,7 +151,7 @@ public class JmxFeature {
         TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_ELEMENT_TABLE);
         for (Map.Entry<String, String> entry : config.entrySet()) {
             String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG_ELEMENT;
-            Object[] itemValues = { entry.getKey(), entry.getValue() };
+            Object[] itemValues = {entry.getKey(), entry.getValue()};
             CompositeData element = new CompositeDataSupport(FEATURE_CONFIG_ELEMENT, itemNames, itemValues);
             table.put(element);
         }
@@ -166,7 +166,7 @@ public class JmxFeature {
         FEATURE_CONFIG_ELEMENT_TABLE = createFeatureConfigElementTableType();
         FEATURE_CONFIG = createFeatureConfigType();
         FEATURE_CONFIG_TABLE = createFeatureConfigTableType();
-        FEATURE_CONFIG_FILES =  createFeatureConfigFilesType();
+        FEATURE_CONFIG_FILES = createFeatureConfigFilesType();
         FEATURE_CONFIG_FILES_TABLE = createFeatureConfigFilesTableType();
         FEATURE = createFeatureType();
         FEATURE_TABLE = createFeatureTableType();
@@ -194,7 +194,7 @@ public class JmxFeature {
     private static TabularType createFeatureIdentifierTableType() {
         try {
             return new TabularType("Features", "The table of featureIdentifiers",
-                    FEATURE_IDENTIFIER, new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION });
+                    FEATURE_IDENTIFIER, new String[]{FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build featureIdentifier table type", e);
         }
@@ -222,7 +222,7 @@ public class JmxFeature {
     private static TabularType createFeatureConfigElementTableType() {
         try {
             return new TabularType("ConfigElement", "The table of configurations elements",
-                    FEATURE_CONFIG_ELEMENT, new String[] { FeaturesServiceMBean.FEATURE_CONFIG_ELEMENT_KEY});
+                    FEATURE_CONFIG_ELEMENT, new String[]{FeaturesServiceMBean.FEATURE_CONFIG_ELEMENT_KEY});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build feature table type", e);
         }
@@ -246,7 +246,7 @@ public class JmxFeature {
             throw new IllegalStateException("Unable to build configElement type", e);
         }
     }
-    
+
     private static CompositeType createFeatureConfigFilesType() {
         try {
             String description = "This type encapsulates Karaf feature config files";
@@ -267,16 +267,16 @@ public class JmxFeature {
     private static TabularType createFeatureConfigTableType() {
         try {
             return new TabularType("Features", "The table of configurations",
-                    FEATURE_CONFIG, new String[] { FeaturesServiceMBean.FEATURE_CONFIG_PID});
+                    FEATURE_CONFIG, new String[]{FeaturesServiceMBean.FEATURE_CONFIG_PID});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build feature table type", e);
         }
     }
-    
+
     private static TabularType createFeatureConfigFilesTableType() {
         try {
             return new TabularType("Features", "The table of configuration files",
-            		FEATURE_CONFIG_FILES, new String[] { FeaturesServiceMBean.FEATURE_CONFIG_FILES_ELEMENTS });
+                    FEATURE_CONFIG_FILES, new String[]{FeaturesServiceMBean.FEATURE_CONFIG_FILES_ELEMENTS});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build feature table type", e);
         }
@@ -291,7 +291,7 @@ public class JmxFeature {
             itemTypes[0] = SimpleType.STRING;
             itemTypes[1] = SimpleType.STRING;
             itemTypes[2] = FEATURE_IDENTIFIER_TABLE;
-            itemTypes[3] = new ArrayType(1, SimpleType.STRING);
+            itemTypes[3] = new ArrayType<String>(1, SimpleType.STRING);
             itemTypes[4] = FEATURE_CONFIG_TABLE;
             itemTypes[5] = FEATURE_CONFIG_FILES_TABLE;
             itemTypes[6] = SimpleType.BOOLEAN;
@@ -314,7 +314,7 @@ public class JmxFeature {
     private static TabularType createFeatureTableType() {
         try {
             return new TabularType("Features", "The table of all features",
-                    FEATURE, new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION });
+                    FEATURE, new String[]{FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build feature table type", e);
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeatureEvent.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeatureEvent.java b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeatureEvent.java
index 81f446b..2319a15 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeatureEvent.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxFeatureEvent.java
@@ -18,8 +18,8 @@ package org.apache.karaf.features.management.codec;
 
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
 
@@ -39,9 +39,14 @@ public class JmxFeatureEvent {
             itemValues[0] = event.getFeature().getName();
             itemValues[1] = event.getFeature().getVersion();
             switch (event.getType()) {
-                case FeatureInstalled:   itemValues[2] = FeaturesServiceMBean.FEATURE_EVENT_EVENT_TYPE_INSTALLED; break;
-                case FeatureUninstalled: itemValues[2] = FeaturesServiceMBean.FEATURE_EVENT_EVENT_TYPE_UNINSTALLED; break;
-                default: throw new IllegalStateException("Unsupported event type: " + event.getType());
+            case FeatureInstalled:
+                itemValues[2] = FeaturesServiceMBean.FEATURE_EVENT_EVENT_TYPE_INSTALLED;
+                break;
+            case FeatureUninstalled:
+                itemValues[2] = FeaturesServiceMBean.FEATURE_EVENT_EVENT_TYPE_UNINSTALLED;
+                break;
+            default:
+                throw new IllegalStateException("Unsupported event type: " + event.getType());
             }
             data = new CompositeDataSupport(FEATURE_EVENT, itemNames, itemValues);
         } catch (OpenDataException e) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepository.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepository.java b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepository.java
index fee1ab2..2dedbbe 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepository.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepository.java
@@ -16,21 +16,21 @@
  */
 package org.apache.karaf.features.management.codec;
 
-import java.util.Collection;
-import java.util.Arrays;
 import java.net.URI;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 
-import javax.management.openmbean.TabularData;
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
 import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.TabularType;
+import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.TabularType;
 
 import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.Repository;
@@ -38,9 +38,9 @@ import org.apache.karaf.features.management.FeaturesServiceMBean;
 
 public class JmxRepository {
 
-    public final static CompositeType REPOSITORY;
+    public static final CompositeType REPOSITORY;
 
-    public final static TabularType REPOSITORY_TABLE;
+    public static final TabularType REPOSITORY_TABLE;
 
     private final CompositeData data;
 
@@ -84,8 +84,8 @@ public class JmxRepository {
     static TabularData getFeatureIdentifierTable(List<Feature> features) throws OpenDataException {
         TabularDataSupport table = new TabularDataSupport(JmxFeature.FEATURE_IDENTIFIER_TABLE);
         for (Feature feature : features) {
-            String[] itemNames = new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION };
-            Object[] itemValues = new Object[] { feature.getName(), feature.getVersion() };
+            String[] itemNames = new String[]{FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION};
+            Object[] itemValues = new Object[]{feature.getName(), feature.getVersion()};
             CompositeData ident = new CompositeDataSupport(JmxFeature.FEATURE_IDENTIFIER, itemNames, itemValues);
             table.put(ident);
         }
@@ -105,7 +105,7 @@ public class JmxRepository {
             String[] itemDescriptions = new String[itemNames.length];
             itemTypes[0] = SimpleType.STRING;
             itemTypes[1] = SimpleType.STRING;
-            itemTypes[2] = new ArrayType(1, SimpleType.STRING);
+            itemTypes[2] = new ArrayType<String>(1, SimpleType.STRING);
             itemTypes[3] = JmxFeature.FEATURE_IDENTIFIER_TABLE;
 
             itemDescriptions[0] = "The name of the repository";
@@ -123,7 +123,7 @@ public class JmxRepository {
     private static TabularType createRepositoryTableType() {
         try {
             return new TabularType("Features", "The table of repositories",
-                    REPOSITORY, new String[] { FeaturesServiceMBean.REPOSITORY_URI });
+                    REPOSITORY, new String[]{FeaturesServiceMBean.REPOSITORY_URI});
         } catch (OpenDataException e) {
             throw new IllegalStateException("Unable to build repository table type", e);
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepositoryEvent.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepositoryEvent.java b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepositoryEvent.java
index e00e85d..24ed606 100644
--- a/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepositoryEvent.java
+++ b/features/core/src/main/java/org/apache/karaf/features/management/codec/JmxRepositoryEvent.java
@@ -17,8 +17,8 @@
 package org.apache.karaf.features.management.codec;
 
 import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
@@ -38,9 +38,14 @@ public class JmxRepositoryEvent {
             Object[] itemValues = new Object[itemNames.length];
             itemValues[0] = event.getRepository().getURI().toString();
             switch (event.getType()) {
-                case RepositoryAdded:   itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_ADDED; break;
-                case RepositoryRemoved: itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_REMOVED; break;
-                default: throw new IllegalStateException("Unsupported event type: " + event.getType());
+            case RepositoryAdded:
+                itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_ADDED;
+                break;
+            case RepositoryRemoved:
+                itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_REMOVED;
+                break;
+            default:
+                throw new IllegalStateException("Unsupported event type: " + event.getType());
             }
             data = new CompositeDataSupport(REPOSITORY_EVENT, itemNames, itemValues);
         } catch (OpenDataException e) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/eclipse/equinox/internal/region/DigraphHelper.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/eclipse/equinox/internal/region/DigraphHelper.java b/features/core/src/main/java/org/eclipse/equinox/internal/region/DigraphHelper.java
index a5e96eb..76714c7 100644
--- a/features/core/src/main/java/org/eclipse/equinox/internal/region/DigraphHelper.java
+++ b/features/core/src/main/java/org/eclipse/equinox/internal/region/DigraphHelper.java
@@ -43,7 +43,7 @@ import org.osgi.framework.BundleException;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.hooks.bundle.CollisionHook;
 
-public class DigraphHelper {
+public final class DigraphHelper {
 
     private static final String DIGRAPH_FILE = "digraph.json";
 
@@ -53,6 +53,9 @@ public class DigraphHelper {
     private static final String HEAD = "head";
     private static final String POLICY = "policy";
 
+    private DigraphHelper() {
+    }
+
     public static StandardRegionDigraph loadDigraph(BundleContext bundleContext) throws BundleException, IOException, InvalidSyntaxException {
         StandardRegionDigraph digraph;
         ThreadLocal<Region> threadLocal = new ThreadLocal<>();
@@ -65,7 +68,7 @@ public class DigraphHelper {
             }
         } else {
             try (
-                InputStream in = new FileInputStream(digraphFile)
+                    InputStream in = new FileInputStream(digraphFile)
             ) {
                 digraph = readDigraph(new DataInputStream(in), bundleContext, threadLocal);
             }
@@ -76,7 +79,7 @@ public class DigraphHelper {
     public static void saveDigraph(BundleContext bundleContext, RegionDigraph digraph) throws IOException {
         File digraphFile = bundleContext.getDataFile(DIGRAPH_FILE);
         try (
-            FileOutputStream out = new FileOutputStream(digraphFile)
+                FileOutputStream out = new FileOutputStream(digraphFile)
         ) {
             saveDigraph(digraph, out);
         } catch (Exception e) {
@@ -107,7 +110,7 @@ public class DigraphHelper {
             String head = (String) e.get(HEAD);
             Map<String, Collection<String>> policy = (Map<String, Collection<String>>) e.get(POLICY);
             RegionFilterBuilder builder = digraph.createRegionFilterBuilder();
-            for (Map.Entry<String,Collection<String>> rf : policy.entrySet()) {
+            for (Map.Entry<String, Collection<String>> rf : policy.entrySet()) {
                 String ns = rf.getKey();
                 for (String f : rf.getValue()) {
                     builder.allow(ns, f);


[4/7] git commit: Code formatting and other checkstyle issues

Posted by gn...@apache.org.
Code formatting and other checkstyle issues

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

Branch: refs/heads/master
Commit: b6c5a173035e9903dddcb128138c6b9de3db7915
Parents: 06b62c0
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 29 00:38:58 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 29 00:38:58 2014 +0200

----------------------------------------------------------------------
 features/core/pom.xml                           |   1 -
 .../org/apache/karaf/features/BundleInfo.java   |   6 +-
 .../apache/karaf/features/ConfigFileInfo.java   |  12 +-
 .../org/apache/karaf/features/Dependency.java   |  27 +-
 .../apache/karaf/features/EventConstants.java   |   1 -
 .../java/org/apache/karaf/features/Feature.java |   4 +-
 .../karaf/features/FeaturesNamespaces.java      |  11 +-
 .../apache/karaf/features/FeaturesService.java  |  16 +-
 .../org/apache/karaf/features/Repository.java   |   2 +-
 .../internal/download/DownloadManager.java      |   2 +-
 .../download/simple/SimpleDownloader.java       |   4 +-
 .../management/FeaturesServiceMBeanImpl.java    |  58 +-
 .../management/StandardEmitterMBean.java        |  32 +-
 .../karaf/features/internal/model/Bundle.java   | 141 ++---
 .../features/internal/model/Capability.java     |  65 +-
 .../features/internal/model/Conditional.java    |   7 +-
 .../karaf/features/internal/model/Config.java   |  74 +--
 .../features/internal/model/ConfigFile.java     |  97 ++-
 .../karaf/features/internal/model/Content.java  |  12 +-
 .../features/internal/model/Dependency.java     |  80 +--
 .../karaf/features/internal/model/Feature.java  | 192 +++---
 .../karaf/features/internal/model/Features.java |  96 ++-
 .../karaf/features/internal/model/JaxbUtil.java |  57 +-
 .../features/internal/model/ObjectFactory.java  |  58 +-
 .../features/internal/model/Requirement.java    |  58 +-
 .../features/internal/model/ScopeFilter.java    |   4 +-
 .../karaf/features/internal/model/Scoping.java  |   9 +-
 .../features/internal/model/package-info.java   |  31 +-
 .../karaf/features/internal/osgi/Activator.java |  76 ++-
 .../region/AbstractRegionDigraphVisitor.java    |   7 +-
 .../internal/region/CandidateComparator.java    |  35 +-
 .../features/internal/region/Subsystem.java     |   4 +-
 .../internal/region/SubsystemResolver.java      |  15 +-
 .../internal/repository/JsonRepository.java     |   8 +-
 .../internal/repository/StaxParser.java         | 130 ++--
 .../features/internal/repository/UrlLoader.java |   2 +-
 .../internal/resolver/CapabilityImpl.java       | 122 +---
 .../internal/resolver/CapabilitySet.java        | 499 ++++++---------
 .../internal/resolver/FeatureResource.java      |  14 +-
 .../internal/resolver/RequirementImpl.java      |  37 +-
 .../internal/resolver/ResourceBuilder.java      | 618 +++++++------------
 .../internal/resolver/ResourceImpl.java         |  64 +-
 .../internal/resolver/ResourceUtils.java        |   5 +-
 .../internal/resolver/SimpleFilter.java         | 518 ++++++----------
 .../internal/resolver/Slf4jResolverLog.java     |  24 +-
 .../features/internal/service/Artifact.java     |   6 +-
 .../internal/service/BootFeaturesInstaller.java |  10 +-
 .../internal/service/BundleComparator.java      |   2 -
 .../internal/service/EventAdminListener.java    |  32 +-
 .../service/FeatureConfigInstaller.java         |  47 +-
 .../internal/service/FeatureValidationUtil.java |  18 +-
 .../internal/service/FeaturesServiceImpl.java   |  89 ++-
 .../features/internal/service/Overrides.java    |  19 +-
 .../internal/service/RepositoryImpl.java        |   2 +-
 .../internal/service/RequirementSort.java       |   5 +-
 .../features/internal/service/StateStorage.java |  17 +-
 .../features/internal/util/ChecksumUtils.java   |   2 +-
 .../features/internal/util/JsonReader.java      | 147 ++---
 .../features/internal/util/JsonWriter.java      |  47 +-
 .../karaf/features/internal/util/Macro.java     |  65 +-
 .../karaf/features/internal/util/MapUtils.java  |   9 +-
 .../features/internal/util/MultiException.java  |  15 +-
 .../management/FeaturesServiceMBean.java        |  96 +--
 .../features/management/codec/JmxFeature.java   |  68 +-
 .../management/codec/JmxFeatureEvent.java       |  13 +-
 .../management/codec/JmxRepository.java         |  28 +-
 .../management/codec/JmxRepositoryEvent.java    |  13 +-
 .../equinox/internal/region/DigraphHelper.java  |  11 +-
 68 files changed, 1761 insertions(+), 2335 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/pom.xml
----------------------------------------------------------------------
diff --git a/features/core/pom.xml b/features/core/pom.xml
index 75fdf94..7972022 100644
--- a/features/core/pom.xml
+++ b/features/core/pom.xml
@@ -136,7 +136,6 @@
                             org.apache.felix.utils.manifest,
                             org.apache.karaf.util,
                             org.apache.karaf.util.collections,
-                            org.apache.karaf.util.json,
                             org.apache.karaf.util.tracker,
                             org.eclipse.equinox.internal.region.*;-split-package:=merge-first,
                         </Private-Package>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/BundleInfo.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/BundleInfo.java b/features/core/src/main/java/org/apache/karaf/features/BundleInfo.java
index 97a541f..c1a4c05 100644
--- a/features/core/src/main/java/org/apache/karaf/features/BundleInfo.java
+++ b/features/core/src/main/java/org/apache/karaf/features/BundleInfo.java
@@ -21,10 +21,10 @@ package org.apache.karaf.features;
  */
 public interface BundleInfo {
 
-	String getLocation();
-	
+    String getLocation();
+
     int getStartLevel();
-    
+
     boolean isStart();
 
     boolean isDependency();

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/ConfigFileInfo.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/ConfigFileInfo.java b/features/core/src/main/java/org/apache/karaf/features/ConfigFileInfo.java
index 960fb31..11dbef2 100644
--- a/features/core/src/main/java/org/apache/karaf/features/ConfigFileInfo.java
+++ b/features/core/src/main/java/org/apache/karaf/features/ConfigFileInfo.java
@@ -17,11 +17,11 @@
 package org.apache.karaf.features;
 
 public interface ConfigFileInfo {
-	
-	String getLocation();
-	
-	String getFinalname();
-	
-	boolean isOverride();
+
+    String getLocation();
+
+    String getFinalname();
+
+    boolean isOverride();
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/Dependency.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/Dependency.java b/features/core/src/main/java/org/apache/karaf/features/Dependency.java
index cafdd92..5e019c7 100644
--- a/features/core/src/main/java/org/apache/karaf/features/Dependency.java
+++ b/features/core/src/main/java/org/apache/karaf/features/Dependency.java
@@ -1,23 +1,20 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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 Dependency {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/EventConstants.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/EventConstants.java b/features/core/src/main/java/org/apache/karaf/features/EventConstants.java
index f83f185..5c819a0 100644
--- a/features/core/src/main/java/org/apache/karaf/features/EventConstants.java
+++ b/features/core/src/main/java/org/apache/karaf/features/EventConstants.java
@@ -42,5 +42,4 @@ public final class EventConstants {
     }
 
 
-
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/Feature.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/Feature.java b/features/core/src/main/java/org/apache/karaf/features/Feature.java
index 06235e2..de2de9b 100644
--- a/features/core/src/main/java/org/apache/karaf/features/Feature.java
+++ b/features/core/src/main/java/org/apache/karaf/features/Feature.java
@@ -24,7 +24,7 @@ import java.util.Map;
  */
 public interface Feature {
 
-    public static String DEFAULT_INSTALL_MODE = "auto";
+    String DEFAULT_INSTALL_MODE = "auto";
 
     String getId();
 
@@ -51,7 +51,7 @@ public interface Feature {
     List<ConfigFileInfo> getConfigurationFiles();
 
     List<? extends Conditional> getConditional();
-    
+
     int getStartLevel();
 
     List<? extends Capability> getCapabilities();

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/FeaturesNamespaces.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/FeaturesNamespaces.java b/features/core/src/main/java/org/apache/karaf/features/FeaturesNamespaces.java
index 282ff71..becc252 100644
--- a/features/core/src/main/java/org/apache/karaf/features/FeaturesNamespaces.java
+++ b/features/core/src/main/java/org/apache/karaf/features/FeaturesNamespaces.java
@@ -5,13 +5,14 @@
  * 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.
+ * 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;
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java b/features/core/src/main/java/org/apache/karaf/features/FeaturesService.java
index 178f404..d8f3d50 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
@@ -38,7 +38,7 @@ public interface FeaturesService {
 
     /**
      * Validate repository contents.
-     * 
+     *
      * @param uri Repository uri.
      * @throws Exception When validation fails.
      */
@@ -51,19 +51,19 @@ public interface FeaturesService {
     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;
@@ -79,7 +79,7 @@ public interface FeaturesService {
     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;
@@ -100,10 +100,10 @@ public interface FeaturesService {
 
     Feature getFeature(String name) throws Exception;
 
-	void refreshRepository(URI uri) throws Exception;
+    void refreshRepository(URI uri) throws Exception;
 
-    public URI getRepositoryUriFor(String name, String version);
+    URI getRepositoryUriFor(String name, String version);
 
-    public String[] getRepositoryNames();
+    String[] getRepositoryNames();
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/Repository.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/Repository.java b/features/core/src/main/java/org/apache/karaf/features/Repository.java
index 84d4a50..0385e4b 100644
--- a/features/core/src/main/java/org/apache/karaf/features/Repository.java
+++ b/features/core/src/main/java/org/apache/karaf/features/Repository.java
@@ -31,5 +31,5 @@ public interface Repository {
     URI[] getRepositories() throws Exception;
 
     Feature[] getFeatures() throws Exception;
-    
+
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/download/DownloadManager.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/download/DownloadManager.java b/features/core/src/main/java/org/apache/karaf/features/internal/download/DownloadManager.java
index 0bac194..d9094a1 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/download/DownloadManager.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/download/DownloadManager.java
@@ -22,6 +22,6 @@ public interface DownloadManager {
 
     Downloader createDownloader();
 
-    Map<String,StreamProvider> getProviders();
+    Map<String, StreamProvider> getProviders();
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/download/simple/SimpleDownloader.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/download/simple/SimpleDownloader.java b/features/core/src/main/java/org/apache/karaf/features/internal/download/simple/SimpleDownloader.java
index 11b20cd..91caac6 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/download/simple/SimpleDownloader.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/download/simple/SimpleDownloader.java
@@ -35,7 +35,7 @@ import org.apache.karaf.features.internal.download.Downloader;
 import org.apache.karaf.features.internal.download.StreamProvider;
 import org.apache.karaf.features.internal.util.MultiException;
 
- import static java.util.jar.JarFile.MANIFEST_NAME;
+import static java.util.jar.JarFile.MANIFEST_NAME;
 
 public class SimpleDownloader implements DownloadManager, Downloader {
 
@@ -102,7 +102,7 @@ public class SimpleDownloader implements DownloadManager, Downloader {
 
         protected Map<String, String> doGetMetadata() throws IOException {
             try (
-                InputStream is = open()
+                    InputStream is = open()
             ) {
                 ZipInputStream zis = new ZipInputStream(is);
                 ZipEntry entry;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
index b1a5865..4bed3c6 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
@@ -1,15 +1,18 @@
 /*
- * Licensed 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
+ * 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
+ *      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.
+ * 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.management;
 
@@ -28,7 +31,12 @@ import javax.management.Notification;
 import javax.management.ObjectName;
 import javax.management.openmbean.TabularData;
 
-import org.apache.karaf.features.*;
+import org.apache.karaf.features.Feature;
+import org.apache.karaf.features.FeatureEvent;
+import org.apache.karaf.features.FeaturesListener;
+import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.features.Repository;
+import org.apache.karaf.features.RepositoryEvent;
 import org.apache.karaf.features.management.FeaturesServiceMBean;
 import org.apache.karaf.features.management.codec.JmxFeature;
 import org.apache.karaf.features.management.codec.JmxFeatureEvent;
@@ -49,9 +57,9 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
 
     private ObjectName objectName;
 
-    private volatile long sequenceNumber = 0;
+    private volatile long sequenceNumber;
 
-    private org.apache.karaf.features.FeaturesService featuresService;
+    private FeaturesService featuresService;
 
     public FeaturesServiceMBeanImpl() throws NotCompliantMBeanException {
         super(FeaturesServiceMBean.class);
@@ -81,7 +89,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
         try {
             List<Feature> allFeatures = Arrays.asList(featuresService.listFeatures());
             List<Feature> insFeatures = Arrays.asList(featuresService.listInstalledFeatures());
-            ArrayList<JmxFeature> features = new ArrayList<JmxFeature>();
+            ArrayList<JmxFeature> features = new ArrayList<>();
             for (Feature feature : allFeatures) {
                 try {
                     features.add(new JmxFeature(feature, insFeatures.contains(feature)));
@@ -89,8 +97,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
                     t.printStackTrace();
                 }
             }
-            TabularData table = JmxFeature.tableFrom(features);
-            return table;
+            return JmxFeature.tableFrom(features);
         } catch (Throwable t) {
             t.printStackTrace();
             return null;
@@ -103,7 +110,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
     public TabularData getRepositories() throws Exception {
         try {
             List<Repository> allRepositories = Arrays.asList(featuresService.listRepositories());
-            ArrayList<JmxRepository> repositories = new ArrayList<JmxRepository>();
+            ArrayList<JmxRepository> repositories = new ArrayList<>();
             for (Repository repository : allRepositories) {
                 try {
                     repositories.add(new JmxRepository(repository));
@@ -111,8 +118,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
                     t.printStackTrace();
                 }
             }
-            TabularData table = JmxRepository.tableFrom(repositories);
-            return table;
+            return JmxRepository.tableFrom(repositories);
         } catch (Throwable t) {
             t.printStackTrace();
             return null;
@@ -202,16 +208,15 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
     }
 
     private TabularData infoFeature(Feature feature) throws Exception {
-        JmxFeature jmxFeature = null;
+        JmxFeature jmxFeature;
         if (featuresService.isInstalled(feature)) {
             jmxFeature = new JmxFeature(feature, true);
         } else {
             jmxFeature = new JmxFeature(feature, false);
         }
-        ArrayList<JmxFeature> features = new ArrayList<JmxFeature>();
+        ArrayList<JmxFeature> features = new ArrayList<>();
         features.add(jmxFeature);
-        TabularData table = JmxFeature.tableFrom(features);
-        return table;
+        return JmxFeature.tableFrom(features);
     }
 
     public void uninstallFeature(String name) throws Exception {
@@ -233,7 +238,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
     public void uninstallFeature(String name, String version, boolean noRefresh) throws Exception {
         EnumSet<org.apache.karaf.features.FeaturesService.Option> options = EnumSet.noneOf(org.apache.karaf.features.FeaturesService.Option.class);
         if (noRefresh) {
-            options.add(org.apache.karaf.features.FeaturesService.Option.NoAutoRefreshBundles);
+            options.add(FeaturesService.Option.NoAutoRefreshBundles);
         }
         featuresService.uninstallFeature(name, version, options);
     }
@@ -242,7 +247,7 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
         this.bundleContext = bundleContext;
     }
 
-    public void setFeaturesService(org.apache.karaf.features.FeaturesService featuresService) {
+    public void setFeaturesService(FeaturesService featuresService) {
         this.featuresService = featuresService;
     }
 
@@ -264,13 +269,6 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
                 }
             }
 
-            public boolean equals(Object o) {
-                if (this == o) {
-                    return true;
-                }
-                return o.equals(this);
-            }
-
         };
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/management/StandardEmitterMBean.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/management/StandardEmitterMBean.java b/features/core/src/main/java/org/apache/karaf/features/internal/management/StandardEmitterMBean.java
index 13a4b6c..37792f3 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/management/StandardEmitterMBean.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/management/StandardEmitterMBean.java
@@ -1,26 +1,38 @@
 /*
- * Licensed 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
+ * 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
+ *      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.
+ * 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.management;
 
-import javax.management.*;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.NotCompliantMBeanException;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.StandardMBean;
 
 public class StandardEmitterMBean extends StandardMBean implements NotificationEmitter {
 
     private final NotificationBroadcasterSupport emitter;
 
     @SuppressWarnings("rawtypes")
-	public StandardEmitterMBean(Class mbeanInterface) throws NotCompliantMBeanException {
+    public StandardEmitterMBean(Class mbeanInterface) throws NotCompliantMBeanException {
         super(mbeanInterface);
         this.emitter = new NotificationBroadcasterSupport() {
             @Override

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java
index 7eebbe5..82b3ec3 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java
@@ -1,23 +1,20 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -26,18 +23,18 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlSchemaType;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
+
 import org.apache.karaf.features.BundleInfo;
 
 
 /**
- * 
  * Deployable element to install.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for bundle complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="bundle">
  *   &lt;simpleContent>
@@ -49,13 +46,11 @@ import org.apache.karaf.features.BundleInfo;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "bundle", propOrder = {
-    "value"
-})
+        "value"
+        })
 public class Bundle implements BundleInfo {
 
     @XmlValue
@@ -64,7 +59,7 @@ public class Bundle implements BundleInfo {
     @XmlAttribute(name = "start-level")
     protected Integer startLevel;
     @XmlAttribute
-    protected Boolean start;// = true;
+    protected Boolean start; // = true;
     @XmlAttribute
     protected Boolean dependency;
 
@@ -78,11 +73,9 @@ public class Bundle implements BundleInfo {
 
     /**
      * Gets the value of the value property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getLocation() {
         return value;
@@ -90,11 +83,9 @@ public class Bundle implements BundleInfo {
 
     /**
      * Sets the value of the value property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setLocation(String value) {
         this.value = value;
@@ -102,23 +93,19 @@ public class Bundle implements BundleInfo {
 
     /**
      * Gets the value of the startLevel property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *     
+     *
+     * @return possible object is
+     * {@link Integer }
      */
     public int getStartLevel() {
-        return startLevel == null? 0: startLevel;
+        return startLevel == null ? 0 : startLevel;
     }
 
     /**
      * Sets the value of the startLevel property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setStartLevel(Integer value) {
         this.startLevel = value;
@@ -126,23 +113,19 @@ public class Bundle implements BundleInfo {
 
     /**
      * Gets the value of the start property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *     
+     *
+     * @return possible object is
+     * {@link Boolean }
      */
     public boolean isStart() {
-        return start == null? true: start;
+        return start == null ? true : start;
     }
 
     /**
      * Sets the value of the start property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setStart(Boolean value) {
         this.start = value;
@@ -150,23 +133,19 @@ public class Bundle implements BundleInfo {
 
     /**
      * Gets the value of the dependency property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *     
+     *
+     * @return possible object is
+     * {@link Boolean }
      */
     public boolean isDependency() {
-        return dependency == null? false: dependency;
+        return dependency == null ? false : dependency;
     }
 
     /**
      * Sets the value of the dependency property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setDependency(Boolean value) {
         this.dependency = value;
@@ -174,16 +153,26 @@ public class Bundle implements BundleInfo {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         Bundle bundle = (Bundle) o;
-
-        if (dependency != bundle.dependency) return false;
-        if (start != bundle.start) return false;
-        if (startLevel != bundle.startLevel) return false;
-        if (value != null ? !value.equals(bundle.value) : bundle.value != null) return false;
-
+        if (dependency != bundle.dependency) {
+            return false;
+        }
+        if (start != bundle.start) {
+            return false;
+        }
+        if ((startLevel != null ? startLevel : 0) != (bundle.startLevel != null ? bundle.startLevel : 0)) {
+            return false;
+        }
+        if (value != null ? !value.equals(bundle.value) : bundle.value != null) {
+            return false;
+        }
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Capability.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Capability.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Capability.java
index b866151..c2ee7b7 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Capability.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Capability.java
@@ -1,44 +1,35 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlSchemaType;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
 
-import org.apache.karaf.features.BundleInfo;
-
 
 /**
- * 
  * Additional capability for a feature.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for bundle complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="capability">
  *   &lt;simpleContent>
@@ -47,13 +38,9 @@ import org.apache.karaf.features.BundleInfo;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "capability", propOrder = {
-    "value"
-})
+@XmlType(name = "capability", propOrder = {"value"})
 public class Capability implements org.apache.karaf.features.Capability {
 
     @XmlValue
@@ -73,19 +60,21 @@ public class Capability implements org.apache.karaf.features.Capability {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
         Capability bundle = (Capability) o;
-
-        if (value != null ? !value.equals(bundle.value) : bundle.value != null) return false;
-
+        if (value != null ? !value.equals(bundle.value) : bundle.value != null) {
+            return false;
+        }
         return true;
     }
 
     @Override
     public int hashCode() {
-        int result = value != null ? value.hashCode() : 0;
-        return result;
+        return value != null ? value.hashCode() : 0;
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Conditional.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Conditional.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Conditional.java
index ed0e8ff..ae309e5 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Conditional.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Conditional.java
@@ -17,12 +17,13 @@
 package org.apache.karaf.features.internal.model;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
+
 import org.apache.karaf.features.Feature;
 
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -32,7 +33,7 @@ import org.apache.karaf.features.Feature;
         "configfile",
         "feature",
         "bundle"
-})
+        })
 public class Conditional extends Content implements org.apache.karaf.features.Conditional {
 
     @XmlElement(name = "condition")
@@ -40,7 +41,7 @@ public class Conditional extends Content implements org.apache.karaf.features.Co
 
     public List<String> getCondition() {
         if (condition == null) {
-            this.condition = new ArrayList<String>();
+            this.condition = new ArrayList<>();
         }
         return condition;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Config.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Config.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Config.java
index a2c6674..4a89187 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Config.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Config.java
@@ -1,22 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -27,15 +24,14 @@ import javax.xml.bind.annotation.XmlValue;
 
 
 /**
- * 
  * Configuration entries which should be created during feature installation. This
  * configuration may be used with OSGi Configuration Admin.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for config complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="config">
  *   &lt;simpleContent>
@@ -45,13 +41,9 @@ import javax.xml.bind.annotation.XmlValue;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "config", propOrder = {
-    "value"
-})
+@XmlType(name = "config", propOrder = {"value"})
 public class Config {
 
     @XmlValue
@@ -61,11 +53,9 @@ public class Config {
 
     /**
      * Gets the value of the value property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getValue() {
         return value;
@@ -73,11 +63,9 @@ public class Config {
 
     /**
      * Sets the value of the value property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setValue(String value) {
         this.value = value;
@@ -85,11 +73,9 @@ public class Config {
 
     /**
      * Gets the value of the name property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getName() {
         return name;
@@ -97,11 +83,9 @@ public class Config {
 
     /**
      * Sets the value of the name property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setName(String value) {
         this.name = value;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/ConfigFile.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/ConfigFile.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/ConfigFile.java
index e5d9d94..a418622 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/ConfigFile.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/ConfigFile.java
@@ -1,22 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -24,18 +21,18 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
+
 import org.apache.karaf.features.ConfigFileInfo;
 
 
 /**
- * 
  * Additional configuration files which should be created during feature installation.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for configFile complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="configFile">
  *   &lt;simpleContent>
@@ -46,13 +43,9 @@ import org.apache.karaf.features.ConfigFileInfo;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "configFile", propOrder = {
-    "value"
-})
+@XmlType(name = "configFile", propOrder = {"value"})
 public class ConfigFile implements ConfigFileInfo {
 
     @XmlValue
@@ -64,11 +57,9 @@ public class ConfigFile implements ConfigFileInfo {
 
     /**
      * Gets the value of the value property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getLocation() {
         return value;
@@ -76,11 +67,9 @@ public class ConfigFile implements ConfigFileInfo {
 
     /**
      * Sets the value of the value property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setLocation(String value) {
         this.value = value;
@@ -88,11 +77,9 @@ public class ConfigFile implements ConfigFileInfo {
 
     /**
      * Gets the value of the finalname property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getFinalname() {
         return finalname;
@@ -100,37 +87,31 @@ public class ConfigFile implements ConfigFileInfo {
 
     /**
      * Sets the value of the finalname property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setFinalname(String value) {
-    	this.finalname = value;
+        this.finalname = value;
     }
 
     /**
      * Gets the value of the override property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *     
+     *
+     * @return possible object is
+     * {@link Boolean }
      */
     public boolean isOverride() {
-        return override == null? false: override;
+        return override == null ? false : override;
     }
 
     /**
      * Sets the value of the override property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setOverride(Boolean value) {
-    	this.override = value;
+        this.override = value;
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Content.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Content.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Content.java
index 756e4c1..3702901 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Content.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Content.java
@@ -27,7 +27,9 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
 import javax.xml.bind.annotation.XmlTransient;
+
 import org.apache.karaf.features.BundleInfo;
 import org.apache.karaf.features.ConfigFileInfo;
 
@@ -88,7 +90,7 @@ public class Content {
      */
     public List<ConfigFile> getConfigfile() {
         if (configfile == null) {
-            configfile = new ArrayList<ConfigFile>();
+            configfile = new ArrayList<>();
         }
         return this.configfile;
     }
@@ -115,7 +117,7 @@ public class Content {
      */
     public List<Dependency> getFeature() {
         if (feature == null) {
-            feature = new ArrayList<Dependency>();
+            feature = new ArrayList<>();
         }
         return this.feature;
     }
@@ -142,7 +144,7 @@ public class Content {
      */
     public List<Bundle> getBundle() {
         if (bundle == null) {
-            bundle = new ArrayList<Bundle>();
+            bundle = new ArrayList<>();
         }
         return this.bundle;
     }
@@ -181,8 +183,8 @@ public class Content {
     }
 
     @SuppressWarnings("rawtypes")
-	protected void interpolation(Properties properties) {
-        for (Enumeration e = properties.propertyNames(); e.hasMoreElements(); ) {
+    protected void interpolation(Properties properties) {
+        for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) {
             String key = (String) e.nextElement();
             String val = properties.getProperty(key);
             Matcher matcher = Pattern.compile("\\$\\{([^}]+)\\}").matcher(val);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Dependency.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Dependency.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Dependency.java
index 9c92a93..b099f28 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Dependency.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Dependency.java
@@ -1,23 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -28,14 +24,13 @@ import javax.xml.bind.annotation.XmlValue;
 
 
 /**
- * 
  * Dependency of feature.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for dependency complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="dependency">
  *   &lt;simpleContent>
@@ -45,13 +40,9 @@ import javax.xml.bind.annotation.XmlValue;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "dependency", propOrder = {
-    "value"
-})
+@XmlType(name = "dependency", propOrder = {"value"})
 public class Dependency implements org.apache.karaf.features.Dependency {
 
     @XmlValue
@@ -60,14 +51,10 @@ public class Dependency implements org.apache.karaf.features.Dependency {
     protected String version;
 
     /**
-     * 
      * Feature name should be non empty string.
-     *             
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getName() {
         return value;
@@ -75,11 +62,9 @@ public class Dependency implements org.apache.karaf.features.Dependency {
 
     /**
      * Sets the value of the value property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setName(String value) {
         this.value = value;
@@ -87,11 +72,9 @@ public class Dependency implements org.apache.karaf.features.Dependency {
 
     /**
      * Gets the value of the version property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getVersion() {
         if (version == null) {
@@ -103,19 +86,16 @@ public class Dependency implements org.apache.karaf.features.Dependency {
 
     /**
      * Sets the value of the version property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setVersion(String value) {
         this.version = value;
     }
 
     public String toString() {
-    	String ret = getName() + Feature.SPLIT_FOR_NAME_AND_VERSION + getVersion();
-    	return ret;
+        return getName() + Feature.SPLIT_FOR_NAME_AND_VERSION + getVersion();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Feature.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Feature.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Feature.java
index 0aa5eb5..154e89a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Feature.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Feature.java
@@ -1,22 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import java.util.ArrayList;
@@ -33,14 +30,13 @@ import javax.xml.bind.annotation.XmlType;
 
 
 /**
- * 
  * Definition of the Feature.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for feature complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="feature">
  *   &lt;complexContent>
@@ -63,24 +59,23 @@ import javax.xml.bind.annotation.XmlType;
  *   &lt;/complexContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "feature", propOrder = {
-    "details",
-    "config",
-    "configfile",
-    "feature",
-    "bundle",
-    "conditional",
-    "capability",
-    "requirement",
-    "scoping"
-})
+        "details",
+        "config",
+        "configfile",
+        "feature",
+        "bundle",
+        "conditional",
+        "capability",
+        "requirement",
+        "scoping"
+        })
 public class Feature extends Content implements org.apache.karaf.features.Feature {
-    public static String SPLIT_FOR_NAME_AND_VERSION = "/";
-    public static String DEFAULT_VERSION = "0.0.0";
+
+    public static final String SPLIT_FOR_NAME_AND_VERSION = "/";
+    public static final String DEFAULT_VERSION = "0.0.0";
 
 
     protected String details;
@@ -115,14 +110,14 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
 
     public static org.apache.karaf.features.Feature valueOf(String str) {
-    	if (str.contains(SPLIT_FOR_NAME_AND_VERSION)) {
-    		String strName = str.substring(0, str.indexOf(SPLIT_FOR_NAME_AND_VERSION));
-        	String strVersion = str.substring(str.indexOf(SPLIT_FOR_NAME_AND_VERSION)
-        			+ SPLIT_FOR_NAME_AND_VERSION.length(), str.length());
-        	return new Feature(strName, strVersion);
-    	} else {
-    		return new Feature(str);
-    	}
+        if (str.contains(SPLIT_FOR_NAME_AND_VERSION)) {
+            String strName = str.substring(0, str.indexOf(SPLIT_FOR_NAME_AND_VERSION));
+            String strVersion = str.substring(str.indexOf(SPLIT_FOR_NAME_AND_VERSION)
+                    + SPLIT_FOR_NAME_AND_VERSION.length(), str.length());
+            return new Feature(strName, strVersion);
+        } else {
+            return new Feature(str);
+        }
 
 
     }
@@ -134,11 +129,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Gets the value of the name property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getName() {
         return name;
@@ -146,11 +139,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Sets the value of the name property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setName(String value) {
         this.name = value;
@@ -158,11 +149,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Gets the value of the version property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getVersion() {
         if (version == null) {
@@ -174,11 +163,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Sets the value of the version property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setVersion(String value) {
         this.version = value;
@@ -194,11 +181,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Gets the value of the description property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getDescription() {
         return description;
@@ -206,11 +191,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Sets the value of the description property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setDescription(String value) {
         this.description = value;
@@ -226,11 +209,9 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Gets the value of the resolver property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getResolver() {
         return resolver;
@@ -246,35 +227,29 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
 
     /**
      * Sets the value of the resolver property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setResolver(String value) {
         this.resolver = value;
     }
-    
+
     /**
      * Gets the value of the startLevel property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *     
+     *
+     * @return possible object is
+     * {@link Integer }
      */
     public int getStartLevel() {
-        return startLevel == null? 0: startLevel;
+        return startLevel == null ? 0 : startLevel;
     }
 
     /**
      * Sets the value of the startLevel property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setStartLevel(Integer value) {
         this.startLevel = value;
@@ -302,21 +277,21 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
      */
     public List<Conditional> getConditional() {
         if (conditional == null) {
-            conditional = new ArrayList<Conditional>();
+            conditional = new ArrayList<>();
         }
         return this.conditional;
     }
 
     public List<Capability> getCapabilities() {
         if (capability == null) {
-            capability = new ArrayList<Capability>();
+            capability = new ArrayList<>();
         }
         return this.capability;
     }
 
     public List<Requirement> getRequirements() {
         if (requirement == null) {
-            requirement = new ArrayList<Requirement>();
+            requirement = new ArrayList<>();
         }
         return this.requirement;
     }
@@ -330,19 +305,24 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
     }
 
     public String toString() {
-    	return getId();
+        return getId();
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
         Feature feature = (Feature) o;
-
-        if (name != null ? !name.equals(feature.name) : feature.name != null) return false;
-        if (version != null ? !version.equals(feature.version) : feature.version != null) return false;
-
+        if (name != null ? !name.equals(feature.name) : feature.name != null) {
+            return false;
+        }
+        if (version != null ? !version.equals(feature.version) : feature.version != null) {
+            return false;
+        }
         return true;
     }
 
@@ -354,7 +334,7 @@ public class Feature extends Content implements org.apache.karaf.features.Featur
     }
 
     @SuppressWarnings("rawtypes")
-	protected void interpolation(Properties properties) {
+    protected void interpolation(Properties properties) {
         for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) {
             String key = (String) e.nextElement();
             String val = properties.getProperty(key);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Features.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Features.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Features.java
index e116f31..0aacf63 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Features.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Features.java
@@ -1,26 +1,24 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -30,16 +28,15 @@ import javax.xml.bind.annotation.XmlType;
 
 
 /**
- * 
  * Root element of Feature definition. It contains optional attribute which allow
  * name of repository. This name will be used in shell to display source repository
  * of given feature.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for featuresRoot complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="features">
  *   &lt;complexContent>
@@ -53,15 +50,10 @@ import javax.xml.bind.annotation.XmlType;
  *   &lt;/complexContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlRootElement(name = "features")
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "features", propOrder = {
-    "repository",
-    "feature"
-})
+@XmlType(name = "features", propOrder = {"repository", "feature"})
 public class Features {
 
     @XmlSchemaType(name = "anyURI")
@@ -72,69 +64,63 @@ public class Features {
 
     /**
      * Gets the value of the repository property.
-     * 
-     * <p>
+     * <p/>
+     * <p/>
      * This accessor method returns a reference to the live list,
      * not a snapshot. Therefore any modification you make to the
      * returned list will be present inside the JAXB object.
      * This is why there is not a <CODE>set</CODE> method for the repository property.
-     * 
-     * <p>
+     * <p/>
+     * <p/>
      * For example, to add a new item, do as follows:
      * <pre>
      *    getRepository().add(newItem);
      * </pre>
-     * 
-     * 
-     * <p>
+     * <p/>
+     * <p/>
+     * <p/>
      * Objects of the following type(s) are allowed in the list
      * {@link String }
-     * 
-     * 
      */
     public List<String> getRepository() {
         if (repository == null) {
-            repository = new ArrayList<String>();
+            repository = new ArrayList<>();
         }
         return this.repository;
     }
 
     /**
      * Gets the value of the feature property.
-     * 
-     * <p>
+     * <p/>
+     * <p/>
      * This accessor method returns a reference to the live list,
      * not a snapshot. Therefore any modification you make to the
      * returned list will be present inside the JAXB object.
      * This is why there is not a <CODE>set</CODE> method for the feature property.
-     * 
-     * <p>
+     * <p/>
+     * <p/>
      * For example, to add a new item, do as follows:
      * <pre>
      *    getFeature().add(newItem);
      * </pre>
-     * 
-     * 
-     * <p>
+     * <p/>
+     * <p/>
+     * <p/>
      * Objects of the following type(s) are allowed in the list
      * {@link Feature }
-     * 
-     * 
      */
     public List<Feature> getFeature() {
         if (feature == null) {
-            feature = new ArrayList<Feature>();
+            feature = new ArrayList<>();
         }
         return this.feature;
     }
 
     /**
      * Gets the value of the name property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
+     *
+     * @return possible object is
+     * {@link String }
      */
     public String getName() {
         return name;
@@ -142,11 +128,9 @@ public class Features {
 
     /**
      * Sets the value of the name property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
+     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setName(String value) {
         this.name = value;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/JaxbUtil.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/JaxbUtil.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/JaxbUtil.java
index 9b5d7b6..35bc0df 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/JaxbUtil.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/JaxbUtil.java
@@ -1,20 +1,18 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
@@ -32,7 +30,6 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
@@ -53,10 +50,12 @@ import org.xml.sax.XMLFilter;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
 
-public class JaxbUtil {
+public final class JaxbUtil {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(JaxbUtil.class);
     private static final JAXBContext FEATURES_CONTEXT;
+    private static final Map<String, Schema> SCHEMAS = new ConcurrentHashMap<>();
+
     static {
         try {
             FEATURES_CONTEXT = JAXBContext.newInstance(Features.class);
@@ -65,6 +64,9 @@ public class JaxbUtil {
         }
     }
 
+    private JaxbUtil() {
+    }
+
     public static void marshal(Features features, OutputStream out) throws JAXBException {
         Marshaller marshaller = FEATURES_CONTEXT.createMarshaller();
 
@@ -139,20 +141,24 @@ public class JaxbUtil {
         }
     }
 
-    private static Map<String, Schema> schemas = new ConcurrentHashMap<String, Schema>();
     private static Schema getSchema(String namespace) throws SAXException {
-        Schema schema = schemas.get(namespace);
+        Schema schema = SCHEMAS.get(namespace);
         if (schema == null) {
             String schemaLocation;
-            if (FeaturesNamespaces.URI_1_0_0.equals(namespace)) {
+            switch (namespace) {
+            case FeaturesNamespaces.URI_1_0_0:
                 schemaLocation = "/org/apache/karaf/features/karaf-features-1.0.0.xsd";
-            } else if (FeaturesNamespaces.URI_1_1_0.equals(namespace)) {
+                break;
+            case FeaturesNamespaces.URI_1_1_0:
                 schemaLocation = "/org/apache/karaf/features/karaf-features-1.1.0.xsd";
-            } else if (FeaturesNamespaces.URI_1_2_0.equals(namespace)) {
+                break;
+            case FeaturesNamespaces.URI_1_2_0:
                 schemaLocation = "/org/apache/karaf/features/karaf-features-1.2.0.xsd";
-            } else if (FeaturesNamespaces.URI_1_3_0.equals(namespace)) {
+                break;
+            case FeaturesNamespaces.URI_1_3_0:
                 schemaLocation = "/org/apache/karaf/features/karaf-features-1.3.0.xsd";
-            } else {
+                break;
+            default:
                 throw new IllegalArgumentException("Unsupported namespace: " + namespace);
             }
 
@@ -163,7 +169,7 @@ public class JaxbUtil {
                 throw new IllegalStateException("Could not find resource: " + schemaLocation);
             }
             schema = factory.newSchema(new StreamSource(url.toExternalForm()));
-            schemas.put(namespace, schema);
+            SCHEMAS.put(namespace, schema);
         }
         return schema;
     }
@@ -206,7 +212,7 @@ public class JaxbUtil {
      * Converts all elements to the features namespace to make old feature files
      * compatible to the new format
      */
-    public static class NoSourceAndNamespaceFilter extends XMLFilterImpl {        
+    public static class NoSourceAndNamespaceFilter extends XMLFilterImpl {
         private static final InputSource EMPTY_INPUT_SOURCE = new InputSource(new ByteArrayInputStream(new byte[0]));
 
         public NoSourceAndNamespaceFilter(XMLReader xmlReader) {
@@ -229,5 +235,4 @@ public class JaxbUtil {
         }
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/ObjectFactory.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/ObjectFactory.java
index 96fbb0f..7ad5c18 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/ObjectFactory.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/ObjectFactory.java
@@ -1,22 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.JAXBElement;
@@ -26,34 +23,31 @@ import javax.xml.namespace.QName;
 
 
 /**
- * This object contains factory methods for each 
- * Java content interface and Java element interface 
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
  * generated in the org.apache.karaf.features.wrapper package.
- * <p>An ObjectFactory allows you to programatically 
- * construct new instances of the Java representation 
- * for XML content. The Java representation of XML 
- * content can consist of schema derived interfaces 
- * and classes representing the binding of schema 
- * type definitions, element declarations and model 
- * groups.  Factory methods for each of these are 
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups.  Factory methods for each of these are
  * provided in this class.
- * 
  */
 @XmlRegistry
 public class ObjectFactory {
 
-    private final static QName _Features_QNAME = new QName("http://karaf.apache.org/xmlns/features/v1.0.0", "features");
+    private static final QName FEATURES_QNAME = new QName("http://karaf.apache.org/xmlns/features/v1.0.0", "features");
 
     /**
      * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.karaf.features.wrapper
-     * 
      */
     public ObjectFactory() {
     }
 
     /**
      * Create an instance of {@link ConfigFile }
-     * 
      */
     public ConfigFile createConfigFile() {
         return new ConfigFile();
@@ -61,7 +55,6 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link Dependency }
-     * 
      */
     public Dependency createDependency() {
         return new Dependency();
@@ -69,7 +62,6 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link Bundle }
-     * 
      */
     public Bundle createBundle() {
         return new Bundle();
@@ -77,7 +69,6 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link Features }
-     * 
      */
     public Features createFeaturesRoot() {
         return new Features();
@@ -85,7 +76,6 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link Config }
-     * 
      */
     public Config createConfig() {
         return new Config();
@@ -93,7 +83,6 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link Feature }
-     * 
      */
     public Feature createFeature() {
         return new Feature();
@@ -101,11 +90,10 @@ public class ObjectFactory {
 
     /**
      * Create an instance of {@link JAXBElement }{@code <}{@link Features }{@code >}}
-     * 
      */
     @XmlElementDecl(namespace = "http://karaf.apache.org/xmlns/features/v1.0.0", name = "features")
     public JAXBElement<Features> createFeatures(Features value) {
-        return new JAXBElement<Features>(_Features_QNAME, Features.class, null, value);
+        return new JAXBElement<>(FEATURES_QNAME, Features.class, null, value);
     }
 
 }


[2/7] Code formatting and other checkstyle issues

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
index 68f8af6..9ad1012 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
@@ -30,7 +30,6 @@ import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.framework.namespace.IdentityNamespace;
-import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.namespace.service.ServiceNamespace;
 import org.osgi.resource.Capability;
@@ -38,12 +37,29 @@ import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
 import org.osgi.service.repository.ContentNamespace;
 
-public class ResourceBuilder {
+public final class ResourceBuilder {
 
     public static final String RESOLUTION_DYNAMIC = "dynamic";
 
-    public static ResourceImpl build(String uri, Map<String, String> headerMap)
-            throws BundleException {
+    private static final char EOF = (char) -1;
+
+    private static final int CLAUSE_START = 0;
+    private static final int PARAMETER_START = 1;
+    private static final int KEY = 2;
+    private static final int DIRECTIVE_OR_TYPEDATTRIBUTE = 4;
+    private static final int ARGUMENT = 8;
+    private static final int VALUE = 16;
+
+    private static final int CHAR = 1;
+    private static final int DELIMITER = 2;
+    private static final int STARTQUOTE = 4;
+    private static final int ENDQUOTE = 8;
+
+
+    private ResourceBuilder() {
+    }
+
+    public static ResourceImpl build(String uri, Map<String, String> headerMap) throws BundleException {
 
         // Verify that only manifest version 2 is specified.
         String manifestVersion = getManifestVersion(headerMap);
@@ -64,7 +80,7 @@ public class ResourceBuilder {
         // Parse bundle symbolic name.
         //
 
-        String bundleSymbolicName = null;
+        String bundleSymbolicName;
         ParsedHeaderClause bundleCap = parseBundleSymbolicName(headerMap);
         if (bundleCap == null) {
             throw new BundleException("Bundle manifest must include bundle symbolic name");
@@ -75,7 +91,7 @@ public class ResourceBuilder {
         String type = headerMap.get(Constants.FRAGMENT_HOST) == null ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT;
         ResourceImpl resource = new ResourceImpl(bundleSymbolicName, type, bundleVersion);
         if (uri != null) {
-            Map<String, Object> attrs = new HashMap<String, Object>();
+            Map<String, Object> attrs = new HashMap<>();
             attrs.put(ContentNamespace.CAPABILITY_URL_ATTRIBUTE, uri);
             resource.addCapability(new CapabilityImpl(resource, ContentNamespace.CONTENT_NAMESPACE, Collections.<String, String>emptyMap(), attrs));
         }
@@ -93,7 +109,7 @@ public class ResourceBuilder {
             String attachment = bundleCap.dirs.get(Constants.FRAGMENT_ATTACHMENT_DIRECTIVE);
             attachment = (attachment == null) ? Constants.FRAGMENT_ATTACHMENT_RESOLVETIME : attachment;
             if (!attachment.equalsIgnoreCase(Constants.FRAGMENT_ATTACHMENT_NEVER)) {
-                Map<String, Object> hostAttrs = new HashMap<String, Object>(bundleCap.attrs);
+                Map<String, Object> hostAttrs = new HashMap<>(bundleCap.attrs);
                 Object value = hostAttrs.remove(BundleRevision.BUNDLE_NAMESPACE);
                 hostAttrs.put(BundleRevision.HOST_NAMESPACE, value);
                 resource.addCapability(new CapabilityImpl(
@@ -196,41 +212,23 @@ public class ResourceBuilder {
         return resource;
     }
 
-    public static List<Requirement> parseImport(Resource resource, String imports) throws BundleException {
-        List<ParsedHeaderClause> importClauses = parseStandardHeader(imports);
-        importClauses = normalizeImportClauses(importClauses);
-        List<Requirement> importReqs = convertImports(importClauses, resource);
-        return importReqs;
-    }
-
     public static List<Requirement> parseRequirement(Resource resource, String requirement) throws BundleException {
         List<ParsedHeaderClause> requireClauses = parseStandardHeader(requirement);
         requireClauses = normalizeRequireCapabilityClauses(requireClauses);
-        List<Requirement> requireReqs = convertRequireCapabilities(requireClauses, resource);
-        return requireReqs;
-    }
-
-    public static List<Capability> parseExport(Resource resource, String bundleSymbolicName, Version bundleVersion, String exports) throws BundleException {
-        List<ParsedHeaderClause> exportClauses = parseStandardHeader(exports);
-        exportClauses = normalizeExportClauses(exportClauses, bundleSymbolicName, bundleVersion);
-        List<Capability> exportCaps = convertExports(exportClauses, resource);
-        return exportCaps;
+        return convertRequireCapabilities(requireClauses, resource);
     }
 
     public static List<Capability> parseCapability(Resource resource, String capability) throws BundleException {
         List<ParsedHeaderClause> provideClauses = parseStandardHeader(capability);
         provideClauses = normalizeProvideCapabilityClauses(provideClauses);
-        List<Capability> provideCaps = convertProvideCapabilities(provideClauses, resource);
-        return provideCaps;
+        return convertProvideCapabilities(provideClauses, resource);
     }
 
-    @SuppressWarnings( "deprecation" )
-    private static List<ParsedHeaderClause> normalizeImportClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+    @SuppressWarnings("deprecation")
+    private static List<ParsedHeaderClause> normalizeImportClauses(List<ParsedHeaderClause> clauses) throws BundleException {
         // Verify that the values are equals if the package specifies
         // both version and specification-version attributes.
-        Set<String> dupeSet = new HashSet<String>();
+        Set<String> dupeSet = new HashSet<>();
         for (ParsedHeaderClause clause : clauses) {
             // Check for "version" and "specification-version" attributes
             // and verify they are the same if both are specified.
@@ -264,16 +262,14 @@ public class ResourceBuilder {
                     // Verify that java.* packages are not imported.
                     if (pkgName.startsWith("java.")) {
                         throw new BundleException("Importing java.* packages not allowed: " + pkgName);
-                    }
                     // The character "." has no meaning in the OSGi spec except
                     // when placed on the bundle class path. Some people, however,
                     // mistakenly think it means the default package when imported
                     // or exported. This is not correct. It is invalid.
-                    else if (pkgName.equals(".")) {
+                    } else if (pkgName.equals(".")) {
                         throw new BundleException("Importing '.' is invalid.");
-                    }
                     // Make sure a package name was specified.
-                    else if (pkgName.length() == 0) {
+                    } else if (pkgName.length() == 0) {
                         throw new BundleException(
                                 "Imported package names cannot be zero length.");
                     }
@@ -288,19 +284,19 @@ public class ResourceBuilder {
     }
 
     private static List<Capability> convertExportService(List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Capability> capList = new ArrayList<Capability>();
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
-                Map<String, String> dirs = new LinkedHashMap<String, String>();
+                Map<String, String> dirs = new LinkedHashMap<>();
                 dirs.put(ServiceNamespace.CAPABILITY_EFFECTIVE_DIRECTIVE, ServiceNamespace.EFFECTIVE_ACTIVE);
-                Map<String, Object> attrs = new LinkedHashMap<String, Object>();
+                Map<String, Object> attrs = new LinkedHashMap<>();
                 attrs.put(Constants.OBJECTCLASS, path);
                 attrs.putAll(clause.attrs);
                 capList.add(new CapabilityImpl(
-                                resource,
-                                ServiceNamespace.SERVICE_NAMESPACE,
-                                dirs,
-                                attrs));
+                        resource,
+                        ServiceNamespace.SERVICE_NAMESPACE,
+                        dirs,
+                        attrs));
             }
         }
         return capList;
@@ -308,13 +304,13 @@ public class ResourceBuilder {
 
     private static List<Requirement> convertImportService(List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
         try {
-            List<Requirement> reqList = new ArrayList<Requirement>();
+            List<Requirement> reqList = new ArrayList<>();
             for (ParsedHeaderClause clause : clauses) {
                 for (String path : clause.paths) {
                     String multiple = clause.dirs.get("multiple");
-                    String avail    = clause.dirs.get("availability");
-                    String filter   = (String) clause.attrs.get("filter");
-                    Map<String, String> dirs = new LinkedHashMap<String, String>();
+                    String avail = clause.dirs.get("availability");
+                    String filter = (String) clause.attrs.get("filter");
+                    Map<String, String> dirs = new LinkedHashMap<>();
                     dirs.put(ServiceNamespace.REQUIREMENT_EFFECTIVE_DIRECTIVE, ServiceNamespace.EFFECTIVE_ACTIVE);
                     if ("optional".equals(avail)) {
                         dirs.put(ServiceNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, ServiceNamespace.RESOLUTION_OPTIONAL);
@@ -331,11 +327,11 @@ public class ResourceBuilder {
                     }
                     dirs.put(ServiceNamespace.REQUIREMENT_FILTER_DIRECTIVE, filter);
                     reqList.add(new RequirementImpl(
-                                    resource,
-                                    ServiceNamespace.SERVICE_NAMESPACE,
-                                    dirs,
-                                    Collections.<String, Object>emptyMap(),
-                                    SimpleFilter.parse(filter)));
+                            resource,
+                            ServiceNamespace.SERVICE_NAMESPACE,
+                            dirs,
+                            Collections.<String, Object>emptyMap(),
+                            SimpleFilter.parse(filter)));
                 }
             }
             return reqList;
@@ -346,7 +342,7 @@ public class ResourceBuilder {
 
     private static List<Requirement> convertImports(List<ParsedHeaderClause> clauses, Resource resource) {
         // Now convert generic header clauses into requirements.
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 // Prepend the package name to the array of attributes.
@@ -354,9 +350,9 @@ public class ResourceBuilder {
                 // Note that we use a linked hash map here to ensure the
                 // package attribute is first, which will make indexing
                 // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+                // TODO: OSGi R4.3 - This is ordering is kind of hacky.
                 // Prepend the package name to the array of attributes.
-                Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
                 // We want this first from an indexing perspective.
                 newAttrs.put(BundleRevision.PACKAGE_NAMESPACE, path);
                 newAttrs.putAll(attrs);
@@ -367,9 +363,9 @@ public class ResourceBuilder {
                 SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
                 // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+                // TODO: OSGi R4.3 - Can we insert this on demand somehow?
                 Map<String, String> dirs = clause.dirs;
-                Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+                Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
                 newDirs.putAll(dirs);
                 newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -380,17 +376,16 @@ public class ResourceBuilder {
                                 BundleRevision.PACKAGE_NAMESPACE,
                                 newDirs,
                                 Collections.<String, Object>emptyMap(),
-                                sf));
+                                sf)
+                );
             }
         }
 
         return reqList;
     }
 
-    @SuppressWarnings( "deprecation" )
-    private static List<ParsedHeaderClause> normalizeDynamicImportClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+    @SuppressWarnings("deprecation")
+    private static List<ParsedHeaderClause> normalizeDynamicImportClauses(List<ParsedHeaderClause> clauses) throws BundleException {
         // Verify that the values are equals if the package specifies
         // both version and specification-version attributes.
         for (ParsedHeaderClause clause : clauses) {
@@ -439,104 +434,85 @@ public class ResourceBuilder {
     }
 
     private static List<ParsedHeaderClause> normalizeRequireCapabilityClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+            List<ParsedHeaderClause> clauses) throws BundleException {
 
         return clauses;
     }
 
     private static List<ParsedHeaderClause> normalizeProvideCapabilityClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException
-    {
+            List<ParsedHeaderClause> clauses) throws BundleException {
 
         // Convert attributes into specified types.
-        for (ParsedHeaderClause clause : clauses)
-        {
-            for (Map.Entry<String, String> entry : clause.types.entrySet())
-            {
+        for (ParsedHeaderClause clause : clauses) {
+            for (Map.Entry<String, String> entry : clause.types.entrySet()) {
                 String type = entry.getValue();
-                if (!type.equals("String"))
-                {
-                    if (type.equals("Double"))
-                    {
+                if (!type.equals("String")) {
+                    if (type.equals("Double")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Double(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.equals("Version"))
-                    {
+                    } else if (type.equals("Version")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Version(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.equals("Long"))
-                    {
+                    } else if (type.equals("Long")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Long(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.startsWith("List"))
-                    {
+                    } else if (type.startsWith("List")) {
                         int startIdx = type.indexOf('<');
                         int endIdx = type.indexOf('>');
                         if (((startIdx > 0) && (endIdx <= startIdx))
-                                || ((startIdx < 0) && (endIdx > 0)))
-                        {
+                                || ((startIdx < 0) && (endIdx > 0))) {
                             throw new BundleException(
                                     "Invalid Provide-Capability attribute list type for '"
                                             + entry.getKey()
                                             + "' : "
-                                            + type);
+                                            + type
+                            );
                         }
 
                         String listType = "String";
-                        if (endIdx > startIdx)
-                        {
+                        if (endIdx > startIdx) {
                             listType = type.substring(startIdx + 1, endIdx).trim();
                         }
 
                         List<String> tokens = parseDelimitedString(
                                 clause.attrs.get(entry.getKey()).toString(), ",", false);
-                        List<Object> values = new ArrayList<Object>(tokens.size());
-                        for (String token : tokens)
-                        {
-                            if (listType.equals("String"))
-                            {
+                        List<Object> values = new ArrayList<>(tokens.size());
+                        for (String token : tokens) {
+                            switch (listType) {
+                            case "String":
                                 values.add(token);
-                            }
-                            else if (listType.equals("Double"))
-                            {
+                                break;
+                            case "Double":
                                 values.add(new Double(token.trim()));
-                            }
-                            else if (listType.equals("Version"))
-                            {
+                                break;
+                            case "Version":
                                 values.add(new Version(token.trim()));
-                            }
-                            else if (listType.equals("Long"))
-                            {
+                                break;
+                            case "Long":
                                 values.add(new Long(token.trim()));
-                            }
-                            else
-                            {
+                                break;
+                            default:
                                 throw new BundleException(
                                         "Unknown Provide-Capability attribute list type for '"
                                                 + entry.getKey()
                                                 + "' : "
-                                                + type);
+                                                + type
+                                );
                             }
                         }
                         clause.attrs.put(
                                 entry.getKey(),
                                 values);
-                    }
-                    else
-                    {
+                    } else {
                         throw new BundleException(
                                 "Unknown Provide-Capability attribute type for '"
                                         + entry.getKey()
                                         + "' : "
-                                        + type);
+                                        + type
+                        );
                     }
                 }
             }
@@ -546,10 +522,10 @@ public class ResourceBuilder {
     }
 
     private static List<Requirement> convertRequireCapabilities(
-            List<ParsedHeaderClause> clauses, Resource resource)
-            throws BundleException {
+            List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
+
         // Now convert generic header clauses into requirements.
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             try {
                 String filterStr = clause.dirs.get(Constants.FILTER_DIRECTIVE);
@@ -559,7 +535,7 @@ public class ResourceBuilder {
                 for (String path : clause.paths) {
                     // Create requirement and add to requirement list.
                     reqList.add(new RequirementImpl(
-                                    resource, path, clause.dirs, clause.attrs, sf));
+                            resource, path, clause.dirs, clause.attrs, sf));
                 }
             } catch (Exception ex) {
                 throw new BundleException("Error creating requirement: " + ex, ex);
@@ -570,9 +546,9 @@ public class ResourceBuilder {
     }
 
     private static List<Capability> convertProvideCapabilities(
-            List<ParsedHeaderClause> clauses, Resource resource)
-            throws BundleException {
-        List<Capability> capList = new ArrayList<Capability>();
+            List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
+
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 if (path.startsWith("osgi.wiring.")) {
@@ -587,11 +563,11 @@ public class ResourceBuilder {
         return capList;
     }
 
-    @SuppressWarnings( "deprecation" )
+    @SuppressWarnings("deprecation")
     private static List<ParsedHeaderClause> normalizeExportClauses(
             List<ParsedHeaderClause> clauses,
-            String bsn, Version bv)
-            throws BundleException {
+            String bsn, Version bv) throws BundleException {
+
         // Verify that "java.*" packages are not exported.
         for (ParsedHeaderClause clause : clauses) {
             // Verify that the named package has not already been declared.
@@ -599,16 +575,14 @@ public class ResourceBuilder {
                 // Verify that java.* packages are not exported.
                 if (pkgName.startsWith("java.")) {
                     throw new BundleException("Exporting java.* packages not allowed: " + pkgName);
-                }
                 // The character "." has no meaning in the OSGi spec except
                 // when placed on the bundle class path. Some people, however,
                 // mistakenly think it means the default package when imported
                 // or exported. This is not correct. It is invalid.
-                else if (pkgName.equals(".")) {
+                } else if (pkgName.equals(".")) {
                     throw new BundleException("Exporing '.' is invalid.");
-                }
                 // Make sure a package name was specified.
-                else if (pkgName.length() == 0) {
+                } else if (pkgName.length() == 0) {
                     throw new BundleException("Exported package names cannot be zero length.");
                 }
             }
@@ -653,14 +627,13 @@ public class ResourceBuilder {
         return clauses;
     }
 
-    private static List<Capability> convertExports(
-            List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Capability> capList = new ArrayList<Capability>();
+    private static List<Capability> convertExports(List<ParsedHeaderClause> clauses, Resource resource) {
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String pkgName : clause.paths) {
                 // Prepend the package name to the array of attributes.
                 Map<String, Object> attrs = clause.attrs;
-                Map<String, Object> newAttrs = new HashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new HashMap<>(attrs.size() + 1);
                 newAttrs.putAll(attrs);
                 newAttrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
 
@@ -677,69 +650,7 @@ public class ResourceBuilder {
         return (manifestVersion == null) ? "1" : manifestVersion.trim();
     }
 
-    private static List<ParsedHeaderClause> calculateImplicitImports(
-            List<BundleCapability> exports, List<ParsedHeaderClause> imports)
-            throws BundleException {
-        List<ParsedHeaderClause> clauseList = new ArrayList<ParsedHeaderClause>();
-
-        // Since all R3 exports imply an import, add a corresponding
-        // requirement for each existing export capability. Do not
-        // duplicate imports.
-        Map<String, String> map = new HashMap<String, String>();
-        // Add existing imports.
-        for (ParsedHeaderClause anImport : imports) {
-            for (int pathIdx = 0; pathIdx < anImport.paths.size(); pathIdx++) {
-                map.put(anImport.paths.get(pathIdx), anImport.paths.get(pathIdx));
-            }
-        }
-        // Add import requirement for each export capability.
-        for (BundleCapability export : exports) {
-            if (map.get(export.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE).toString()) == null) {
-                // Convert Version to VersionRange.
-                Object version = export.getAttributes().get(Constants.VERSION_ATTRIBUTE);
-                ParsedHeaderClause clause = new ParsedHeaderClause();
-                if (version != null) {
-                    clause.attrs.put(Constants.VERSION_ATTRIBUTE, VersionRange.parseVersionRange(version.toString()));
-                }
-                clause.paths.add((String) export.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
-                clauseList.add(clause);
-            }
-        }
-
-        return clauseList;
-    }
-
-    private static List<Capability> calculateImplicitUses(
-            List<Capability> exports, List<ParsedHeaderClause> imports)
-            throws BundleException {
-        // Add a "uses" directive onto each export of R3 bundles
-        // that references every other import (which will include
-        // exports, since export implies import); this is
-        // necessary since R3 bundles assumed a single class space,
-        // but R4 allows for multiple class spaces.
-        String usesValue = "";
-        for (ParsedHeaderClause anImport : imports) {
-            for (int pathIdx = 0; pathIdx < anImport.paths.size(); pathIdx++) {
-                usesValue = usesValue
-                        + ((usesValue.length() > 0) ? "," : "")
-                        + anImport.paths.get(pathIdx);
-            }
-        }
-        for (int i = 0; i < exports.size(); i++) {
-            Map<String, String> dirs = new HashMap<String, String>(1);
-            dirs.put(Constants.USES_DIRECTIVE, usesValue);
-            exports.set(i, new CapabilityImpl(
-                    exports.get(i).getResource(),
-                    BundleRevision.PACKAGE_NAMESPACE,
-                    dirs,
-                    exports.get(i).getAttributes()));
-        }
-
-        return exports;
-    }
-
-    private static ParsedHeaderClause parseBundleSymbolicName(Map<String, String> headerMap)
-            throws BundleException {
+    private static ParsedHeaderClause parseBundleSymbolicName(Map<String, String> headerMap) throws BundleException {
         List<ParsedHeaderClause> clauses = parseStandardHeader(headerMap.get(Constants.BUNDLE_SYMBOLICNAME));
         if (clauses.size() > 0) {
             if (clauses.size() > 1 || clauses.get(0).paths.size() > 1) {
@@ -763,11 +674,8 @@ public class ResourceBuilder {
         return null;
     }
 
-    private static List<RequirementImpl> parseFragmentHost(
-            Resource resource, Map<String, String> headerMap)
-            throws BundleException {
-        List<RequirementImpl> reqs = new ArrayList<RequirementImpl>();
-
+    private static List<RequirementImpl> parseFragmentHost(Resource resource, Map<String, String> headerMap) throws BundleException {
+        List<RequirementImpl> reqs = new ArrayList<>();
         List<ParsedHeaderClause> clauses = parseStandardHeader(headerMap.get(Constants.FRAGMENT_HOST));
         if (clauses.size() > 0) {
             // Make sure that only one fragment host symbolic name is specified.
@@ -784,10 +692,10 @@ public class ResourceBuilder {
             // Note that we use a linked hash map here to ensure the
             // host symbolic name is first, which will make indexing
             // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+            // TODO: OSGi R4.3 - This is ordering is kind of hacky.
             // Prepend the host symbolic name to the map of attributes.
             Map<String, Object> attrs = clauses.get(0).attrs;
-            Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+            Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
             // We want this first from an indexing perspective.
             newAttrs.put(BundleRevision.HOST_NAMESPACE, clauses.get(0).paths.get(0));
             newAttrs.putAll(attrs);
@@ -798,9 +706,9 @@ public class ResourceBuilder {
             SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
             // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+            // TODO: OSGi R4.3 - Can we insert this on demand somehow?
             Map<String, String> dirs = clauses.get(0).dirs;
-            Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+            Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
             newDirs.putAll(dirs);
             newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -826,7 +734,7 @@ public class ResourceBuilder {
     }
 
     private static List<Requirement> convertRequires(List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 // Prepend the bundle symbolic name to the array of attributes.
@@ -834,9 +742,9 @@ public class ResourceBuilder {
                 // Note that we use a linked hash map here to ensure the
                 // symbolic name attribute is first, which will make indexing
                 // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+                // TODO: OSGi R4.3 - This is ordering is kind of hacky.
                 // Prepend the symbolic name to the array of attributes.
-                Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
                 // We want this first from an indexing perspective.
                 newAttrs.put(BundleRevision.BUNDLE_NAMESPACE, path);
                 newAttrs.putAll(attrs);
@@ -847,9 +755,9 @@ public class ResourceBuilder {
                 SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
                 // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+                // TODO: OSGi R4.3 - Can we insert this on demand somehow?
                 Map<String, String> dirs = clause.dirs;
-                Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+                Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
                 newDirs.putAll(dirs);
                 newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -861,30 +769,17 @@ public class ResourceBuilder {
         return reqList;
     }
 
-    private static final char EOF = (char) -1;
-
-    private static char charAt(int pos, String headers, int length)
-    {
-        if (pos >= length)
-        {
+    private static char charAt(int pos, String headers, int length) {
+        if (pos >= length) {
             return EOF;
         }
         return headers.charAt(pos);
     }
 
-    private static final int CLAUSE_START = 0;
-    private static final int PARAMETER_START = 1;
-    private static final int KEY = 2;
-    private static final int DIRECTIVE_OR_TYPEDATTRIBUTE = 4;
-    private static final int ARGUMENT = 8;
-    private static final int VALUE = 16;
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private static List<ParsedHeaderClause> parseStandardHeader(String header)
-    {
-        List<ParsedHeaderClause> clauses = new ArrayList<ParsedHeaderClause>();
-        if (header == null)
-        {
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    private static List<ParsedHeaderClause> parseStandardHeader(String header) {
+        List<ParsedHeaderClause> clauses = new ArrayList<>();
+        if (header == null) {
             return clauses;
         }
         ParsedHeaderClause clause = null;
@@ -897,133 +792,110 @@ public class ResourceBuilder {
         boolean quoted = false;
         boolean escaped = false;
 
-        char currentChar = EOF;
-        do
-        {
+        char currentChar;
+        do {
             currentChar = charAt(currentPosition, header, length);
-            switch (state)
-            {
-                case CLAUSE_START:
-                    clause = new ParsedHeaderClause();
-                    clauses.add(clause);
-                    state = PARAMETER_START;
-                case PARAMETER_START:
-                    startPosition = currentPosition;
-                    state = KEY;
-                case KEY:
-                    switch (currentChar)
-                    {
-                        case ':':
-                        case '=':
-                            key = header.substring(startPosition, currentPosition).trim();
-                            startPosition = currentPosition + 1;
-                            targetMap = clause.attrs;
-                            state = currentChar == ':' ? DIRECTIVE_OR_TYPEDATTRIBUTE : ARGUMENT;
-                            break;
-                        case EOF:
-                        case ',':
-                        case ';':
-                            clause.paths.add(header.substring(startPosition, currentPosition).trim());
-                            state = currentChar == ',' ? CLAUSE_START : PARAMETER_START;
-                            break;
-                        default:
-                            break;
+            switch (state) {
+            case CLAUSE_START:
+                clause = new ParsedHeaderClause();
+                clauses.add(clause);
+                // Fall through
+            case PARAMETER_START:
+                startPosition = currentPosition;
+                state = KEY;
+                // Fall through
+            case KEY:
+                switch (currentChar) {
+                case ':':
+                case '=':
+                    key = header.substring(startPosition, currentPosition).trim();
+                    startPosition = currentPosition + 1;
+                    targetMap = clause.attrs;
+                    state = currentChar == ':' ? DIRECTIVE_OR_TYPEDATTRIBUTE : ARGUMENT;
+                    break;
+                case EOF:
+                case ',':
+                case ';':
+                    clause.paths.add(header.substring(startPosition, currentPosition).trim());
+                    state = currentChar == ',' ? CLAUSE_START : PARAMETER_START;
+                    break;
+                default:
+                    break;
+                }
+                currentPosition++;
+                break;
+            case DIRECTIVE_OR_TYPEDATTRIBUTE:
+                switch (currentChar) {
+                case '=':
+                    if (startPosition != currentPosition) {
+                        clause.types.put(key, header.substring(startPosition, currentPosition).trim());
+                    } else {
+                        targetMap = clause.dirs;
                     }
-                    currentPosition++;
+                    state = ARGUMENT;
+                    startPosition = currentPosition + 1;
                     break;
-                case DIRECTIVE_OR_TYPEDATTRIBUTE:
-                    switch(currentChar)
-                    {
-                        case '=':
-                            if (startPosition != currentPosition)
-                            {
-                                clause.types.put(key, header.substring(startPosition, currentPosition).trim());
+                default:
+                    break;
+                }
+                currentPosition++;
+                break;
+            case ARGUMENT:
+                if (currentChar == '\"') {
+                    quoted = true;
+                    currentPosition++;
+                } else {
+                    quoted = false;
+                }
+                if (!Character.isWhitespace(currentChar)) {
+                    state = VALUE;
+                } else {
+                    currentPosition++;
+                }
+                break;
+            case VALUE:
+                if (escaped) {
+                    escaped = false;
+                } else {
+                    if (currentChar == '\\') {
+                        escaped = true;
+                    } else if (quoted && currentChar == '\"') {
+                        quoted = false;
+                    } else if (!quoted) {
+                        String value;
+                        switch (currentChar) {
+                        case EOF:
+                        case ';':
+                        case ',':
+                            value = header.substring(startPosition, currentPosition).trim();
+                            if (value.startsWith("\"") && value.endsWith("\"")) {
+                                value = value.substring(1, value.length() - 1);
                             }
-                            else
-                            {
-                                targetMap = clause.dirs;
+                            if (targetMap.put(key, value) != null) {
+                                throw new IllegalArgumentException(
+                                        "Duplicate '" + key + "' in: " + header);
                             }
-                            state = ARGUMENT;
-                            startPosition = currentPosition + 1;
+                            state = currentChar == ';' ? PARAMETER_START : CLAUSE_START;
                             break;
                         default:
                             break;
-                    }
-                    currentPosition++;
-                    break;
-                case ARGUMENT:
-                    if (currentChar == '\"')
-                    {
-                        quoted = true;
-                        currentPosition++;
-                    }
-                    else
-                    {
-                        quoted = false;
-                    }
-                    if (!Character.isWhitespace(currentChar)) {
-                        state = VALUE;
-                    }
-                    else {
-                        currentPosition++;
-                    }
-                    break;
-                case VALUE:
-                    if (escaped)
-                    {
-                        escaped = false;
-                    }
-                    else
-                    {
-                        if (currentChar == '\\' )
-                        {
-                            escaped = true;
-                        }
-                        else if (quoted && currentChar == '\"')
-                        {
-                            quoted = false;
-                        }
-                        else if (!quoted)
-                        {
-                            String value = null;
-                            switch(currentChar)
-                            {
-                                case EOF:
-                                case ';':
-                                case ',':
-                                    value = header.substring(startPosition, currentPosition).trim();
-                                    if (value.startsWith("\"") && value.endsWith("\""))
-                                    {
-                                        value = value.substring(1, value.length() - 1);
-                                    }
-                                    if (targetMap.put(key, value) != null)
-                                    {
-                                        throw new IllegalArgumentException(
-                                                "Duplicate '" + key + "' in: " + header);
-                                    }
-                                    state = currentChar == ';' ? PARAMETER_START : CLAUSE_START;
-                                    break;
-                                default:
-                                    break;
-                            }
                         }
                     }
-                    currentPosition++;
-                    break;
-                default:
-                    break;
+                }
+                currentPosition++;
+                break;
+            default:
+                break;
             }
-        } while ( currentChar != EOF);
+        } while (currentChar != EOF);
 
-        if (state > PARAMETER_START)
-        {
+        if (state > PARAMETER_START) {
             throw new IllegalArgumentException("Unable to parse header: " + header);
         }
         return clauses;
     }
 
-    public static List<String> parseDelimitedString(String value, String delim)
-    {
+    public static List<String> parseDelimitedString(String value, String delim) {
         return parseDelimitedString(value, delim, true);
     }
 
@@ -1032,88 +904,62 @@ public class ResourceBuilder {
      * parser obeys quotes, so the delimiter character will be ignored if it is
      * inside of a quote. This method assumes that the quote character is not
      * included in the set of delimiter characters.
+     *
      * @param value the delimited string to parse.
      * @param delim the characters delimiting the tokens.
      * @return a list of string or an empty list if there are none.
-     **/
-    public static List<String> parseDelimitedString(String value, String delim, boolean trim)
-    {
-        if (value == null)
-        {
+     */
+    public static List<String> parseDelimitedString(String value, String delim, boolean trim) {
+        if (value == null) {
             value = "";
         }
 
-        List<String> list = new ArrayList();
+        List<String> list = new ArrayList<>();
 
-        int CHAR = 1;
-        int DELIMITER = 2;
-        int STARTQUOTE = 4;
-        int ENDQUOTE = 8;
+        StringBuilder sb = new StringBuilder();
 
-        StringBuffer sb = new StringBuffer();
-
-        int expecting = (CHAR | DELIMITER | STARTQUOTE);
+        int expecting = CHAR | DELIMITER | STARTQUOTE;
 
         boolean isEscaped = false;
-        for (int i = 0; i < value.length(); i++)
-        {
+        for (int i = 0; i < value.length(); i++) {
             char c = value.charAt(i);
 
-            boolean isDelimiter = (delim.indexOf(c) >= 0);
+            boolean isDelimiter = delim.indexOf(c) >= 0;
 
-            if (!isEscaped && (c == '\\'))
-            {
+            if (!isEscaped && c == '\\') {
                 isEscaped = true;
                 continue;
             }
 
-            if (isEscaped)
-            {
+            if (isEscaped) {
                 sb.append(c);
-            }
-            else if (isDelimiter && ((expecting & DELIMITER) > 0))
-            {
-                if (trim)
-                {
+            } else if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+                if (trim) {
                     list.add(sb.toString().trim());
-                }
-                else
-                {
+                } else {
                     list.add(sb.toString());
                 }
                 sb.delete(0, sb.length());
-                expecting = (CHAR | DELIMITER | STARTQUOTE);
-            }
-            else if ((c == '"') && ((expecting & STARTQUOTE) > 0))
-            {
+                expecting = CHAR | DELIMITER | STARTQUOTE;
+            } else if ((c == '"') && (expecting & STARTQUOTE) > 0) {
                 sb.append(c);
                 expecting = CHAR | ENDQUOTE;
-            }
-            else if ((c == '"') && ((expecting & ENDQUOTE) > 0))
-            {
+            } else if ((c == '"') && (expecting & ENDQUOTE) > 0) {
                 sb.append(c);
-                expecting = (CHAR | STARTQUOTE | DELIMITER);
-            }
-            else if ((expecting & CHAR) > 0)
-            {
+                expecting = CHAR | STARTQUOTE | DELIMITER;
+            } else if ((expecting & CHAR) > 0) {
                 sb.append(c);
-            }
-            else
-            {
+            } else {
                 throw new IllegalArgumentException("Invalid delimited string: " + value);
             }
 
             isEscaped = false;
         }
 
-        if (sb.length() > 0)
-        {
-            if (trim)
-            {
+        if (sb.length() > 0) {
+            if (trim) {
                 list.add(sb.toString().trim());
-            }
-            else
-            {
+            } else {
                 list.add(sb.toString());
             }
         }
@@ -1123,9 +969,9 @@ public class ResourceBuilder {
 
 
     static class ParsedHeaderClause {
-        public final List<String> paths = new ArrayList<String>();
-        public final Map<String, String> dirs = new LinkedHashMap<String, String>();
-        public final Map<String, Object> attrs = new LinkedHashMap<String, Object>();
-        public final Map<String, String> types = new LinkedHashMap<String, String>();
+        public final List<String> paths = new ArrayList<>();
+        public final Map<String, String> dirs = new LinkedHashMap<>();
+        public final Map<String, Object> attrs = new LinkedHashMap<>();
+        public final Map<String, String> types = new LinkedHashMap<>();
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
index cd48ca2..99ffb52 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
@@ -31,38 +31,33 @@ import org.osgi.resource.Resource;
  */
 public class ResourceImpl implements Resource {
 
-    private final List<Capability> m_caps;
-    private final List<Requirement> m_reqs;
+    private final List<Capability> caps;
+    private final List<Requirement> reqs;
 
     /**
      * CAUTION: This constructor does not ensure that the resource
      * has the required identity capability
      */
     public ResourceImpl() {
-        m_caps = new ArrayList<Capability>();
-        m_reqs = new ArrayList<Requirement>();
+        caps = new ArrayList<>();
+        reqs = new ArrayList<>();
     }
 
-    public ResourceImpl(String name, Version version) {
-        this(name, IdentityNamespace.TYPE_BUNDLE, version);
-    }
-
-    public ResourceImpl(String name, String type, Version version)
-    {
-        m_caps = new ArrayList<Capability>();
-        Map<String, String> dirs = new HashMap<String, String>();
-        Map<String, Object> attrs = new HashMap<String, Object>();
+    public ResourceImpl(String name, String type, Version version) {
+        caps = new ArrayList<>();
+        Map<String, String> dirs = new HashMap<>();
+        Map<String, Object> attrs = new HashMap<>();
         attrs.put(IdentityNamespace.IDENTITY_NAMESPACE, name);
         attrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, type);
         attrs.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
         CapabilityImpl identity = new CapabilityImpl(this, IdentityNamespace.IDENTITY_NAMESPACE, dirs, attrs);
-        m_caps.add(identity);
-        m_reqs = new ArrayList<Requirement>();
+        caps.add(identity);
+        reqs = new ArrayList<>();
     }
 
     public void addCapability(Capability capability) {
         assert capability.getResource() == this;
-        m_caps.add(capability);
+        caps.add(capability);
     }
 
     public void addCapabilities(Iterable<? extends Capability> capabilities) {
@@ -73,7 +68,7 @@ public class ResourceImpl implements Resource {
 
     public void addRequirement(Requirement requirement) {
         assert requirement.getResource() == this;
-        m_reqs.add(requirement);
+        reqs.add(requirement);
     }
 
     public void addRequirements(Iterable<? extends Requirement> requirements) {
@@ -82,16 +77,12 @@ public class ResourceImpl implements Resource {
         }
     }
 
-    public List<Capability> getCapabilities(String namespace)
-    {
-        List<Capability> result = m_caps;
-        if (namespace != null)
-        {
-            result = new ArrayList<Capability>();
-            for (Capability cap : m_caps)
-            {
-                if (cap.getNamespace().equals(namespace))
-                {
+    public List<Capability> getCapabilities(String namespace) {
+        List<Capability> result = caps;
+        if (namespace != null) {
+            result = new ArrayList<>();
+            for (Capability cap : caps) {
+                if (cap.getNamespace().equals(namespace)) {
                     result.add(cap);
                 }
             }
@@ -99,16 +90,12 @@ public class ResourceImpl implements Resource {
         return result;
     }
 
-    public List<Requirement> getRequirements(String namespace)
-    {
-        List<Requirement> result = m_reqs;
-        if (namespace != null)
-        {
-            result = new ArrayList<Requirement>();
-            for (Requirement req : m_reqs)
-            {
-                if (req.getNamespace().equals(namespace))
-                {
+    public List<Requirement> getRequirements(String namespace) {
+        List<Requirement> result = reqs;
+        if (namespace != null) {
+            result = new ArrayList<>();
+            for (Requirement req : reqs) {
+                if (req.getNamespace().equals(namespace)) {
                     result.add(req);
                 }
             }
@@ -117,8 +104,7 @@ public class ResourceImpl implements Resource {
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
         Capability cap = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).get(0);
         return cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE) + "/"
                 + cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
index 03d4fd9..b22f9b8 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
@@ -32,12 +32,15 @@ import static org.osgi.framework.namespace.IdentityNamespace.IDENTITY_NAMESPACE;
 import static org.osgi.service.repository.ContentNamespace.CAPABILITY_URL_ATTRIBUTE;
 import static org.osgi.service.repository.ContentNamespace.CONTENT_NAMESPACE;
 
-public class ResourceUtils {
+public final class ResourceUtils {
 
     public static final String TYPE_SUBSYSTEM = "karaf.subsystem";
 
     public static final String TYPE_FEATURE = "karaf.feature";
 
+    private ResourceUtils() {
+    }
+
     public static String getUri(Resource resource) {
         List<Capability> caps = resource.getCapabilities(null);
         for (Capability cap : caps) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
index ae10441..1e2a48c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
@@ -23,8 +23,7 @@ import java.util.Map.Entry;
 
 import org.apache.felix.utils.version.VersionRange;
 
-public class SimpleFilter
-{
+public class SimpleFilter {
     public static final int MATCH_ALL = 0;
     public static final int AND = 1;
     public static final int OR = 2;
@@ -36,94 +35,83 @@ public class SimpleFilter
     public static final int PRESENT = 8;
     public static final int APPROX = 9;
 
-    private final String m_name;
-    private final Object m_value;
-    private final int m_op;
+    private final String name;
+    private final Object value;
+    private final int op;
 
-    public SimpleFilter(String attr, Object value, int op)
-    {
-        m_name = attr;
-        m_value = value;
-        m_op = op;
+    public SimpleFilter(String name, Object value, int op) {
+        this.name = name;
+        this.value = value;
+        this.op = op;
     }
 
-    public String getName()
-    {
-        return m_name;
+    public String getName() {
+        return name;
     }
 
-    public Object getValue()
-    {
-        return m_value;
+    public Object getValue() {
+        return value;
     }
 
-    public int getOperation()
-    {
-        return m_op;
+    public int getOperation() {
+        return op;
     }
 
-    public String toString()
-    {
+    public String toString() {
         String s = null;
-        switch (m_op)
-        {
-            case AND:
-                s = "(&" + toString((List) m_value) + ")";
-                break;
-            case OR:
-                s = "(|" + toString((List) m_value) + ")";
-                break;
-            case NOT:
-                s = "(!" + toString((List) m_value) + ")";
-                break;
-            case EQ:
-                s = "(" + m_name + "=" + toEncodedString(m_value) + ")";
-                break;
-            case LTE:
-                s = "(" + m_name + "<=" + toEncodedString(m_value) + ")";
-                break;
-            case GTE:
-                s = "(" + m_name + ">=" + toEncodedString(m_value) + ")";
-                break;
-            case SUBSTRING:
-                s = "(" + m_name + "=" + unparseSubstring((List<String>) m_value) + ")";
-                break;
-            case PRESENT:
-                s = "(" + m_name + "=*)";
-                break;
-            case APPROX:
-                s = "(" + m_name + "~=" + toEncodedString(m_value) + ")";
-                break;
-            case MATCH_ALL:
-                s = "(*)";
-                break;
+        switch (op) {
+        case AND:
+            s = "(&" + toString((List) value) + ")";
+            break;
+        case OR:
+            s = "(|" + toString((List) value) + ")";
+            break;
+        case NOT:
+            s = "(!" + toString((List) value) + ")";
+            break;
+        case EQ:
+            s = "(" + name + "=" + toEncodedString(value) + ")";
+            break;
+        case LTE:
+            s = "(" + name + "<=" + toEncodedString(value) + ")";
+            break;
+        case GTE:
+            s = "(" + name + ">=" + toEncodedString(value) + ")";
+            break;
+        case SUBSTRING:
+            s = "(" + name + "=" + unparseSubstring((List<String>) value) + ")";
+            break;
+        case PRESENT:
+            s = "(" + name + "=*)";
+            break;
+        case APPROX:
+            s = "(" + name + "~=" + toEncodedString(value) + ")";
+            break;
+        case MATCH_ALL:
+            s = "(*)";
+            break;
+        default:
+            throw new IllegalStateException("Unsupported operator " + op);
         }
         return s;
     }
 
-    private static String toString(List list)
-    {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < list.size(); i++)
-        {
-            sb.append(list.get(i).toString());
+    private static String toString(List list) {
+        StringBuilder sb = new StringBuilder();
+        for (Object aList : list) {
+            sb.append(aList.toString());
         }
         return sb.toString();
     }
 
-    private static String toDecodedString(String s, int startIdx, int endIdx)
-    {
-        StringBuffer sb = new StringBuffer(endIdx - startIdx);
+    private static String toDecodedString(String s, int startIdx, int endIdx) {
+        StringBuilder sb = new StringBuilder(endIdx - startIdx);
         boolean escaped = false;
-        for (int i = 0; i < (endIdx - startIdx); i++)
-        {
+        for (int i = 0; i < (endIdx - startIdx); i++) {
             char c = s.charAt(startIdx + i);
-            if (!escaped && (c == '\\'))
-            {
+            if (!escaped && (c == '\\')) {
                 escaped = true;
-            }
-            else
-            {
+            } else {
                 escaped = false;
                 sb.append(c);
             }
@@ -132,17 +120,13 @@ public class SimpleFilter
         return sb.toString();
     }
 
-    private static String toEncodedString(Object o)
-    {
-        if (o instanceof String)
-        {
+    private static String toEncodedString(Object o) {
+        if (o instanceof String) {
             String s = (String) o;
-            StringBuffer sb = new StringBuffer();
-            for (int i = 0; i < s.length(); i++)
-            {
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
-                if ((c == '\\') || (c == '(') || (c == ')') || (c == '*'))
-                {
+                if ((c == '\\') || (c == '(') || (c == ')') || (c == '*')) {
                     sb.append('\\');
                 }
                 sb.append(c);
@@ -154,143 +138,97 @@ public class SimpleFilter
         return o.toString();
     }
 
-    public static SimpleFilter parse(String filter)
-    {
+    public static SimpleFilter parse(String filter) {
         int idx = skipWhitespace(filter, 0);
 
-        if ((filter == null) || (filter.length() == 0) || (idx >= filter.length()))
-        {
+        if ((filter == null) || (filter.length() == 0) || (idx >= filter.length())) {
             throw new IllegalArgumentException("Null or empty filter.");
-        }
-        else if (filter.charAt(idx) != '(')
-        {
+        } else if (filter.charAt(idx) != '(') {
             throw new IllegalArgumentException("Missing opening parenthesis: " + filter);
         }
 
         SimpleFilter sf = null;
-        List stack = new ArrayList();
+        List<Object> stack = new ArrayList<>();
         boolean isEscaped = false;
-        while (idx < filter.length())
-        {
-            if (sf != null)
-            {
+        while (idx < filter.length()) {
+            if (sf != null) {
                 throw new IllegalArgumentException(
                         "Only one top-level operation allowed: " + filter);
             }
 
-            if (!isEscaped && (filter.charAt(idx) == '('))
-            {
+            if (!isEscaped && (filter.charAt(idx) == '(')) {
                 // Skip paren and following whitespace.
                 idx = skipWhitespace(filter, idx + 1);
 
-                if (filter.charAt(idx) == '&')
-                {
+                if (filter.charAt(idx) == '&') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.AND));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else if (filter.charAt(idx) == '|')
-                {
+                } else if (filter.charAt(idx) == '|') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.OR));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else if (filter.charAt(idx) == '!')
-                {
+                } else if (filter.charAt(idx) == '!') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else
-                {
-                    stack.add(0, new Integer(idx));
+                } else {
+                    stack.add(0, idx);
                 }
-            }
-            else if (!isEscaped && (filter.charAt(idx) == ')'))
-            {
+            } else if (!isEscaped && (filter.charAt(idx) == ')')) {
                 Object top = stack.remove(0);
-                if (top instanceof SimpleFilter)
-                {
-                    if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter))
-                    {
-                        ((List) ((SimpleFilter) stack.get(0)).m_value).add(top);
-                    }
-                    else
-                    {
+                if (top instanceof SimpleFilter) {
+                    if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter)) {
+                        ((List<Object>) ((SimpleFilter) stack.get(0)).value).add(top);
+                    } else {
                         sf = (SimpleFilter) top;
                     }
+                } else if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter)) {
+                    ((List<Object>) ((SimpleFilter) stack.get(0)).value).add(
+                            SimpleFilter.subfilter(filter, (Integer) top, idx));
+                } else {
+                    sf = SimpleFilter.subfilter(filter, (Integer) top, idx);
                 }
-                else if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter))
-                {
-                    ((List) ((SimpleFilter) stack.get(0)).m_value).add(
-                            SimpleFilter.subfilter(filter, ((Integer) top).intValue(), idx));
-                }
-                else
-                {
-                    sf = SimpleFilter.subfilter(filter, ((Integer) top).intValue(), idx);
-                }
-            }
-            else if (!isEscaped && (filter.charAt(idx) == '\\'))
-            {
-                isEscaped = true;
-            }
-            else
-            {
-                isEscaped = false;
+            } else {
+                isEscaped = !isEscaped && (filter.charAt(idx) == '\\');
             }
 
             idx = skipWhitespace(filter, idx + 1);
         }
 
-        if (sf == null)
-        {
+        if (sf == null) {
             throw new IllegalArgumentException("Missing closing parenthesis: " + filter);
         }
 
         return sf;
     }
 
-    private static SimpleFilter subfilter(String filter, int startIdx, int endIdx)
-    {
+    private static SimpleFilter subfilter(String filter, int startIdx, int endIdx) {
         final String opChars = "=<>~";
 
         // Determine the ending index of the attribute name.
         int attrEndIdx = startIdx;
-        for (int i = 0; i < (endIdx - startIdx); i++)
-        {
+        for (int i = 0; i < (endIdx - startIdx); i++) {
             char c = filter.charAt(startIdx + i);
-            if (opChars.indexOf(c) >= 0)
-            {
+            if (opChars.indexOf(c) >= 0) {
                 break;
-            }
-            else if (!Character.isWhitespace(c))
-            {
+            } else if (!Character.isWhitespace(c)) {
                 attrEndIdx = startIdx + i + 1;
             }
         }
-        if (attrEndIdx == startIdx)
-        {
+        if (attrEndIdx == startIdx) {
             throw new IllegalArgumentException(
                     "Missing attribute name: " + filter.substring(startIdx, endIdx));
         }
@@ -300,43 +238,39 @@ public class SimpleFilter
         startIdx = skipWhitespace(filter, attrEndIdx);
 
         // Determine the operator type.
-        int op = -1;
-        switch (filter.charAt(startIdx))
-        {
-            case '=':
-                op = EQ;
-                startIdx++;
-                break;
-            case '<':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = LTE;
-                startIdx += 2;
-                break;
-            case '>':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = GTE;
-                startIdx += 2;
-                break;
-            case '~':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = APPROX;
-                startIdx += 2;
-                break;
-            default:
+        int op;
+        switch (filter.charAt(startIdx)) {
+        case '=':
+            op = EQ;
+            startIdx++;
+            break;
+        case '<':
+            if (filter.charAt(startIdx + 1) != '=') {
+                throw new IllegalArgumentException(
+                        "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = LTE;
+            startIdx += 2;
+            break;
+        case '>':
+            if (filter.charAt(startIdx + 1) != '=') {
+                throw new IllegalArgumentException(
+                        "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = GTE;
+            startIdx += 2;
+            break;
+        case '~':
+            if (filter.charAt(startIdx + 1) != '=') {
                 throw new IllegalArgumentException(
                         "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = APPROX;
+            startIdx += 2;
+            break;
+        default:
+            throw new IllegalArgumentException(
+                    "Unknown operator: " + filter.substring(startIdx, endIdx));
         }
 
         // Parse value.
@@ -344,18 +278,14 @@ public class SimpleFilter
 
         // Check if the equality comparison is actually a substring
         // or present operation.
-        if (op == EQ)
-        {
+        if (op == EQ) {
             String valueStr = filter.substring(startIdx, endIdx);
             List<String> values = parseSubstring(valueStr);
             if ((values.size() == 2)
                     && (values.get(0).length() == 0)
-                    && (values.get(1).length() == 0))
-            {
+                    && (values.get(1).length() == 0)) {
                 op = PRESENT;
-            }
-            else if (values.size() > 1)
-            {
+            } else if (values.size() > 1) {
                 op = SUBSTRING;
                 value = values;
             }
@@ -364,10 +294,9 @@ public class SimpleFilter
         return new SimpleFilter(attr, value, op);
     }
 
-    public static List<String> parseSubstring(String value)
-    {
-        List<String> pieces = new ArrayList();
-        StringBuffer ss = new StringBuffer();
+    public static List<String> parseSubstring(String value) {
+        List<String> pieces = new ArrayList<>();
+        StringBuilder ss = new StringBuilder();
         // int kind = SIMPLE; // assume until proven otherwise
         boolean wasStar = false; // indicates last piece was a star
         boolean leftstar = false; // track if the initial piece is a star
@@ -377,17 +306,12 @@ public class SimpleFilter
 
         // We assume (sub)strings can contain leading and trailing blanks
         boolean escaped = false;
-        loop:   for (;;)
-        {
-            if (idx >= value.length())
-            {
-                if (wasStar)
-                {
+        for (;;) {
+            if (idx >= value.length()) {
+                if (wasStar) {
                     // insert last piece as "" to handle trailing star
                     rightstar = true;
-                }
-                else
-                {
+                } else {
                     pieces.add(ss.toString());
                     // accumulate the last piece
                     // note that in the case of
@@ -395,64 +319,50 @@ public class SimpleFilter
                     // the string "" (!=null)
                 }
                 ss.setLength(0);
-                break loop;
+                break;
             }
 
             // Read the next character and account for escapes.
             char c = value.charAt(idx++);
-            if (!escaped && (c == '*'))
-            {
+            if (!escaped && (c == '*')) {
                 // If we have successive '*' characters, then we can
                 // effectively collapse them by ignoring succeeding ones.
-                if (!wasStar)
-                {
-                    if (ss.length() > 0)
-                    {
+                if (!wasStar) {
+                    if (ss.length() > 0) {
                         pieces.add(ss.toString()); // accumulate the pieces
                         // between '*' occurrences
                     }
                     ss.setLength(0);
                     // if this is a leading star, then track it
-                    if (pieces.isEmpty())
-                    {
+                    if (pieces.isEmpty()) {
                         leftstar = true;
                     }
                     wasStar = true;
                 }
-            }
-            else if (!escaped && (c == '\\'))
-            {
+            } else if (!escaped && (c == '\\')) {
                 escaped = true;
-            }
-            else
-            {
+            } else {
                 escaped = false;
                 wasStar = false;
                 ss.append(c);
             }
         }
-        if (leftstar || rightstar || pieces.size() > 1)
-        {
+        if (leftstar || rightstar || pieces.size() > 1) {
             // insert leading and/or trailing "" to anchor ends
-            if (rightstar)
-            {
+            if (rightstar) {
                 pieces.add("");
             }
-            if (leftstar)
-            {
+            if (leftstar) {
                 pieces.add(0, "");
             }
         }
         return pieces;
     }
 
-    public static String unparseSubstring(List<String> pieces)
-    {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < pieces.size(); i++)
-        {
-            if (i > 0)
-            {
+    public static String unparseSubstring(List<String> pieces) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < pieces.size(); i++) {
+            if (i > 0) {
                 sb.append("*");
             }
             sb.append(toEncodedString(pieces.get(i)));
@@ -460,8 +370,7 @@ public class SimpleFilter
         return sb.toString();
     }
 
-    public static boolean compareSubstring(List<String> pieces, String s)
-    {
+    public static boolean compareSubstring(List<String> pieces, String s) {
         // Walk the pieces to match the string
         // There are implicit stars between each piece,
         // and the first and last pieces might be "" to anchor the match.
@@ -473,8 +382,7 @@ public class SimpleFilter
 
         // Special case, if there is only one piece, then
         // we must perform an equality test.
-        if (len == 1)
-        {
+        if (len == 1) {
             return s.equals(pieces.get(0));
         }
 
@@ -483,45 +391,32 @@ public class SimpleFilter
 
         int index = 0;
 
-        loop:   for (int i = 0; i < len; i++)
-        {
+        for (int i = 0; i < len; i++) {
             String piece = pieces.get(i);
 
             // If this is the first piece, then make sure the
             // string starts with it.
-            if (i == 0)
-            {
-                if (!s.startsWith(piece))
-                {
+            if (i == 0) {
+                if (!s.startsWith(piece)) {
                     result = false;
-                    break loop;
+                    break;
                 }
             }
 
             // If this is the last piece, then make sure the
             // string ends with it.
-            if (i == (len - 1))
-            {
-                if (s.endsWith(piece) && (s.length() >= (index + piece.length())))
-                {
-                    result = true;
-                }
-                else
-                {
-                    result = false;
-                }
-                break loop;
+            if (i == (len - 1)) {
+                result = s.endsWith(piece) && (s.length() >= (index + piece.length()));
+                break;
             }
 
             // If this is neither the first or last piece, then
             // make sure the string contains it.
-            if ((i > 0) && (i < (len - 1)))
-            {
+            if ((i > 0) && (i < (len - 1))) {
                 index = s.indexOf(piece, index);
-                if (index < 0)
-                {
+                if (index < 0) {
                     result = false;
-                    break loop;
+                    break;
                 }
             }
 
@@ -532,11 +427,9 @@ public class SimpleFilter
         return result;
     }
 
-    private static int skipWhitespace(String s, int startIdx)
-    {
+    private static int skipWhitespace(String s, int startIdx) {
         int len = s.length();
-        while ((startIdx < len) && Character.isWhitespace(s.charAt(startIdx)))
-        {
+        while ((startIdx < len) && Character.isWhitespace(s.charAt(startIdx))) {
             startIdx++;
         }
         return startIdx;
@@ -549,98 +442,85 @@ public class SimpleFilter
      * in the desired order. Equality testing is assumed for all attribute types
      * other than version ranges, which are handled appropriated. If the attribute
      * map is empty, then a filter that matches anything is returned.
+     *
      * @param attrs Map of attributes to convert to a filter.
      * @return A filter corresponding to the attributes.
      */
-    public static SimpleFilter convert(Map<String, Object> attrs)
-    {
+    public static SimpleFilter convert(Map<String, Object> attrs) {
         // Rather than building a filter string to be parsed into a SimpleFilter,
         // we will just create the parsed SimpleFilter directly.
 
         List<SimpleFilter> filters = new ArrayList<SimpleFilter>();
 
-        for (Entry<String, Object> entry : attrs.entrySet())
-        {
-            if (entry.getValue() instanceof VersionRange)
-            {
+        for (Entry<String, Object> entry : attrs.entrySet()) {
+            if (entry.getValue() instanceof VersionRange) {
                 VersionRange vr = (VersionRange) entry.getValue();
-                if (!vr.isOpenFloor())
-                {
+                if (!vr.isOpenFloor()) {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     vr.getFloor().toString(),
-                                    SimpleFilter.GTE));
-                }
-                else
-                {
+                                    SimpleFilter.GTE)
+                    );
+                } else {
                     SimpleFilter not =
                             new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
-                    ((List) not.getValue()).add(
+                    ((List<Object>) not.getValue()).add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     vr.getFloor().toString(),
-                                    SimpleFilter.LTE));
+                                    SimpleFilter.LTE)
+                    );
                     filters.add(not);
                 }
 
-                if (vr.getCeiling() != null)
-                {
-                    if (!vr.isOpenCeiling())
-                    {
+                if (vr.getCeiling() != null) {
+                    if (!vr.isOpenCeiling()) {
                         filters.add(
                                 new SimpleFilter(
                                         entry.getKey(),
                                         vr.getCeiling().toString(),
-                                        SimpleFilter.LTE));
-                    }
-                    else
-                    {
+                                        SimpleFilter.LTE)
+                        );
+                    } else {
                         SimpleFilter not =
                                 new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
-                        ((List) not.getValue()).add(
+                        ((List<Object>) not.getValue()).add(
                                 new SimpleFilter(
                                         entry.getKey(),
                                         vr.getCeiling().toString(),
-                                        SimpleFilter.GTE));
+                                        SimpleFilter.GTE)
+                        );
                         filters.add(not);
                     }
                 }
-            }
-            else
-            {
+            } else {
                 List<String> values = SimpleFilter.parseSubstring(entry.getValue().toString());
-                if (values.size() > 1)
-                {
+                if (values.size() > 1) {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     values,
-                                    SimpleFilter.SUBSTRING));
-                }
-                else
-                {
+                                    SimpleFilter.SUBSTRING)
+                    );
+                } else {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     values.get(0),
-                                    SimpleFilter.EQ));
+                                    SimpleFilter.EQ)
+                    );
                 }
             }
         }
 
         SimpleFilter sf = null;
 
-        if (filters.size() == 1)
-        {
+        if (filters.size() == 1) {
             sf = filters.get(0);
-        }
-        else if (attrs.size() > 1)
-        {
+        } else if (attrs.size() > 1) {
             sf = new SimpleFilter(null, filters, SimpleFilter.AND);
-        }
-        else if (filters.isEmpty())
-        {
+        } else if (filters.isEmpty()) {
             sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
         }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
index 2f4a1f3..e83268a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
@@ -32,18 +32,18 @@ public class Slf4jResolverLog extends org.apache.felix.resolver.Logger {
     @Override
     protected void doLog(int level, String msg, Throwable throwable) {
         switch (level) {
-            case LOG_ERROR:
-                logger.error(msg, throwable);
-                break;
-            case LOG_WARNING:
-                logger.warn(msg, throwable);
-                break;
-            case LOG_INFO:
-                logger.info(msg, throwable);
-                break;
-            case LOG_DEBUG:
-                logger.debug(msg, throwable);
-                break;
+        case LOG_ERROR:
+            logger.error(msg, throwable);
+            break;
+        case LOG_WARNING:
+            logger.warn(msg, throwable);
+            break;
+        case LOG_INFO:
+            logger.info(msg, throwable);
+            break;
+        default:
+            logger.debug(msg, throwable);
+            break;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
index 44e9a7c..d76acd8 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
@@ -27,7 +27,7 @@ public class Artifact {
     String version;
     String extension;
     String classifier;
-    
+
     public Artifact(String coords) {
         String[] coordsAr = coords.split(":");
         if (coordsAr.length != 5) {
@@ -39,12 +39,12 @@ public class Artifact {
         this.extension = coordsAr[2];
         this.classifier = coordsAr[3];
     }
-    
+
     public Artifact(String coords, String version) {
         this(coords);
         this.version = version;
     }
-    
+
     public URI getMavenUrl(String version) {
         String uriSt = "mvn:" + this.groupId + "/" + this.artifactId + "/" + version + "/" + this.extension + "/" + this.classifier;
         try {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
index 93827bf..81e6a3a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
@@ -24,7 +24,6 @@ import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -37,9 +36,9 @@ import org.slf4j.LoggerFactory;
 
 public class BootFeaturesInstaller {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(BootFeaturesInstaller.class);
+    public static final String VERSION_PREFIX = "version=";
 
-    public static String VERSION_PREFIX = "version=";
+    private static final Logger LOGGER = LoggerFactory.getLogger(BootFeaturesInstaller.class);
 
     private final FeaturesServiceImpl featuresService;
     private final BundleContext bundleContext;
@@ -48,7 +47,6 @@ public class BootFeaturesInstaller {
     private final boolean asynchronous;
 
     /**
-     *
      * @param features list of boot features separated by comma. Optionally contains ;version=x.x.x to specify a specific feature version
      */
     public BootFeaturesInstaller(BundleContext bundleContext,
@@ -118,7 +116,6 @@ public class BootFeaturesInstaller {
     }
 
     /**
-     *
      * @param featureSt either feature name or <featurename>;version=<version>
      * @return feature matching the feature string
      * @throws Exception
@@ -163,7 +160,8 @@ public class BootFeaturesInstaller {
 
     private void publishBootFinished() {
         if (bundleContext != null) {
-            BootFinished bootFinished = new BootFinished() {};
+            BootFinished bootFinished = new BootFinished() {
+            };
             bundleContext.registerService(BootFinished.class, bootFinished, new Hashtable<String, String>());
         }
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
index d6bd3e1..0d1060c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
@@ -18,10 +18,8 @@ package org.apache.karaf.features.internal.service;
 
 import java.util.Comparator;
 
-import org.apache.felix.resolver.Util;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
-import org.osgi.resource.Resource;
 
 public class BundleComparator implements Comparator<Bundle> {
 


[5/7] git commit: Simplify code a bit

Posted by gn...@apache.org.
Simplify code a bit

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

Branch: refs/heads/master
Commit: 24c00ae056e40cba45c46d7b634ca19f5e727a07
Parents: b6c5a17
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 29 01:14:39 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 29 01:14:39 2014 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/scr/command/action/ListAction.java  | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/24c00ae0/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
----------------------------------------------------------------------
diff --git a/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java b/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
index ce47532..50d2e93 100755
--- a/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
+++ b/scr/command/src/main/java/org/apache/karaf/scr/command/action/ListAction.java
@@ -46,16 +46,9 @@ public class ListAction extends ScrActionSupport {
         Component[] components = scrService.getComponents();
         Arrays.sort(components, idComparator);
         for (Component component : ScrUtils.emptyIfNull(Component.class, components)) {
-            if (showHidden) {
-                // we display all because we are overridden
+            // Display only non hidden components, or all if showHidden is true
+            if (showHidden || !ScrActionSupport.isHiddenComponent(component)) {
                 table.addRow().addContent(component.getId(), ScrUtils.getState(component.getState()), component.getName());
-            } else {
-                if (ScrActionSupport.isHiddenComponent(component)) {
-                    // do nothing
-                } else {
-                    // we aren't hidden so print it
-                    table.addRow().addContent(component.getId(), ScrUtils.getState(component.getState()), component.getName());
-                }
             }
         }
         table.print(System.out);


[7/7] git commit: [KARAF-2951] Let the karaf-maven-plugin add the repositories to etc/org.apache.karaf.features.cfg

Posted by gn...@apache.org.
[KARAF-2951] Let the karaf-maven-plugin add the repositories to etc/org.apache.karaf.features.cfg

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

Branch: refs/heads/master
Commit: 5ca04ca6722afe6b18dfa94760f88b862db29cee
Parents: fd0143a
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 29 01:20:48 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 29 01:20:48 2014 +0200

----------------------------------------------------------------------
 .../filtered-resources/resources/etc/org.apache.karaf.features.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/5ca04ca6/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg b/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
index 06495e7..73f3bbf 100644
--- a/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
+++ b/assemblies/features/framework/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
@@ -36,7 +36,7 @@
 #
 # Comma separated list of features repositories to register by default
 #
-featuresRepositories=mvn:org.apache.karaf.features/standard/${project.version}/xml/features,mvn:org.apache.karaf.features/enterprise/${project.version}/xml/features,mvn:org.ops4j.pax.web/pax-web-features/${pax.web.version}/xml/features,mvn:org.apache.karaf.features/spring/${project.version}/xml/features
+featuresRepositories=
 
 #
 # Comma separated list of features to install at startup


[6/7] git commit: [KARAF-2951] Transitive repositories and bundles are not added to system repo

Posted by gn...@apache.org.
[KARAF-2951] Transitive repositories and bundles are not added to system repo

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

Branch: refs/heads/master
Commit: fd0143a1e4895dfc8af04efd33ec3445b9278f00
Parents: 24c00ae
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 29 01:19:28 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 29 01:19:28 2014 +0200

----------------------------------------------------------------------
 .../karaf/tooling/features/InstallKarsMojo.java | 117 ++++++++++---------
 1 file changed, 64 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/fd0143a1/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
index f58ca37..ef06c6d 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
@@ -44,6 +44,7 @@ import org.apache.karaf.features.Dependency;
 import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.features.Repository;
 import org.apache.karaf.features.internal.model.Bundle;
+import org.apache.karaf.features.internal.model.Conditional;
 import org.apache.karaf.features.internal.model.Feature;
 import org.apache.karaf.features.internal.model.Features;
 import org.apache.karaf.features.internal.model.JaxbUtil;
@@ -249,37 +250,40 @@ public class InstallKarsMojo extends MojoSupport {
 
         // install bundles listed in install features not in system
         for (Feature feature : localRepoFeatures) {
-            for (Bundle bundle : feature.getBundle()) {
-                if (!bundle.isDependency()) {
-                    String key = bundle.getLocation();
-                    // remove wrap: protocol to resolve from maven
-                    if (key.startsWith("wrap:")) {
-                        key = key.substring(5);
-                    }
-                    String path = this.dependencyHelper.pathFromMaven(key);
-                    File test = new File(system.resolve(path));
-                    if (!test.exists()) {
-                        File target = new File(system.resolve(path));
-                        if (!target.exists()) {
-                            install(key, target);
-                            Artifact artifact = this.dependencyHelper.mvnToArtifact(key);
-                            if (artifact.isSnapshot()) {
-                                // generate maven-metadata-local.xml for the artifact
-                                File metadataSource = new File(this.dependencyHelper.resolveById(key, getLog()).getParentFile(), "maven-metadata-local.xml");
-                                File metadataTarget = new File(target.getParentFile(), "maven-metadata-local.xml");
-                                metadataTarget.getParentFile().mkdirs();
-                                try {
-                                    if (!metadataSource.exists()) {
-                                        // the maven-metadata-local.xml doesn't exist in the local repo, generate one
-                                        MavenUtil.generateMavenMetadata(artifact, metadataTarget);
-                                    } else {
-                                        // copy the metadata to the target
-                                        copy(metadataSource, metadataTarget);
-                                    }
-                                } catch (IOException ioException) {
-                                    getLog().warn(ioException);
-                                    getLog().warn("Unable to copy the maven-metadata-local.xml, it means that this SNAPSHOT will be overwritten by a remote one (if exist)");
+            List<Bundle> bundles = new ArrayList<Bundle>();
+            bundles.addAll(feature.getBundle());
+            for (Conditional cond : feature.getConditional()) {
+                bundles.addAll(cond.getBundle());
+            }
+            for (Bundle bundle : bundles) {
+                String key = bundle.getLocation();
+                // remove wrap: protocol to resolve from maven
+                if (key.startsWith("wrap:")) {
+                    key = key.substring(5);
+                }
+                String path = this.dependencyHelper.pathFromMaven(key);
+                File test = new File(system.resolve(path));
+                if (!test.exists()) {
+                    File target = new File(system.resolve(path));
+                    if (!target.exists()) {
+                        install(key, target);
+                        Artifact artifact = this.dependencyHelper.mvnToArtifact(key);
+                        if (artifact.isSnapshot()) {
+                            // generate maven-metadata-local.xml for the artifact
+                            File metadataSource = new File(this.dependencyHelper.resolveById(key, getLog()).getParentFile(), "maven-metadata-local.xml");
+                            File metadataTarget = new File(target.getParentFile(), "maven-metadata-local.xml");
+                            metadataTarget.getParentFile().mkdirs();
+                            try {
+                                if (!metadataSource.exists()) {
+                                    // the maven-metadata-local.xml doesn't exist in the local repo, generate one
+                                    MavenUtil.generateMavenMetadata(artifact, metadataTarget);
+                                } else {
+                                    // copy the metadata to the target
+                                    copy(metadataSource, metadataTarget);
                                 }
+                            } catch (IOException ioException) {
+                                getLog().warn(ioException);
+                                getLog().warn("Unable to copy the maven-metadata-local.xml, it means that this SNAPSHOT will be overwritten by a remote one (if exist)");
                             }
                         }
                     }
@@ -332,29 +336,7 @@ public class InstallKarsMojo extends MojoSupport {
                         existingFeatureRepos = existingFeatureRepos + uri.toString();
                         properties.put(FEATURES_REPOSITORIES, existingFeatureRepos);
                     }
-                    Features repo = readFeatures(uri);
-                    for (String innerRepository : repo.getRepository()) {
-                        String innerRepositoryPath = dependencyHelper.pathFromMaven(innerRepository);
-                        File innerRepositoryTargetInSystemRepository = new File(system.resolve(innerRepositoryPath));
-                        if (!innerRepositoryTargetInSystemRepository.exists()) {
-                            File innerRepositorySourceFile = dependencyHelper.resolveById(innerRepository, getLog());
-                            innerRepositoryTargetInSystemRepository.getParentFile().mkdirs();
-                            copy(innerRepositorySourceFile, innerRepositoryTargetInSystemRepository);
-
-                            // add metadata for snapshot
-                            Artifact innerRepositoryArtifact = dependencyHelper.mvnToArtifact(innerRepository);
-                            if (innerRepositoryArtifact.isSnapshot()) {
-                                getLog().debug("Feature repository " + innerRepository + " is a SNAPSHOT, generate the maven-metadata-local.xml file");
-                                File metadataTarget = new File(innerRepositoryTargetInSystemRepository.getParentFile(), "maven-metadata-local.xml");
-                                try {
-                                    MavenUtil.generateMavenMetadata(innerRepositoryArtifact, metadataTarget);
-                                } catch (Exception e) {
-                                    getLog().warn("Could not create maven-metadata-local.xml", e);
-                                    getLog().warn("It means that this SNAPSHOT could be overwritten by an older one present on remote repositories");
-                                }
-                            }
-                        }
-                    }
+                    Features repo = loadAndCopyRepo(uri);
                     for (Feature feature : repo.getFeature()) {
                         featureSet.add(feature);
                         if (startupFeatures != null && startupFeatures.contains(feature.getName())) {
@@ -391,6 +373,35 @@ public class InstallKarsMojo extends MojoSupport {
             }
         }
 
+        private Features loadAndCopyRepo(URI uri) throws MojoExecutionException, MojoFailureException, JAXBException, XMLStreamException, IOException {
+            String repositoryPath = dependencyHelper.pathFromMaven(uri.toASCIIString());
+            getLog().info("Copying repo " + uri);
+            File repositoryTargetInSystemRepository = new File(system.resolve(repositoryPath));
+            if (!repositoryTargetInSystemRepository.exists()) {
+                File innerRepositorySourceFile = dependencyHelper.resolveById(uri.toASCIIString(), getLog());
+                repositoryTargetInSystemRepository.getParentFile().mkdirs();
+                copy(innerRepositorySourceFile, repositoryTargetInSystemRepository);
+
+                // add metadata for snapshot
+                Artifact innerRepositoryArtifact = dependencyHelper.mvnToArtifact(uri.toASCIIString());
+                if (innerRepositoryArtifact.isSnapshot()) {
+                    getLog().debug("Feature repository " + uri + " is a SNAPSHOT, generate the maven-metadata-local.xml file");
+                    File metadataTarget = new File(repositoryTargetInSystemRepository.getParentFile(), "maven-metadata-local.xml");
+                    try {
+                        MavenUtil.generateMavenMetadata(innerRepositoryArtifact, metadataTarget);
+                    } catch (Exception e) {
+                        getLog().warn("Could not create maven-metadata-local.xml", e);
+                        getLog().warn("It means that this SNAPSHOT could be overwritten by an older one present on remote repositories");
+                    }
+                }
+            }
+            Features features = readFeatures(repositoryTargetInSystemRepository.toURI());
+            for (String innerRepository : features.getRepository()) {
+                loadAndCopyRepo(URI.create(innerRepository));
+            }
+            return features;
+        }
+
         private void addMissingDependenciesToRepo() {
             for (ListIterator<Dependency> iterator = missingDependencies.listIterator(); iterator.hasNext(); ) {
                 Dependency dependency = iterator.next();


[3/7] Code formatting and other checkstyle issues

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Requirement.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Requirement.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Requirement.java
index f7b5775..6771e3d 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Requirement.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Requirement.java
@@ -1,23 +1,19 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.model;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -27,14 +23,13 @@ import javax.xml.bind.annotation.XmlValue;
 
 
 /**
- * 
  * Additional requirement for a feature.
- *             
- * 
+ * <p/>
+ * <p/>
  * <p>Java class for bundle complex type.
- * 
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within this class.
- * 
+ * <p/>
  * <pre>
  * &lt;complexType name="capability">
  *   &lt;simpleContent>
@@ -43,13 +38,9 @@ import javax.xml.bind.annotation.XmlValue;
  *   &lt;/simpleContent>
  * &lt;/complexType>
  * </pre>
- * 
- * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "requirement", propOrder = {
-    "value"
-})
+@XmlType(name = "requirement", propOrder = {"value"})
 public class Requirement implements org.apache.karaf.features.Requirement {
 
     @XmlValue
@@ -69,13 +60,16 @@ public class Requirement implements org.apache.karaf.features.Requirement {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
         Requirement bundle = (Requirement) o;
-
-        if (value != null ? !value.equals(bundle.value) : bundle.value != null) return false;
-
+        if (value != null ? !value.equals(bundle.value) : bundle.value != null) {
+            return false;
+        }
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/ScopeFilter.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/ScopeFilter.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/ScopeFilter.java
index 4b81fed..a1096ac 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/ScopeFilter.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/ScopeFilter.java
@@ -23,9 +23,7 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
 
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "scopeFilter", propOrder = {
-        "value"
-})
+@XmlType(name = "scopeFilter", propOrder = {"value"})
 public class ScopeFilter implements org.apache.karaf.features.ScopeFilter {
 
     @XmlAttribute(required = true)

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/Scoping.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/Scoping.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/Scoping.java
index 6773995..85264b3 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/Scoping.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/Scoping.java
@@ -26,10 +26,7 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "scoping", propOrder = {
-        "imports",
-        "exports"
-})
+@XmlType(name = "scoping", propOrder = {"imports", "exports"})
 public class Scoping implements org.apache.karaf.features.Scoping {
 
     @XmlAttribute
@@ -41,14 +38,14 @@ public class Scoping implements org.apache.karaf.features.Scoping {
 
     public List<ScopeFilter> getImport() {
         if (imports == null) {
-            imports = new ArrayList<ScopeFilter>();
+            imports = new ArrayList<>();
         }
         return imports;
     }
 
     public List<ScopeFilter> getExport() {
         if (exports == null) {
-            exports = new ArrayList<ScopeFilter>();
+            exports = new ArrayList<>();
         }
         return exports;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/model/package-info.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/model/package-info.java b/features/core/src/main/java/org/apache/karaf/features/internal/model/package-info.java
index c86a58c..b5506bc 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/model/package-info.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/model/package-info.java
@@ -1,21 +1,20 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.
  */
-
-@javax.xml.bind.annotation.XmlSchema(namespace = org.apache.karaf.features.FeaturesNamespaces.URI_CURRENT, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+@javax.xml.bind.annotation.XmlSchema(
+        namespace = org.apache.karaf.features.FeaturesNamespaces.URI_CURRENT,
+        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
 package org.apache.karaf.features.internal.model;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
index 81fdf49..1be87fc 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
@@ -33,17 +33,17 @@ import org.apache.felix.resolver.ResolverImpl;
 import org.apache.felix.utils.properties.Properties;
 import org.apache.karaf.features.FeaturesListener;
 import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.features.internal.management.FeaturesServiceMBeanImpl;
 import org.apache.karaf.features.internal.repository.AggregateRepository;
 import org.apache.karaf.features.internal.repository.JsonRepository;
 import org.apache.karaf.features.internal.repository.XmlRepository;
 import org.apache.karaf.features.internal.resolver.Slf4jResolverLog;
+import org.apache.karaf.features.internal.service.BootFeaturesInstaller;
 import org.apache.karaf.features.internal.service.EventAdminListener;
 import org.apache.karaf.features.internal.service.FeatureConfigInstaller;
 import org.apache.karaf.features.internal.service.FeatureFinder;
-import org.apache.karaf.features.internal.service.BootFeaturesInstaller;
 import org.apache.karaf.features.internal.service.FeaturesServiceImpl;
 import org.apache.karaf.features.internal.service.StateStorage;
-import org.apache.karaf.features.internal.management.FeaturesServiceMBeanImpl;
 import org.apache.karaf.util.tracker.BaseActivator;
 import org.eclipse.equinox.internal.region.DigraphHelper;
 import org.eclipse.equinox.internal.region.StandardRegionDigraph;
@@ -146,9 +146,15 @@ public class Activator extends BaseActivator {
         }
         Repository globalRepository;
         switch (repositories.size()) {
-            case 0: globalRepository = null; break;
-            case 1: globalRepository = repositories.get(0); break;
-            default: globalRepository = new AggregateRepository(repositories); break;
+        case 0:
+            globalRepository = null;
+            break;
+        case 1:
+            globalRepository = repositories.get(0);
+            break;
+        default:
+            globalRepository = new AggregateRepository(repositories);
+            break;
         }
 
         FeatureConfigInstaller configInstaller = new FeatureConfigInstaller(configurationAdmin);
@@ -180,37 +186,41 @@ public class Activator extends BaseActivator {
             eventAdminListener = null;
         }
         featuresService = new FeaturesServiceImpl(
-                                bundleContext.getBundle(),
-                                bundleContext.getBundle(0).getBundleContext(),
-                                stateStorage,
-                                featureFinder,
-                                eventAdminListener,
-                                configInstaller,
-                                digraph,
-                                overrides,
-                                featureResolutionRange,
-                                bundleUpdateRange,
-                                updateSnapshots,
-                                globalRepository);
+                bundleContext.getBundle(),
+                bundleContext.getBundle(0).getBundleContext(),
+                stateStorage,
+                featureFinder,
+                eventAdminListener,
+                configInstaller,
+                digraph,
+                overrides,
+                featureResolutionRange,
+                bundleUpdateRange,
+                updateSnapshots,
+                globalRepository);
         register(FeaturesService.class, featuresService);
 
         featuresListenerTracker = new ServiceTracker<>(
-                bundleContext, FeaturesListener.class, new ServiceTrackerCustomizer<FeaturesListener, FeaturesListener>() {
-            @Override
-            public FeaturesListener addingService(ServiceReference<FeaturesListener> reference) {
-                FeaturesListener service = bundleContext.getService(reference);
-                featuresService.registerListener(service);
-                return service;
-            }
-            @Override
-            public void modifiedService(ServiceReference<FeaturesListener> reference, FeaturesListener service) {
-            }
-            @Override
-            public void removedService(ServiceReference<FeaturesListener> reference, FeaturesListener service) {
-                featuresService.unregisterListener(service);
-                bundleContext.ungetService(reference);
-            }
-        }
+                bundleContext,
+                FeaturesListener.class,
+                new ServiceTrackerCustomizer<FeaturesListener, FeaturesListener>() {
+                    @Override
+                    public FeaturesListener addingService(ServiceReference<FeaturesListener> reference) {
+                        FeaturesListener service = bundleContext.getService(reference);
+                        featuresService.registerListener(service);
+                        return service;
+                    }
+
+                    @Override
+                    public void modifiedService(ServiceReference<FeaturesListener> reference, FeaturesListener service) {
+                    }
+
+                    @Override
+                    public void removedService(ServiceReference<FeaturesListener> reference, FeaturesListener service) {
+                        featuresService.unregisterListener(service);
+                        bundleContext.ungetService(reference);
+                    }
+                }
         );
         featuresListenerTracker.open();
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/region/AbstractRegionDigraphVisitor.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/AbstractRegionDigraphVisitor.java b/features/core/src/main/java/org/apache/karaf/features/internal/region/AbstractRegionDigraphVisitor.java
index 3ad2325..698db1b 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/AbstractRegionDigraphVisitor.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/AbstractRegionDigraphVisitor.java
@@ -80,8 +80,9 @@ public abstract class AbstractRegionDigraphVisitor<C> implements RegionDigraphVi
                 i.remove();
             }
         }
-        if (candidates.isEmpty())
+        if (candidates.isEmpty()) {
             return false; // this filter does not apply; avoid traversing this edge
+        }
         // push the filtered candidates for the next region
         filteredDeque.push(candidates);
         // push the allowed
@@ -104,7 +105,7 @@ public abstract class AbstractRegionDigraphVisitor<C> implements RegionDigraphVi
     /**
      * Determines whether the given region contains the given candidate.
      *
-     * @param region the {@link Region}
+     * @param region    the {@link Region}
      * @param candidate the candidate
      * @return <code>true</code> if and only if the given region contains the given candidate
      */
@@ -114,7 +115,7 @@ public abstract class AbstractRegionDigraphVisitor<C> implements RegionDigraphVi
      * Determines whether the given candidate is allowed by the given {@link RegionFilter}.
      *
      * @param candidate the candidate
-     * @param filter the filter
+     * @param filter    the filter
      * @return <code>true</code> if and only if the given candidate is allowed by the given filter
      */
     protected abstract boolean isAllowed(C candidate, RegionFilter filter);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/region/CandidateComparator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/CandidateComparator.java b/features/core/src/main/java/org/apache/karaf/features/internal/region/CandidateComparator.java
index 74c014b..35d6043 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/CandidateComparator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/CandidateComparator.java
@@ -25,10 +25,8 @@ import org.osgi.framework.namespace.PackageNamespace;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.resource.Capability;
 
-public class CandidateComparator implements Comparator<Capability>
-{
-    public int compare(Capability cap1, Capability cap2)
-    {
+public class CandidateComparator implements Comparator<Capability> {
+    public int compare(Capability cap1, Capability cap2) {
         int c = 0;
         // Always prefer system bundle
         if (cap1 instanceof BundleCapability && !(cap2 instanceof BundleCapability)) {
@@ -37,12 +35,10 @@ public class CandidateComparator implements Comparator<Capability>
             c = 1;
         }
         // Compare revision capabilities.
-        if ((c == 0) && cap1.getNamespace().equals(BundleNamespace.BUNDLE_NAMESPACE))
-        {
-            c = ((Comparable) cap1.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE))
+        if ((c == 0) && cap1.getNamespace().equals(BundleNamespace.BUNDLE_NAMESPACE)) {
+            c = ((Comparable<Object>) cap1.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE))
                     .compareTo(cap2.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE));
-            if (c == 0)
-            {
+            if (c == 0) {
                 Version v1 = (!cap1.getAttributes().containsKey(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE))
                         ? Version.emptyVersion
                         : (Version) cap1.getAttributes().get(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE);
@@ -53,14 +49,11 @@ public class CandidateComparator implements Comparator<Capability>
                 // highest version to have priority.
                 c = compareVersions(v2, v1);
             }
-        }
         // Compare package capabilities.
-        else if ((c == 0) && cap1.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
-        {
-            c = ((Comparable) cap1.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE))
+        } else if ((c == 0) && cap1.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE)) {
+            c = ((Comparable<Object>) cap1.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE))
                     .compareTo(cap2.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
-            if (c == 0)
-            {
+            if (c == 0) {
                 Version v1 = (!cap1.getAttributes().containsKey(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE))
                         ? Version.emptyVersion
                         : (Version) cap1.getAttributes().get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE);
@@ -71,8 +64,7 @@ public class CandidateComparator implements Comparator<Capability>
                 // highest version to have priority.
                 c = compareVersions(v2, v1);
                 // if same version, rather compare on the bundle version
-                if (c == 0)
-                {
+                if (c == 0) {
                     v1 = (!cap1.getAttributes().containsKey(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE))
                             ? Version.emptyVersion
                             : (Version) cap1.getAttributes().get(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE);
@@ -84,14 +76,11 @@ public class CandidateComparator implements Comparator<Capability>
                     c = compareVersions(v2, v1);
                 }
             }
-        }
         // Compare feature capabilities
-        else if ((c == 0) && cap1.getNamespace().equals(IdentityNamespace.IDENTITY_NAMESPACE))
-        {
-            c = ((Comparable) cap1.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE))
+        } else if ((c == 0) && cap1.getNamespace().equals(IdentityNamespace.IDENTITY_NAMESPACE)) {
+            c = ((Comparable<Object>) cap1.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE))
                     .compareTo(cap2.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE));
-            if (c == 0)
-            {
+            if (c == 0) {
                 Version v1 = (!cap1.getAttributes().containsKey(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE))
                         ? Version.emptyVersion
                         : (Version) cap1.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java b/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
index 8d6277a..d4e362f 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
@@ -188,7 +188,7 @@ public class Subsystem extends ResourceImpl {
         Capability identity = as.getCapabilities(IDENTITY_NAMESPACE).iterator().next();
         Object bsn = identity.getAttributes().get(IDENTITY_NAMESPACE);
         Requirement requirement = new RequirementImpl(this, IDENTITY_NAMESPACE,
-                Collections.<String,String>emptyMap(),
+                Collections.<String, String>emptyMap(),
                 Collections.singletonMap(IDENTITY_NAMESPACE, bsn));
         addRequirement(requirement);
         // Add it to repo
@@ -325,7 +325,7 @@ public class Subsystem extends ResourceImpl {
         for (DependencyInfo info : dependencies.values()) {
             installable.add(info.resource);
             addIdentityRequirement(info.resource, this, info.mandatory);
-       }
+        }
     }
 
     void addDependency(ResourceImpl resource, boolean mandatory, boolean start, int startLevel) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java b/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
index 0478125..fbacb9c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolver.java
@@ -105,7 +105,8 @@ public class SubsystemResolver {
                 ss = getOrCreateChild(ss, parts[i]);
             }
             for (String feature : entry.getValue()) {
-                String name, range;
+                String name;
+                String range;
                 int idx = feature.indexOf('/');
                 if (idx >= 0) {
                     name = feature.substring(0, idx);
@@ -257,7 +258,7 @@ public class SubsystemResolver {
     public Map<Resource, String> getFeatures() {
         if (features == null) {
             SimpleFilter sf = createFilter(IDENTITY_NAMESPACE, "*",
-                                           CAPABILITY_TYPE_ATTRIBUTE, TYPE_FEATURE);
+                    CAPABILITY_TYPE_ATTRIBUTE, TYPE_FEATURE);
             features = getResourceMapping(sf);
         }
         return features;
@@ -268,7 +269,7 @@ public class SubsystemResolver {
         Map<Resource, List<Wire>> wiring = getWiring();
         Map<Resource, String> resources = new HashMap<>();
         SimpleFilter sf = createFilter(IDENTITY_NAMESPACE, "*",
-                                       CAPABILITY_TYPE_ATTRIBUTE, TYPE_SUBSYSTEM);
+                CAPABILITY_TYPE_ATTRIBUTE, TYPE_SUBSYSTEM);
         for (Resource resource : wiring.keySet()) {
             if (findMatchingCapability(resourceFilter, resource.getCapabilities(null)) != null) {
                 // Find the subsystem where this feature is installed
@@ -351,7 +352,7 @@ public class SubsystemResolver {
     private SimpleFilter createFilter(String... s) {
         Map<String, Object> attrs = new HashMap<>();
         for (int i = 0; i < s.length - 1; i += 2) {
-            attrs.put(s[i], s[i+1]);
+            attrs.put(s[i], s[i + 1]);
         }
         return SimpleFilter.convert(attrs);
 
@@ -391,9 +392,11 @@ public class SubsystemResolver {
 
     private RegionFilterBuilder createRegionFilterBuilder(RegionDigraph digraph, Map<String, Set<String>> sharingPolicy) throws InvalidSyntaxException {
         RegionFilterBuilder result = digraph.createRegionFilterBuilder();
-        for (Map.Entry<String, Set<String>> entry : sharingPolicy.entrySet())
-            for (String filter : entry.getValue())
+        for (Map.Entry<String, Set<String>> entry : sharingPolicy.entrySet()) {
+            for (String filter : entry.getValue()) {
                 result.allow(entry.getKey(), filter);
+            }
+        }
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/repository/JsonRepository.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/repository/JsonRepository.java b/features/core/src/main/java/org/apache/karaf/features/internal/repository/JsonRepository.java
index f1f3c0b..270bcdf 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/repository/JsonRepository.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/repository/JsonRepository.java
@@ -102,11 +102,11 @@ public class JsonRepository extends BaseRepository {
 
     @SuppressWarnings("unchecked")
     private Map<String, Map<String, String>> verify(Object value) {
-        Map<?,?> obj = Map.class.cast(value);
-        for (Map.Entry<?,?> entry : obj.entrySet()) {
+        Map<?, ?> obj = Map.class.cast(value);
+        for (Map.Entry<?, ?> entry : obj.entrySet()) {
             String.class.cast(entry.getKey());
-            Map<?,?> child = Map.class.cast(entry.getValue());
-            for (Map.Entry<?,?> ce : child.entrySet()) {
+            Map<?, ?> child = Map.class.cast(entry.getValue());
+            for (Map.Entry<?, ?> ce : child.entrySet()) {
                 String.class.cast(ce.getKey());
                 String.class.cast(ce.getValue());
             }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/repository/StaxParser.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/repository/StaxParser.java b/features/core/src/main/java/org/apache/karaf/features/internal/repository/StaxParser.java
index 9e13e8e..4b59b3d 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/repository/StaxParser.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/repository/StaxParser.java
@@ -1,20 +1,18 @@
 /*
- * 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
+ * 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
+ *      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.
+ * 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.repository;
 
@@ -42,7 +40,7 @@ import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
 /**
  * Repository XML xml based on StaX
  */
-public class StaxParser {
+public final class StaxParser {
 
     public static final String REPOSITORY = "repository";
     public static final String REPO_NAME = "name";
@@ -60,6 +58,11 @@ public class StaxParser {
     public static final String VALUE = "value";
     public static final String TYPE = "type";
 
+    static XMLInputFactory factory;
+
+    private StaxParser() {
+    }
+
     public static class Referral {
         String url;
         int depth = Integer.MAX_VALUE;
@@ -68,8 +71,8 @@ public class StaxParser {
     public static class XmlRepository {
         String name;
         long increment;
-        List<Referral> referrals = new ArrayList<Referral>();
-        List<Resource> resources = new ArrayList<Resource>();
+        List<Referral> referrals = new ArrayList<>();
+        List<Resource> resources = new ArrayList<>();
     }
 
     public static XmlRepository parse(InputStream is) throws XMLStreamException {
@@ -86,11 +89,14 @@ public class StaxParser {
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) {
             String attrName = reader.getAttributeLocalName(i);
             String attrValue = reader.getAttributeValue(i);
-            if (REPO_NAME.equals(attrName)) {
+            switch (attrName) {
+            case REPO_NAME:
                 repo.name = attrName;
-            } else if (INCREMENT.equals(attrName)) {
+                break;
+            case INCREMENT:
                 repo.increment = Integer.parseInt(attrValue);
-            } else {
+                break;
+            default:
                 throw new IllegalStateException("Unexpected attribute '" + attrName + "'");
             }
         }
@@ -99,16 +105,20 @@ public class StaxParser {
         }
         while ((event = reader.nextTag()) == START_ELEMENT) {
             String element = reader.getLocalName();
-            if (REFERRAL.equals(element)) {
+            switch (element) {
+            case REFERRAL:
                 Referral referral = new Referral();
                 for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) {
                     String attrName = reader.getAttributeLocalName(i);
                     String attrValue = reader.getAttributeValue(i);
-                    if (DEPTH.equals(attrName)) {
+                    switch (attrName) {
+                    case DEPTH:
                         referral.depth = Integer.parseInt(attrValue);
-                    } else if (URL.equals(attrName)) {
+                        break;
+                    case URL:
                         referral.url = attrValue;
-                    } else {
+                        break;
+                    default:
                         throw new IllegalStateException("Unexpected attribute '" + attrName + "'");
                     }
                 }
@@ -117,9 +127,11 @@ public class StaxParser {
                 }
                 repo.referrals.add(referral);
                 sanityCheckEndElement(reader, reader.nextTag(), REFERRAL);
-            } else if (RESOURCE.equals(element)) {
+                break;
+            case RESOURCE:
                 repo.resources.add(parseResource(reader));
-            } else {
+                break;
+            default:
                 throw new IllegalStateException("Unsupported element '" + element + "'. Expected 'referral' or 'resource'");
             }
         }
@@ -143,19 +155,25 @@ public class StaxParser {
             int event;
             while ((event = reader.nextTag()) == START_ELEMENT) {
                 String element = reader.getLocalName();
-                if (CAPABILITY.equals(element)) {
+                switch (element) {
+                case CAPABILITY:
                     resource.addCapability(parseCapability(reader, resource));
-                } else if (REQUIREMENT.equals(element)) {
+                    break;
+                case REQUIREMENT:
                     resource.addRequirement(parseRequirement(reader, resource));
-                } else {
+                    break;
+                default:
                     while ((event = reader.next()) != END_ELEMENT) {
                         switch (event) {
-                            case START_ELEMENT:
-                                throw new IllegalStateException("Unexpected element '" + reader.getLocalName() + "' inside 'resource' element");
-                            case CHARACTERS:
-                                throw new IllegalStateException("Unexpected text inside 'resource' element");
+                        case START_ELEMENT:
+                            throw new IllegalStateException("Unexpected element '" + reader.getLocalName() + "' inside 'resource' element");
+                        case CHARACTERS:
+                            throw new IllegalStateException("Unexpected text inside 'resource' element");
+                        default:
+                            break;
                         }
                     }
+                    break;
                 }
             }
             // Sanity check
@@ -173,8 +191,8 @@ public class StaxParser {
 
     private static CapabilityImpl parseCapability(XMLStreamReader reader, ResourceImpl resource) throws XMLStreamException {
         String[] namespace = new String[1];
-        Map<String, String> directives = new HashMap<String, String>();
-        Map<String, Object> attributes = new HashMap<String, Object>();
+        Map<String, String> directives = new HashMap<>();
+        Map<String, Object> attributes = new HashMap<>();
         parseClause(reader, namespace, directives, attributes);
         sanityCheckEndElement(reader, reader.getEventType(), CAPABILITY);
         return new CapabilityImpl(resource, namespace[0], directives, attributes);
@@ -182,8 +200,8 @@ public class StaxParser {
 
     private static RequirementImpl parseRequirement(XMLStreamReader reader, ResourceImpl resource) throws XMLStreamException {
         String[] namespace = new String[1];
-        Map<String, String> directives = new HashMap<String, String>();
-        Map<String, Object> attributes = new HashMap<String, Object>();
+        Map<String, String> directives = new HashMap<>();
+        Map<String, Object> attributes = new HashMap<>();
         parseClause(reader, namespace, directives, attributes);
         sanityCheckEndElement(reader, reader.getEventType(), REQUIREMENT);
         return new RequirementImpl(resource, namespace[0], directives, attributes);
@@ -205,17 +223,21 @@ public class StaxParser {
         }
         while (reader.nextTag() == START_ELEMENT) {
             String element = reader.getLocalName();
-            if (DIRECTIVE.equals(element)) {
+            switch (element) {
+            case DIRECTIVE: {
                 String name = null;
                 String value = null;
                 for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) {
                     String attName = reader.getAttributeLocalName(i);
                     String attValue = reader.getAttributeValue(i);
-                    if (NAME.equals(attName)) {
+                    switch (attName) {
+                    case NAME:
                         name = attValue;
-                    } else if (VALUE.equals(attName)) {
+                        break;
+                    case VALUE:
                         value = attValue;
-                    } else {
+                        break;
+                    default:
                         throw new IllegalStateException("Unexpected attribute: '" + attName + "'. Expected 'name', or 'value'.");
                     }
                 }
@@ -224,20 +246,26 @@ public class StaxParser {
                 }
                 directives.put(name, value);
                 sanityCheckEndElement(reader, reader.nextTag(), DIRECTIVE);
-            } else if (ATTRIBUTE.equals(element)) {
+                break;
+            }
+            case ATTRIBUTE: {
                 String name = null;
                 String value = null;
                 String type = "String";
                 for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) {
                     String attName = reader.getAttributeLocalName(i);
                     String attValue = reader.getAttributeValue(i);
-                    if (NAME.equals(attName)) {
+                    switch (attName) {
+                    case NAME:
                         name = attValue;
-                    } else if (VALUE.equals(attName)) {
+                        break;
+                    case VALUE:
                         value = attValue;
-                    } else if (TYPE.equals(attName)) {
+                        break;
+                    case TYPE:
                         type = attValue;
-                    } else {
+                        break;
+                    default:
                         throw new IllegalStateException("Unexpected attribute: '" + attName + "'. Expected 'name', 'value' or 'type'.");
                     }
                 }
@@ -246,7 +274,9 @@ public class StaxParser {
                 }
                 attributes.put(name, parseAttribute(value, type));
                 sanityCheckEndElement(reader, reader.nextTag(), ATTRIBUTE);
-            } else {
+                break;
+            }
+            default:
                 throw new IllegalStateException("Unexpected element: '" + element + ". Expected 'directive' or 'attribute'");
             }
         }
@@ -263,7 +293,7 @@ public class StaxParser {
             return Double.parseDouble(value.trim());
         } else if (type.startsWith("List<") && type.endsWith(">")) {
             type = type.substring("List<".length(), type.length() - 1);
-            List<Object> list = new ArrayList<Object>();
+            List<Object> list = new ArrayList<>();
             for (String s : value.split(",")) {
                 list.add(parseAttribute(s.trim(), type));
             }
@@ -273,8 +303,6 @@ public class StaxParser {
         }
     }
 
-    static XMLInputFactory factory;
-
     private static synchronized XMLInputFactory getFactory() {
         if (StaxParser.factory == null) {
             XMLInputFactory factory = XMLInputFactory.newInstance();
@@ -284,6 +312,4 @@ public class StaxParser {
         return StaxParser.factory;
     }
 
-    private StaxParser() {
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/repository/UrlLoader.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/repository/UrlLoader.java b/features/core/src/main/java/org/apache/karaf/features/internal/repository/UrlLoader.java
index 77db247..640837a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/repository/UrlLoader.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/repository/UrlLoader.java
@@ -62,7 +62,7 @@ public abstract class UrlLoader {
                 return false;
             }
             try (
-                BufferedInputStream bis = new BufferedInputStream(connection.getInputStream())
+                    BufferedInputStream bis = new BufferedInputStream(connection.getInputStream())
             ) {
                 // Auto-detect gzipped streams
                 InputStream is = bis;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilityImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilityImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilityImpl.java
index bfe9b40..ba6bfd7 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilityImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilityImpl.java
@@ -16,13 +16,11 @@
  */
 package org.apache.karaf.features.internal.resolver;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 import org.osgi.framework.Constants;
 import org.osgi.resource.Capability;
@@ -30,136 +28,56 @@ import org.osgi.resource.Resource;
 
 public class CapabilityImpl extends BaseClause implements Capability {
 
-    private final Resource m_resource;
-    private final String m_namespace;
-    private final Map<String, String> m_dirs;
-    private final Map<String, Object> m_attrs;
-    private final List<String> m_uses;
-    private final List<List<String>> m_includeFilter;
-    private final List<List<String>> m_excludeFilter;
-    private final Set<String> m_mandatory;
-
-    public CapabilityImpl(Capability capability) {
-        this(null, capability.getNamespace(), capability.getDirectives(), capability.getAttributes());
-    }
+    private final Resource resource;
+    private final String namespace;
+    private final Map<String, String> dirs;
+    private final Map<String, Object> attrs;
+    private final Set<String> mandatory;
 
     public CapabilityImpl(Resource resource, String namespace,
                           Map<String, String> dirs, Map<String, Object> attrs) {
-        m_namespace = namespace;
-        m_resource = resource;
-        m_dirs = dirs;
-        m_attrs = attrs;
-
-        // Find all export directives: uses, mandatory, include, and exclude.
-
-        List<String> uses = Collections.emptyList();
-        String value = m_dirs.get(Constants.USES_DIRECTIVE);
-        if (value != null) {
-            // Parse these uses directive.
-            StringTokenizer tok = new StringTokenizer(value, ",");
-            uses = new ArrayList<String>(tok.countTokens());
-            while (tok.hasMoreTokens()) {
-                uses.add(tok.nextToken().trim());
-            }
-        }
-        m_uses = uses;
-
-        value = m_dirs.get(Constants.INCLUDE_DIRECTIVE);
-        if (value != null) {
-            List<String> filters = ResourceBuilder.parseDelimitedString(value, ",");
-            m_includeFilter = new ArrayList<List<String>>(filters.size());
-            for (String filter : filters) {
-                List<String> substrings = SimpleFilter.parseSubstring(filter);
-                m_includeFilter.add(substrings);
-            }
-        } else {
-            m_includeFilter = null;
-        }
-
-        value = m_dirs.get(Constants.EXCLUDE_DIRECTIVE);
-        if (value != null) {
-            List<String> filters = ResourceBuilder.parseDelimitedString(value, ",");
-            m_excludeFilter = new ArrayList<List<String>>(filters.size());
-            for (String filter : filters) {
-                List<String> substrings = SimpleFilter.parseSubstring(filter);
-                m_excludeFilter.add(substrings);
-            }
-        } else {
-            m_excludeFilter = null;
-        }
+        this.namespace = namespace;
+        this.resource = resource;
+        this.dirs = dirs;
+        this.attrs = attrs;
 
+        // Handle mandatory directive
         Set<String> mandatory = Collections.emptySet();
-        value = m_dirs.get(Constants.MANDATORY_DIRECTIVE);
+        String value = this.dirs.get(Constants.MANDATORY_DIRECTIVE);
         if (value != null) {
             List<String> names = ResourceBuilder.parseDelimitedString(value, ",");
-            mandatory = new HashSet<String>(names.size());
+            mandatory = new HashSet<>(names.size());
             for (String name : names) {
                 // If attribute exists, then record it as mandatory.
-                if (m_attrs.containsKey(name)) {
+                if (this.attrs.containsKey(name)) {
                     mandatory.add(name);
-                }
                 // Otherwise, report an error.
-                else {
+                } else {
                     throw new IllegalArgumentException("Mandatory attribute '" + name + "' does not exist.");
                 }
             }
         }
-        m_mandatory = mandatory;
+        this.mandatory = mandatory;
     }
 
     public Resource getResource() {
-        return m_resource;
+        return resource;
     }
 
     public String getNamespace() {
-        return m_namespace;
+        return namespace;
     }
 
     public Map<String, String> getDirectives() {
-        return m_dirs;
+        return dirs;
     }
 
     public Map<String, Object> getAttributes() {
-        return m_attrs;
+        return attrs;
     }
 
     public boolean isAttributeMandatory(String name) {
-        return !m_mandatory.isEmpty() && m_mandatory.contains(name);
-    }
-
-    public List<String> getUses() {
-        return m_uses;
-    }
-
-    public boolean isIncluded(String name) {
-        if ((m_includeFilter == null) && (m_excludeFilter == null)) {
-            return true;
-        }
-
-        // Get the class name portion of the target class.
-        String className = getClassName(name);
-
-        // If there are no include filters then all classes are included
-        // by default, otherwise try to find one match.
-        boolean included = (m_includeFilter == null);
-        for (int i = 0; !included && m_includeFilter != null && i < m_includeFilter.size(); i++) {
-            included = SimpleFilter.compareSubstring(m_includeFilter.get(i), className);
-        }
-
-        // If there are no exclude filters then no classes are excluded
-        // by default, otherwise try to find one match.
-        boolean excluded = false;
-        for (int i = 0; (!excluded) && (m_excludeFilter != null) && (i < m_excludeFilter.size()); i++) {
-            excluded = SimpleFilter.compareSubstring(m_excludeFilter.get(i), className);
-        }
-        return included && !excluded;
-    }
-
-    private static String getClassName(String className) {
-        if (className == null) {
-            className = "";
-        }
-        return (className.lastIndexOf('.') < 0) ? "" : className.substring(className.lastIndexOf('.') + 1);
+        return !mandatory.isEmpty() && mandatory.contains(name);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilitySet.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilitySet.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilitySet.java
index 4c5656d..46fd571 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilitySet.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/CapabilitySet.java
@@ -32,74 +32,60 @@ import java.util.TreeMap;
 import org.osgi.framework.Constants;
 import org.osgi.resource.Capability;
 
-public class CapabilitySet
-{
-    private final Map<String, Map<Object, Set<Capability>>> m_indices;
-    private final Set<Capability> m_capSet = new HashSet<Capability>();
-
-public void dump()
-{
-    for (Entry<String, Map<Object, Set<Capability>>> entry : m_indices.entrySet())
-    {
-        boolean header1 = false;
-        for (Entry<Object, Set<Capability>> entry2 : entry.getValue().entrySet())
-        {
-            boolean header2 = false;
-            for (Capability cap : entry2.getValue())
-            {
-                if (!header1)
-                {
-                    System.out.println(entry.getKey() + ":");
-                    header1 = true;
-                }
-                if (!header2)
-                {
-                    System.out.println("   " + entry2.getKey());
-                    header2 = true;
-                }
-                System.out.println("      " + cap);
-            }
+public class CapabilitySet {
+
+    private static final Class<?>[] STRING_CLASS = new Class[] {String.class};
+
+    private final Map<String, Map<Object, Set<Capability>>> indices;
+    private final Set<Capability> capSet = new HashSet<>();
+
+    public CapabilitySet(List<String> indexProps) {
+        indices = new TreeMap<>();
+        for (int i = 0; (indexProps != null) && (i < indexProps.size()); i++) {
+            indices.put(
+                    indexProps.get(i), new HashMap<Object, Set<Capability>>());
         }
     }
-}
 
-    public CapabilitySet(List<String> indexProps)
-    {
-        m_indices = new TreeMap<String, Map<Object, Set<Capability>>>();
-        for (int i = 0; (indexProps != null) && (i < indexProps.size()); i++)
-        {
-            m_indices.put(
-                indexProps.get(i), new HashMap<Object, Set<Capability>>());
+    public void dump() {
+        for (Entry<String, Map<Object, Set<Capability>>> entry : indices.entrySet()) {
+            boolean header1 = false;
+            for (Entry<Object, Set<Capability>> entry2 : entry.getValue().entrySet()) {
+                boolean header2 = false;
+                for (Capability cap : entry2.getValue()) {
+                    if (!header1) {
+                        System.out.println(entry.getKey() + ":");
+                        header1 = true;
+                    }
+                    if (!header2) {
+                        System.out.println("   " + entry2.getKey());
+                        header2 = true;
+                    }
+                    System.out.println("      " + cap);
+                }
+            }
         }
     }
 
-    public void addCapability(Capability cap)
-    {
-        m_capSet.add(cap);
+    public void addCapability(Capability cap) {
+        capSet.add(cap);
 
         // Index capability.
-        for (Entry<String, Map<Object, Set<Capability>>> entry : m_indices.entrySet())
-        {
+        for (Entry<String, Map<Object, Set<Capability>>> entry : indices.entrySet()) {
             Object value = cap.getAttributes().get(entry.getKey());
-            if (value != null)
-            {
-                if (value.getClass().isArray())
-                {
+            if (value != null) {
+                if (value.getClass().isArray()) {
                     value = convertArrayToList(value);
                 }
 
                 Map<Object, Set<Capability>> index = entry.getValue();
 
-                if (value instanceof Collection)
-                {
+                if (value instanceof Collection) {
                     Collection c = (Collection) value;
-                    for (Object o : c)
-                    {
+                    for (Object o : c) {
                         indexCapability(index, cap, o);
                     }
-                }
-                else
-                {
+                } else {
                     indexCapability(index, cap, value);
                 }
             }
@@ -107,43 +93,32 @@ public void dump()
     }
 
     private void indexCapability(
-        Map<Object, Set<Capability>> index, Capability cap, Object capValue)
-    {
+            Map<Object, Set<Capability>> index, Capability cap, Object capValue) {
         Set<Capability> caps = index.get(capValue);
-        if (caps == null)
-        {
-            caps = new HashSet<Capability>();
+        if (caps == null) {
+            caps = new HashSet<>();
             index.put(capValue, caps);
         }
         caps.add(cap);
     }
 
-    public void removeCapability(Capability cap)
-    {
-        if (m_capSet.remove(cap))
-        {
-            for (Entry<String, Map<Object, Set<Capability>>> entry : m_indices.entrySet())
-            {
+    public void removeCapability(Capability cap) {
+        if (capSet.remove(cap)) {
+            for (Entry<String, Map<Object, Set<Capability>>> entry : indices.entrySet()) {
                 Object value = cap.getAttributes().get(entry.getKey());
-                if (value != null)
-                {
-                    if (value.getClass().isArray())
-                    {
+                if (value != null) {
+                    if (value.getClass().isArray()) {
                         value = convertArrayToList(value);
                     }
 
                     Map<Object, Set<Capability>> index = entry.getValue();
 
-                    if (value instanceof Collection)
-                    {
+                    if (value instanceof Collection) {
                         Collection c = (Collection) value;
-                        for (Object o : c)
-                        {
+                        for (Object o : c) {
                             deindexCapability(index, cap, o);
                         }
-                    }
-                    else
-                    {
+                    } else {
                         deindexCapability(index, cap, value);
                     }
                 }
@@ -152,91 +127,67 @@ public void dump()
     }
 
     private void deindexCapability(
-        Map<Object, Set<Capability>> index, Capability cap, Object value)
-    {
+            Map<Object, Set<Capability>> index, Capability cap, Object value) {
         Set<Capability> caps = index.get(value);
-        if (caps != null)
-        {
+        if (caps != null) {
             caps.remove(cap);
-            if (caps.isEmpty())
-            {
+            if (caps.isEmpty()) {
                 index.remove(value);
             }
         }
     }
 
-    public Set<Capability> match(SimpleFilter sf, boolean obeyMandatory)
-    {
-        Set<Capability> matches = match(m_capSet, sf);
-        return (obeyMandatory)
-            ? matchMandatory(matches, sf)
-            : matches;
+    public Set<Capability> match(SimpleFilter sf, boolean obeyMandatory) {
+        Set<Capability> matches = match(capSet, sf);
+        return obeyMandatory
+                ? matchMandatory(matches, sf)
+                : matches;
     }
 
-    private Set<Capability> match(Set<Capability> caps, SimpleFilter sf)
-    {
-        Set<Capability> matches = new HashSet<Capability>();
+    @SuppressWarnings("unchecked")
+    private Set<Capability> match(Set<Capability> caps, SimpleFilter sf) {
+        Set<Capability> matches = new HashSet<>();
 
-        if (sf.getOperation() == SimpleFilter.MATCH_ALL)
-        {
+        if (sf.getOperation() == SimpleFilter.MATCH_ALL) {
             matches.addAll(caps);
-        }
-        else if (sf.getOperation() == SimpleFilter.AND)
-        {
+        } else if (sf.getOperation() == SimpleFilter.AND) {
             // Evaluate each subfilter against the remaining capabilities.
             // For AND we calculate the intersection of each subfilter.
             // We can short-circuit the AND operation if there are no
             // remaining capabilities.
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; (caps.size() > 0) && (i < sfs.size()); i++)
-            {
+            for (int i = 0; (caps.size() > 0) && (i < sfs.size()); i++) {
                 matches = match(caps, sfs.get(i));
                 caps = matches;
             }
-        }
-        else if (sf.getOperation() == SimpleFilter.OR)
-        {
+        } else if (sf.getOperation() == SimpleFilter.OR) {
             // Evaluate each subfilter against the remaining capabilities.
             // For OR we calculate the union of each subfilter.
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; i < sfs.size(); i++)
-            {
-                matches.addAll(match(caps, sfs.get(i)));
+            for (SimpleFilter sf1 : sfs) {
+                matches.addAll(match(caps, sf1));
             }
-        }
-        else if (sf.getOperation() == SimpleFilter.NOT)
-        {
+        } else if (sf.getOperation() == SimpleFilter.NOT) {
             // Evaluate each subfilter against the remaining capabilities.
             // For OR we calculate the union of each subfilter.
             matches.addAll(caps);
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; i < sfs.size(); i++)
-            {
-                matches.removeAll(match(caps, sfs.get(i)));
+            for (SimpleFilter sf1 : sfs) {
+                matches.removeAll(match(caps, sf1));
             }
-        }
-        else
-        {
-            Map<Object, Set<Capability>> index = m_indices.get(sf.getName());
-            if ((sf.getOperation() == SimpleFilter.EQ) && (index != null))
-            {
+        } else {
+            Map<Object, Set<Capability>> index = indices.get(sf.getName());
+            if ((sf.getOperation() == SimpleFilter.EQ) && (index != null)) {
                 Set<Capability> existingCaps = index.get(sf.getValue());
-                if (existingCaps != null)
-                {
+                if (existingCaps != null) {
                     matches.addAll(existingCaps);
                     matches.retainAll(caps);
                 }
-            }
-            else
-            {
-                for (Iterator<Capability> it = caps.iterator(); it.hasNext(); )
-                {
-                    Capability cap = it.next();
+            } else {
+                for (Capability cap : caps) {
                     Object lhs = cap.getAttributes().get(sf.getName());
-                    if (lhs != null)
-                    {
-                        if (compare(lhs, sf.getValue(), sf.getOperation()))
-                        {
+                    if (lhs != null) {
+                        if (compare(lhs, sf.getValue(), sf.getOperation())) {
                             matches.add(cap);
                         }
                     }
@@ -247,58 +198,44 @@ public void dump()
         return matches;
     }
 
-    public static boolean matches(Capability cap, SimpleFilter sf)
-    {
+    public static boolean matches(Capability cap, SimpleFilter sf) {
         return matchesInternal(cap, sf) && matchMandatory(cap, sf);
     }
 
-    private static boolean matchesInternal(Capability cap, SimpleFilter sf)
-    {
+    @SuppressWarnings("unchecked")
+    private static boolean matchesInternal(Capability cap, SimpleFilter sf) {
         boolean matched = true;
 
-        if (sf.getOperation() == SimpleFilter.MATCH_ALL)
-        {
+        if (sf.getOperation() == SimpleFilter.MATCH_ALL) {
             matched = true;
-        }
-        else if (sf.getOperation() == SimpleFilter.AND)
-        {
+        } else if (sf.getOperation() == SimpleFilter.AND) {
             // Evaluate each subfilter against the remaining capabilities.
             // For AND we calculate the intersection of each subfilter.
             // We can short-circuit the AND operation if there are no
             // remaining capabilities.
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; matched && (i < sfs.size()); i++)
-            {
+            for (int i = 0; matched && (i < sfs.size()); i++) {
                 matched = matchesInternal(cap, sfs.get(i));
             }
-        }
-        else if (sf.getOperation() == SimpleFilter.OR)
-        {
+        } else if (sf.getOperation() == SimpleFilter.OR) {
             // Evaluate each subfilter against the remaining capabilities.
             // For OR we calculate the union of each subfilter.
             matched = false;
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; !matched && (i < sfs.size()); i++)
-            {
+            for (int i = 0; !matched && (i < sfs.size()); i++) {
                 matched = matchesInternal(cap, sfs.get(i));
             }
-        }
-        else if (sf.getOperation() == SimpleFilter.NOT)
-        {
+        } else if (sf.getOperation() == SimpleFilter.NOT) {
             // Evaluate each subfilter against the remaining capabilities.
             // For OR we calculate the union of each subfilter.
             List<SimpleFilter> sfs = (List<SimpleFilter>) sf.getValue();
-            for (int i = 0; i < sfs.size(); i++)
-            {
-                matched = !(matchesInternal(cap, sfs.get(i)));
+            for (SimpleFilter sf1 : sfs) {
+                matched = !(matchesInternal(cap, sf1));
             }
-        }
-        else
-        {
+        } else {
             matched = false;
             Object lhs = cap.getAttributes().get(sf.getName());
-            if (lhs != null)
-            {
+            if (lhs != null) {
                 matched = compare(lhs, sf.getValue(), sf.getOperation());
             }
         }
@@ -307,27 +244,21 @@ public void dump()
     }
 
     private static Set<Capability> matchMandatory(
-        Set<Capability> caps, SimpleFilter sf)
-    {
-        for (Iterator<Capability> it = caps.iterator(); it.hasNext(); )
-        {
+            Set<Capability> caps, SimpleFilter sf) {
+        for (Iterator<Capability> it = caps.iterator(); it.hasNext();) {
             Capability cap = it.next();
-            if (!matchMandatory(cap, sf))
-            {
+            if (!matchMandatory(cap, sf)) {
                 it.remove();
             }
         }
         return caps;
     }
 
-    private static boolean matchMandatory(Capability cap, SimpleFilter sf)
-    {
+    private static boolean matchMandatory(Capability cap, SimpleFilter sf) {
         if (cap instanceof CapabilityImpl) {
-            for (Entry<String, Object> entry : cap.getAttributes().entrySet())
-            {
+            for (Entry<String, Object> entry : cap.getAttributes().entrySet()) {
                 if (((CapabilityImpl) cap).isAttributeMandatory(entry.getKey())
-                    && !matchMandatoryAttribute(entry.getKey(), sf))
-                {
+                        && !matchMandatoryAttribute(entry.getKey(), sf)) {
                     return false;
                 }
             }
@@ -335,11 +266,9 @@ public void dump()
             String value = cap.getDirectives().get(Constants.MANDATORY_DIRECTIVE);
             if (value != null) {
                 List<String> names = ResourceBuilder.parseDelimitedString(value, ",");
-                for (Entry<String, Object> entry : cap.getAttributes().entrySet())
-                {
+                for (Entry<String, Object> entry : cap.getAttributes().entrySet()) {
                     if (names.contains(entry.getKey())
-                            && !matchMandatoryAttribute(entry.getKey(), sf))
-                    {
+                            && !matchMandatoryAttribute(entry.getKey(), sf)) {
                         return false;
                     }
                 }
@@ -349,21 +278,15 @@ public void dump()
         return true;
     }
 
-    private static boolean matchMandatoryAttribute(String attrName, SimpleFilter sf)
-    {
-        if ((sf.getName() != null) && sf.getName().equals(attrName))
-        {
+    private static boolean matchMandatoryAttribute(String attrName, SimpleFilter sf) {
+        if ((sf.getName() != null) && sf.getName().equals(attrName)) {
             return true;
-        }
-        else if (sf.getOperation() == SimpleFilter.AND)
-        {
+        } else if (sf.getOperation() == SimpleFilter.AND) {
             List list = (List) sf.getValue();
-            for (int i = 0; i < list.size(); i++)
-            {
-                SimpleFilter sf2 = (SimpleFilter) list.get(i);
+            for (Object aList : list) {
+                SimpleFilter sf2 = (SimpleFilter) aList;
                 if ((sf2.getName() != null)
-                    && sf2.getName().equals(attrName))
-                {
+                        && sf2.getName().equals(attrName)) {
                     return true;
                 }
             }
@@ -371,129 +294,77 @@ public void dump()
         return false;
     }
 
-    private static final Class<?>[] STRING_CLASS = new Class[] { String.class };
-
-    private static boolean compare(Object lhs, Object rhsUnknown, int op)
-    {
-        if (lhs == null)
-        {
+    @SuppressWarnings("unchecked")
+    private static boolean compare(Object lhs, Object rhsUnknown, int op) {
+        if (lhs == null) {
             return false;
         }
 
         // If this is a PRESENT operation, then just return true immediately
         // since we wouldn't be here if the attribute wasn't present.
-        if (op == SimpleFilter.PRESENT)
-        {
+        if (op == SimpleFilter.PRESENT) {
             return true;
         }
 
         // If the type is comparable, then we can just return the
         // result immediately.
-        if (lhs instanceof Comparable)
-        {
+        if (lhs instanceof Comparable) {
             // Spec says SUBSTRING is false for all types other than string.
-            if ((op == SimpleFilter.SUBSTRING) && !(lhs instanceof String))
-            {
+            if ((op == SimpleFilter.SUBSTRING) && !(lhs instanceof String)) {
                 return false;
             }
 
             Object rhs;
-            if (op == SimpleFilter.SUBSTRING)
-            {
+            if (op == SimpleFilter.SUBSTRING) {
                 rhs = rhsUnknown;
-            }
-            else
-            {
-                try
-                {
+            } else {
+                try {
                     rhs = coerceType(lhs, (String) rhsUnknown);
-                }
-                catch (Exception ex)
-                {
+                } catch (Exception ex) {
                     return false;
                 }
             }
 
-            switch (op)
-            {
-                case SimpleFilter.EQ :
-                    try
-                    {
-                        return (((Comparable) lhs).compareTo(rhs) == 0);
-                    }
-                    catch (Exception ex)
-                    {
-                        return false;
-                    }
-                case SimpleFilter.GTE :
-                    try
-                    {
-                        return (((Comparable) lhs).compareTo(rhs) >= 0);
-                    }
-                    catch (Exception ex)
-                    {
-                        return false;
-                    }
-                case SimpleFilter.LTE :
-                    try
-                    {
-                        return (((Comparable) lhs).compareTo(rhs) <= 0);
-                    }
-                    catch (Exception ex)
-                    {
-                        return false;
-                    }
-                case SimpleFilter.APPROX :
-                    return compareApproximate(((Comparable) lhs), rhs);
-                case SimpleFilter.SUBSTRING :
-                    return SimpleFilter.compareSubstring((List<String>) rhs, (String) lhs);
-                default:
-                    throw new RuntimeException(
-                        "Unknown comparison operator: " + op);
-            }
-        }
-        // Booleans do not implement comparable, so special case them.
-        else if (lhs instanceof Boolean)
-        {
-            Object rhs;
-            try
-            {
-                rhs = coerceType(lhs, (String) rhsUnknown);
-            }
-            catch (Exception ex)
-            {
-                return false;
-            }
-
-            switch (op)
-            {
-                case SimpleFilter.EQ :
-                case SimpleFilter.GTE :
-                case SimpleFilter.LTE :
-                case SimpleFilter.APPROX :
-                    return (lhs.equals(rhs));
-                default:
-                    throw new RuntimeException(
-                        "Unknown comparison operator: " + op);
+            switch (op) {
+            case SimpleFilter.EQ:
+                try {
+                    return ((Comparable) lhs).compareTo(rhs) == 0;
+                } catch (Exception ex) {
+                    return false;
+                }
+            case SimpleFilter.GTE:
+                try {
+                    return ((Comparable) lhs).compareTo(rhs) >= 0;
+                } catch (Exception ex) {
+                    return false;
+                }
+            case SimpleFilter.LTE:
+                try {
+                    return ((Comparable) lhs).compareTo(rhs) <= 0;
+                } catch (Exception ex) {
+                    return false;
+                }
+            case SimpleFilter.APPROX:
+                return compareApproximate(lhs, rhs);
+            case SimpleFilter.SUBSTRING:
+                return SimpleFilter.compareSubstring((List<String>) rhs, (String) lhs);
+            default:
+                throw new RuntimeException("Unknown comparison operator: " + op);
             }
         }
 
         // If the LHS is not a comparable or boolean, check if it is an
         // array. If so, convert it to a list so we can treat it as a
         // collection.
-        if (lhs.getClass().isArray())
-        {
+        if (lhs.getClass().isArray()) {
             lhs = convertArrayToList(lhs);
         }
 
         // If LHS is a collection, then call compare() on each element
         // of the collection until a match is found.
-        if (lhs instanceof Collection)
-        {
-            for (Iterator iter = ((Collection) lhs).iterator(); iter.hasNext(); )
-            {
-                if (compare(iter.next(), rhsUnknown, op))
-                {
+        if (lhs instanceof Collection) {
+            for (Object o : (Collection) lhs) {
+                if (compare(o, rhsUnknown, op)) {
                     return true;
                 }
             }
@@ -502,90 +373,71 @@ public void dump()
         }
 
         // Spec says SUBSTRING is false for all types other than string.
-        if ((op == SimpleFilter.SUBSTRING) && !(lhs instanceof String))
-        {
+        if (op == SimpleFilter.SUBSTRING) {
             return false;
         }
 
         // Since we cannot identify the LHS type, then we can only perform
         // equality comparison.
-        try
-        {
+        try {
             return lhs.equals(coerceType(lhs, (String) rhsUnknown));
-        }
-        catch (Exception ex)
-        {
+        } catch (Exception ex) {
             return false;
         }
     }
 
-    private static boolean compareApproximate(Object lhs, Object rhs)
-    {
-        if (rhs instanceof String)
-        {
+    private static boolean compareApproximate(Object lhs, Object rhs) {
+        if (rhs instanceof String) {
             return removeWhitespace((String) lhs)
-                .equalsIgnoreCase(removeWhitespace((String) rhs));
-        }
-        else if (rhs instanceof Character)
-        {
-            return Character.toLowerCase(((Character) lhs))
-                == Character.toLowerCase(((Character) rhs));
+                    .equalsIgnoreCase(removeWhitespace((String) rhs));
+        } else if (rhs instanceof Character) {
+            return Character.toLowerCase((Character) lhs)
+                    == Character.toLowerCase((Character) rhs);
         }
         return lhs.equals(rhs);
     }
 
-    private static String removeWhitespace(String s)
-    {
-        StringBuffer sb = new StringBuffer(s.length());
-        for (int i = 0; i < s.length(); i++)
-        {
-            if (!Character.isWhitespace(s.charAt(i)))
-            {
+    private static String removeWhitespace(String s) {
+        StringBuilder sb = new StringBuilder(s.length());
+        for (int i = 0; i < s.length(); i++) {
+            if (!Character.isWhitespace(s.charAt(i))) {
                 sb.append(s.charAt(i));
             }
         }
         return sb.toString();
     }
 
-    private static Object coerceType(Object lhs, String rhsString) throws Exception
-    {
+    private static Object coerceType(Object lhs, String rhsString) throws Exception {
         // If the LHS expects a string, then we can just return
         // the RHS since it is a string.
-        if (lhs.getClass() == rhsString.getClass())
-        {
+        if (lhs.getClass() == rhsString.getClass()) {
             return rhsString;
         }
 
         // Try to convert the RHS type to the LHS type by using
         // the string constructor of the LHS class, if it has one.
-        Object rhs = null;
-        try
-        {
+        Object rhs;
+        try {
             // The Character class is a special case, since its constructor
             // does not take a string, so handle it separately.
-            if (lhs instanceof Character)
-            {
-                rhs = new Character(rhsString.charAt(0));
-            }
-            else
-            {
+            if (lhs instanceof Character) {
+                rhs = rhsString.charAt(0);
+            } else {
                 // Spec says we should trim number types.
-                if ((lhs instanceof Number) || (lhs instanceof Boolean))
-                {
+                if ((lhs instanceof Number) || (lhs instanceof Boolean)) {
                     rhsString = rhsString.trim();
                 }
                 Constructor ctor = lhs.getClass().getConstructor(STRING_CLASS);
                 ctor.setAccessible(true);
-                rhs = ctor.newInstance(new Object[] { rhsString });
+                rhs = ctor.newInstance(rhsString);
             }
-        }
-        catch (Exception ex)
-        {
+        } catch (Exception ex) {
             throw new Exception(
-                "Could not instantiate class "
-                    + lhs.getClass().getName()
-                    + " from string constructor with argument '"
-                    + rhsString + "' because " + ex);
+                    "Could not instantiate class "
+                            + lhs.getClass().getName()
+                            + " from string constructor with argument '"
+                            + rhsString + "' because " + ex
+            );
         }
 
         return rhs;
@@ -596,15 +448,14 @@ public void dump()
      * to an array of primitive wrapper objects. This method simplifies
      * processing LDAP filters since the special case of primitive arrays
      * can be ignored.
+     *
      * @param array An array of primitive types.
      * @return An corresponding array using pritive wrapper objects.
-    **/
-    private static List convertArrayToList(Object array)
-    {
+     */
+    private static List<Object> convertArrayToList(Object array) {
         int len = Array.getLength(array);
-        List list = new ArrayList(len);
-        for (int i = 0; i < len; i++)
-        {
+        List<Object> list = new ArrayList<>(len);
+        for (int i = 0; i < len; i++) {
             list.add(Array.get(array, i));
         }
         return list;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/FeatureResource.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/FeatureResource.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/FeatureResource.java
index 707a213..15cfcc1 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/FeatureResource.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/FeatureResource.java
@@ -33,11 +33,16 @@ import static org.apache.karaf.features.internal.resolver.ResourceUtils.TYPE_FEA
 import static org.apache.karaf.features.internal.resolver.ResourceUtils.addIdentityRequirement;
 
 /**
-*/
-public class FeatureResource extends ResourceImpl {
+ */
+public final class FeatureResource extends ResourceImpl {
 
     private final Feature feature;
 
+    private FeatureResource(Feature feature) {
+        super(feature.getName(), TYPE_FEATURE, VersionTable.getVersion(feature.getVersion()));
+        this.feature = feature;
+    }
+
     public static FeatureResource build(Feature feature, Conditional conditional, String featureRange, Map<String, ? extends Resource> locToRes) throws BundleException {
         Feature fcond = conditional.asFeature(feature.getName(), feature.getVersion());
         FeatureResource resource = build(fcond, featureRange, locToRes);
@@ -97,11 +102,6 @@ public class FeatureResource extends ResourceImpl {
         addIdentityRequirement(resource, name, TYPE_FEATURE, version);
     }
 
-    public FeatureResource(Feature feature) {
-        super(feature.getName(), TYPE_FEATURE, VersionTable.getVersion(feature.getVersion()));
-        this.feature = feature;
-    }
-
     public Feature getFeature() {
         return feature;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/RequirementImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/RequirementImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/RequirementImpl.java
index a4ef775..f03fbb3 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/RequirementImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/RequirementImpl.java
@@ -24,23 +24,24 @@ import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
 
 public class RequirementImpl extends BaseClause implements Requirement {
-    private final Resource m_resource;
-    private final String m_namespace;
-    private final SimpleFilter m_filter;
-    private final boolean m_optional;
-    private final Map<String, String> m_dirs;
-    private final Map<String, Object> m_attrs;
+
+    private final Resource resource;
+    private final String namespace;
+    private final SimpleFilter filter;
+    private final boolean optional;
+    private final Map<String, String> dirs;
+    private final Map<String, Object> attrs;
 
     public RequirementImpl(
             Resource resource, String namespace,
             Map<String, String> dirs, Map<String, Object> attrs, SimpleFilter filter) {
-        m_resource = resource;
-        m_namespace = namespace;
-        m_dirs = dirs;
-        m_attrs = attrs;
-        m_filter = filter;
+        this.resource = resource;
+        this.namespace = namespace;
+        this.dirs = dirs;
+        this.attrs = attrs;
+        this.filter = filter;
         // Find resolution import directives.
-        m_optional = Constants.RESOLUTION_OPTIONAL.equals(m_dirs.get(Constants.RESOLUTION_DIRECTIVE));
+        optional = Constants.RESOLUTION_OPTIONAL.equals(this.dirs.get(Constants.RESOLUTION_DIRECTIVE));
     }
 
     public RequirementImpl(
@@ -50,19 +51,19 @@ public class RequirementImpl extends BaseClause implements Requirement {
     }
 
     public String getNamespace() {
-        return m_namespace;
+        return namespace;
     }
 
     public Map<String, String> getDirectives() {
-        return m_dirs;
+        return dirs;
     }
 
     public Map<String, Object> getAttributes() {
-        return m_attrs;
+        return attrs;
     }
 
     public Resource getResource() {
-        return m_resource;
+        return resource;
     }
 
     public boolean matches(Capability cap) {
@@ -70,11 +71,11 @@ public class RequirementImpl extends BaseClause implements Requirement {
     }
 
     public boolean isOptional() {
-        return m_optional;
+        return optional;
     }
 
     public SimpleFilter getFilter() {
-        return m_filter;
+        return filter;
     }
 
 }