[jira] [Commented] (DELTASPIKE-1212) Introduce a ConfigResolver.resolveAllProperties method
[ https://issues.apache.org/jira/browse/DELTASPIKE-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16986128#comment-16986128 ] Andrew Marinchuk commented on DELTASPIKE-1212: -- Hi! This is a workaround for resolving all properties with some prefix: {code:java}private @Nonnull Map filterPropsByPrefix(@Nonnull Map props, @Nonnull String prefix, boolean resolveConfig) { int prefixLength = prefix.length(); Map result = new LinkedHashMap<>(); if (resolveConfig) { for (Entry entry : props.entrySet()) // Select only parameters with specified prefix if (entry.getKey().startsWith(prefix)) { String key = entry.getKey(); if (ProjectStage.valueOf(key.substring(key.lastIndexOf('.') + 1)) != null) key = key.substring(0, key.lastIndexOf('.')); result.put(key.substring(prefixLength), ConfigResolver.getProjectStageAwarePropertyValue(key)); } } else for (Entry entry : props.entrySet()) if (entry.getKey().startsWith(prefix)) result.put(entry.getKey().substring(prefixLength), entry.getValue()); return result; } {code} Usage: {code:java}private static final String CONFIG_PREFIX = "myprefix."; // ... Map allPropsWithPrefix = filterPropsByPrefix(ConfigResolver.getAllProperties(), CONFIG_PREFIX, true);{code} May be method like this could be a good alternative to resolveAllProperties? > Introduce a ConfigResolver.resolveAllProperties method > -- > > Key: DELTASPIKE-1212 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1212 > Project: DeltaSpike > Issue Type: New Feature > Components: Configuration >Affects Versions: 1.7.0 >Reporter: John D. Ament >Assignee: John D. Ament >Priority: Major > > Invoking ConfigResolver.getAllProperties does not expand out any inlined > variables. In addition, assume the following properties file and project > stage = Development > {code} > some-service-url=${edge-server-url}/some-service > edge-server-url=undefined > edge-server-url.Development=http://development:8081 > edge-server-url.Staging=http://staging:8081 > edge-server-url.Production=http://prod:8081 > {code} > calling {{getAllProperties}} returns the raw output of this file. > Introducing a new {{resolveAllProperties}} method would only return back the > active values. The expected result would be > {code} > some-service-url=http://development:8081/some-service > edge-server-url=http://development:8081 > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (DELTASPIKE-1212) Introduce a ConfigResolver.resolveAllProperties method
[ https://issues.apache.org/jira/browse/DELTASPIKE-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16013583#comment-16013583 ] Mark Struberg commented on DELTASPIKE-1212: --- Of course, if it's only technically hard to do then that's no show stopper. But if it makes no sense from a logical point (even on paper) then that's another story. Maybe I didn't yet understand what you meant. We already have MapConfigResolver#getAllProperties() This is imo as good as it gets. It resolves the native configured values. For anything else you'd need to guess what parameters should get applied during the evaluation: fallback chain, variables, etc Do we have all this information? I doubt it. In any case it's nothing we can solve for the 1.8.0 release which I'd like to roll this week. I gonna move it to 1.8.1, oki? > Introduce a ConfigResolver.resolveAllProperties method > -- > > Key: DELTASPIKE-1212 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1212 > Project: DeltaSpike > Issue Type: New Feature > Components: Configuration >Affects Versions: 1.7.0 >Reporter: John D. Ament >Assignee: John D. Ament > Fix For: 1.8.1 > > > Invoking ConfigResolver.getAllProperties does not expand out any inlined > variables. In addition, assume the following properties file and project > stage = Development > {code} > some-service-url=${edge-server-url}/some-service > edge-server-url=undefined > edge-server-url.Development=http://development:8081 > edge-server-url.Staging=http://staging:8081 > edge-server-url.Production=http://prod:8081 > {code} > calling {{getAllProperties}} returns the raw output of this file. > Introducing a new {{resolveAllProperties}} method would only return back the > active values. The expected result would be > {code} > some-service-url=http://development:8081/some-service > edge-server-url=http://development:8081 > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (DELTASPIKE-1212) Introduce a ConfigResolver.resolveAllProperties method
[ https://issues.apache.org/jira/browse/DELTASPIKE-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16013120#comment-16013120 ] John D. Ament commented on DELTASPIKE-1212: --- I disagree with closing hard to implement things as won't fix. We'll come up with a way to solve this, even if its expensive. > Introduce a ConfigResolver.resolveAllProperties method > -- > > Key: DELTASPIKE-1212 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1212 > Project: DeltaSpike > Issue Type: New Feature > Components: Configuration >Affects Versions: 1.7.0 >Reporter: John D. Ament > Fix For: 1.8.1 > > > Invoking ConfigResolver.getAllProperties does not expand out any inlined > variables. In addition, assume the following properties file and project > stage = Development > {code} > some-service-url=${edge-server-url}/some-service > edge-server-url=undefined > edge-server-url.Development=http://development:8081 > edge-server-url.Staging=http://staging:8081 > edge-server-url.Production=http://prod:8081 > {code} > calling {{getAllProperties}} returns the raw output of this file. > Introducing a new {{resolveAllProperties}} method would only return back the > active values. The expected result would be > {code} > some-service-url=http://development:8081/some-service > edge-server-url=http://development:8081 > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (DELTASPIKE-1212) Introduce a ConfigResolver.resolveAllProperties method
[ https://issues.apache.org/jira/browse/DELTASPIKE-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16012168#comment-16012168 ] Mark Struberg commented on DELTASPIKE-1212: --- John, I'm still not sure how this could be done. Can we close this as wont fix? > Introduce a ConfigResolver.resolveAllProperties method > -- > > Key: DELTASPIKE-1212 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1212 > Project: DeltaSpike > Issue Type: New Feature > Components: Configuration >Affects Versions: 1.7.0 >Reporter: John D. Ament > Fix For: 1.8.0 > > > Invoking ConfigResolver.getAllProperties does not expand out any inlined > variables. In addition, assume the following properties file and project > stage = Development > {code} > some-service-url=${edge-server-url}/some-service > edge-server-url=undefined > edge-server-url.Development=http://development:8081 > edge-server-url.Staging=http://staging:8081 > edge-server-url.Production=http://prod:8081 > {code} > calling {{getAllProperties}} returns the raw output of this file. > Introducing a new {{resolveAllProperties}} method would only return back the > active values. The expected result would be > {code} > some-service-url=http://development:8081/some-service > edge-server-url=http://development:8081 > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (DELTASPIKE-1212) Introduce a ConfigResolver.resolveAllProperties method
[ https://issues.apache.org/jira/browse/DELTASPIKE-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15951033#comment-15951033 ] Mark Struberg commented on DELTASPIKE-1212: --- I think this is not an accident but by design. If you use getAllProperties then you cannot easily make assumptions about whether a specific property-evaluation, projectstage-evaluation or variable replacement is to be assumed. Any assumption we would take might be wrong, isn't? One could still iterate over the keys and resolve them one by one. > Introduce a ConfigResolver.resolveAllProperties method > -- > > Key: DELTASPIKE-1212 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1212 > Project: DeltaSpike > Issue Type: New Feature > Components: Configuration >Affects Versions: 1.7.0 >Reporter: John D. Ament > Fix For: 1.8.0 > > > Invoking ConfigResolver.getAllProperties does not expand out any inlined > variables. In addition, assume the following properties file and project > stage = Development > {code} > some-service-url=${edge-server-url}/some-service > edge-server-url=undefined > edge-server-url.Development=http://development:8081 > edge-server-url.Staging=http://staging:8081 > edge-server-url.Production=http://prod:8081 > {code} > calling {{getAllProperties}} returns the raw output of this file. > Introducing a new {{resolveAllProperties}} method would only return back the > active values. The expected result would be > {code} > some-service-url=http://development:8081/some-service > edge-server-url=http://development:8081 > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)