Archived
Are multi line properties possible?
Hi, we sometimes have subsystems or complex data structures that are configured via JSON. In these cases it is not possible (dynamic length) or unpractical to split the data into multiple properties. Since it is a hassle to always have to load a file containing the multi line JSON data and the JSON becomes unreadable if smushed into one line, we would like to pass the data via one multi line property.
Looking at the documentation, i did not see an option to do this. Is there really no option for this or did i miss it?
If this is not possible: is there an option to replace the default property file parser and provide a custom one? This would allow us to write a parser that treats a trailing \
al line continuation.
Comments
-
The configuration file format doesn't allow for setting a property to a multi-line string, you can create a property set by calling
createProperties
and the usesetProperty
as needed.See https://doc.zeroc.com/ice/3.6/properties-and-configuration/setting-properties
5 -
(I noticed, i used the link to the Ice 3.6 documentation, but we are using Ice 3.7)
So, i took a look at the code and it seems to be impossible to patch this (due to some design decisions by the devs).Details:
Ice::PropertiesI
is not exposed to user code and thus impossible to derive. Otherwise it would be enough to deriveIce::PropertiesI
, override theload
method and use a custom version ofcreateProperties
to use the class derivingIce::PropertiesI
.
A fix for this would be to expose the implementation classes (I can understand why this is not done).Also, it is impossible to use a completely custom implementation of
Ice::Properties
since parts of ice (Ice/Instance.cpp:1697
) use methods ofIce::PropertiesI
that are not in the interface ofIce::Properties
. The code relies on an unchecked static cast to cast toIce::PropertiesI*
to call the function, instead of a dynamic cast and check fornullptr
.
This could be fixed by only using the public interface inside of the implementation.It would be nice, if the next version of ice would include some way of providing multi line properties (e.g. using a trailing
\
) and would allow to patch ice by using your own replacement classes.0