On 10/4/07, Raymond Feng <[EMAIL PROTECTED]> wrote: > > Hi, > > I put together a demo application to showcase our XML integration story. > The > business scenario is derived from the bigbank demo and the main function > is > to calculate the total value (using a selected currency) of a customer who > has checking/saving/stock accounts. > > At this moment, I add three different sources to provide XML data. > > 1) A live feed to retrieve the exchange rate (binding.feed) and use XPath > to > exact the rate for a given currency. I have to use Rome API to convert the > feed as our feed binding produces Feed objects. > > 2) The account data for a customer is loaded from a XML file. (We can use > implementation.data once Sebastien's proposal is implemented). > > 3) A live Web Service invocation to get the quotes for a list of symbols. > Only XMLStreamReader is used as the input and output. (binding.ws) > > 4) The calculation of the total value is implemented using XQuery to join > the XML data from 2 and 3. (implementation.xquery) > > The demo application is checked in under r581755. I hope we can use it as > a > test-bed to further drive our XML integration story. Please feel free to > chime in with your ideas, for example, add implementation.data or > implementation.das, or implementation.bpel. > > Thanks, > Raymond
That looks really good. The XML integration story is something I've always thought could be a great demonstration of Tuscany's value...and of the value of things like Tuscany's support for dynamic/script languages. I'd really like to be able to replace the CustomerAssetImpl Java class used in that demo with a dynamic language component, say Ruby or JavaScript, for example, like this with JavaScript/E4X which seems much more concise and readable to me than the Java code: function getTotalValue(currency) { java.lang.System.out.println("Retrieving exchange rate..."); feed = exchangeRate.getRates(); entry = feed.getEntries().get(0); rateTable = new XML(entry.getSummary().getValue()); rate = rateTable.TR.(TD[0]==currency).TD[1] accounts = accountData.getAccounts(); quotes = stockQuote.GetStockQuotes( <q:GetQuotes xmlns:q="http://swanandmokashi.com"> <q:QuoteTicker>IBM,GOOG,MSFT</q:QuoteTicker> </q:GetQuotes> ); value = stockValue.calculate(quotes, accounts); java.lang.System.out.println("Total Value=USD " + value); return value; } And even that could probably be simplified if we could get exchangeRate.getRates() to return e4x xml. Unfortunately none of that JavaScript code is working in Tuscany any more :( Similar things did used to work but we're lost the the E4X databinding and support for xml references in script components that we used to have. It would be a fair bit of work to get all that going again so before i (or anyone else who wants to help) does that - is there much interested in supporting stuff like this? ...ant