You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Cassie Doll (JIRA)" <ji...@apache.org> on 2008/09/02 19:27:44 UTC

[jira] Created: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Modify BeanXmlConveter to output properly formatted xml. 
---------------------------------------------------------

                 Key: SHINDIG-562
                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
             Project: Shindig
          Issue Type: New Feature
          Components: RESTful API (Java)
            Reporter: Cassie Doll
            Priority: Blocker


The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Assigned: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Cassie Doll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cassie Doll reassigned SHINDIG-562:
-----------------------------------

    Assignee:     (was: Cassie Doll)

Unassigning this issue because I am having real difficulties with betwixt. 

I'm hoping that there is someone out there who has more experience with advanced configuration of betwixt and can help Shindig cross this issue off the list. Here are the things I think are left to do:

1. empty lists need to be suppressed (i'm not sure why they are showing up...)

2. maps need a custom outputter. essentially, when we have a map like this:  {key : value, key2 : value2} we need the following xml:
<key>value</key> <key2>value2</key2>

by default it does this:

<empty>false</empty>
<entry><key>key</key><value>value</value></entry>
<entry><key>key2</key><value>value2</value></entry>


3. within a list the items need to be renamed. (i thought this would be easy with .betwixt files but i couldn't get the converter to find/use my .betwixt files)

Betwixt does this by default:
<accounts>
  <AccountImpl> //that's the name of the java class
  ...
  </AccountImpl>
</accounts>
<activities>
  <String>...</String>
</activities>

and we need this:
<accounts>
  <account>
  ...
  </account>
</accounts>
<activities>
  <activity>...</activity>
</activities>

So there are 3 concrete things left - and then we will just need to check out output against the xsd to double check that we caught everything.

Patches welcome!

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Assigned: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ian Boston reassigned SHINDIG-562:
----------------------------------

    Assignee: Ian Boston

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641224#action_12641224 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------



There is now an XStream based implementation with unit tests that works.

If this issue is still a blocker, I can complete the integration of this converter, and port the atom converter to use the same code.

So..... is this issue still a blocker, and is the Xstream converter acceptable ?

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638746#action_12638746 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

Work in progress has been posted at 
http://codereview.appspot.com/7289


> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645635#action_12645635 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

Ignore my previous comment, I wrote a converter that inspects annotated beans and works directly with the Xtream writer. The implementaion is now complete and the unit tests pass. I suspect there will need to be some optimization to get some of the resolution methods work as lookups, and to clean up trailing spaces and other things.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645136#action_12645136 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

The XStream  converters are now active trunk.
Most of the unit tests pass.
The XSD in the 081 spec, is clearly not complete, and there appear to be a number of missing fields, and missmatches to the text of the spec, so I am working with a modified XSD that matches the text of the spec document and should be closer to 0.9


> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638745#action_12638745 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

I now have a fully working Bean->XML implementation based on XStream that appears to be relatively easy to configure. It needs a few hashmaps populated to modify the behaviour and classes in some parts, and a modified Map marshaller.

I will post a working diff to the code review site and a url here.



> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639230#action_12639230 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

I have now committed, but not enabled the XStream implementation. It does work if activated in the Guice modules. I do however think that it needs more unit tests to validate that the serialization works in all instances, and it needs the same technique to be used for atom serialization.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Closed: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ian Boston closed SHINDIG-562.
------------------------------

    Resolution: Fixed

This is now fixed, the atom format still remains to be checked and tested.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638922#action_12638922 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

Serialization now works in both directions, I have tested with some small test cases, will expand to some larger test cases.

Patch Set 2 at http://codereview.appspot.com/7289  represents where this issue is at present.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639231#action_12639231 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

"
2. maps need a custom outputter. essentially, when we have a map like this: {key : value, key2 : value2} we need the following xml:
<key>value</key> <key2>value2</key2> 
"

Looking at the XSD for appdata, that map is defined as

<entry>
    <key>value</key>
    <value>value2</value>
</entry>

The suggested form cant be validated by XSD since the element names are variable, so 
the code committed uses the <entry> variant.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637428#action_12637428 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------

1. 
The empty lists appear to be Ok, the following unit test passes.

 public void testEmptyList() throws XmlException {
    List<String> empty = new ArrayList<String>();
    String xml = beanXmlConverter.convertToXml(empty);
    XmlUtil.parse(xml);
    String expectedXml =
      "<response/>";
    assertEquals(expectedXml, StringUtils.deleteWhitespace(xml));

    List<List<String>> emptyLists = new ArrayList<List<String>>();
    emptyLists.add(empty);
    emptyLists.add(empty);
    emptyLists.add(empty);
    xml = beanXmlConverter.convertToXml(emptyLists);
    XmlUtil.parse(xml);
    expectedXml =
      "<response>" +
      "<ArrayList/>" +
      "<ArrayList/>" +
      "<ArrayList/>" +
      "</response>";
    assertEquals(expectedXml, StringUtils.deleteWhitespace(xml));
  }
  

However, question.

Should the second response really be 
<response/>

as opposed to 
<response>
  <ArrayList/>
  <ArrayList/>
  <ArrayList/>
</response>


?

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Commented: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645484#action_12645484 ] 

Ian Boston commented on SHINDIG-562:
------------------------------------




Oh dear!

XStream searializes fields not methods, and since we need to serialize API's and the fields may (and are proxied) we cant use XStream.

Its probably great if you want to store beans to xml and ..... but hopeless without method based serialization for API's.

I should apologizes to Evan who was working on an annotation based method, which might make more sense, but I am going to go and have a quick look at other possibilities.
The work is not entirely wasted, as we have a xsd, and unit tests.

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Ian Boston
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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


[jira] Assigned: (SHINDIG-562) Modify BeanXmlConveter to output properly formatted xml.

Posted by "Cassie Doll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cassie Doll reassigned SHINDIG-562:
-----------------------------------

    Assignee: Cassie Doll

> Modify BeanXmlConveter to output properly formatted xml. 
> ---------------------------------------------------------
>
>                 Key: SHINDIG-562
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-562
>             Project: Shindig
>          Issue Type: New Feature
>          Components: RESTful API (Java)
>            Reporter: Cassie Doll
>            Assignee: Cassie Doll
>            Priority: Blocker
>
> The BeanXmlConverter needs to match the xsd in the opensocial restful spec.

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