org.hibernate.boot.registry.selector.StrategyRegistrationProvider Java Examples

The following examples show how to use org.hibernate.boot.registry.selector.StrategyRegistrationProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 6 votes vote down vote up
/**
 * Builds the selector.
 *
 * @param classLoaderService The class loading service used to (attempt to) resolve any un-registered
 *        strategy implementations.
 *
 * @return The selector.
 */
public static StrategySelector buildSelector(ClassLoaderService classLoaderService) {
    final StrategySelectorImpl strategySelector = new StrategySelectorImpl(classLoaderService);

    // build the baseline...
    strategySelector.registerStrategyLazily(Dialect.class, new DefaultDialectSelector());
    strategySelector.registerStrategyLazily(JtaPlatform.class, new DefaultJtaPlatformSelector());
    addTransactionCoordinatorBuilders(strategySelector);
    addMultiTableBulkIdStrategies(strategySelector);
    addImplicitNamingStrategies(strategySelector);
    addCacheKeysFactories(strategySelector);

    // Required to support well known extensions e.g. Envers
    // TODO: should we introduce a new integrator SPI to limit these to extensions supported by Quarkus?
    for (StrategyRegistrationProvider provider : classLoaderService.loadJavaServices(StrategyRegistrationProvider.class)) {
        for (StrategyRegistration discoveredStrategyRegistration : provider.getStrategyRegistrations()) {
            applyFromStrategyRegistration(strategySelector, discoveredStrategyRegistration);
        }
    }

    return strategySelector;
}
 
Example #2
Source File: StrategySelectorBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Builds the selector.
 *
 * @param classLoaderService The class loading service used to (attempt to) resolve any un-registered
 * strategy implementations.
 *
 * @return The selector.
 */
public StrategySelector buildSelector(ClassLoaderService classLoaderService) {
	final StrategySelectorImpl strategySelector = new StrategySelectorImpl( classLoaderService );

	// build the baseline...
	addDialects( strategySelector );
	addJtaPlatforms( strategySelector );
	addTransactionCoordinatorBuilders( strategySelector );
	addMultiTableBulkIdStrategies( strategySelector );
	addEntityCopyObserverStrategies( strategySelector );
	addImplicitNamingStrategies( strategySelector );
	addCacheKeysFactories( strategySelector );

	// apply auto-discovered registrations
	for ( StrategyRegistrationProvider provider : classLoaderService.loadJavaServices( StrategyRegistrationProvider.class ) ) {
		for ( StrategyRegistration discoveredStrategyRegistration : provider.getStrategyRegistrations() ) {
			applyFromStrategyRegistration( strategySelector, discoveredStrategyRegistration );
		}
	}

	// apply customizations
	for ( StrategyRegistration explicitStrategyRegistration : explicitStrategyRegistrations ) {
		applyFromStrategyRegistration( strategySelector, explicitStrategyRegistration );
	}

	return strategySelector;
}
 
Example #3
Source File: BootstrapServiceRegistryBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @deprecated Use {@link #applyStrategySelectors} instead
 */
@SuppressWarnings( {"UnusedDeclaration"})
@Deprecated
public BootstrapServiceRegistryBuilder withStrategySelectors(StrategyRegistrationProvider strategyRegistrationProvider) {
	return applyStrategySelectors( strategyRegistrationProvider );
}
 
Example #4
Source File: BootstrapServiceRegistryBuilder.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Applies one or more strategy selectors announced as available by the passed announcer.
 *
 * @param strategyRegistrationProvider A provider for one or more available selectors
 *
 * @return {@code this}, for method chaining
 *
 * @see org.hibernate.boot.registry.selector.spi.StrategySelector#registerStrategyImplementor(Class, String, Class)
 */
@SuppressWarnings( {"UnusedDeclaration"})
public BootstrapServiceRegistryBuilder applyStrategySelectors(StrategyRegistrationProvider strategyRegistrationProvider) {
	for ( StrategyRegistration strategyRegistration : strategyRegistrationProvider.getStrategyRegistrations() ) {
		this.strategySelectorBuilder.addExplicitStrategyRegistration( strategyRegistration );
	}
	return this;
}
 
Example #5
Source File: StrategyRegistrationProviderList.java    From lams with GNU General Public License v2.0 votes vote down vote up
public List<StrategyRegistrationProvider> getStrategyRegistrationProviders();