1

私はOpen Socialをサービスに統合し、それに対応するようにApache Shindigを変更する作業を行ってきました。使用したい非オープンソーシャル機能がいくつかあります。これまでのところ、基本的な js 機能とサーバー側のデータ メソッドを追加する方法を理解しました。しかし、 Data Pipelining標準に追加したいのですが、ドキュメントを見つけるのに苦労しています。Apache Shindig の Open Social Templates 部分を変更する方法を知っている人はいますか? ドキュメントはまばらです。

4

1 に答える 1

1

私は Shindig と一緒に働いた経験があまりありませんが、私は助けようとします.

Apache Shindig は、依存性注入フレームワークとしてGoogle Guiceを使用しているため、shindig サービスの実装を簡単に上書きできます。Google Guice を使用すると、独自のモジュールを構築し、それらを shindig に挿入できます。

おそらく、拡張org.apache.shindig.gadgets.render.ProxyRenderer、実装org.netmera.portal.shindig.RequestPipelineorg.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 を掘り下げて、まさにあなたが望むものを作成する必要があります。Web には、Guice を使用して Shindig を拡張および構成することを説明するかなりの例があります。

于 2010-09-07T23:02:03.573 に答える