Archived

This forum has been archived. Please start a new discussion on GitHub.

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

  • (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 derive Ice::PropertiesI, override the load method and use a custom version of createProperties to use the class deriving Ice::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 of Ice::PropertiesI that are not in the interface of Ice::Properties. The code relies on an unchecked static cast to cast to Ice::PropertiesI* to call the function, instead of a dynamic cast and check for nullptr.
    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.