[hibernate-dev] Redefining the API/SPI/implementation split

Sanne Grinovero sanne at hibernate.org
Fri Dec 5 15:30:01 EST 2014


One of today's issues for Hibernate Search had the goal to move this class:

org.hibernate.search.engine.spi.SearchFactoryImplementor

to not have the "SPI" package postfix as we never meant this to be
part of the SPI but rather an internal contract.
While it's an internal contract, it's functionality is needed by other
modules *in our same repository*, for example hibernate-search-orm
needs to access it.
So we consider it an integration contract across our own shards, but
it's not meant to be used by anyone else.

So it seemed a straight-forward decision to move it to:

org.hibernate.search.engine.impl.SearchFactoryImplementor

However then we need to patch the OSGi descriptor to export this package:
org.hibernate.search.engine.impl

By doing so this will export more than what is strictly necessary - as
there are other classes in there - and this gets Karaf to blow up with
many nasty errors as there are dependent classloaders being triggered
by those other internal components. So we really need to keep those
sealed into the module.

So I was thinking to create a new package classification "internal":

org.hibernate.search.engine.internal.SearchFactoryImplementor

We would export this package via OSGi descriptors, but still the name
should be self-explanatory enough as a warning to other consumers?

Sanne


More information about the hibernate-dev mailing list