[ 
http://opencast.jira.com/browse/MH-8850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=30832#comment-30832
 ] 

Christoph E. Driessen commented on MH-8850:
-------------------------------------------

The problem that the used JAXB implementation serializes single element 
lists/arrays as an object was something I was facing while working for an ETH 
project. I figured out that this behavior, along with others, is something 
vendor specific. This makes it difficult to turn off.
I also tried to implement a custom ContextProvider to engage into the 
serialization process but CXF (our JAXB implementation) does not support 
registering ContextProvider via the @Provider annotation. Quote: "Putting 
@Provider annotation on the provider class is something that should lead to 
your provider being registered with the runtime. CXF does not support this 
feature yet."
It is recommended to use some Spring bean config, but ... (fill in the gap 
yourself ;)

Since I'm not a big fan of all those annotation driven frameworks that try to 
magically handle things in the background leaving you alone when it comes to 
serious applications I thought about a different approach. An approach that 
yields control back to the developer. So I came up with a small set of 
functions wrapping the json-simple library (which is already part of the 
project) that lets you create JSON output like this:

      jO(p("offset", offset),
          p("count", ts.size()),
          p("tracks", jA(jO(p("id", 1),
                                   p("name", "bla"))));

yields:

{
  "offset": 10,
  "count": 20,
  "tracks": [{
    "id": 1,
    "name": "bla"
  }]
}

Along with some mapping over lists etc, you are able to build complex 
structures in an easy, readable, modular and very maintainable way. This again 
proves to me that function composition is a much stronger concept than any of 
those (annotation) frameworks will ever be.

If you're interested along with some demo code leave me a line.
                
> Engage player cannot play videos with a single track
> ----------------------------------------------------
>
>                 Key: MH-8850
>                 URL: http://opencast.jira.com/browse/MH-8850
>             Project: Matterhorn Project
>          Issue Type: Bug
>          Components: Engage Tools
>    Affects Versions: Trunk, 1.4, 1.3, 1.2
>            Reporter: Rubén Pérez Vázquez
>            Priority: Release Blocker
>             Fix For: 1.4, 1.3.1
>
>         Attachments: compose-distribute-publish.xml, dos.png, uno.png
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://opencast.jira.com/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn


To unsubscribe please email
[email protected]
_______________________________________________

Reply via email to