I'll go for search configuration for now.

On 27 oct. 2010, at 19:23, Emmanuel Bernard wrote:

> Actually I've got a question for the registration of existing service 
> instances. Esp in the case of Infinispan where that use case is requested.
> 
> I can add the contract to SearchConfiguration
> 
> interface SearchConfiguration {
>  ...
>  Map<Class<? extends ServiceProvider<?>>, Object> getExternalServices();
> }
> 
> SearchConfiguration infinispanSearchConfiguration = ...
> infinispanSearchConfiguration.addExternalService(InfinispanContainerProvider.class,
>  cacheContainer);
> SearchFactory sf = new SearchFactoryBuilder().configuration( 
> infinispanSearchConfiguration ).buildSearchFactory();
> 
> HSearch would then register these as external services
> 
> or I could add it to the new programmatic API to build SearchFactories
> 
> SearchConfiguration infinispanSearchConfiguration = ...
> SearchFactory sf = new SearchFactoryBuilder()
>    .configuration( infinispanSearchConfiguration )
>    .addService(InfinispanContainerProvider.class, cacheContainer)
>    .buildSearchFactory();
> 
> I guess I could do both as well.
> 
> WDYT?
> 
> 
> 
> On 27 oct. 2010, at 19:02, Emmanuel Bernard wrote:
> 
>> Hi Sanne and all,
>> I've done a first cut to the external service provider solution. Let me know 
>> if you think that would fit for the InfinispanDP and if you find better 
>> names to the APIs
>> 
>> The core is available in branch 
>> http://github.com/emmanuelbernard/hibernate-search/tree/HSEARCH-603
>> 
>> A service needs to put a 
>> META-INF/services/org.hibernate.search.spi.ServiceProvider file that 
>> contains the implementation of a ServiceProvider interface
>> http://github.com/emmanuelbernard/hibernate-search/blob/HSEARCH-603/hibernate-search/src/test/resources/META-INF/services/org.hibernate.search.spi.ServiceProvider
>> 
>> http://github.com/emmanuelbernard/hibernate-search/blob/HSEARCH-603/hibernate-search/src/main/java/org/hibernate/search/spi/ServiceProvider.java
>> The service provider has start / stop / getService
>> 
>> Accessing the service from directory providers is done via BuildContext
>> http://github.com/emmanuelbernard/hibernate-search/blob/HSEARCH-603/hibernate-search/src/main/java/org/hibernate/search/spi/BuildContext.java
>> 
>> CacheContainer container = 
>> context.registerServiceUse(InfinispanContainerProvider.class);
>> ...
>> context.unregisterServiceUse(InfinispanContainerProvider.class);
>> 
>> Note that the key is the ServiceProvider implementation class instead of a 
>> raw string.
>> 
>> I have not yet implemented the way to pass an existing instance at search 
>> factory creation but that's next.
>> 
>> I'd like to get better names on registerServiceUse / unregisterServiceUse. 
>> I've been thinking about enlistUseOfService / delistUseOfService and 
>> holdService / releaseService.
>> 
>> Feedback welcome, I'd like to push that in beta3.
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to