I suppose that the first problem (wrong type of SDO created) probably is not connected to SCA,
because there is no SCA code involved. It doesn’t matter for this problem what context SCA uses, because I use the default SDO context directly when registering the Factory and creating the SDO. The second problem (the PackageNotFoundException upon deserialization) may have to do with SCA, because there is a mediating SCA transformer. But perhaps this transformer is thrown off track by the same underlying SDO problem. If there is no further suggestion from the list, I will create a JIRA for this. -- Sebastian From: Frank Budinsky [mailto:[email protected]] Sent: Thursday, October 07, 2010 3:30 PM To: [email protected] Subject: Re: SDO instance creation and deserialization error I think that should work, so my only guess is that maybe the SCA component and runtime are not using the same classLoader and/or HelperContext (scope). Maybe someone with more SCA knowledge can help. Frank. "Millies, Sebastian" <[email protected]> wrote on 10/07/2010 03:38:35 AM: > [image removed] > > SDO instance creation and deserialization error > > Millies, Sebastian > > to: > > user > > 10/07/2010 03:39 AM > > Please respond to user > > Frank, thank you for that explanation. I’m opening a new thread now, > because the subject > matter of this conversation has changed somewhat. > > I tried your example, and it did not work as expected. In > particular, I created a > data object for a type which has a statically generated class, but > unexpectedly > got back an instance of DynamicDataObjectImpl. > > Here are the details: > > I created the types using XSD2JavaGenerator from this XSD: > <?xml version="1.0" encoding="UTF-8"?> > <schema xmlns="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://psp.softwareag.com/catalogBaseType" > xmlns:catalogBaseType="http://psp.softwareag.com/catalogBaseType"> > > <complexType name="CatalogBaseType"> > <attribute name="id" type="string"></attribute> > <attribute name="catalogID" type="string"></attribute> > <attribute name="fileName" type="string"></attribute> > <attribute name="catalogName" type="string"></attribute> > <attribute name="catalogStatus" type="string"></attribute> > <attribute name="supplierID" type="string"></attribute> > <attribute name="eclassVersion" type="string"></attribute> > </complexType> > > <element name="catalogBaseType" type="catalogBaseType:CatalogBaseType"></ > element> > </schema> > > The classes get generated in package com.softwareag.psp.catalog.base.type > . I generated no interfaces ( I > ran XSD2JavaGenerator with the following options: -noInterfaces - > noNotification -noUnsettable –prefix). > I have called the generated factory CatalogBaseTypeFactory. > > Then in my coding (SCA service implementation) I do the following: > a) statically register the factory with the default context > static { > helperContext = HelperProvider.getDefaultContext(); > CatalogBaseTypeFactory.INSTANCE.register( helperContext ); > } > b) create a data object from the targetNamespace of the XSD and > the type name > DataObject obj = helperContext.getDataFactory().create( > "http://psp.softwareag.com/catalogBaseType", "CatalogBaseType"); > > Unexpectedly the following holds: assertTrue(obj instanceof > DynamicDataObjectImpl); > Where I would have expected an instance of CatalogBaseType. > > When I call the service that returns this SDO using a Java RMI > client, I also get an exception when trying to > deserialize the dynamic data object: > org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package > with uri 'http://psp.softwareag.com/catalogBaseType' not found. ( > http:///temp.xml <http://temp.xml> , 5, 24) > which is caused by an underlying > org.eclipse.emf.ecore.xmi.PackageNotFoundException. > (see also my previous post with subject “SDO deserialization error”) > > I guess that this exception and the fact that the wrong type of SDO > got created may be related. > I am using Tuscany 1.6, Java 1.6.0 and Eclipse Helios. > > Can anyone spot where I went wrong? > > -- Sebastian > > From: Frank Budinsky [mailto:[email protected]] > Sent: Wednesday, October 06, 2010 9:55 PM > To: [email protected] > Subject: Re: FW: [SDO] Samples for notification feature / register ? > > You don't need to know anything about the static Java class. All you > need to know is the type name. You can then get the type and create > the instance like this: > > Type type = scope.getTypeHelper().getType("http://blablaURI", "blablaType"); > DataObject obj = scope.getDataFactory().create(type); > > Alternatively, you can just call the other convenient create() method: > > DataObject obj = scope.getDataFactory().create("http://blablaURI", > "blablaType"); > > If there is no static Java class then the returned obj will be an > instance of DynamicDataObjectImp: > > assertTrue(obj instanceof DynamicDataObjectImpl); > > If there is a static implementation class, then it will be used: > > assertTrue(obj instanceof BlaBlaImpl); > > Frank. > > "Millies, Sebastian" <[email protected]> wrote on 10/ > 06/2010 12:57:19 PM: > > > [image removed] > > > > FW: [SDO] Samples for notification feature / register ? > > > > Millies, Sebastian > > > > to: > > > > user > > > > 10/06/2010 01:03 PM > > > > Please respond to user > > > > I think what I do not understand is just how to use the “ordinary” > > factory to create instances of static data objects without static > > knowledge of the generated classes. > > > > I think my confusion stems from the call scope.getDataFactory(type). > > This calls the “ordinary” factory, but in order to supply the > > type argument, I’d need something like > > GeneratedFactory.INSTANCE.getBlablaType(), which > > would obviously presuppose static knowledge of the generated > > Java classes. > > > > -- Sebastian > > > > > > From: Frank Budinsky [mailto:[email protected]] > > Sent: Wednesday, October 06, 2010 2:31 PM > > To: [email protected] > > Subject: Re: FW: [SDO] Samples for notification feature / register ? > > > > I'm not sure I really understand what you're asking. > > > > There are 2 factories in the picture. The generated Factory that > > only knows how to create instances of the static SDO types, and the > > "ordinary" SDO DataFactory, that can be used to create instances of > > any type (static or dynamic). The second one is used in code that > > doesn't have static knowledge of the generated Java classes (for > > example, the loader). > > > > Frank. > > > > "Millies, Sebastian" ---10/05/2010 01:54:26 PM---Hello Frank,
