代码之家  ›  专栏  ›  技术社区  ›  Jon W

修改apache shindig以接受新的数据管道

  •  1
  • Jon W  · 技术社区  · 15 年前

    我一直在努力整合 Open Social 变成服务,并修改 Apache Shindig 以适应。我想使用一些非开放的社交功能,到目前为止我已经了解了如何添加基本的JS功能和服务器端数据方法。不过,我想补充一下 Data Pipelining 标准,我很难找到文档。有人知道如何更改ApacheShindig的开放式社交模板部分吗?文件很稀少。

    1 回复  |  直到 15 年前
        1
  •  1
  •   Ferid Gürbüz    15 年前

    我没有太多的经验和辛迪格一起工作,我会尽力帮助。

    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 越来越多…

    我想,为了吸引您的服务,需要这样一个模块。 在这里, 米汉德尔 是我自己的管理者:

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

    霍维尔,你应该深入了解 狂欢节 假装要做你想要的东西。在Web上有很多例子解释了如何用guice扩展和配置shindig。