Java 修改apacheshindig以接受新的数据管道

Java 修改apacheshindig以接受新的数据管道,java,javascript,opensocial,apache-shindig,Java,Javascript,Opensocial,Apache Shindig,我一直致力于集成到服务中,并进行修改以适应。我想使用一些非开放的社交功能,到目前为止,我已经知道了如何添加基本的js功能和服务器端数据方法。然而,我想添加到标准中,我很难找到文档。有人知道如何对ApacheShindig的开放式社交模板部分进行更改吗?文档是,呃,稀疏的。我没有太多与Shindig合作的经验,hovewer我会尽力提供帮助 apacheshindig使用依赖注入框架,这使得覆盖Shindig服务实现变得简单。通过GoogleGuice,您可以构建自己的模块并将其注入shindig

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

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

apacheshindig使用依赖注入框架,这使得覆盖Shindig服务实现变得简单。通过GoogleGuice,您可以构建自己的模块并将其注入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);
    }
}
/**
*提供社交api组件注入。
*/
公共类MySocialApiModule扩展了SocialApiGuiceModule{
/*
*(非Javadoc)
* 
*@见
*org.apache.shindig.social.core.config.SocialApiGuiceModule#configure()
*/
@凌驾
受保护的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);
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(beanxreamatomconverter.class);
this.bind(new TypeLiteral(){}).toProvider(AuthenticationHandlerProvider.class);
final Multibinder handlerBinder=Multibinder.newSetBinder(this.binder(),Object.class,Names.named(“org.apache.shindig.handlers”);
for(最终类处理程序:this.getHandlers()){
handlerBinder.addBinding().toInstance(处理程序);
}
bind(OAuthDataStore.class).to(MyOAuthDataStore.class);
}
/**
*钩子提供一组请求处理程序。子类可以重写以添加
*或替换其他处理程序。
*/
@凌驾
受保护的集合>(ActivityHandler.class、AppDataHandler.class、MyPersonHandler.class、MessageHandler.class、MyHandler.class、ACLHandler.class);
}
}

Howewer,你应该挖掘Shindig和Guice,使事情完全符合你的需要。web上有很多例子解释了如何使用Guice扩展和配置Shindig。

我没有太多使用Shindig的经验,但我会尽力提供帮助

apacheshindig使用依赖注入框架,这使得覆盖Shindig服务实现变得简单。通过GoogleGuice,您可以构建自己的模块并将其注入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);
    }
}
/**
*提供社交api组件注入。
*/
公共类MySocialApiModule扩展了SocialApiGuiceModule{
/*
*(非Javadoc)
* 
*@见
*org.apache.shindig.social.core.config.SocialApiGuiceModule#configure()
*/
@凌驾
受保护的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);
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(beanxreamatomconverter.class);
this.bind(new TypeLiteral(){}).toProvider(AuthenticationHandlerProvider.class);
final Multibinder handlerBinder=Multibinder.newSetBinder(this.binder(),Object.class,Names.named(“org.apache.shindig.handlers”);
for(最终类处理程序:this.getHandlers()){
handlerBinder.addBinding().toInstance(处理程序);
}
bind(OAuthDataStore.class).to(MyOAuthDataStore.class);
}
/**
*钩子提供一组请求处理程序。子类可以重写以添加
*或替换其他处理程序。
*/
@凌驾
受保护的集合>(ActivityHandler.class、AppDataHandler.class、MyPersonHandler.class、MessageHandler.class、MyHandler.class、ACLHandler.class);
}
}

Howewer,你应该挖掘Shindig和Guice,使事情完全符合你的需要。web上有很多例子解释了如何使用Guice扩展和配置Shindig。

您能举个例子说明您希望对模板进行哪些更改吗?“这些文件看起来不太稀疏。”文森特说。我有一个定制的SPI挂钩