I am not really sure what you mean by "need a way to find out whether the passed MetadataBuilder is meant to bootstrap Hibernate ORM or OGM". I assume what you mean is really much more simple: how do I access configuration settings from within a MetadataBuilderContributor? Presumably a "yes OGM is available on the classpath, but it should not be used here" setting. That is the general tact we use for discovered services and allowing them to be skipped.
Anyway, I will have to alter the MetadataBuilderContributor interface to accept the StandardServiceRegistry. Your option (3) Also... Funny timing :) I was thinking some more this morning about ways to allow OGM to alter stuff in this process. I think another thing we should do is to make the SessionFactoryBuilder pluggable. The default impl would build instances of org.hibernate.internal.SessionFactoryImpl. OGM could plug in an impl that builds the OGM-specific SessionFactory. That would allow OGM users to seamlessly use the same bootstrap constructs. Perhaps even a pluggable MetadataBuildingProcess? On Wed, Apr 15, 2015 at 4:52 AM, Gunnar Morling <gun...@hibernate.org> wrote: > Steve, all, > > For migrating OGM to the new ORM 5 bootstrap APIs, I am looking into using > a MetadataBuilderContributor for applying an OGM-specific > ImplicitNamingStrategy. > > Provided it is exposed via META-INF/services, the contributor is run > un-conditionally. So I'd need a way to find out whether the passed > MetadataBuilder is meant to bootstrap Hibernate ORM or OGM. > > If there is no way to do so (I couldn't find any), could the previously > applied configuration settings be exposed e.g. via > > * an accessor MetadataBuilder#getSettings() > * or a new parameter on > MetadataBuilderContributor#contribute(MetadataBuilder b, Map<String, > Object> settings) > * or even MetadataBuilderContributor#contribute(MetadataBuilder b, > StandardServiceRegistry ssr) > > ? > > Then I could make contribute() instantly return depending on some property > which is set before (we can do that for JPA in HibernateOgmPersistence, > OGM's PersistenceProvider, and in a custom ServiceRegistry factory for > non-JPA). > > Thanks, > > --Gunnar > _______________________________________________ > 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