HHH-9726 - Rename MetadataBuilderContributor to MetadataBuilderInitializer and pass it the StandardServiceRegistry

This commit is contained in:
Steve Ebersole 2015-04-15 11:44:49 -05:00
parent 596753ea4b
commit 83f83c57dc
3 changed files with 20 additions and 7 deletions

View File

@ -66,7 +66,7 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.selector.spi.StrategySelector;
import org.hibernate.boot.spi.MappingDefaults;
import org.hibernate.boot.spi.MetadataBuilderContributor;
import org.hibernate.boot.spi.MetadataBuilderInitializer;
import org.hibernate.boot.spi.MetadataBuildingOptions;
import org.hibernate.boot.spi.MetadataSourcesContributor;
import org.hibernate.cache.spi.RegionFactory;
@ -145,11 +145,13 @@ public class MetadataBuilderImpl implements MetadataBuilder, TypeContributions {
contributor.contribute( sources );
}
// todo : not so sure this is needed anymore.
// these should be set during the StandardServiceRegistryBuilder.configure call
applyCfgXmlValues( serviceRegistry.getService( CfgXmlAccessService.class ) );
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
for ( MetadataBuilderContributor contributor : classLoaderService.loadJavaServices( MetadataBuilderContributor.class ) ) {
contributor.contribute( this );
for ( MetadataBuilderInitializer contributor : classLoaderService.loadJavaServices( MetadataBuilderInitializer.class ) ) {
contributor.contribute( this, serviceRegistry );
}
}

View File

@ -24,12 +24,17 @@
package org.hibernate.boot.spi;
import org.hibernate.boot.MetadataBuilder;
import org.hibernate.boot.registry.StandardServiceRegistry;
/**
* Contract for contributing to the initialization of MetadataBuilder
* Contract for contributing to the initialization of MetadataBuilder. Called
* immediately after any configuration settings have been applied from
* {@link org.hibernate.engine.config.spi.ConfigurationService}. Any values specified
* here override those. Any values set here can still be overridden explicitly by the user
* via the exposed config methods of {@link MetadataBuilder}
*
* @author Steve Ebersole
*/
public interface MetadataBuilderContributor {
public void contribute(MetadataBuilder metadataBuilder);
public interface MetadataBuilderInitializer {
public void contribute(MetadataBuilder metadataBuilder, StandardServiceRegistry serviceRegistry);
}

View File

@ -28,7 +28,13 @@ import java.util.Map;
import org.hibernate.service.Service;
/**
* Provides access to the initial user-provided configuration values
* Provides access to the initial user-provided configuration values. Generally speaking
* these values come from:<ul>
* <li>Calls to {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder#loadProperties}</li>
* <li>Calls to {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder#applySetting}</li>
* <li>Calls to {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder#applySettings}</li>
* <li>Calls to {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder#configure}</li>
* </ul>
*
* @author Steve Ebersole
*/