Mike,

You don't need to provide your own implementation of 
XStream081Configuration.java.  Within XStream081Configuration.java, you only 
need to register your top level data types (e.g. Space.class and 
Application.class), just as an "activityEntry" is mapped to an 
ActivityEntry.class.  This happens within 4 places:
    initNameSpace();
    elementMappingList.put(ConverterSet.DEFAULT, ImmutableList.of(...
    elementMappingList.put(ConverterSet.COLLECTION, ImmutableList.of(
    elementClassMap.put(ConverterSet.DEFAULT, new ImmutableMap.Builder<String, 
Class<?>>()

Also within this file, add a new ImplicitCollectionFieldMapping() for any lists 
within your Spaces.java & Applications.java classes.  This tells xstream to 
recognize these fields as lists of the proper type when serializing.

Next, reference SocialApiGuiceModule.java within social > core > config.  This 
shows you how to set up the bindings for your service handlers within your 
guice module.  As you said, bind XStreamConfiguration to 
XStream081Configuration, then register the bean converters for XML, JSON, and 
ATOM:

    bind(XStreamConfiguration.class).to(XStream081Configuration.class);
    
bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.xml")).to(
        BeanXStreamConverter.class);
    
bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.json")).to(
        BeanJsonConverter.class);
    
bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.atom")).to(
        BeanXStreamAtomConverter.class);

ATOM requires a couple of extra steps within util > atom.  Specifically, you 
need to add your data types to AtomEntry.java and AtomContent.java.  Don't 
stress too much about the ATOM serialization as XML & JSON are the primary 
formats.  There's talk of deprecating ATOM altogether.

Last, you can automate the testing of your service, handler, and serialization 
by modeling after testing ActivityStreams.  Refer to social-api > src > test > 
java > org > apache > shindig > social > dataservice > integration.

This is the general process.  Hope this helps.

- Eric W.

Reply via email to