Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-173

[configuration] Missing useful functionality of XPath in HierarchicalConfiguration

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      Hi,

      I find out that there is missing very usefull functionality for
      org.apache.commons.configuration.HierarchicalConfiguration.

      For instance, I have XML like below:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration>
      <Service name="contract.funds" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeFunds_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeFunds_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeFunds_rules.xml" />
      </ServiceParameters>
      </Service>

      <Service name="contract.servicing.agents" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeServicingAgents_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeServicingAgents_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeServicingAgents_rules.xml" />
      </ServiceParameters>
      </Service>

      <Service name="contract.additional.info" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeAdditionalInfo_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeAdditionalInfo_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeAdditionalInfo_rules.xml" />
      </ServiceParameters>
      </Service>
      </Configuration>

      From the application I would like to go directly to the configuration of
      service with name: "contract.funds" instead of reading whole hierarhi and check
      if the name is equals "contract.funds" I prefer to get its parameters like this:

      config.getProperty("Service[@name='contract.funds']").ServiceParameters.Param)

      instead of calling in a loop:

      for(int i=0;;i++){
      if(config.getProperty("Service("i")[@name]").equals("contract.funds"))

      { // DO SOMETHING }

      }

      So in a simple words - it would be very helpfull if there will be full
      supoorted the XML Path Language (XPath) during requesting properties.

      Best regards
      Rafal

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rafal Zablocki
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development