org.hibernate.integrator.spi.IntegratorService Java Examples

The following examples show how to use org.hibernate.integrator.spi.IntegratorService. 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: 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 #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 strategySelector The StrategySelector to use
 * @param integratorService The IntegratorService to use
 *
 * @see org.hibernate.boot.registry.BootstrapServiceRegistryBuilder
 */
public BootstrapServiceRegistryImpl(
		boolean autoCloseRegistry,
		ClassLoaderService classLoaderService,
		StrategySelector strategySelector,
		IntegratorService integratorService) {
	this.autoCloseRegistry = autoCloseRegistry;

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

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

	this.integratorServiceBinding = new ServiceBinding<IntegratorService>(
			this,
			IntegratorService.class,
			integratorService
	);
}
 
Example #3
Source File: ReactiveServiceRegistryBuilder.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void applyServiceContributingIntegrators() {
    for ( Integrator integrator : bootstrapServiceRegistry.getService( IntegratorService.class )
            .getIntegrators() ) {
        if (integrator instanceof ServiceContributingIntegrator) {
            ((ServiceContributingIntegrator) integrator).prepareServices( this );
        }
    }
}
 
Example #4
Source File: StandardServiceRegistryBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void applyServiceContributingIntegrators() {
	for ( Integrator integrator : bootstrapServiceRegistry.getService( IntegratorService.class )
			.getIntegrators() ) {
		if ( org.hibernate.integrator.spi.ServiceContributingIntegrator.class.isInstance( integrator ) ) {
			org.hibernate.integrator.spi.ServiceContributingIntegrator.class.cast( integrator ).prepareServices(
					this );
		}
	}
}
 
Example #5
Source File: BootstrapServiceRegistryImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole) {
	if ( ClassLoaderService.class.equals( serviceRole ) ) {
		return (ServiceBinding<R>) classLoaderServiceBinding;
	}
	else if ( StrategySelector.class.equals( serviceRole) ) {
		return (ServiceBinding<R>) strategySelectorBinding;
	}
	else if ( IntegratorService.class.equals( serviceRole ) ) {
		return (ServiceBinding<R>) integratorServiceBinding;
	}

	return null;
}
 
Example #6
Source File: HibernateDatastore.java    From gorm-hibernate5 with Apache License 2.0 5 votes vote down vote up
private Metadata getMetadataInternal() {
    Metadata metadata = null;
    ServiceRegistry bootstrapServiceRegistry = ((SessionFactoryImplementor) sessionFactory).getServiceRegistry().getParentServiceRegistry();
    Iterable<Integrator> integrators = bootstrapServiceRegistry.getService(IntegratorService.class).getIntegrators();
    for (Integrator integrator : integrators) {
        if (integrator instanceof MetadataIntegrator) {
            metadata = ((MetadataIntegrator) integrator).getMetadata();
        }
    }
    return metadata;
}
 
Example #7
Source File: BootstrapServiceRegistryImpl.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a BootstrapServiceRegistryImpl.
 *
 * Do not use directly generally speaking.  Use {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder}
 * instead.
 *
 * @param classLoaderService The ClassLoaderService to use
 * @param strategySelector The StrategySelector to use
 * @param integratorService The IntegratorService to use
 *
 * @see org.hibernate.boot.registry.BootstrapServiceRegistryBuilder
 */
public BootstrapServiceRegistryImpl(
		ClassLoaderService classLoaderService,
		StrategySelector strategySelector,
		IntegratorService integratorService) {
	this( true, classLoaderService, strategySelector, integratorService );
}