You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Yang ZHONG (JIRA)" <tu...@ws.apache.org> on 2006/06/28 00:16:29 UTC

[jira] Created: (TUSCANY-503) XSD substitution support in SDO2

XSD substitution support in SDO2
--------------------------------

         Key: TUSCANY-503
         URL: http://issues.apache.org/jira/browse/TUSCANY-503
     Project: Tuscany
        Type: New Feature

  Components: Java SDO Implementation  
 Environment: Java
    Reporter: Yang ZHONG
    Priority: Minor


Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):

Raymond Feng
Tue, 13 Jun 2006 16:43:09 -0700


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TUSCANY-503) XSD substitution support in SDO2

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-503?page=all ]

Yang ZHONG updated TUSCANY-503:
-------------------------------

    Attachment: patch&test.zip

Attaching contribution and test case.

> XSD substitution support in SDO2
> --------------------------------
>
>          Key: TUSCANY-503
>          URL: http://issues.apache.org/jira/browse/TUSCANY-503
>      Project: Tuscany
>         Type: New Feature

>   Components: Java SDO Implementation
>  Environment: Java
>     Reporter: Yang ZHONG
>     Priority: Minor
>  Attachments: patch&test.zip
>
> Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):
> Raymond Feng
> Tue, 13 Jun 2006 16:43:09 -0700

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TUSCANY-503) XSD substitution support in SDO2

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-503?page=comments#action_12418137 ] 

Yang ZHONG commented on TUSCANY-503:
------------------------------------

Frank and I propose adding this new method into XMLHelper API to support XSD substitution in SDO2:
  /**
   * Gets the Sequence corresponding to the specified substitutable Property of the specified DataObject.
   * @param dataObject Not null, otherwise NullPointerException.
   * @param head A substitution group head property. 
   * @return The Sequence corresponding to the specified substitutable Property of the specified DataObject,
   *         null if the specified Property isn't a substitution head.
   */
    Sequence getSubstitutionValues(DataObject dataObject, Property head);

Before it reaches the spec, we'll host it in SDOUtil for the time being.


> XSD substitution support in SDO2
> --------------------------------
>
>          Key: TUSCANY-503
>          URL: http://issues.apache.org/jira/browse/TUSCANY-503
>      Project: Tuscany
>         Type: New Feature

>   Components: Java SDO Implementation
>  Environment: Java
>     Reporter: Yang ZHONG
>     Priority: Minor

>
> Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):
> Raymond Feng
> Tue, 13 Jun 2006 16:43:09 -0700

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TUSCANY-503) XSD substitution support in SDO2

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-503?page=comments#action_12418353 ] 

Yang ZHONG commented on TUSCANY-503:
------------------------------------

Test code (& the new API usage example):

public final class SubstitutionValues extends junit.framework.TestCase
{
  public void test () throws java.io.IOException
  {
    java.net.URL url = SubstitutionValues.class.getClassLoader().getResource( "SubstitutionValues.xsd");
    XSDHelper.INSTANCE.define( url.openStream(), url.toString());
      //  IOException may be thrown
    final DataObject  object = DataFactory.INSTANCE.create( "http://www.apache.org/tuscany/SubstitutionValues", "Module");
    final Type  type = object.getType();
    assertNotNull( SDOUtil.getSubstitutionValues( object, type.getProperty( "implementation")));
    assertNull( SDOUtil.getSubstitutionValues( object, type.getProperty( "nonSubstitutionHead")));
  }
}

Test XSD:

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.apache.org/tuscany/SubstitutionValues" 
        xmlns:sca="http://www.apache.org/tuscany/SubstitutionValues"> 
  <element name="implementation" type="string"/>
  <complexType name="Module">
    <sequence>
      <element ref="sca:implementation"/>
      <element name="nonSubstitutionHead" type="string"/>
    </sequence>
  </complexType>
  <element name="implementation.java" type="string" substitutionGroup="sca:implementation"/>
</schema>

> XSD substitution support in SDO2
> --------------------------------
>
>          Key: TUSCANY-503
>          URL: http://issues.apache.org/jira/browse/TUSCANY-503
>      Project: Tuscany
>         Type: New Feature

>   Components: Java SDO Implementation
>  Environment: Java
>     Reporter: Yang ZHONG
>     Priority: Minor
>  Attachments: patch&test.zip
>
> Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):
> Raymond Feng
> Tue, 13 Jun 2006 16:43:09 -0700

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TUSCANY-503) XSD substitution support in SDO2

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-503?page=comments#action_12418135 ] 

Yang ZHONG commented on TUSCANY-503:
------------------------------------

Raymond Feng 
Tue, 13 Jun 2006 16:43:09 -0700 

Hi,

Taking the SCA 0.9 XSDs as an example, the "implementation.java" can substitute "implementation". 

<element name="implementation" type="sca:Implementation"/>
<complexType name="Implementation"/>

<element name="implementation.java" type="sca:JavaImplementation" substitutionGroup="sca:implementation"/> 
<complexType name="JavaImplementation">
<complexContent>
<extension base="sca:Implementation">
<sequence>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> 
</sequence>
<attribute name="class" type="NCName" use="required"/>
<anyAttribute namespace="##any" processContents="lax"/>
</extension>
</complexContent>
</complexType>

The XML document is as follows:

<module xmlns="http://www.osoa.org/xmlns/sca/0.9"; xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
name="helloworld">
<component name="HelloWorldServiceComponent">
<implementation.java class="helloworld.HelloWorldImpl"/>
</component>
</module>

I use XSDHelper.define() to convert the XSD into SDO types, load the XML document using XMLHelper and get a DataObject representing the module. 

Now the question for the SDO Type of ComponentType, I'm seeing two properties in the debugger, "implementation" and "implementation.java". I want to differentiate these two properties so that I can produce the same XML document when I navigate the DataObject to construct the XMLStreamReader. Do we have a SDO-way here (I know in EMF we can look into the metadata)?


Raymond Feng
Tue, 13 Jun 2006 17:33:41 -0700

I did some investigation on the EMF implementation and it seems that I need to test if the property is transient (in EMF term). Do we have the same capability in SDO? 


Jeremy Boynes
Wed, 14 Jun 2006 06:24:03 -0700

Shouldn't there just be one property "implementation.java" whose type is
a sub-type of "implementation"?


Raymond Feng
Wed, 14 Jun 2006 09:31:30 -0700

By the SDO spec, the component Type (which owns the implementation substitution group) is open and there will be two properties: 

implementation: normal property in Type.getProperties() list
implementation.java: dynamic property in DataObject.getInstanceProperties() list 

If the type was just open then yes. I thought the intent here though
was substitution so wouldn't that mean that the "implementation"
property should contain an "implementation.java" sub-type instance?


Raymond Feng
Wed, 14 Jun 2006 10:36:55 -0700

It seems that SDO models XSD substitution group as open content. So in this case, we have two properties: implementation and implementation.java. The DataObject.getXXX(Property) method works for both and returns the same value. And because of this, the code doesn't know if the implementation.java substitutes implementation. As a result, the vaule is incorrectly written twice into the XML stream.


Pete Robbins
Wed, 14 Jun 2006 12:35:29 -0700

In the C++ implementation you would only get a single property
"implementation". It's type would be sca:JavaImplementation which is a sub
type of Implemetation. I think this is correct as the schema tells us that
when loading the instance document to treat " implementation.java"  as
"implementation" so you should not see a property named implementation.java.

possibly...


Frank Budinsky
Wed, 14 Jun 2006 15:03:23 -0700

Raymond is trying to write a serializer, and I presume he wants to produce 
this:

<implementation.java ...>

If the only property on the object is "implementation" with a value that 
is an sca:Implementation subclass, you'd get/expect this when serializing:

<implementation xsi:type="sca:JavaImplementation" ...>

which is valid, but isn't using the substitution group.

So it's really the "implementation.java" property that we need to 
serialize, but the "implementation" property is a static property of the 
Type, so it will always be there. In the Java implementation they both 
return the same thing, but the serializer needs to know that one is just 
derived from the other and not to serialize them both.

More generally, I'm wondering how the C++ implementation will serialize 
this. Does it roundtrip back to the same XML that was loaded?


Jeremy Boynes
Wed, 14 Jun 2006 09:43:43 -0700


> XSD substitution support in SDO2
> --------------------------------
>
>          Key: TUSCANY-503
>          URL: http://issues.apache.org/jira/browse/TUSCANY-503
>      Project: Tuscany
>         Type: New Feature

>   Components: Java SDO Implementation
>  Environment: Java
>     Reporter: Yang ZHONG
>     Priority: Minor

>
> Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):
> Raymond Feng
> Tue, 13 Jun 2006 16:43:09 -0700

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (TUSCANY-503) XSD substitution support in SDO2

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-503?page=all ]

Frank Budinsky resolved TUSCANY-503.
------------------------------------

    Resolution: Fixed

Patch committed in revision 422835.

> XSD substitution support in SDO2
> --------------------------------
>
>                 Key: TUSCANY-503
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-503
>             Project: Tuscany
>          Issue Type: New Feature
>          Components: Java SDO Implementation
>         Environment: Java
>            Reporter: Yang ZHONG
>            Priority: Minor
>         Attachments: patch&test.zip
>
>
> Copied from eMail thread "Question about XSD substitution support in SDO2" (http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg03963.html):
> Raymond Feng
> Tue, 13 Jun 2006 16:43:09 -0700

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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