views:

114

answers:

1

I've been working on integrating Open Social into a service, and modifying Apache Shindig to accommodate. There are some non-open-social features I'd like to use, and I've figured out so far how to add basic js features and server-side data methods. However, I'd like to add to the Data Pipelining standard, and I'm having a hard time finding documentation. Does anyone have any idea how to make changes to the Open Social Templates portion of Apache Shindig? The documentation is, uh, sparse.

+1  A: 

I do not have too much experience working with Shindig, hovewer i will try to help.

Apache Shindig uses Google Guice as dependency injection framework which makes it simple to overwrite shindig service implementations. With google guice, you can build your own modules and inject them into shindig.

Probably, you need to extend org.apache.shindig.gadgets.render.ProxyRenderer, implement org.netmera.portal.shindig.RequestPipeline, org.apache.shindig.gadgets.templates.TemplateModule and more and more...

I think, to hook your service, a module like this is needed. Here, MyHandler.class is my own handler:

/**
 * Provides social api component injection.
 */
public class MySocialApiModule extends SocialApiGuiceModule {

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.apache.shindig.social.core.config.SocialApiGuiceModule#configure()
     */
    @Override
    protected void configure(){
        this.bind(ParameterFetcher.class).annotatedWith(Names.named("DataServiceServlet")).to(DataServiceServletFetcher.class);
        this.bind(Boolean.class).annotatedWith(Names.named(AnonymousAuthenticationHandler.ALLOW_UNAUTHENTICATED)).toInstance(Boolean.TRUE);
        this.bind(XStreamConfiguration.class).to(XStream081Configuration.class);
        this.bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.xml")).to(BeanXStreamConverter.class);
        this.bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.json")).to(BeanJsonConverter.class);
        this.bind(BeanConverter.class).annotatedWith(Names.named("shindig.bean.converter.atom")).to(BeanXStreamAtomConverter.class);
        this.bind(new TypeLiteral<List<AuthenticationHandler>>(){}).toProvider(AuthenticationHandlerProvider.class);
        final Multibinder<Object> handlerBinder = Multibinder.newSetBinder(this.binder(), Object.class, Names.named("org.apache.shindig.handlers"));
        for (final Class handler : this.getHandlers()) {
            handlerBinder.addBinding().toInstance(handler);
        }
        this.bind(OAuthDataStore.class).to(MyOAuthDataStore.class);
    }

    /**
     * Hook to provide a Set of request handlers. Subclasses may override to add
     * or replace additional handlers.
     */
    @Override
    protected Set<Class<?>> getHandlers(){
        return ImmutableSet.<Class<?>> of(ActivityHandler.class, AppDataHandler.class, MyPersonHandler.class, MessageHandler.class, MyHandler.class, ACLHandler.class);
    }
}

Hovewer, you should dig in Shindig and Guice to make things as exactly what you want. There are quite a bit examples on web that explains extending and configuring Shindig with Guice.

feridcelik
Thanks for the help.
Jweede