You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2018/06/28 08:33:43 UTC

[sling-site] branch master updated: improve documentation of .config files containing flout/double values

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git


The following commit(s) were added to refs/heads/master by this push:
     new 37fa989  improve documentation of .config files containing flout/double values
37fa989 is described below

commit 37fa989c4c6a9bdb8afd3309837c29822aee13a8
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Jun 28 10:33:26 2018 +0200

    improve documentation of .config files containing flout/double values
---
 .../bundles/configuration-installer-factory.md     | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/main/jbake/content/documentation/bundles/configuration-installer-factory.md b/src/main/jbake/content/documentation/bundles/configuration-installer-factory.md
index 51275f6..89ac103 100644
--- a/src/main/jbake/content/documentation/bundles/configuration-installer-factory.md
+++ b/src/main/jbake/content/documentation/bundles/configuration-installer-factory.md
@@ -26,11 +26,13 @@ When a Managed Service Factory is used, the situation is different. The `<pid>`
     // creates an instance for com.acme.abc
 
 
-If a configuration is modified, the file installer will write the configuration back to a file to ensure peristence across restarts (if `sling.fileinstall.writeback` is enabled).
+If a configuration is modified, the file installer will write the configuration back to a file to ensure persistence across restarts (if `sling.fileinstall.writeback` is enabled). A similar writeback mechanism is supported by the [JCR installer](jcr-installer-provider.html).
+
+The code for parsing the configuration files is in [InternalResource#readDictionary](https://github.com/apache/sling-org-apache-sling-installer-core/blob/0a34e33dd26092437be5180e34979abbf9a88300/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java#L221).
 
 ### Property Files (.cfg)
 
-Configuration files ending in '.cfg' are plain property files (`java.util.Property`). The format is simple:
+Configuration files ending in `.cfg` are plain property files (`java.util.Property`). The format is simple:
  	 
 
     file ::= ( header | comment ) *
@@ -42,9 +44,11 @@ Notice that this model only supports string properties. For example:
     # default port
     ftp.port = 21
 
+In addition the XML format defined by [java.util.Property](https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#loadFromXML(java.io.InputStream)) is supported if the file starts with the character `<`.
+
 ### Configuration Files (.config)
 
-Configuration files ending in '.config' use the format of the Apache Felix ConfigAdmin implementation. It allows to specify the type and cardinality of a configuration property and is not limited to string values.
+Configuration files ending in `.config` use the format of the [Apache Felix ConfigAdmin implementation](https://github.com/apache/felix/blob/trunk/configadmin/src/main/java/org/apache/felix/cm/file/ConfigurationHandler.java). It allows to specify the type and cardinality of a configuration property and is not limited to string values.
 
 The first line of such a file might start with a comment line (a line starting with a #). Comments within the file are not allowed.
 
@@ -66,15 +70,17 @@ The quoted string format is equal to the definition from HTTP 1.1 ([RFC2616](htt
 
 The 1 character type code is one of:
 
-* 'T' : simple string
-* 'I' : Integer
-* 'L' : Long
-* 'F' : Float
-* 'D' : Double
-* 'X' : Byte
-* 'S' : Short
-* 'C' : Character
-* 'B' : Boolean
+* `T` : simple string
+* `I` : Integer
+* `L` : Long
+* `F` : Float
+* `D` : Double
+* `X` : Byte
+* `S` : Short
+* `C` : Character
+* `B` : Boolean
+
+For Float and Double types the methods [Float.intBitsToFloat](https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#intBitsToFloat%28int%29) and [Double.longBitsToDouble](https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#longBitsToDouble%28long%29) are being used to convert the numeric string into the correct type. These methods rely on the IEEE 754 floating-point formats described in [Single-precision floating-point format](https://en.wikipedia.org/wiki/Single-pre [...]
 
 A number of such .config files exist in the Sling codebase and can be used as examples.