org.hibernate.boot.registry.selector.internal.StrategySelectorImpl Java Examples

The following examples show how to use org.hibernate.boot.registry.selector.internal.StrategySelectorImpl. 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: BootstrapServiceRegistryImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a BootstrapServiceRegistryImpl.
 *
 * Do not use directly generally speaking.  Use {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder}
 * instead.
 *
 * @param autoCloseRegistry See discussion on
 * {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder#disableAutoClose}
 * @param classLoaderService The ClassLoaderService to use
 * @param providedIntegrators The group of explicitly provided integrators
 *
 * @see org.hibernate.boot.registry.BootstrapServiceRegistryBuilder
 */
public BootstrapServiceRegistryImpl(
		boolean autoCloseRegistry,
		ClassLoaderService classLoaderService,
		LinkedHashSet<Integrator> providedIntegrators) {
	this.autoCloseRegistry = autoCloseRegistry;

	this.classLoaderServiceBinding = new ServiceBinding<ClassLoaderService>(
			this,
			ClassLoaderService.class,
			classLoaderService
	);

	final StrategySelectorImpl strategySelector = new StrategySelectorImpl( classLoaderService );
	this.strategySelectorBinding = new ServiceBinding<StrategySelector>(
			this,
			StrategySelector.class,
			strategySelector
	);

	this.integratorServiceBinding = new ServiceBinding<IntegratorService>(
			this,
			IntegratorService.class,
			new IntegratorServiceImpl( providedIntegrators, classLoaderService )
	);
}
 
Example #3
Source File: PreconfiguredServiceRegistryBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private BootstrapServiceRegistry buildEmptyBootstrapServiceRegistry() {

        // N.B. support for custom IntegratorProvider injected via Properties (as
        // instance) removed

        // N.B. support for custom StrategySelector is not implemented yet

        final StrategySelectorImpl strategySelector = new StrategySelectorImpl(FlatClassLoaderService.INSTANCE);

        return new BootstrapServiceRegistryImpl(true,
                FlatClassLoaderService.INSTANCE,
                strategySelector, // new MirroringStrategySelector(),
                new MirroringIntegratorService(integrators));
    }
 
Example #4
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private static <T> void applyFromStrategyRegistration(
        StrategySelectorImpl strategySelector,
        StrategyRegistration<T> strategyRegistration) {
    for (String name : strategyRegistration.getSelectorNames()) {
        strategySelector.registerStrategyImplementor(
                strategyRegistration.getStrategyRole(),
                name,
                strategyRegistration.getStrategyImplementation());
    }
}
 
Example #5
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static void addTransactionCoordinatorBuilders(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            TransactionCoordinatorBuilder.class,
            JdbcResourceLocalTransactionCoordinatorBuilderImpl.SHORT_NAME,
            JdbcResourceLocalTransactionCoordinatorBuilderImpl.class);
    strategySelector.registerStrategyImplementor(
            TransactionCoordinatorBuilder.class,
            JtaTransactionCoordinatorBuilderImpl.SHORT_NAME,
            JtaTransactionCoordinatorBuilderImpl.class);
}
 
Example #6
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static void addMultiTableBulkIdStrategies(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            PersistentTableBulkIdStrategy.SHORT_NAME,
            PersistentTableBulkIdStrategy.class);
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            GlobalTemporaryTableBulkIdStrategy.SHORT_NAME,
            GlobalTemporaryTableBulkIdStrategy.class);
    strategySelector.registerStrategyImplementor(
            MultiTableBulkIdStrategy.class,
            LocalTemporaryTableBulkIdStrategy.SHORT_NAME,
            LocalTemporaryTableBulkIdStrategy.class);
}
 
Example #7
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static void addImplicitNamingStrategies(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            ImplicitNamingStrategy.class,
            "default",
            ImplicitNamingStrategyJpaCompliantImpl.class);
    strategySelector.registerStrategyImplementor(
            ImplicitNamingStrategy.class,
            "jpa",
            ImplicitNamingStrategyJpaCompliantImpl.class);
    strategySelector.registerStrategyImplementor(
            ImplicitNamingStrategy.class,
            "component-path",
            ImplicitNamingStrategyComponentPathImpl.class);
}
 
Example #8
Source File: QuarkusStrategySelectorBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private static void addCacheKeysFactories(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            CacheKeysFactory.class,
            DefaultCacheKeysFactory.SHORT_NAME,
            DefaultCacheKeysFactory.class);
    strategySelector.registerStrategyImplementor(
            CacheKeysFactory.class,
            SimpleCacheKeysFactory.SHORT_NAME,
            SimpleCacheKeysFactory.class);
}
 
Example #9
Source File: PreconfiguredReactiveServiceRegistryBuilder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private BootstrapServiceRegistry buildEmptyBootstrapServiceRegistry() {

        // N.B. support for custom IntegratorProvider injected via Properties (as
        // instance) removed

        // N.B. support for custom StrategySelector is not implemented yet

        final StrategySelectorImpl strategySelector = new StrategySelectorImpl(FlatClassLoaderService.INSTANCE);

        return new BootstrapServiceRegistryImpl(true,
                FlatClassLoaderService.INSTANCE,
                strategySelector, // new MirroringStrategySelector(),
                new MirroringIntegratorService(integrators));
    }