You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/04/13 13:51:14 UTC
[1/2] karaf git commit: [KARAF-4489] Introduce configCfgStore
property in etc/org.apache.karaf.features.cfg to define if the features
service automatically creates cfg file for element
Repository: karaf
Updated Branches:
refs/heads/karaf-4.0.x ec18716e2 -> 3f6ddbbb1
[KARAF-4489] Introduce configCfgStore property in etc/org.apache.karaf.features.cfg to define if the features service automatically creates cfg file for <config/> element
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/0357766e
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/0357766e
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/0357766e
Branch: refs/heads/karaf-4.0.x
Commit: 0357766e78da336c2f9d47286638c93405e60b44
Parents: 700b4b4
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Apr 13 13:49:52 2016 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Apr 13 13:49:52 2016 +0200
----------------------------------------------------------------------
.../resources/etc/org.apache.karaf.features.cfg | 5 ++
.../apache/karaf/features/FeaturesService.java | 1 +
.../karaf/features/internal/osgi/Activator.java | 4 +-
.../service/FeatureConfigInstaller.java | 10 +++-
.../internal/service/FeaturesServiceImpl.java | 48 +++++++++++++++++++-
5 files changed, 64 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/0357766e/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
----------------------------------------------------------------------
diff --git a/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg b/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
index 77e7a3b..57b92b4 100644
--- a/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
+++ b/assemblies/features/base/src/main/filtered-resources/resources/etc/org.apache.karaf.features.cfg
@@ -57,3 +57,8 @@ featuresBootAsynchronous=false
# - enforce: service requirements are always verified
#
#serviceRequirements=default
+
+#
+# Store cfg file for config element in feature
+#
+#configCfgStore=true
http://git-wip-us.apache.org/repos/asf/karaf/blob/0357766e/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 a9aab6b..f16eec1 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
@@ -47,6 +47,7 @@ public interface FeaturesService {
int DEFAULT_SCHEDULE_MAX_RUN = 9;
long DEFAULT_REPOSITORY_EXPIRATION = 60000; // 1 minute
+ boolean DEFAULT_CONFIG_CFG_STORE = true;
enum Option {
NoFailOnFeatureNotFound,
http://git-wip-us.apache.org/repos/asf/karaf/blob/0357766e/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 b38c33f..ea5e783 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
@@ -180,6 +180,7 @@ public class Activator extends BaseActivator {
int scheduleMaxRun = getInt("scheduleMaxRun", FeaturesService.DEFAULT_SCHEDULE_MAX_RUN);
String blacklisted = getString("blacklisted", new File(System.getProperty("karaf.etc"), "blacklisted.properties").toURI().toString());
String serviceRequirements = getString("serviceRequirements", FeaturesService.SERVICE_REQUIREMENTS_DEFAULT);
+ boolean configCfgStore = getBoolean("configCfgStore", FeaturesService.DEFAULT_CONFIG_CFG_STORE);
StateStorage stateStorage = new StateStorage() {
@Override
protected InputStream getInputStream() throws IOException {
@@ -221,7 +222,8 @@ public class Activator extends BaseActivator {
downloadThreads,
scheduleDelay,
scheduleMaxRun,
- blacklisted);
+ blacklisted,
+ configCfgStore);
register(FeaturesService.class, featuresService);
featuresListenerTracker = new ServiceTracker<>(
http://git-wip-us.apache.org/repos/asf/karaf/blob/0357766e/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 1e19cb8..467cb70 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
@@ -50,10 +50,18 @@ public class FeatureConfigInstaller {
private final ConfigurationAdmin configAdmin;
private File storage;
+ private boolean configCfgStore;
public FeatureConfigInstaller(ConfigurationAdmin configAdmin) {
this.configAdmin = configAdmin;
this.storage = new File(System.getProperty("karaf.etc"));
+ this.configCfgStore = FeaturesServiceImpl.DEFAULT_CONFIG_CFG_STORE;
+ }
+
+ public FeatureConfigInstaller(ConfigurationAdmin configAdmin, boolean configCfgStore) {
+ this.configAdmin = configAdmin;
+ this.storage = new File(System.getProperty("karaf.etc"));
+ this.configCfgStore = configCfgStore;
}
private String[] parsePid(String pid) {
@@ -239,7 +247,7 @@ public class FeatureConfigInstaller {
}
protected void updateStorage(String pid, String factoryPid, Dictionary props) throws Exception {
- if (storage != null) {
+ if (storage != null && configCfgStore) {
// get the cfg file
File cfgFile;
if (factoryPid != null) {
http://git-wip-us.apache.org/repos/asf/karaf/blob/0357766e/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 e5bb14e..4acddb9 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
@@ -165,6 +165,8 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
private final String blacklisted;
+ private final boolean configCfgStore;
+
private final ThreadLocal<String> outputFile = new ThreadLocal<>();
/**
@@ -180,7 +182,6 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
private final Map<String, Repository> repositoryCache = new HashMap<>();
private Map<String, Map<String, Feature>> featureCache;
-
public FeaturesServiceImpl(Bundle bundle,
BundleContext systemBundleContext,
StateStorage storage,
@@ -206,7 +207,7 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
this.eventAdminListener = eventAdminListener;
this.configurationAdmin = configurationAdmin;
this.resolver = resolver;
- this.configInstaller = configurationAdmin != null ? new FeatureConfigInstaller(configurationAdmin) : null;
+ this.configInstaller = configurationAdmin != null ? new FeatureConfigInstaller(configurationAdmin, FeaturesService.DEFAULT_CONFIG_CFG_STORE) : null;
this.digraph = digraph;
this.overrides = overrides;
this.featureResolutionRange = featureResolutionRange;
@@ -218,9 +219,52 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
this.scheduleDelay = scheduleDelay;
this.scheduleMaxRun = scheduleMaxRun;
this.blacklisted = blacklisted;
+ this.configCfgStore = FeaturesService.DEFAULT_CONFIG_CFG_STORE;
loadState();
checkResolve();
+ }
+ public FeaturesServiceImpl(Bundle bundle,
+ BundleContext systemBundleContext,
+ StateStorage storage,
+ FeatureFinder featureFinder,
+ EventAdminListener eventAdminListener,
+ ConfigurationAdmin configurationAdmin,
+ Resolver resolver,
+ RegionDigraph digraph,
+ String overrides,
+ String featureResolutionRange,
+ String bundleUpdateRange,
+ String updateSnaphots,
+ String serviceRequirements,
+ org.osgi.service.repository.Repository globalRepository,
+ int downloadThreads,
+ long scheduleDelay,
+ int scheduleMaxRun,
+ String blacklisted,
+ boolean configCfgStore) {
+ this.bundle = bundle;
+ this.systemBundleContext = systemBundleContext;
+ this.storage = storage;
+ this.featureFinder = featureFinder;
+ this.eventAdminListener = eventAdminListener;
+ this.configurationAdmin = configurationAdmin;
+ this.resolver = resolver;
+ this.configInstaller = configurationAdmin != null ? new FeatureConfigInstaller(configurationAdmin, configCfgStore) : null;
+ this.digraph = digraph;
+ this.overrides = overrides;
+ this.featureResolutionRange = featureResolutionRange;
+ this.bundleUpdateRange = bundleUpdateRange;
+ this.updateSnaphots = updateSnaphots;
+ this.serviceRequirements = serviceRequirements;
+ this.globalRepository = globalRepository;
+ this.downloadThreads = downloadThreads > 0 ? downloadThreads : 1;
+ this.scheduleDelay = scheduleDelay;
+ this.scheduleMaxRun = scheduleMaxRun;
+ this.blacklisted = blacklisted;
+ this.configCfgStore = configCfgStore;
+ loadState();
+ checkResolve();
}
@SuppressWarnings("unchecked")
[2/2] karaf git commit: Merge branch 'karaf-4.0.x' of
https://git-wip-us.apache.org/repos/asf/karaf into karaf-4.0.x
Posted by jb...@apache.org.
Merge branch 'karaf-4.0.x' of https://git-wip-us.apache.org/repos/asf/karaf into karaf-4.0.x
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3f6ddbbb
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3f6ddbbb
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3f6ddbbb
Branch: refs/heads/karaf-4.0.x
Commit: 3f6ddbbb18d3fb1025fdfc3b67f773bd1e9af8fe
Parents: 0357766 ec18716
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Apr 13 13:51:05 2016 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Apr 13 13:51:05 2016 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------