You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Richard Mah (JIRA)" <de...@tuscany.apache.org> on 2008/08/07 20:56:44 UTC

[jira] Created: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Tuscany object model does not handle unknown content in composite files.
------------------------------------------------------------------------

                 Key: TUSCANY-2538
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Assembly Model
            Reporter: Richard Mah


Tuscany object model does not handle unknown content in composite files.

Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.

As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Luciano Resende (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luciano Resende reopened TUSCANY-2538:
--------------------------------------

      Assignee: Luciano Resende  (was: Dhaval Chauhan)

Reopening to merge in Java SCA Release 1.3.2

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Luciano Resende
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by Raymond Feng <en...@gmail.com>.
I guess we can add a generic UnknownElementStaxProcessor to read the unknown 
element into DOM (or AXIOM) and add it to the getExtensions() list. The 
unknown elements/attributes will be only valid where <xsd:any> or 
<xsd:anyAttribute> is declared in the XSD for SCDLs.

Thanks,
Raymond
--------------------------------------------------
From: "Richard Mah (JIRA)" <de...@tuscany.apache.org>
Sent: Monday, August 11, 2008 1:32 PM
To: <de...@tuscany.apache.org>
Subject: [jira] Updated: (TUSCANY-2538) Tuscany object model does not handle 
unknown content in composite files.

>
>     [ 
> https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Richard Mah updated TUSCANY-2538:
> ---------------------------------
>
>    Attachment: MyComposite.composite
>
> Hi Simon,
>
> I've attached a simple composite file with a few "unknown content".  Below 
> is the text of the composite file:
> ----------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> name="MyComposite" targetNamespace="http://MyComposite.com">
> <reference name="reference" unknownAttribute="attrValue" />
> <component name="component" />
> <unknownElement unknownAttr="attrValue2">
> <subUnknownElement subUnknownElement="attrValue3" />
> </unknownElement>
> </composite>
> ----------------------------------------------------------------------------------------------------------------------
> The following content will be lost when the compostie file is loaded and 
> written back to file:
> 1)On the Reference Element, the attribute:
>                unknownAttribute="attrValue"
>
> 2)The entire child and subchild of the Composite Element:
>                <unknownElement unknownAttr="attrValue2">
> <subUnknownElement subUnknownElement="attrValue3" />
> </unknownElement>
>
> Thanks Simon.
>
>> Tuscany object model does not handle unknown content in composite files.
>> ------------------------------------------------------------------------
>>
>>                 Key: TUSCANY-2538
>>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>>             Project: Tuscany
>>          Issue Type: Bug
>>          Components: Java SCA Assembly Model
>>            Reporter: Richard Mah
>>         Attachments: MyComposite.composite
>>
>>
>> Tuscany object model does not handle unknown content in composite files.
>> Unknown content in composite files are not persisted when the Tuscany 
>> model is loaded.  As a result, the unknown content is lost when I write 
>> the composite back to file.
>> As an example, say I don't include the Tuscany models which model EJB 
>> bindings.  If I load a composite file which contains EJB bindings and 
>> write it back to file, I lose all of my EJB bindings.  In this example, 
>> there's no expectation to work with the EJB bindings via the Tuscany 
>> model in a "first class way".  Perhaps some generic get/set/edit methods 
>> but at the very least, persist the content of the EJB bindings in the 
>> Tuscany model and write them back out to file.
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 

[jira] Updated: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Richard Mah (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mah updated TUSCANY-2538:
---------------------------------

    Attachment: MyComposite.composite

Hi Simon,

I've attached a simple composite file with a few "unknown content".  Below is the text of the composite file:
----------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
	name="MyComposite" targetNamespace="http://MyComposite.com">
	<reference name="reference" unknownAttribute="attrValue" />
	<component name="component" />
	<unknownElement unknownAttr="attrValue2">
		<subUnknownElement subUnknownElement="attrValue3" />
	</unknownElement>
</composite>
----------------------------------------------------------------------------------------------------------------------
The following content will be lost when the compostie file is loaded and written back to file:
1)On the Reference Element, the attribute:
                unknownAttribute="attrValue"

2)The entire child and subchild of the Composite Element:
                	<unknownElement unknownAttr="attrValue2">
		<subUnknownElement subUnknownElement="attrValue3" />
	</unknownElement>

Thanks Simon.

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>         Attachments: MyComposite.composite
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Dhaval Chauhan (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dhaval Chauhan reassigned TUSCANY-2538:
---------------------------------------

    Assignee: Dhaval Chauhan

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>         Attachments: MyComposite.composite
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Luciano Resende (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luciano Resende resolved TUSCANY-2538.
--------------------------------------

    Resolution: Fixed

Fixed under svn revision #695536. Thanks Dhaval.

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Luciano Resende (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luciano Resende resolved TUSCANY-2538.
--------------------------------------

    Resolution: Fixed

Merged changes in Java SCA 1.3.2 branch under svn revision 695573.

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>    Affects Versions: Java-SCA-1.3.2
>            Reporter: Richard Mah
>            Assignee: Luciano Resende
>             Fix For: Java-SCA-1.3.2
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Luciano Resende (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629392#action_12629392 ] 

Luciano Resende commented on TUSCANY-2538:
------------------------------------------

Looks like this patch is breaking various test cases, I could see two patterns on the breakages :

   - Test case was able to call processors.read() and elements would be ignored when processors were not available, this is probably a test case design issue, below is an example and a possible workaround for ReadDocumentTestCase

Index: policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
===================================================================
--- policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java        (revision 693313)
+++ policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java        (working copy)
@@ -63,6 +63,8 @@
     private StAXArtifactProcessor<Object> staxProcessor;
     private Monitor monitor;
         
+    private static final QName elementToProcess = new QName("http://www.osoa.org/xmlns/sca/1.0", "implementationType");
+    
     private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
     private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
     private Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
@@ -95,6 +97,7 @@
             monitor = monitorFactory.createMonitor();
             utilities.addUtility(monitorFactory);
         }
+        
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
         staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
@@ -102,7 +105,18 @@
         URL url = getClass().getResource("test_definitions.xml");
         InputStream urlStream = url.openStream();
         XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
-        reader.next();
+        
+
+        //position on the right element qname to get processed
+        while(reader.hasNext()) {
+               reader.next();
+               int event = reader.getEventType();
+        
+               if(event == START_ELEMENT && reader.getName().equals(elementToProcess)) {
+                       break;
+               }
+        }
+
         while ( true ) {
             int event = reader.getEventType();
             switch (event) {
@@ -142,6 +156,7 @@
                 break;
             }
         }
+
         urlStream.close();
     }


   - The other issue is when no processor is found (e.g during write), but the model wasn't created by the DefaultUnknownElementProcessor, then the write operation will have cast exception issues. Not sure what's the best solution here, as if we don't know how to write, we would get to the same issue that originated the jira defect, but I think we should at least check before casting.

   - I also think we should enhance the code that generates the DOM for the unknown elements to handle attributes. Note that this is different from TUSCANY-2463 that will handle extended attributes and also create a "DefaultUnknownAttributeProcessor" to handle extended attributes that does not have it's own processor.


> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Dhaval Chauhan (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dhaval Chauhan updated TUSCANY-2538:
------------------------------------

    Attachment: tuscany-TUSCANY-2538_1.Dhaval.diff

- Attached patch contains the processor for the unknown element.
- This processor just has the read() method at this point of time. It recognizes and reads contents of the   
   unknown element and generates DOM out of it.
- Currently, I am working on the write() method to write this DOM back to the composite file and some test
   cases to test this whole scenario.
  


> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Dhaval Chauhan (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dhaval Chauhan updated TUSCANY-2538:
------------------------------------

    Attachment: tuscany-TUSCANY-2538.Dhaval.diff

This patch contains following items:
- DefaultUnknownElementProcessor.java : It's a processor that handles the unknown contents inside the 
  composite file.
- TestReadWriteUnkonwnElement.java : Testcase to read and write composite file having unknown 
   contents
- Some additional changes required to make the processor work.



> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>            Assignee: Dhaval Chauhan
>             Fix For: Java-SCA-Next
>
>         Attachments: MyComposite.composite, tuscany-TUSCANY-2538.Dhaval.diff, tuscany-TUSCANY-2538_1.Dhaval.diff
>
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2538) Tuscany object model does not handle unknown content in composite files.

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620897#action_12620897 ] 

Simon Laws commented on TUSCANY-2538:
-------------------------------------

Hi Richard, 

Any chance you could knock up a sample composite file that we can use to test with?

Simon

> Tuscany object model does not handle unknown content in composite files.
> ------------------------------------------------------------------------
>
>                 Key: TUSCANY-2538
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2538
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Richard Mah
>
> Tuscany object model does not handle unknown content in composite files.
> Unknown content in composite files are not persisted when the Tuscany model is loaded.  As a result, the unknown content is lost when I write the composite back to file.
> As an example, say I don't include the Tuscany models which model EJB bindings.  If I load a composite file which contains EJB bindings and write it back to file, I lose all of my EJB bindings.  In this example, there's no expectation to work with the EJB bindings via the Tuscany model in a "first class way".  Perhaps some generic get/set/edit methods but at the very least, persist the content of the EJB bindings in the Tuscany model and write them back out to file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.