You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jean-Sebastien Delfino <js...@apache.org> on 2006/11/29 23:06:38 UTC
[C++] Digging data out of an SDO graph
We're starting to have pages of code in our various extensions (and
sometimes duplicate code) to just dig data out of an SDO graph.
This initially sounds pretty simple:
- I have an SDO that I loaded from an XML element
- I'd like to populate a C++ list with values of the child elements of
that XML for example.
like in:
<add>
<op1>2</op1>
<op2>3</op2>
</add>
I would populate a C++ list or array with 2 ints {2, 3}...
It turns out to be not so simple, as depending on how you've defined
your schema for that XML (if you have a schema at all) you need to check
for:
- SDO properties defined in your schema
- SDO instance properties (if your parent element is an open content)
- SDO sequences
- properties that are DataObjectLists
- properties that contain open content again...
I'm thinking about writing a generic utility class once for all, which
will implement a Visitor pattern to visit the SDO graph and gather the
interesting data... What do people think about this approach?
Can somebody point me to existing SDO navigation code that I could reuse
for this?
Or am I missing something and there is a simpler way to get child
elements out of an SDO without having to worry about all these cases?
Thanks,
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Digging data out of an SDO graph
Posted by Yang ZHONG <le...@gmail.com>.
SDO data digging concept (
http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg11291.html)
also applys to the Java counterpart.
There're two different SDO use cases:
2-1. access specific Property data
2-2. browse/dig data
Current spec has taken care of 2-1.
2-2 users have to be familiar with internal data structure and write very
complicated code which is error-prone.
Something like the following may help browsing SDO data:
interface Property.Setting
{
Property getProperty();
Object getValue();
}
interface DataObject
{
Iterator<Property.Setting> getPropertySettings();
...
}
SDO implementations can also benefit from the support of 2-2 use case,
such as exposing DataObject as StAX Reader, DataObject Copy Helper,
DataObject Equality Helper, DataObject Serializer,
and the DO print util mentioned by Pete.
--
Yang ZHONG
Re: [C++] Digging data out of an SDO graph
Posted by Pete Robbins <ro...@googlemail.com>.
On 29/11/06, Jean-Sebastien Delfino <js...@apache.org> wrote:
>
> We're starting to have pages of code in our various extensions (and
> sometimes duplicate code) to just dig data out of an SDO graph.
>
> This initially sounds pretty simple:
> - I have an SDO that I loaded from an XML element
> - I'd like to populate a C++ list with values of the child elements of
> that XML for example.
>
> like in:
> <add>
> <op1>2</op1>
> <op2>3</op2>
> </add>
>
> I would populate a C++ list or array with 2 ints {2, 3}...
>
> It turns out to be not so simple, as depending on how you've defined
> your schema for that XML (if you have a schema at all) you need to check
> for:
> - SDO properties defined in your schema
> - SDO instance properties (if your parent element is an open content)
> - SDO sequences
> - properties that are DataObjectLists
> - properties that contain open content again...
>
> I'm thinking about writing a generic utility class once for all, which
> will implement a Visitor pattern to visit the SDO graph and gather the
> interesting data... What do people think about this approach?
>
> Can somebody point me to existing SDO navigation code that I could reuse
> for this?
>
> Or am I missing something and there is a simpler way to get child
> elements out of an SDO without having to worry about all these cases?
>
> Thanks,
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
There is code in
tuscany/sca/util/Utils.cpp
that prints DO contents. May be a starting point.
Cheers,
--
Pete