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 2019/05/27 15:44:00 UTC
[karaf] branch master updated: [KARAF-6182] Add override attribute
on feature config
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/master by this push:
new fd89c89 [KARAF-6182] Add override attribute on feature config
new 8ac6ea4 Merge pull request #852 from jbonofre/KARAF-6182
fd89c89 is described below
commit fd89c8959ae17cdb4cb699ef192f9997cc567c6d
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Sat May 25 06:41:38 2019 +0200
[KARAF-6182] Add override attribute on feature config
---
.../src/main/feature/feature.xml | 2 +-
.../java/org/apache/karaf/features/ConfigInfo.java | 2 +
.../apache/karaf/features/FeaturesNamespaces.java | 8 +-
.../karaf/features/internal/model/Config.java | 22 ++
.../karaf/features/internal/model/JaxbUtil.java | 3 +
.../internal/service/FeatureConfigInstaller.java | 49 ++-
.../apache/karaf/features/karaf-features-1.6.0.xsd | 345 +++++++++++++++++++++
.../features/karaf-features-processing-1.0.0.xsd | 6 +-
.../karaf/features/internal/service/fp01.xml | 2 +-
.../karaf/features/internal/service/fp02.xml | 2 +-
.../karaf/features/internal/service/fp03.xml | 2 +-
.../karaf/features/internal/service/fp04.xml | 2 +-
.../karaf/features/internal/service/fpi04.xml | 2 +-
.../internal/service/org.apache.karaf.features.xml | 2 +-
.../apache/karaf/itests/OverrideConfigTest.java | 78 +++++
.../src/it/test-aggregate-features/control.xml | 2 +-
.../src/it/test-basic-generation/control.xml | 2 +-
.../it/test-check-dependencies-failure/control.xml | 2 +-
.../src/it/test-check-dependencies/control.xml | 2 +-
.../src/it/test-feature-dependencies/control.xml | 2 +-
.../it/test-feature-use-base-version/control.xml | 2 +-
.../control.xml | 2 +-
.../control.xml | 2 +-
.../it/test-feature-use-version-range/control.xml | 2 +-
.../it/test-include-project-artifact/control.xml | 2 +-
.../src/it/test-input-file/control.xml | 2 +-
.../src/it/test-rename-main-feature/control.xml | 2 +-
.../it/test-repository-dependencies/control.xml | 2 +-
.../src/it/test-simplify-bundles/control.xml | 2 +-
.../src/it/test-type-classifier/control.xml | 2 +-
30 files changed, 504 insertions(+), 53 deletions(-)
diff --git a/examples/karaf-soap-example/karaf-soap-example-features/src/main/feature/feature.xml b/examples/karaf-soap-example/karaf-soap-example-features/src/main/feature/feature.xml
index 9f1a74a..faf406b 100644
--- a/examples/karaf-soap-example/karaf-soap-example-features/src/main/feature/feature.xml
+++ b/examples/karaf-soap-example/karaf-soap-example-features/src/main/feature/feature.xml
@@ -16,7 +16,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<features name="karaf-soap-example-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.5.0">
+<features name="karaf-soap-example-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.5.0">
<repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</repository>
diff --git a/features/core/src/main/java/org/apache/karaf/features/ConfigInfo.java b/features/core/src/main/java/org/apache/karaf/features/ConfigInfo.java
index 76ea330..e53b59a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/ConfigInfo.java
+++ b/features/core/src/main/java/org/apache/karaf/features/ConfigInfo.java
@@ -28,6 +28,8 @@ public interface ConfigInfo {
boolean isAppend();
+ boolean isOverride();
+
boolean isExternal();
}
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 d4f584f..2957015 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
@@ -31,12 +31,13 @@ public interface FeaturesNamespaces {
String URI_1_3_0 = "http://karaf.apache.org/xmlns/features/v1.3.0";
String URI_1_4_0 = "http://karaf.apache.org/xmlns/features/v1.4.0";
String URI_1_5_0 = "http://karaf.apache.org/xmlns/features/v1.5.0";
+ String URI_1_6_0 = "http://karaf.apache.org/xmlns/features/v1.6.0";
- String URI_CURRENT = URI_1_5_0;
+ String URI_CURRENT = URI_1_6_0;
String[] SUPPORTED_URIS = {
URI_1_0_0, URI_1_1_0, URI_1_2_0, URI_1_2_1,
- URI_1_3_0, URI_1_4_0, URI_1_5_0
+ URI_1_3_0, URI_1_4_0, URI_1_5_0, URI_1_6_0
};
QName FEATURES_0_0_0 = new QName("features");
@@ -47,7 +48,8 @@ public interface FeaturesNamespaces {
QName FEATURES_1_3_0 = new QName(URI_1_3_0, "features");
QName FEATURES_1_4_0 = new QName(URI_1_4_0, "features");
QName FEATURES_1_5_0 = new QName(URI_1_5_0, "features");
+ QName FEATURES_1_6_0 = new QName(URI_1_6_0, "features");
- QName FEATURES_CURRENT = FEATURES_1_5_0;
+ QName FEATURES_CURRENT = FEATURES_1_6_0;
}
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 167de33..b9bdf7e 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
@@ -55,6 +55,8 @@ public class Config implements ConfigInfo {
private Boolean append = false;
@XmlAttribute
private Boolean external = false;
+ @XmlAttribute
+ private Boolean override = false;
/**
* Gets the value of the value property.
@@ -118,6 +120,26 @@ public class Config implements ConfigInfo {
this.external = external;
}
+ /**
+ * Gets the value of the override property.
+ *
+ * @return possible object is
+ * {@link Boolean }
+ */
+ public boolean isOverride() {
+ return override == null ? false : override;
+ }
+
+ /**
+ * Sets the value of the override property.
+ *
+ * @param value allowed object is
+ * {@link Boolean }
+ */
+ public void setOverride(Boolean value) {
+ this.override = value;
+ }
+
public Properties getProperties() {
Properties props = new Properties();
try {
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 09b939b..2a55380 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
@@ -166,6 +166,9 @@ public final class JaxbUtil {
case FeaturesNamespaces.URI_1_5_0:
schemaLocation = "/org/apache/karaf/features/karaf-features-1.5.0.xsd";
break;
+ case FeaturesNamespaces.URI_1_6_0:
+ schemaLocation = "/org/apache/karaf/features/karaf-features-1.6.0.xsd";
+ break;
default:
throw new IllegalArgumentException("Unsupported namespace: " + namespace);
}
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 e401a69..84c8a5d 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
@@ -109,29 +109,29 @@ public class FeatureConfigInstaller {
}
ConfigId cid = parsePid(config.getName());
Configuration cfg = findExistingConfiguration(configAdmin, cid);
- if (cfg == null) {
-
- File cfgFile = null;
- if (storage != null) {
- cfgFile = new File(storage, cid.fullPid + ".cfg");
- }
- if (!cfgFile.exists()) {
- Dictionary<String, Object> cfgProps = convertToDict(props);
- cfg = createConfiguration(configAdmin, cid.pid, cid.factoryPid);
- cfgProps.put(CONFIG_KEY, cid.fullPid);
- props.put(CONFIG_KEY, cid.fullPid);
- if (storage != null && configCfgStore) {
- cfgProps.put(FILEINSTALL_FILE_NAME, cfgFile.getAbsoluteFile().toURI().toString());
- }
- cfg.update(cfgProps);
- try {
- updateStorage(cid, props, false);
- } catch (Exception e) {
- LOGGER.warn("Can't update cfg file", e);
- }
- } else {
- LOGGER.info("Skipping configuration {} - file already exists", cfgFile);
- }
+ if (cfg == null || config.isOverride()) {
+
+ File cfgFile = null;
+ if (storage != null) {
+ cfgFile = new File(storage, cid.fullPid + ".cfg");
+ }
+ if (!cfgFile.exists() || config.isOverride()) {
+ Dictionary<String, Object> cfgProps = convertToDict(props);
+ cfg = createConfiguration(configAdmin, cid.pid, cid.factoryPid);
+ cfgProps.put(CONFIG_KEY, cid.fullPid);
+ props.put(CONFIG_KEY, cid.fullPid);
+ if (storage != null && configCfgStore) {
+ cfgProps.put(FILEINSTALL_FILE_NAME, cfgFile.getAbsoluteFile().toURI().toString());
+ }
+ cfg.update(cfgProps);
+ try {
+ updateStorage(cid, props, false);
+ } catch (Exception e) {
+ LOGGER.warn("Can't update cfg file", e);
+ }
+ } else {
+ LOGGER.info("Skipping configuration {} - file already exists", cfgFile);
+ }
} else if (config.isAppend()) {
boolean update = false;
Dictionary<String, Object> properties = cfg.getProperties();
@@ -321,8 +321,7 @@ public class FeatureConfigInstaller {
return cfgFile;
}
- private void updateExistingConfig(TypedProperties props, boolean append, File cfgFile)
- throws IOException {
+ private void updateExistingConfig(TypedProperties props, boolean append, File cfgFile) throws IOException {
TypedProperties properties = new TypedProperties();
properties.load(cfgFile);
for (String key : props.keySet()) {
diff --git a/features/core/src/main/resources/org/apache/karaf/features/karaf-features-1.6.0.xsd b/features/core/src/main/resources/org/apache/karaf/features/karaf-features-1.6.0.xsd
new file mode 100644
index 0000000..527071c
--- /dev/null
+++ b/features/core/src/main/resources/org/apache/karaf/features/karaf-features-1.6.0.xsd
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<xs:schema elementFormDefault="qualified"
+ targetNamespace="http://karaf.apache.org/xmlns/features/v1.6.0"
+ xmlns:tns="http://karaf.apache.org/xmlns/features/v1.6.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Karaf features mechanism. For documentation please visit the
+<a href="http://karaf.apache.org/">Karaf website</a>.
+ ]]></xs:documentation>
+ </xs:annotation>
+
+ <xs:complexType name="features">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Root element of Feature definition. It contains an required attribute for
+designating from which repository this feature should be loaded. The Karaf
+shell will show the repository name when displaying information about the feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="repository" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional feature repository where dependencies are stored.
+ ]]></xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="resource-repository" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional OSGi Resource Repository where OSGi resources are stored.
+ ]]></xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="feature" type="tns:feature">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Feature definition.
+ ]]></xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="feature">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Definition of the Feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="details" minOccurs="0" type="xs:string">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+ The help text shown for this feature when using feature:info console command.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="config" type="tns:config" />
+ <xs:element name="configfile" type="tns:configFile" />
+ <xs:element name="feature" type="tns:dependency" />
+ <xs:element name="bundle" type="tns:bundle" />
+ <xs:element name="conditional" type="tns:conditional" />
+ <xs:element name="requirement" type="tns:requirement" />
+ <xs:element name="capability" type="tns:capability" />
+ <xs:element name="library" type="tns:library" />
+ </xs:choice>
+ <xs:element name="scoping" minOccurs="0" maxOccurs="1" type="tns:scoping" />
+ </xs:sequence>
+ <xs:attribute name="name" type="tns:featureName" use="required" />
+ <xs:attribute name="version" type="xs:string" default="0.0.0" />
+ <xs:attribute name="description" type="xs:string" />
+ <xs:attribute name="install" type="tns:install">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Marks if the feature will be automatically started when thrown to the deploy folder.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="start-level" type="xs:int">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Set this attribute to have an OSGi start level for this feature different
+from the default start level defined in Karaf's config.properties.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="hidden" type="xs:boolean" default="false" />
+ </xs:complexType>
+
+ <xs:complexType name="conditional">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Definition of the Conditional.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="config" type="tns:config" />
+ <xs:element name="configfile" type="tns:configFile" />
+ <xs:element name="feature" type="tns:dependency" />
+ <xs:element name="bundle" type="tns:bundle" />
+ <xs:element name="condition" type="tns:dependency" minOccurs="0" maxOccurs="1" />
+ </xs:choice>
+ </xs:complexType>
+
+
+ <xs:complexType name="bundle">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Deployable element to install.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="start-level" type="xs:int">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Set this attribute to have an OSGi start level for this bundle different
+from the default start level defined in the Karaf's config.properties.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="start" type="xs:boolean" default="true">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+If false, leaves bundle in resolved state rather than the default active state.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="dependency" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Mark this bundle as a dependency for the resolver.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="dependency">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Dependency of feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="tns:featureName">
+ <xs:attribute name="version" type="xs:string" default="0.0.0" />
+ <xs:attribute name="prerequisite" type="xs:boolean" default="false"/>
+ <xs:attribute name="dependency" type="xs:boolean" default="false"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="config">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Configuration entries which should be created during feature installation. This
+configuration may be used with OSGi Configuration Admin. The element content is
+read in as a properties file.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="append" type="xs:boolean" use="optional">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Optional flag to append unknown values to the configuration.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="external" type="xs:boolean" use="optional">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Specifies that this configuration is external, i.e. the content of this element
+points to the URL where the configuration can be downloaded from.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="override" type="xs:boolean" use="optional">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Specifies that this configuration will override existing one.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="configFile">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional configuration files which should be created during feature installation.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="finalname" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+The final destination path and name for the configuration file.
+ ]]></xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="override" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+If the configFile already exists at the finalname location, whether or not to replace it.
+ ]]></xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="requirement">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional requirements of this feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="prerequisite" type="xs:boolean" default="false"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="capability">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional capability of this feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="library">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Additional capability of this feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="type" type="tns:libraryType" default="default"/>
+ <xs:attribute name="export" type="xs:boolean" default="false"/>
+ <xs:attribute name="delegate" type="xs:boolean" default="false"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="libraryType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="endorsed"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="boot"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="scoping">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Scoping definition for this feature.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="import" type="tns:scopeFilter"/>
+ <xs:element name="export" type="tns:scopeFilter"/>
+ </xs:choice>
+ <xs:attribute name="acceptDependencies" type="xs:boolean"/>
+ </xs:complexType>
+
+ <xs:complexType name="scopeFilter">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="namespace" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="featureName">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Feature name should be non empty string.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="install">
+ <xs:annotation>
+ <xs:documentation><![CDATA[
+Installation mode. Can be either manual or auto. Specifies whether the feature should be automatically installed when
+dropped inside the deploy folder. Note: This attribute doesn't affect feature descriptors that are installed from the
+command line or as part of the org.apache.karaf.features.cfg.
+ ]]></xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="features" type="tns:features" />
+
+</xs:schema>
diff --git a/features/core/src/main/resources/org/apache/karaf/features/karaf-features-processing-1.0.0.xsd b/features/core/src/main/resources/org/apache/karaf/features/karaf-features-processing-1.0.0.xsd
index f25fabe..fffd415 100644
--- a/features/core/src/main/resources/org/apache/karaf/features/karaf-features-processing-1.0.0.xsd
+++ b/features/core/src/main/resources/org/apache/karaf/features/karaf-features-processing-1.0.0.xsd
@@ -20,10 +20,10 @@
<xs:schema elementFormDefault="qualified"
targetNamespace="http://karaf.apache.org/xmlns/features-processing/v1.0.0"
xmlns:tns="http://karaf.apache.org/xmlns/features-processing/v1.0.0"
- xmlns:features="http://karaf.apache.org/xmlns/features/v1.5.0"
+ xmlns:features="http://karaf.apache.org/xmlns/features/v1.6.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:import namespace="http://karaf.apache.org/xmlns/features/v1.5.0" />
+ <xs:import namespace="http://karaf.apache.org/xmlns/features/v1.6.0" />
<xs:element name="featuresProcessing" type="tns:featuresProcessing" />
@@ -212,7 +212,7 @@ add/remove some items (usually bundles) to/from original feature.
<xs:complexType name="overrideFeature">
<xs:annotation>
<xs:documentation><![CDATA[Any feature may be "overriden" simply by including its changed definition
-according to http://karaf.apache.org/xmlns/features/v1.5.0 XML schema.
+according to http://karaf.apache.org/xmlns/features/v1.6.0 XML schema.
]]></xs:documentation>
</xs:annotation>
<xs:sequence>
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp01.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp01.xml
index 99407ac..3631d88 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp01.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp01.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<features name="fp01" xmlns="http://karaf.apache.org/xmlns/features/v1.5.0">
+<features name="fp01" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0">
<repository>mvn:org.hibernate/hibernate-validator-osgi-karaf-features/4.1/xml/features</repository>
<repository>mvn:org.hibernate/hibernate-validator-osgi-karaf-features/5.2/xml/features</repository>
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp02.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp02.xml
index 94d01cf..b28e2e7 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp02.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp02.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<features name="fp02" xmlns="http://karaf.apache.org/xmlns/features/v1.5.0">
+<features name="fp02" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0">
<feature name="f1" />
<feature name="f2a" version="42" />
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp03.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp03.xml
index ad621e3..6b76551 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp03.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp03.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<features name="fp02" xmlns="http://karaf.apache.org/xmlns/features/v1.5.0">
+<features name="fp02" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0">
<feature name="f5" version="4.2">
<bundle>mvn:commons-io/commons-io/1.2</bundle>
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp04.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp04.xml
index ec545e8..4f73211 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp04.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fp04.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<features name="fp04" xmlns="http://karaf.apache.org/xmlns/features/v1.5.0">
+<features name="fp04" xmlns="http://karaf.apache.org/xmlns/features/v1.6.0">
<feature name="f1" version="1.0">
<bundle dependency="false">mvn:commons-io/commons-io/1.2</bundle>
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fpi04.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fpi04.xml
index f0c7abe..b1c1d05 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/fpi04.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/fpi04.xml
@@ -18,7 +18,7 @@
under the License.
-->
<featuresProcessing xmlns="http://karaf.apache.org/xmlns/features-processing/v1.0.0"
- xmlns:f="http://karaf.apache.org/xmlns/features/v1.5.0">
+ xmlns:f="http://karaf.apache.org/xmlns/features/v1.6.0">
<featureReplacements>
<replacement mode="replace">
diff --git a/features/core/src/test/resources/org/apache/karaf/features/internal/service/org.apache.karaf.features.xml b/features/core/src/test/resources/org/apache/karaf/features/internal/service/org.apache.karaf.features.xml
index 3691319..4b6f2ec 100644
--- a/features/core/src/test/resources/org/apache/karaf/features/internal/service/org.apache.karaf.features.xml
+++ b/features/core/src/test/resources/org/apache/karaf/features/internal/service/org.apache.karaf.features.xml
@@ -18,7 +18,7 @@
under the License.
-->
<featuresProcessing xmlns="http://karaf.apache.org/xmlns/features-processing/v1.0.0"
- xmlns:f="http://karaf.apache.org/xmlns/features/v1.5.0">
+ xmlns:f="http://karaf.apache.org/xmlns/features/v1.6.0">
<!--
org.apache.karaf.features.internal.service.RepositoryCache will refuse to add/track a repository URI if it's blacklisted,
diff --git a/itests/test/src/test/java/org/apache/karaf/itests/OverrideConfigTest.java b/itests/test/src/test/java/org/apache/karaf/itests/OverrideConfigTest.java
new file mode 100644
index 0000000..6dc6980
--- /dev/null
+++ b/itests/test/src/test/java/org/apache/karaf/itests/OverrideConfigTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.itests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.service.cm.Configuration;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import static java.nio.file.StandardOpenOption.*;
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class OverrideConfigTest extends KarafTestSupport {
+
+ @Test
+ public void testOverrideConfig() throws Exception {
+ Path dir = Paths.get(System.getProperty("karaf.base"), "system/org/foo/bar/1.0-SNAPSHOT");
+ Files.createDirectories(dir);
+
+ writeTo(dir.resolve("bar-1.0-SNAPSHOT-features.xml"), //
+ "<features name='org.foo'>\n" +
+ " <feature name='bar' version='1.0-SNAPSHOT'>\n" +
+ " <config name='org.foo' override='true'>\n" +
+ " foo=bar" +
+ " </config>\n" +
+ " </feature>\n" +
+ "</features>\n");
+
+ Configuration configuration = configurationAdmin.getConfiguration("org.foo");
+ Dictionary<String, Object> props = new Hashtable<>();
+ props.put("foo", "test");
+ configuration.update(props);
+
+ Configuration[] cfgs = configurationAdmin.listConfigurations("(service.pid=org.foo)");
+ assertNotNull(cfgs);
+ assertEquals(1, cfgs.length);
+ assertEquals("test", cfgs[0].getProperties().get("foo"));
+
+ featureService.addRepository(URI.create("mvn:org.foo/bar/1.0-SNAPSHOT/xml/features"), true);
+
+ cfgs = configurationAdmin.listConfigurations("(service.pid=org.foo)");
+ assertNotNull(cfgs);
+ assertEquals(1, cfgs.length);
+ assertEquals("bar", cfgs[0].getProperties().get("foo"));
+ }
+
+ private void writeTo(Path file, String content) throws IOException {
+ try (BufferedWriter w = Files.newBufferedWriter(file, CREATE, TRUNCATE_EXISTING, WRITE)) {
+ w.write(content);
+ }
+ }
+
+}
diff --git a/tooling/karaf-maven-plugin/src/it/test-aggregate-features/control.xml b/tooling/karaf-maven-plugin/src/it/test-aggregate-features/control.xml
index 1508054..ee56e74 100644
--- a/tooling/karaf-maven-plugin/src/it/test-aggregate-features/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-aggregate-features/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="aggregate-features">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="aggregate-features">
<feature description="aggregate-recursive-module-c" version="1.0.0.SNAPSHOT" name="aggregate-recursive-module-c">
<details>Test Description</details>
<bundle>mvn:test/aggregate-recursive-module-b/1.0-SNAPSHOT</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-basic-generation/control.xml b/tooling/karaf-maven-plugin/src/it/test-basic-generation/control.xml
index b0cecdb..d7e36ed 100644
--- a/tooling/karaf-maven-plugin/src/it/test-basic-generation/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-basic-generation/control.xml
@@ -18,4 +18,4 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-basic-generation"/>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-basic-generation"/>
diff --git a/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml b/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml
index d4b982b..ea0ab4b 100644
--- a/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-check-dependencies-failure/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="check-dependencies-features">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="check-dependencies-features">
<feature description="dependency-module-c" version="1.0.0.SNAPSHOT" name="dependency-module-c">
<bundle>mvn:test/dependency-module-a/1.0-SNAPSHOT</bundle>
<bundle>mvn:test/dependency-module-b/1.0-SNAPSHOT</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-check-dependencies/control.xml b/tooling/karaf-maven-plugin/src/it/test-check-dependencies/control.xml
index d4b982b..ea0ab4b 100644
--- a/tooling/karaf-maven-plugin/src/it/test-check-dependencies/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-check-dependencies/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="check-dependencies-features">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="check-dependencies-features">
<feature description="dependency-module-c" version="1.0.0.SNAPSHOT" name="dependency-module-c">
<bundle>mvn:test/dependency-module-a/1.0-SNAPSHOT</bundle>
<bundle>mvn:test/dependency-module-b/1.0-SNAPSHOT</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml b/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml
index e859c84..5b27d1e 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-dependencies/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="dependencies-features">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="dependencies-features">
<feature name="dependency-feature-a" description="dependency-feature-a" version="1.0.0.SNAPSHOT">
<feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">dependency-feature-c</feature>
<bundle>mvn:test/dependency-bundle-a/1.0-SNAPSHOT</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml b/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml
index 8e357ed..031d228 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-base-version/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-feature-use-base-version">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-feature-use-base-version">
<feature name="test-feature-use-base-version" description="test-feature-use-base-version" version="1.0.0.SNAPSHOT">
<bundle>mvn:org.apache.commons/commons-lang3/3.4</bundle>
</feature>
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml
index 14a253c..a49d760 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transfer-properties/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="feature">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="feature">
<feature name="feature" description="feature" version="1.0.0.SNAPSHOT">
<bundle>mvn:test/transitive/[0.9,1.9)</bundle>
<bundle>mvn:org.apache.commons/commons-lang3/[3.0,3.4)</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml
index 14a253c..a49d760 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range-transitive/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="feature">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="feature">
<feature name="feature" description="feature" version="1.0.0.SNAPSHOT">
<bundle>mvn:test/transitive/[0.9,1.9)</bundle>
<bundle>mvn:org.apache.commons/commons-lang3/[3.0,3.4)</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml
index a3594a5..606eb10 100644
--- a/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-feature-use-version-range/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-feature-use-version-range">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-feature-use-version-range">
<feature name="test-feature-use-version-range" description="test-feature-use-version-range" version="1.0.0.SNAPSHOT">
<bundle>mvn:org.apache.commons/commons-lang3/[3.0,3.4)</bundle>
</feature>
diff --git a/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml b/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml
index fe1b017..8ad5956 100644
--- a/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-include-project-artifact/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-include-project-artifact">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-include-project-artifact">
<feature name="test-include-project-artifact" description="test-include-project-artifact" version="1.0.0.SNAPSHOT">
<bundle>mvn:test/test-include-project-artifact/1.0-SNAPSHOT</bundle>
</feature>
diff --git a/tooling/karaf-maven-plugin/src/it/test-input-file/control.xml b/tooling/karaf-maven-plugin/src/it/test-input-file/control.xml
index 7ec72f0..e6b1e78 100644
--- a/tooling/karaf-maven-plugin/src/it/test-input-file/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-input-file/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-input-file">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-input-file">
<feature description="Test Description" version="1.0.0.SNAPSHOT" name="test-input-file">
<details>Test Description</details>
<bundle>mvn:test/test-input-file/1.0-SNAPSHOT</bundle>
diff --git a/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml b/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml
index 46d0824..920bb83 100644
--- a/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-rename-main-feature/control.xml
@@ -19,7 +19,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-rename-project-artifact">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-rename-project-artifact">
<feature name="test-feature" description="test-rename-project-artifact" version="1.0.0.SNAPSHOT">
<bundle>mvn:test/test-rename-project-artifact/1.0-SNAPSHOT</bundle>
</feature>
diff --git a/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml b/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml
index 276b97d..67eebbe 100644
--- a/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-repository-dependencies/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="dependency-feature-a">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="dependency-feature-a">
<repository>mvn:test/dependency-feature-b/1.0-SNAPSHOT/xml/features</repository>
<feature name="dependency-feature-a" description="dependency-feature-a" version="1.0.0.SNAPSHOT">
<feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">dependency-feature-b</feature>
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
index 20c6ee2..24058b7 100644
--- a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="simplify-features">
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="simplify-features">
<repository>mvn:test/simplify-feature-a/1.0-SNAPSHOT/xml/features</repository>
<feature name="simplify-feature-as-is" description="simplify-feature-as-is" version="1.0.0.SNAPSHOT">
<details>Check that bundles are simplified</details>
diff --git a/tooling/karaf-maven-plugin/src/it/test-type-classifier/control.xml b/tooling/karaf-maven-plugin/src/it/test-type-classifier/control.xml
index 3a7371c..44f4e99 100644
--- a/tooling/karaf-maven-plugin/src/it/test-type-classifier/control.xml
+++ b/tooling/karaf-maven-plugin/src/it/test-type-classifier/control.xml
@@ -18,4 +18,4 @@
~ under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="test-type-classifier"/>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="test-type-classifier"/>