<div dir="ltr"><div>I think the properties format is too closely tied to your particular use case - in general having a long prefix on every line would actual settings harder to see than in a structured format like XML/JSON/YAML, not easier. And if the cache name is repeated on every line, you can't easily compare the configuration of two nodes or of two caches - all the lines would be different.</div>
<div><br></div>I'm also not sure about implementing toProperties()/append(StringBuilder)/etc. in every configuration class instead of using reflection. We already have a lot of changes to make when we add/modify a setting, I'd rather not make that even harder than it is.<div>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 19, 2013 at 5:18 PM, Michal Linhard <span dir="ltr"><<a href="mailto:mlinhard@redhat.com" target="_blank">mlinhard@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">No need for java.util.Properties, the main feature I want is<br>
- Configuration displayable as collection of flat key-value properties<br>
- Hierarchy (e.g. l1 is under clustering) is expressed via extending the<br>
prefix and dividing by dot '.'<br>
<br>
but it would be usefull if the outputformat was easily parceable, using<br>
common Java SE means<br>
one advantage of not using string as output value and keeping a<br>
collection like java.util.Properties<br>
that you can easily combine more of the configs (give them different<br>
prefixes) and sort them in the end<br>
<br>
that's what I do in PerfRepo:<br>
config.node01.cache.clustering...<br>
config.node01.global...<br>
config.node01.jgroups...<br>
config.node02.cache.clustering...<br>
...<br>
<span class="HOEnZb"><font color="#888888"><br>
m.<br>
</font></span><div class="HOEnZb"><div class="h5">On 11/19/2013 03:25 PM, Sanne Grinovero wrote:<br>
> I love the idea, especially as it happened to me to try to help<br>
> someone who was running Infinispan configured via other means (like<br>
> the AS7 configuration format), and it's always hard to understand how<br>
> it's actually configured without knowing all the implicit default<br>
> values, on a specific version (as defaults evolve too).<br>
><br>
> But do you really need an output in the form of java.util.Properties ?<br>
> Wouldn't a descriptive string not be more suited? The API could be the<br>
> well known toString() method on the configuration; we'd enforce the<br>
> internal components to fullfill some internal contract like<br>
> "appendTo(StringBuilder sb);" to make sure it's always maintained<br>
> correctly.<br>
> Also, I'd add an option which logs the fully defined configuration on<br>
> cache start at INFO or DEBUG level.<br>
><br>
> Sanne<br>
><br>
> On 19 November 2013 13:47, Michal Linhard <<a href="mailto:mlinhard@redhat.com">mlinhard@redhat.com</a>> wrote:<br>
>> please refer to the branch, I've rewritten the original config:<br>
>> <a href="https://github.com/mlinhard/infinispan/tree/t_flatconfig" target="_blank">https://github.com/mlinhard/infinispan/tree/t_flatconfig</a><br>
>><br>
>> On 11/19/2013 02:45 PM, Michal Linhard wrote:<br>
>>> Hi,<br>
>>><br>
>>> This is a configuration output format feature proposal.<br>
>>><br>
>>> I'd like to be able to flatten the infinispan cache configuration to<br>
>>> flat properties style so that two configurations can be easily comparable<br>
>>> in a view that displays sorted matching properties side by side to<br>
>>> quickly spot differences.<br>
>>><br>
>>> This is useful in our internal PerfRepo app where I do it so far by<br>
>>> reflection, by patching the server or a radargun plugin by special<br>
>>> addon, but this can lead to numerous errors. It would be much simpler<br>
>>> and less error-prone process if we had it integrated in the upstream code.<br>
>>><br>
>>> I proposed adding a method configuration.toProperties() that flattens<br>
>>> properties of a configuration object<br>
>>> (org.infinispan.configuration*Configuration) and produces<br>
>>> java.util.Properties. The nested configuration objects under the main<br>
>>> Configuration would recursively add their properties under an extended<br>
>>> property prefix.<br>
>>><br>
>>> I also added a possibility to specify --format=properties in the info<br>
>>> command of the CLI so that the server responds with the property style<br>
>>> configuration of the specific cache...<br>
>>><br>
>>> <a href="https://github.com/mlinhard/infinispan/commit/d8360f7850b67956adfa29aca86dae9dfad5c22d" target="_blank">https://github.com/mlinhard/infinispan/commit/d8360f7850b67956adfa29aca86dae9dfad5c22d</a><br>
>>><br>
>>> (I didn't implement toProperties in all objects, cause it's quite a lot<br>
>>> of changes that would be made in vain in case you don't like this<br>
>>> approach, the commit just demonstrates how I'd like to go about it.)<br>
>>><br>
>>> These properties would also be exposed via JMX as (example values)<br>
>>> jboss.infinispan:type=Cache,name="testCache(dist_sync)",manager="default",component=Cache<br>
>>> attribute "configurationProperties"<br>
>>> jboss.infinispan:type=CacheManager,name="default",component=CacheManager<br>
>>> attribute "globalConfigurationProperties"<br>
>>> that could be converted by any JMX client back to java.util.Properties<br>
>>><br>
>>> WDYT?<br>
>>><br>
>>> m.<br>
>>><br>
>><br>
>> --<br>
>> Michal Linhard<br>
>> Quality Assurance Engineer<br>
>> JBoss Datagrid<br>
>><br>
>> Red Hat Czech s.r.o.<br>
>> Purkynova 99 612 45 Brno, Czech Republic<br>
>> phone: <a href="tel:%2B420%20532%20294%20320%20ext.%208262320" value="+420532294320">+420 532 294 320 ext. 8262320</a><br>
>> mobile: <a href="tel:%2B420%20728%20626%20363" value="+420728626363">+420 728 626 363</a><br>
>><br>
>> _______________________________________________<br>
>> infinispan-dev mailing list<br>
>> <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
> _______________________________________________<br>
> infinispan-dev mailing list<br>
> <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
<br>
<br>
--<br>
Michal Linhard<br>
Quality Assurance Engineer<br>
JBoss Datagrid<br>
<br>
Red Hat Czech s.r.o.<br>
Purkynova 99 612 45 Brno, Czech Republic<br>
phone: <a href="tel:%2B420%20532%20294%20320%20ext.%208262320" value="+420532294320">+420 532 294 320 ext. 8262320</a><br>
mobile: <a href="tel:%2B420%20728%20626%20363" value="+420728626363">+420 728 626 363</a><br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</div></div></blockquote></div><br></div>