修改 Apache Shindig 以接受新的数据管道

发布于 2024-09-15 14:58:45 字数 431 浏览 1 评论 0原文

我一直致力于将 Open Social 集成到服务中,并修改 Apache Shindig 以适应。有一些非开放社交功能我想使用,到目前为止我已经弄清楚如何添加基本的js功能和服务器端数据方法。但是,我想添加数据管道标准,而且我很难找到文档。有人知道如何更改 Apache Shindig 的开放社交模板部分吗?文档是,呃,稀疏的。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东走西顾 2024-09-22 14:58:45

我没有太多与 Shindig 合作的经验,但我会尽力提供帮助。

Apache Shindig 使用 Google Guice 作为依赖项注入框架,这使得覆盖 Shindig 服务变得简单实施。使用 google guice,您可以构建自己的模块并将它们注入到 shindig 中。

也许,您需要扩展 org.apache.shindig.gadgets.render.ProxyRenderer,实现 org.netmera.portal.shindig.RequestPipeline、org.apache。 shindig.gadgets.templates.TemplateModule 以及越来越多...

我认为,要挂钩您的服务,需要这样的模块。
这里,MyHandler.class 是我自己的处理程序:

/**
 * 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);
    }
}

但是,您应该挖掘 Shindig 和 Guice 来使事情完全符合您的要求。网络上有很多示例解释了如何使用 Guice 扩展和配置 Shindig。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文