Created
April 13, 2011 15:16
-
-
Save anpieber/917722 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -> % git diff | |
| diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java | |
| index c8d74fc..2755fc2 100644 | |
| --- a/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java | |
| +++ b/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java | |
| @@ -458,7 +458,7 @@ public class FeaturesServiceImpl implements FeaturesService, FrameworkListener { | |
| Configuration cfg = findExistingConfiguration(configAdmin, pid[0], pid[1]); | |
| if (cfg == null) { | |
| cfg = createConfiguration(configAdmin, pid[0], pid[1]); | |
| - String key = (pid[1] == null ? pid[0] : pid[0] + "-" + pid[1]); | |
| + String key = createConfigurationKey(pid[0], pid[1]); | |
| props.put(CONFIG_KEY, key); | |
| if (cfg.getBundleLocation() != null) { | |
| cfg.setBundleLocation(null); | |
| @@ -478,6 +478,10 @@ public class FeaturesServiceImpl implements FeaturesService, FrameworkListener { | |
| state.features.put(feature, bundles); | |
| } | |
| + private String createConfigurationKey(String pid, String factoryPid) { | |
| + return factoryPid == null ? pid : pid + "-" + factoryPid; | |
| + } | |
| + | |
| protected List<BundleInfo> resolve(Feature feature) throws Exception { | |
| String resolver = feature.getResolver(); | |
| // If no resolver is specified, we expect a list of uris | |
| @@ -1018,19 +1022,16 @@ public class FeaturesServiceImpl implements FeaturesService, FrameworkListener { | |
| if (factoryPid == null) { | |
| filter = "(" + Constants.SERVICE_PID + "=" + pid + ")"; | |
| } else { | |
| - filter = "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + factoryPid + ")"; | |
| + String key = createConfigurationKey(pid, factoryPid); | |
| + filter = "(" + CONFIG_KEY + "=" + key + ")"; | |
| } | |
| Configuration[] configurations = configurationAdmin.listConfigurations(filter); | |
| - if (configurations != null && configurations.length > 0) | |
| - { | |
| + if (configurations != null && configurations.length > 0) { | |
| return configurations[0]; | |
| } | |
| - else | |
| - { | |
| - return null; | |
| - } | |
| + return null; | |
| } | |
| - | |
| + | |
| protected void saveState() { | |
| try { | |
| File file = bundleContext.getDataFile("FeaturesServiceState.properties"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment