You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Ron Gavlin <rg...@yahoo.com> on 2006/07/07 06:23:48 UTC

SDOXMLResourceImpl.load(Node, Map) problems

Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and save methods to transform between DataObjects and DOM Nodes. The same technique is no longer working with Tuscany SDO 2.0. For example, when I invoke SDOXMLResourceImpl.load(Node, null), a DynamicEObjectImpl is created instead of a DataObjectImpl. Any ideas off the top of your head how to make this work? 

Of course, we would rather not resort to EMF APIs to efficiently convert between DataObjects and DOM Nodes. But EMF APIs are better than paying the performance penalty of using Strings or Input/Output Streams as an intermediate representation. It would be nice if SDO or Tuscany provided XMLHelper-like save/load methods that took DOM Nodes in addition to Strings and Streams. Assuming we can get the SDOXMLResourceImpl load/save problems mentioned above resolved, would it make sense to use EMF's load/save capabilities to provide load/save services for DOM nodes? Would SDOUtil, DataObjectUtil, a Tuscany DOMHelper, or another class be the right location for such methods? 

One of the reasons we need DOM Nodes from SDO DataObjects is so we can perform XML Schema validation. Another reason we transform between DataObjects and DOM Nodes is to interact with our web services engine.

Thanks in advance for your help.

- Ron



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDOXMLResourceImpl.load(Node, Map) problems

Posted by Ron Gavlin <rg...@yahoo.com>.
Greetings,
 
Yes, Source and Result parameters make alot of sense and provide maximum flexibility. Are you thinking about trying to get these into the spec? Any thoughts how these would be implemented? Would you try to leverage EMF, write it from scratch, or even use the databinding mediation framework?
 
I took a brief look at the databinding mediation framework and it looks promising. It would be great if you could eliminate or at least isolate the SCA-dependencies so that the framework is accessible to SDO-only folks. It would also be nice if it was JDK 1.4 compatible for those like me living in the dark ages. One last thing, you might consider non-SCA folks when you integrate building and packaging the databinding mediation framework into the global tuscany build. 
 
- Ron
 
P.S. Any ideas why SDOXMLResourceImpl.load(Node, null) isn't working or should I wait on Frank for this one?

----- Original Message ----
From: Raymond Feng <en...@gmail.com>
To: tuscany-user@ws.apache.org
Sent: Friday, July 7, 2006 1:21:11 AM
Subject: Re: SDOXMLResourceImpl.load(Node, Map) problems


Hi,

I think we have discussed similar requirements on this list and the 
conclusion was to support save() and load() methods using 
javax.xml.transform.Source and javax.xml.transform.Result.
For example,

XMLHelper.load(Source source, Object option);
XMLHelper.save(Result result, Object option);

The Source can be StreamSource, DOMSource, SAXSource, StAXSource while the 
Result can be StreamResult, DOMResult, SAXResult and StAXResult.

BTW, on the dev list, we are also discussing a databinding mediation 
framework which can transform data from one format to the other.

Thanks,
Raymond

----- Original Message ----- 
From: "Ron Gavlin" <rg...@yahoo.com>
To: "tuscany-user tuscany-user" <tu...@ws.apache.org>
Sent: Thursday, July 06, 2006 9:23 PM
Subject: SDOXMLResourceImpl.load(Node, Map) problems


> Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and save 
> methods to transform between DataObjects and DOM Nodes. The same technique 
> is no longer working with Tuscany SDO 2.0. For example, when I invoke 
> SDOXMLResourceImpl.load(Node, null), a DynamicEObjectImpl is created 
> instead of a DataObjectImpl. Any ideas off the top of your head how to 
> make this work?
>
> Of course, we would rather not resort to EMF APIs to efficiently convert 
> between DataObjects and DOM Nodes. But EMF APIs are better than paying the 
> performance penalty of using Strings or Input/Output Streams as an 
> intermediate representation. It would be nice if SDO or Tuscany provided 
> XMLHelper-like save/load methods that took DOM Nodes in addition to 
> Strings and Streams. Assuming we can get the SDOXMLResourceImpl load/save 
> problems mentioned above resolved, would it make sense to use EMF's 
> load/save capabilities to provide load/save services for DOM nodes? Would 
> SDOUtil, DataObjectUtil, a Tuscany DOMHelper, or another class be the 
> right location for such methods?
>
> One of the reasons we need DOM Nodes from SDO DataObjects is so we can 
> perform XML Schema validation. Another reason we transform between 
> DataObjects and DOM Nodes is to interact with our web services engine.
>
> Thanks in advance for your help.
>
> - Ron
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDOXMLResourceImpl.load(Node, Map) problems

Posted by Raymond Feng <en...@gmail.com>.
Hi,

I think we have discussed similar requirements on this list and the 
conclusion was to support save() and load() methods using 
javax.xml.transform.Source and javax.xml.transform.Result.
For example,

XMLHelper.load(Source source, Object option);
XMLHelper.save(Result result, Object option);

The Source can be StreamSource, DOMSource, SAXSource, StAXSource while the 
Result can be StreamResult, DOMResult, SAXResult and StAXResult.

BTW, on the dev list, we are also discussing a databinding mediation 
framework which can transform data from one format to the other.

Thanks,
Raymond

----- Original Message ----- 
From: "Ron Gavlin" <rg...@yahoo.com>
To: "tuscany-user tuscany-user" <tu...@ws.apache.org>
Sent: Thursday, July 06, 2006 9:23 PM
Subject: SDOXMLResourceImpl.load(Node, Map) problems


> Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and save 
> methods to transform between DataObjects and DOM Nodes. The same technique 
> is no longer working with Tuscany SDO 2.0. For example, when I invoke 
> SDOXMLResourceImpl.load(Node, null), a DynamicEObjectImpl is created 
> instead of a DataObjectImpl. Any ideas off the top of your head how to 
> make this work?
>
> Of course, we would rather not resort to EMF APIs to efficiently convert 
> between DataObjects and DOM Nodes. But EMF APIs are better than paying the 
> performance penalty of using Strings or Input/Output Streams as an 
> intermediate representation. It would be nice if SDO or Tuscany provided 
> XMLHelper-like save/load methods that took DOM Nodes in addition to 
> Strings and Streams. Assuming we can get the SDOXMLResourceImpl load/save 
> problems mentioned above resolved, would it make sense to use EMF's 
> load/save capabilities to provide load/save services for DOM nodes? Would 
> SDOUtil, DataObjectUtil, a Tuscany DOMHelper, or another class be the 
> right location for such methods?
>
> One of the reasons we need DOM Nodes from SDO DataObjects is so we can 
> perform XML Schema validation. Another reason we transform between 
> DataObjects and DOM Nodes is to interact with our web services engine.
>
> Thanks in advance for your help.
>
> - Ron
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDOXMLResourceImpl.load(Node, Map) problems

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Ron,

Nothing obvious jumps out.  Loading from DOM should work the same as from 
a stream. You'll just need to debug it, or if you can provide a simple 
JUnit that illustrates the problem, I can take a look.

Frank.

Ron Gavlin <rg...@yahoo.com> wrote on 07/07/2006 01:09:11 PM:

> Hi,
> 
> See below.
> 
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Friday, July 7, 2006 9:39:24 AM
> Subject: Re: SDOXMLResourceImpl.load(Node, Map) problems
> 
> 
> Ron Gavlin <rg...@yahoo.com> wrote on 07/07/2006 12:23:48 AM:
> 
> > Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and 
> > save methods to transform between DataObjects and DOM Nodes. The 
> > same technique is no longer working with Tuscany SDO 2.0. For 
> > example, when I invoke SDOXMLResourceImpl.load(Node, null), a 
> > DynamicEObjectImpl is created instead of a DataObjectImpl. Any ideas
> > off the top of your head how to make this work? 
> My guess is that you tried this in an environment where the SDO runtime 
> wasn't initialized. Usually that happens automatically, under the 
covers, 
> when you use SDO features, but you can force it by calling 
DataObjectUtil.
> initRuntime().
> 
> <RG>
> In this case, I am initializing the runtime before running the test.
> Here's the code. I highlighted where I am receiving the 
> ClassCastException. Do you have any thoughts?
> 
> // initialize SDO runtime, define types, load document
> ...
> org.w3c.dom.Element element = document.getDocumentElement();
> DataGraphImpl dataGraph = (DataGraphImpl) SDOUtil.createDataGraph();
> SDOXMLResourceImpl doResource = (SDOXMLResourceImpl) dataGraph.
> getRootResource();
> doResource.unload();
> 
> ExtendedMetaData extendedMetaData = ((TypeHelperImpl) TypeHelper.
> INSTANCE).getExtendedMetaData();
> DataObjectUtil.configureXMLResource(doResource, extendedMetaData);
> 
> // this is required by my mixed static/dynamic model which include 
xsi:type
> doResource.getDefaultLoadOptions().put(XMLResource.
> OPTION_USE_DEPRECATED_METHODS, Boolean.TRUE);
> 
> doResource.load(element, null);
> 
> if (!doResource.getContents().isEmpty())
> {
>    // ClassCastException here -- DynamicEObjectImpl returned instead
> of DataObjectImpl
>    DataObject rootObject = (DataObject) doResource.getContents().get(0);
>    SDOUtil.setRootObject(dataGraph, rootObject);
> }
> 
> return dataGraph;
> 
> </RG>
> 
> 
> > 
> > Of course, we would rather not resort to EMF APIs to efficiently 
> > convert between DataObjects and DOM Nodes. But EMF APIs are better 
> > than paying the performance penalty of using Strings or Input/Output
> > Streams as an intermediate representation. It would be nice if SDO 
> > or Tuscany provided XMLHelper-like save/load methods that took DOM 
> > Nodes in addition to Strings and Streams. Assuming we can get the 
> > SDOXMLResourceImpl load/save problems mentioned above resolved, 
> > would it make sense to use EMF's load/save capabilities to provide 
> > load/save services for DOM nodes? Would SDOUtil, DataObjectUtil, a 
> > Tuscany DOMHelper, or another class be the right location for such 
> methods? 
> I would stay away from calling the EMF APIs directly, if I were you. As 
> Raymond mentioned, in his reply, the plan is to add an API to use 
> Source/Result for this. That API has been agreed for addition to the 2.1 

> version of the SDO spec. In the meantime, however, we could add 
something 
> to SDOUtil in Tuscany. Maybe if you want to speed things up, you could 
> write the SDOUtil method for this and contribute it to the project?
> 
> > 
> > One of the reasons we need DOM Nodes from SDO DataObjects is so we 
> > can perform XML Schema validation. Another reason we transform 
> > between DataObjects and DOM Nodes is to interact with our web services 

> engine.
> > 
> > Thanks in advance for your help.
> > 
> > - Ron
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDOXMLResourceImpl.load(Node, Map) problems

Posted by Ron Gavlin <rg...@yahoo.com>.
Hi,
 
See below.

----- Original Message ----
From: Frank Budinsky <fr...@ca.ibm.com>
To: tuscany-user@ws.apache.org
Sent: Friday, July 7, 2006 9:39:24 AM
Subject: Re: SDOXMLResourceImpl.load(Node, Map) problems


Ron Gavlin <rg...@yahoo.com> wrote on 07/07/2006 12:23:48 AM:

> Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and 
> save methods to transform between DataObjects and DOM Nodes. The 
> same technique is no longer working with Tuscany SDO 2.0. For 
> example, when I invoke SDOXMLResourceImpl.load(Node, null), a 
> DynamicEObjectImpl is created instead of a DataObjectImpl. Any ideas
> off the top of your head how to make this work? 
My guess is that you tried this in an environment where the SDO runtime 
wasn't initialized. Usually that happens automatically, under the covers, 
when you use SDO features, but you can force it by calling DataObjectUtil.
initRuntime().

<RG>
In this case, I am initializing the runtime before running the test. Here's the code. I highlighted where I am receiving the ClassCastException. Do you have any thoughts?
 
// initialize SDO runtime, define types, load document
...
org.w3c.dom.Element element = document.getDocumentElement();
DataGraphImpl dataGraph = (DataGraphImpl) SDOUtil.createDataGraph();
SDOXMLResourceImpl doResource = (SDOXMLResourceImpl) dataGraph.getRootResource();
doResource.unload();
 
ExtendedMetaData extendedMetaData = ((TypeHelperImpl) TypeHelper.INSTANCE).getExtendedMetaData();
DataObjectUtil.configureXMLResource(doResource, extendedMetaData);
 
// this is required by my mixed static/dynamic model which include xsi:type
doResource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.TRUE);
 
doResource.load(element, null);
 
if (!doResource.getContents().isEmpty())
{
   // ClassCastException here -- DynamicEObjectImpl returned instead of DataObjectImpl
   DataObject rootObject = (DataObject) doResource.getContents().get(0);
   SDOUtil.setRootObject(dataGraph, rootObject);
}
 
return dataGraph;
 
</RG>
 

> 
> Of course, we would rather not resort to EMF APIs to efficiently 
> convert between DataObjects and DOM Nodes. But EMF APIs are better 
> than paying the performance penalty of using Strings or Input/Output
> Streams as an intermediate representation. It would be nice if SDO 
> or Tuscany provided XMLHelper-like save/load methods that took DOM 
> Nodes in addition to Strings and Streams. Assuming we can get the 
> SDOXMLResourceImpl load/save problems mentioned above resolved, 
> would it make sense to use EMF's load/save capabilities to provide 
> load/save services for DOM nodes? Would SDOUtil, DataObjectUtil, a 
> Tuscany DOMHelper, or another class be the right location for such 
methods? 
I would stay away from calling the EMF APIs directly, if I were you. As 
Raymond mentioned, in his reply, the plan is to add an API to use 
Source/Result for this. That API has been agreed for addition to the 2.1 
version of the SDO spec. In the meantime, however, we could add something 
to SDOUtil in Tuscany. Maybe if you want to speed things up, you could 
write the SDOUtil method for this and contribute it to the project?

> 
> One of the reasons we need DOM Nodes from SDO DataObjects is so we 
> can perform XML Schema validation. Another reason we transform 
> between DataObjects and DOM Nodes is to interact with our web services 
engine.
> 
> Thanks in advance for your help.
> 
> - Ron
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDOXMLResourceImpl.load(Node, Map) problems

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Ron Gavlin <rg...@yahoo.com> wrote on 07/07/2006 12:23:48 AM:

> Using EMF/SDO 1.0, we were able to use XMLResourceImpl's load and 
> save methods to transform between DataObjects and DOM Nodes. The 
> same technique is no longer working with Tuscany SDO 2.0. For 
> example, when I invoke SDOXMLResourceImpl.load(Node, null), a 
> DynamicEObjectImpl is created instead of a DataObjectImpl. Any ideas
> off the top of your head how to make this work? 
My guess is that you tried this in an environment where the SDO runtime 
wasn't initialized. Usually that happens automatically, under the covers, 
when you use SDO features, but you can force it by calling DataObjectUtil.
initRuntime().

> 
> Of course, we would rather not resort to EMF APIs to efficiently 
> convert between DataObjects and DOM Nodes. But EMF APIs are better 
> than paying the performance penalty of using Strings or Input/Output
> Streams as an intermediate representation. It would be nice if SDO 
> or Tuscany provided XMLHelper-like save/load methods that took DOM 
> Nodes in addition to Strings and Streams. Assuming we can get the 
> SDOXMLResourceImpl load/save problems mentioned above resolved, 
> would it make sense to use EMF's load/save capabilities to provide 
> load/save services for DOM nodes? Would SDOUtil, DataObjectUtil, a 
> Tuscany DOMHelper, or another class be the right location for such 
methods? 
I would stay away from calling the EMF APIs directly, if I were you. As 
Raymond mentioned, in his reply, the plan is to add an API to use 
Source/Result for this. That API has been agreed for addition to the 2.1 
version of the SDO spec. In the meantime, however, we could add something 
to SDOUtil in Tuscany. Maybe if you want to speed things up, you could 
write the SDOUtil method for this and contribute it to the project?

> 
> One of the reasons we need DOM Nodes from SDO DataObjects is so we 
> can perform XML Schema validation. Another reason we transform 
> between DataObjects and DOM Nodes is to interact with our web services 
engine.
> 
> Thanks in advance for your help.
> 
> - Ron
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org