This discussion is archived
7 Replies Latest reply: Sep 21, 2010 11:35 PM by Anuj Dwivedi RSS

How to read properties file(key-value) in OSB?

VibhorRastogi Newbie
Currently Being Moderated
Hi

I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
But now need to implement this in OSB and performance is very critical in this project.

I followed DVM approached defined in

http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html

But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.

What is the best approach for this (Can not go for db call as performance is very critical)?

Thanks
Vibhor
  • 1. Re: How to read properties file(key-value) in OSB?
    Anuj Dwivedi Guru
    Currently Being Moderated
    Hello Vibhor,

    You may create a XML having key-value pair, upload that as a XQuery in OSB configuration. In message flow use assign action to load the content of XML in a variable. Use Xpath on that variable to get desired data.

    Seeing the amount of key-value pairs it may not be the best solution but with the restrictions you have it is an option. What is the problem with DVM?

    Regards,
    Anuj

    Edited by: Anuj Dwivedi on Sep 21, 2010 3:44 PM
  • 2. Re: How to read properties file(key-value) in OSB?
    VibhorRastogi Newbie
    Currently Being Moderated
    Hi Anuj

    I think DVM approach and what you told both are same.
    I uploaded key-value pair as XQuery resource and assigned it to a new variable DVM, but I am unable to traverse through $DVM.

    $DVM is returning me complete key-value pairs but when I do $DVM/dvm/columns[1]/column[1] its not returning any value.

    Because of this issue I am unable to go ahead.

    Secondly I have hundreds of Key-Value pairs, so DVM loading and reading with also take time.So wanted to know what are all possible solutions for this scenario?

    One more question- Which xslt processer OSB uses, is it XALAN?

    Thanks
    Vibhor
  • 3. Re: How to read properties file(key-value) in OSB?
    Anuj Dwivedi Guru
    Currently Being Moderated
    Hello Vibhor,
    $DVM is returning me complete key-value pairs but when I do $DVM/dvm/columns[1]/column[1] its not returning any value.
    Perhaps due to invalid X-path you are not getting anything. Please paste the content of $DVM here so that we may figure out the problem.
    Secondly I have hundreds of Key-Value pairs, so DVM loading and reading with also take time.So wanted to know what are all possible solutions for this scenario?
    From my point of view, DB should be the best approach. Whay you can not use DB?
    One more question- Which xslt processer OSB uses, is it XALAN?
    Yes. It uses Xalan processer.

    Regards,
    Anuj
  • 4. Re: How to read properties file(key-value) in OSB?
    VibhorRastogi Newbie
    Currently Being Moderated
    $DVM= <dvm      name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
         <columns>
         <column      name="PROPERTY_KEY" qualifier="false" order="1"/>
         <column      name="PROPERTY_VALUE" qualifier="false" order="1"/>
         </columns>
         <rows>
         <row>
         <cell>dealer.locate.default.buypower.link</cell>
         <cell>http://www.xyz.com</cell>
         </row>
         <row>
         <cell>dealer.locate.default.unitOfMeasure</cell>
         <cell>MILES</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.nu</cell>
         <cell>Nurun</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.bu</cell>
         <cell>Buick</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.ca</cell>
         <cell>Cadillac</cell>
         </row>
    </rows>
    </dvm>

    XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()

    If I run this xpath in Jdeveloper,its giving me proper output.

    Please this as CQuery resource and try to run this xpath on OSB console.

    Thanks
    Vibhor

    Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM
  • 5. Re: How to read properties file(key-value) in OSB?
    Anuj Dwivedi Guru
    Currently Being Moderated
    Hello Vibhor,

    Xpath in OSB assign action should be like -

    $DVMVar/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()

    where DVMVar holds the below content -


    <dvm name="InterfaceProperties" xmlns="http://xmlns.oracle.com/dvm">
    <columns>
    <column name="PROPERTY_KEY" qualifier="false" order="1"/>
    <column name="PROPERTY_VALUE" qualifier="false" order="1"/>
    </columns>
    <rows>
    <row>
    <cell>dealer.locate.default.buypower.link</cell>
    <cell>http://www.xyz.com</cell>
    </row>
    <row>
    <cell>dealer.locate.default.unitOfMeasure</cell>
    <cell>MILES</cell>
    </row>
    <row>
    <cell>dealer.locate.brand.identifier.nu</cell>
    <cell>Nurun</cell>
    </row>
    <row>
    <cell>dealer.locate.brand.identifier.bu</cell>
    <cell>Buick</cell>
    </row>
    <row>
    <cell>dealer.locate.brand.identifier.ca</cell>
    <cell>Cadillac</cell>
    </row>
    </rows>
    </dvm>

    Regards,
    Anuj
  • 6. Re: How to read properties file(key-value) in OSB?
    VibhorRastogi Newbie
    Currently Being Moderated
    Yeah,it's working now but I could not understand- why should I remove Root element i.e. dvm from XQuery?

    Anyway thanks for the help.

    Will put some more questions tomorrow. :)

    Thanks
    Vibhor
  • 7. Re: How to read properties file(key-value) in OSB?
    Anuj Dwivedi Guru
    Currently Being Moderated
    why should I remove Root element i.e. dvm from XQuery?
    Because your variable holds root element.
    Will put some more questions tomorrow.
    welcome. :)

    Regards,
    Anuj

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points