[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14948222#comment-14948222
 ] 

ASF GitHub Bot commented on KARAF-3262:
---

Github user asfgit closed the pull request at:

https://github.com/apache/karaf/pull/83


> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.2
>
>
> The  element in a feature accepts a finalname attribute to 
> define where the configfile has to be copied.
> However, finalname is relative to ${karaf.base}, whereas it should be able to 
> use ${karaf.etc} (and so relative to ${karaf.etc}).
> In order to be backward compatible, if finalname starts with /etc/ it will be 
> relative to ${karaf.base}, else it will be related to ${karaf.etc}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14948223#comment-14948223
 ] 

Jean-Baptiste Onofré commented on KARAF-3262:
-

I'm also updating the documentation according to that.

> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.2
>
>
> The  element in a feature accepts a finalname attribute to 
> define where the configfile has to be copied.
> However, finalname is relative to ${karaf.base}, whereas it should be able to 
> use ${karaf.etc} (and so relative to ${karaf.etc}).
> In order to be backward compatible, if finalname starts with /etc/ it will be 
> relative to ${karaf.base}, else it will be related to ${karaf.etc}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14948788#comment-14948788
 ] 

ASF GitHub Bot commented on KARAF-3262:
---

GitHub user maggu2810 opened a pull request:

https://github.com/apache/karaf/pull/85

[KARAF-3262] do not use @ as a delimiter

The current filtering of the feature XML is using ${*} and @ as a
delimiter. If you are using a single @ (e.g. an email address in the
license) in your XML the processing of the XML is done incorrectly.

Signed-off-by: Markus Rathgeb 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/maggu2810/karaf kbp-feature-at

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/karaf/pull/85.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #85


commit dc42dfd2dc3042e10c5ab478d7b2267da14b10c1
Author: Markus Rathgeb 
Date:   2015-10-08T14:47:35Z

[KARAF-3262] do not use @ as a delimiter

The current filtering of the feature XML is using ${*} and @ as a
delimiter. If you are using a single @ (e.g. an email address in the
license) in your XML the processing of the XML is done incorrectly.

Signed-off-by: Markus Rathgeb 




> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.2
>
>
> The  element in a feature accepts a finalname attribute to 
> define where the configfile has to be copied.
> However, finalname is relative to ${karaf.base}, whereas it should be able to 
> use ${karaf.etc} (and so relative to ${karaf.etc}).
> In order to be backward compatible, if finalname starts with /etc/ it will be 
> relative to ${karaf.base}, else it will be related to ${karaf.etc}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14944757#comment-14944757
 ] 

ASF GitHub Bot commented on KARAF-3262:
---

GitHub user maggu2810 opened a pull request:

https://github.com/apache/karaf/pull/83

[KARAF-3262] feature configfile: substitution

Add variable substitution to the configfile finalname of a feature.

Old situation:
* All ${...} are removed from the config file name and not used.
* The given path is prefixed with / relative to ${karaf.base} on
  installation

New behaviour:
* If the final name starts not with "${", the path is prefixed with /
  relative to karaf.base.
* All ${...} are substituted.
* If the substituted string starts with an variable (the first one
* has
  been unknown), it is prefixed with / relative to karaf.base.
* All unknown variables are removed from the resulting final name.

Signed-off-by: Markus Rathgeb 

Here some testing:
```java
public static void main(String[] args) {
System.setProperty("karaf.base", "/tmp/karaf.base");
System.setProperty("foo1", "/foo1");

final String[] finalNames = {
"etc/test.cfg",
"/etc/test.cfg",
"${karaf.base}/etc/test.cfg",
"etc/${foo1}/test.cfg",
"${foo1}/test.cfg",
"etc${foo2}/${foo2}test.cfg",
"${foo2}/etc/test.cfg${foo2}",
"${karaf.base}${foo2}/etc/test.cfg",
"etc${}/${foo1}/test.cfg",
"${foo1}/test.cfg",
};

for (final String finalName : finalNames) {
System.out.println(finalName + " => " + substFinalName(finalName));
}
}
```

Result (the exception is catched, kept logging):
```java
etc/test.cfg => /tmp/karaf.base/etc/test.cfg
/etc/test.cfg => /tmp/karaf.base//etc/test.cfg
${karaf.base}/etc/test.cfg => /tmp/karaf.base/etc/test.cfg
etc/${foo1}/test.cfg => /tmp/karaf.base/etc//foo1/test.cfg
${foo1}/test.cfg => /foo1/test.cfg
etc${foo2}/${foo2}test.cfg => /tmp/karaf.base/etc/test.cfg
${foo2}/etc/test.cfg${foo2} => /tmp/karaf.base//etc/test.cfg
${karaf.base}${foo2}/etc/test.cfg => /tmp/karaf.base/etc/test.cfg
etc${}/${foo1}/test.cfg => /tmp/karaf.base/etc//test.cfg
Oct 06, 2015 10:57:43 AM 
org.apache.karaf.features.internal.service.FeatureConfigInstaller substFinalName
WARNING: Skip substitution of variables of configuration final name 
(etc${}/${foo1}/test.cfg).
java.lang.IllegalArgumentException: recursive variable reference: 
at 
org.apache.felix.utils.properties.InterpolationHelper.doSubstVars(InterpolationHelper.java:319)
at 
org.apache.felix.utils.properties.InterpolationHelper.substVars(InterpolationHelper.java:235)
at 
org.apache.karaf.features.internal.service.FeatureConfigInstaller.substFinalName(FeatureConfigInstaller.java:180)
at 
org.apache.karaf.features.internal.service.FeatureConfigInstaller.main(FeatureConfigInstaller.java:157)

${foo1}/test.cfg => /foo1/test.cfg
```

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/maggu2810/karaf feature-config-path

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/karaf/pull/83.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #83


commit 032f3e75e99b4d1523b8aba20e08072b4d291cff
Author: Markus Rathgeb 
Date:   2015-10-05T14:56:19Z

[KARAF-3262] feature configfile: substitution

Add variable substitution to the configfile finalname of a feature.

Old situation:
* All ${...} are removed from the config file name and not used.
* The given path is prefixed with / relative to ${karaf.base} on
  installation

New behaviour:
* If the final name starts not with "${", the path is prefixed with /
  relative to karaf.base.
* All ${...} are substituted.
* If the substituted string starts with an variable (the first one
* has
  been unknown), it is prefixed with / relative to karaf.base.
* All unknown variables are removed from the resulting final name.

Signed-off-by: Markus Rathgeb 




> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré

[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-05 Thread Markus Rathgeb (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14943488#comment-14943488
 ] 

Markus Rathgeb commented on KARAF-3262:
---

Hi, could have a look at this change, please:
https://github.com/apache/karaf/compare/master...maggu2810:feature-config-path?expand=1

> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>
> The  element in a feature accepts a finalname attribute to 
> define where the configfile has to be copied.
> However, finalname is relative to ${karaf.base}, whereas it should be able to 
> use ${karaf.etc} (and so relative to ${karaf.etc}).
> In order to be backward compatible, if finalname starts with /etc/ it will be 
> relative to ${karaf.base}, else it will be related to ${karaf.etc}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (KARAF-3262) Being able to use ${karaf.etc} in feature element

2015-10-05 Thread JIRA

[ 
https://issues.apache.org/jira/browse/KARAF-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14943491#comment-14943491
 ] 

Jean-Baptiste Onofré commented on KARAF-3262:
-

Thanks, I gonna take a look.

> Being able to use ${karaf.etc} in feature  element
> ---
>
> Key: KARAF-3262
> URL: https://issues.apache.org/jira/browse/KARAF-3262
> Project: Karaf
>  Issue Type: Improvement
>  Components: karaf-feature
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>
> The  element in a feature accepts a finalname attribute to 
> define where the configfile has to be copied.
> However, finalname is relative to ${karaf.base}, whereas it should be able to 
> use ${karaf.etc} (and so relative to ${karaf.etc}).
> In order to be backward compatible, if finalname starts with /etc/ it will be 
> relative to ${karaf.base}, else it will be related to ${karaf.etc}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)