[hibernate-dev] HSEARCH-603 external service provider

Emmanuel Bernard emmanuel at hibernate.org
Wed Oct 27 13:02:26 EDT 2010


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.



More information about the hibernate-dev mailing list