Hello,

We have another issue related to 1 and 4 below. We have an "any"
element defined by the common schema in the identity element. The
packageDescriptor schema defines the packageIdentity element, which
extends the identity element in the common schema. I'm running the
following code:

       HelperContext context = SDOUtil.createHelperContext();

       
oasis.names.tc.sdd._1._0.deployment.descriptor.DescriptorFactory.INSTANCE.register(context);
       
oasis.names.tc.sdd._1._0.package_.descriptor.DescriptorFactory.INSTANCE.register(context);
       oasis.names.tc.sdd._1._0.common.CommonFactory.INSTANCE.register(context);
       org.w3._2000._09.xmldsig.XmldsigFactory.INSTANCE.register(context);

       context.getXSDHelper().define(new
FileInputStream("./Address.xsd"), (new
File("./Address.xsd")).toURI().toString());
       DataObject address =
context.getDataFactory().create("http://www.example.org/Address";,
"AddressType");

       address.set("Street", "123 Fake St.");
       address.set("City", "Springfield");
       address.set("Zip", "46392");

       Property addressProperty =
context.getXSDHelper().getGlobalProperty("http://www.example.org/Address";,
"Address", true);

       PackageDescriptorType pd =
DescriptorFactory.INSTANCE.createPackageDescriptorType();
       PackageIdentityType identity =
DescriptorFactory.INSTANCE.createPackageIdentityType();

       ((DataObject) identity).getList(addressProperty).add(address);

       context.getXMLHelper().save((DataObject) pd,
"urn:oasis:names:tc:SDD:1:0:packageDescriptor", "PackageDescriptor",
System.out);

When the getList() method is called, I get the following error:

Exception in thread "main" java.lang.NullPointerException
        at 
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eOpenGet(BasicEObjectImpl.java:645)
        at 
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java(Compiled
Code))
        at 
org.apache.tuscany.sdo.impl.DataObjectImpl.get(DataObjectImpl.java:132)
        at 
org.apache.tuscany.sdo.util.DataObjectUtil.getList(DataObjectUtil.java:172)
        at 
org.apache.tuscany.sdo.impl.DataObjectImpl.getList(DataObjectImpl.java:995)
        at com.ibm.isd.mapper.impl.Test.anyTest_Static_PD(Test.java:117)
        at com.ibm.isd.mapper.impl.Test.main(Test.java:126)

The problem has to do with a bogus featureID being passed into one of
the EMF methods. I need it to return the ANY ID, but I end up getting
the ID of an attribute. The attribute I'm getting is the SoftwareID
attribute mentioned in my issue 4.

Please let me know if you have any insight to this. Thanks,
-Chris

On 5/7/07, Chris Mildebrandt <[EMAIL PROTECTED]> wrote:
Hello,

I'm having issues generating static SDOs from my schema. My schema can
be found here:

http://www.oasis-open.org/committees/download.php/23876/CL1_Schema.zip

and here:

http://www.w3.org/2000/09/xmldsig

I generate my classes using IBM's JDK 1.4.2 with the following commands:

set javaExe=C:\ibmsdk1.4.2_sr4-1\bin\java
set output=.
set schemaLocation=..\schema\sdd-20070504_49

set 
sdo_cp=lib\org.eclipse.emf.codegen_2.2.2.v200702131851.jar;lib\org.eclipse.emf.codegen.ecore_2.2.2.v200702131851.jar;lib\org.eclipse.emf.common_2.2.1.v200702131851.jar;lib\org.eclipse.emf.ecore_2.2.2.v200702131851.jar;lib\org.eclipse.emf.ecore.change_2.2.1.v200702131851.jar;lib\org.eclipse.emf.ecore.xmi_2.2.2.v200702131851.jar;lib\sdo-api-r2.1-1.0-incubating-SNAPSHOT.jar;lib\tuscany-sdo-impl-1.0-incubating-SNAPSHOT.jar;lib\tuscany-sdo-tools-1.0-incubating-SNAPSHOT.jar;lib\org.eclipse.xsd_2.2.2.v200702131851.jar
set options=-cp %sdo_cp%
org.apache.tuscany.sdo.generate.XSD2JavaGenerator -arrayAccessors
-targetDirectory %output%

%javaExe% %options% "%schemaLocation%\wd-sdd-common-1.0.xsd"
%javaExe% %options% "%schemaLocation%\wd-sdd-deploymentDescriptor-1.0.xsd"
%javaExe% %options% "%schemaLocation%\wd-sdd-packageDescriptor-1.0.xsd"
%javaExe% %options% "%schemaLocation%\xmldsig-core-schema.xsd"

I've built the Tuscany SDO libraries from the 5/6 code in subversion
with IBM's 1.4.2 JDK.

Ok, with that out of the way, here are the problems I'm seeing:

1) Load the generated classes into Eclipse and you'll see this error.
identityTypeType isn't defined. In
oasis.names.tc.sdd._1._0.package_.descriptor.impl.DescriptorFactoryImpl
the following line:

addSuperType(packageIdentityTypeType, identityTypeType);

seems like it should be:

addSuperType(packageIdentityTypeType, theCommonPackageImpl.getIdentityType());

Let me know if that is correct.


2) There are a few 2-dimensional arrays being created incorrectly as a
part of xmldsig-core-schema.xsd. For example:

protected static final byte[][] X509SKI_EEMPTY_ARRAY = new byte[] [0];

should probably be:

protected static final byte[][] X509SKI_EEMPTY_ARRAY = new byte[0] [0];

Let me know if that sounds correct as well.

3) This problem just appeared in the past week. I think it may have to
do with issue 1223. After generating the classes from
xmldsig-core-schema.xsd, I get problems with the code generated around
the base64 types. I get errors stating the methods from
XMLTypeFactoryImpl don't exist. Perhaps it's my version of EMF? I've
used 2.2.2, 2.2.3, and 2.3.0, but none solved my problem.

4) This is a runtime issue, but it may have to do with issue 1 above.
This was last tested with the Tuscany SDO code built on 4/27.

I'm getting the following error:

java.lang.ClassCastException: java.lang.String
        at 
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLSaveImpl.saveElementFeatureMap(SDOXMLResourceImpl.java:753)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1352)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2459)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1033)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:919)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2166)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1381)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2459)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1033)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:919)
        at 
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLSaveImpl.saveElementFeatureMap(SDOXMLResourceImpl.java:771)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1352)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:624)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:549)
        at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:233)
        at 
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:203)
        at 
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:993)
        at 
org.apache.tuscany.sdo.helper.XMLDocumentImpl.save(XMLDocumentImpl.java:184)
        at 
org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:115)
        at 
org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:110)
        at SimpleStaticTest.descriptorTest(SimpleStaticTest.java:47)
        at SimpleStaticTest.packageDescriptorTest(SimpleStaticTest.java:59)
        at SimpleStaticTest.main(SimpleStaticTest.java:69)

When reading in this file:

<?xml version="1.0" encoding="UTF-8"?>
<sdd-pd:PackageDescriptor descriptorID="0F000F000F000F000F000F000F000F01"
                          descriptorLanguageBundle="com.ibm.res.translations"
                          lastModified="2001-12-31T12:00:00"
                          schemaVersion="1.0"
                          xmlns:ds="http://www.w3.org/2000/09/xmldsig#";
                          xmlns:sdd-common="urn:oasis:names:tc:SDD:1:0:common"

xmlns:sdd-pd="urn:oasis:names:tc:SDD:1:0:packageDescriptor"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="urn:oasis:names:tc:SDD:1:0:packageDescriptor
../../schema/sdd-20070403_36/wd-sdd-packageDescriptor-1.0.xsd

http://www.w3.org/2000/09/xmldsig#
http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd

urn:oasis:names:tc:SDD:1:0:common
../../schema/sdd-20070403_36/wd-sdd-common-1.0.xsd ">
  <PackageIdentity packageType="baseInstall" softwareID="5786-345">
    <Name translationKey="name">Shopping</Name>
    <Description translationKey="desc">Shopping Cart Package</Description>
    <ShortDescription translationKey="short_desc">Shopping
Cart</ShortDescription>
    <Version>4.5</Version>
  </PackageIdentity>
  <Files>
    <File id="earFile" length="0" pathname="./ShoppingCart45.ear"
purpose="content">
        <ds:DigestMethod Algorithm="SHA-1"></ds:DigestMethod>
        <ds:DigestValue></ds:DigestValue>
    </File>
  </Files>
</sdd-pd:PackageDescriptor>

with this code:

        HelperContext context = SDOUtil.createHelperContext();
          
oasis.names.tc.sdd._1._0.deployment.descriptor.DescriptorFactory.INSTANCE.register(context);
        
oasis.names.tc.sdd._1._0.package_.descriptor.DescriptorFactory.INSTANCE.register(context);
        
oasis.names.tc.sdd._1._0.common.CommonFactory.INSTANCE.register(context);
        org.w3._2000._09.xmldsig.XmldsigFactory.INSTANCE.register(context);

        InputStream in = new File(shoppingCart-pd-4.5.xml).toURL().openStream();
        XMLDocument doc = context.getXMLHelper().load(in);
        in.close();

        DataObject descriptor = doc.getRootObject();

        context.getXMLHelper().save(descriptor,
doc.getRootElementURI(), doc.getRootElementName(), System.out);

It has to do with the softwareID attribute in the PackageIdentity
element in the xml file above. For some reason, the code is getting a
String returned when it's expecting a List. When I remove the
softwareID attribute, it runs fine. I think this is related to issue 1
above.

Please let me know if these problems can be resolved. Issue 3 and 4
are the two problems we're unable to work around currently.

Thanks,
-Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to