[ 
https://issues.apache.org/jira/browse/SLING-2477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13580876#comment-13580876
 ] 

Ian Boston commented on SLING-2477:
-----------------------------------

Picking this up and parsing String property values to check if they are 
formatted as OSGi property files. Below is a set of test patterns in the form 
test, typeprefix, extracted value, valid typeprefix, java object value.

One thing that jumps out is that any configuration that matches the pattern 
/^([TIiLlFfDdSsXxCcBb])"(.*)"/ will get converted, which may impact Sling users.

I assume that this is a small price to pay ? (and unlikely to cause problems). 
WDYT?

  private static final Object[][] MATCH_PATTERNS_CONVERTER = {
        { "T\"testing\"","T","testing",true,"testing" },
        { "I\"101\"","I", "101",true, new Integer(101) },
        { "i\"101\"","i","101", true, (int) 101 },
        { "L\"1010\"","L","1010", true, new Long(1010) },
        { "l\"1010\"","l","1010", true, 1010L },
        { "F\"101.01\"","F","101.01", true, new Float(101.01) },
        { "f\"101.01\"","f","101.01", true, 101.01F },
        { "D\"101.02\"","D","101.02", true, new Double(101.02) },
        { "d\"101.03\"","d","101.03", true, 101.03D },
        { "X\"0x34\"","X","0x34", true, new Byte((byte)0x34) },
        { "x\"0x35\"","x","0x35", true, (byte)0x35 },
        { "S\"34\"","S","34", true, new Short((short) 34) },
        { "s\"35\"","s","35", true, (short)35 },
        { "C\"a\"","C","a", true, new Character('a') },
        { "c\"b\"","c","b", true, 'b'},        
        { "B\"true\"","B","true", true, new Boolean(true) },
        { "b\"false\"","b","false", true, false },
    };


                
> Configuration via sling:OsgiConfig nodes does not support all types
> -------------------------------------------------------------------
>
>                 Key: SLING-2477
>                 URL: https://issues.apache.org/jira/browse/SLING-2477
>             Project: Sling
>          Issue Type: Bug
>          Components: Installer
>    Affects Versions: JCR Installer 3.1.2
>            Reporter: Alexander Klimetschek
>
> Most notably, the common "service.ranking" needs to be an Integer, while the 
> jcr property mapping only allows for "Long" types at the moment. The problem 
> is that JCR has a smaller set of property types than the OSGi config admin 
> (JCR: String, Boolean, Long, Double, Decimal; OSGi: String, Boolean, Long, 
> Integer, Float, Double, and probably more differences...).
> Similarly to properties files (which do it in the value like 
> 'service.ranking=I"-10000"' with I=Integer), there must be a way to 
> explicitly specify the type regardless of the JCR type. For example, encoding 
> it in the property name like "service.ranking{int}".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to