HHH-6683 - Consolidate (consistency) building of service registries

This commit is contained in:
Steve Ebersole 2011-09-27 11:49:17 -05:00
parent 8c691d5fcd
commit f4fa176255
56 changed files with 330 additions and 278 deletions

View File

@ -875,6 +875,11 @@
is the root registry (no parent) in normal use. is the root registry (no parent) in normal use.
</para> </para>
<para>
Instances of boot-strap registries are built using the
<classname>org.hibernate.service.BootstrapServiceRegistryBuilder</classname> builder.
</para>
<section id="services-registry-bootstrap-services"> <section id="services-registry-bootstrap-services">
<title>Boot-strap registry services</title> <title>Boot-strap registry services</title>
<section id="services-ClassLoaderService"> <section id="services-ClassLoaderService">

View File

@ -132,7 +132,7 @@ import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.secure.internal.JACCConfiguration; import org.hibernate.secure.internal.JACCConfiguration;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata; import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.tool.hbm2ddl.IndexMetadata; import org.hibernate.tool.hbm2ddl.IndexMetadata;
import org.hibernate.tool.hbm2ddl.TableMetadata; import org.hibernate.tool.hbm2ddl.TableMetadata;
@ -1754,7 +1754,7 @@ public class Configuration implements Serializable {
@Override @Override
public void sessionFactoryClosed(SessionFactory factory) { public void sessionFactoryClosed(SessionFactory factory) {
( (BasicServiceRegistryImpl) serviceRegistry ).destroy(); ( (StandardServiceRegistryImpl) serviceRegistry ).destroy();
} }
} }
); );

View File

@ -50,7 +50,7 @@ import org.hibernate.metamodel.source.MappingException;
import org.hibernate.metamodel.source.MappingNotFoundException; import org.hibernate.metamodel.source.MappingNotFoundException;
import org.hibernate.metamodel.source.internal.JaxbHelper; import org.hibernate.metamodel.source.internal.JaxbHelper;
import org.hibernate.metamodel.source.internal.MetadataBuilderImpl; import org.hibernate.metamodel.source.internal.MetadataBuilderImpl;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
/** /**
@ -65,17 +65,17 @@ public class MetadataSources {
private final JaxbHelper jaxbHelper; private final JaxbHelper jaxbHelper;
private final BasicServiceRegistry serviceRegistry; private final ServiceRegistry serviceRegistry;
private final EntityResolver entityResolver; private final EntityResolver entityResolver;
private final NamingStrategy namingStrategy; private final NamingStrategy namingStrategy;
private final MetadataBuilderImpl metadataBuilder; private final MetadataBuilderImpl metadataBuilder;
public MetadataSources(BasicServiceRegistry serviceRegistry) { public MetadataSources(ServiceRegistry serviceRegistry) {
this( serviceRegistry, EJB3DTDEntityResolver.INSTANCE, EJB3NamingStrategy.INSTANCE ); this( serviceRegistry, EJB3DTDEntityResolver.INSTANCE, EJB3NamingStrategy.INSTANCE );
} }
public MetadataSources(BasicServiceRegistry serviceRegistry, EntityResolver entityResolver, NamingStrategy namingStrategy) { public MetadataSources(ServiceRegistry serviceRegistry, EntityResolver entityResolver, NamingStrategy namingStrategy) {
this.serviceRegistry = serviceRegistry; this.serviceRegistry = serviceRegistry;
this.entityResolver = entityResolver; this.entityResolver = entityResolver;
this.namingStrategy = namingStrategy; this.namingStrategy = namingStrategy;
@ -96,7 +96,7 @@ public class MetadataSources {
return annotatedClasses; return annotatedClasses;
} }
public BasicServiceRegistry getServiceRegistry() { public ServiceRegistry getServiceRegistry() {
return serviceRegistry; return serviceRegistry;
} }

View File

@ -35,14 +35,14 @@ import org.hibernate.metamodel.binding.IdGenerator;
import org.hibernate.metamodel.binding.PluralAttributeBinding; import org.hibernate.metamodel.binding.PluralAttributeBinding;
import org.hibernate.metamodel.binding.TypeDef; import org.hibernate.metamodel.binding.TypeDef;
import org.hibernate.metamodel.relational.Database; import org.hibernate.metamodel.relational.Database;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.TypeResolver; import org.hibernate.type.TypeResolver;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface MetadataImplementor extends Metadata, BindingContext, Mapping { public interface MetadataImplementor extends Metadata, BindingContext, Mapping {
public BasicServiceRegistry getServiceRegistry(); public ServiceRegistry getServiceRegistry();
public Database getDatabase(); public Database getDatabase();

View File

@ -33,7 +33,7 @@ import org.hibernate.metamodel.Metadata;
import org.hibernate.metamodel.MetadataBuilder; import org.hibernate.metamodel.MetadataBuilder;
import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSourceProcessingOrder;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.config.spi.ConfigurationService; import org.hibernate.service.config.spi.ConfigurationService;
/** /**
@ -93,7 +93,7 @@ public class MetadataBuilderImpl implements MetadataBuilder {
private String defaultSchemaName; private String defaultSchemaName;
private String defaultCatalogName; private String defaultCatalogName;
public OptionsImpl(BasicServiceRegistry serviceRegistry) { public OptionsImpl(ServiceRegistry serviceRegistry) {
ConfigurationService configService = serviceRegistry.getService( ConfigurationService.class ); ConfigurationService configService = serviceRegistry.getService( ConfigurationService.class );
// cache access type // cache access type

View File

@ -49,23 +49,23 @@ import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSourceProcessingOrder;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.SessionFactoryBuilder; import org.hibernate.metamodel.SessionFactoryBuilder;
import org.hibernate.metamodel.binding.AttributeBinding;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.FetchProfile;
import org.hibernate.metamodel.binding.IdGenerator;
import org.hibernate.metamodel.binding.PluralAttributeBinding; import org.hibernate.metamodel.binding.PluralAttributeBinding;
import org.hibernate.metamodel.binding.TypeDef;
import org.hibernate.metamodel.domain.BasicType;
import org.hibernate.metamodel.domain.Type;
import org.hibernate.metamodel.relational.Database;
import org.hibernate.metamodel.source.MappingDefaults; import org.hibernate.metamodel.source.MappingDefaults;
import org.hibernate.metamodel.source.MetaAttributeContext; import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.MetadataSourceProcessor; import org.hibernate.metamodel.source.MetadataSourceProcessor;
import org.hibernate.metamodel.source.annotations.AnnotationMetadataSourceProcessorImpl; import org.hibernate.metamodel.source.annotations.AnnotationMetadataSourceProcessorImpl;
import org.hibernate.metamodel.source.hbm.HbmMetadataSourceProcessorImpl; import org.hibernate.metamodel.source.hbm.HbmMetadataSourceProcessorImpl;
import org.hibernate.metamodel.binding.AttributeBinding;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.FetchProfile;
import org.hibernate.metamodel.binding.IdGenerator;
import org.hibernate.metamodel.binding.TypeDef;
import org.hibernate.metamodel.domain.BasicType;
import org.hibernate.metamodel.domain.Type;
import org.hibernate.metamodel.relational.Database;
import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterClassResolver;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.type.TypeResolver; import org.hibernate.type.TypeResolver;
@ -83,7 +83,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
MetadataImpl.class.getName() MetadataImpl.class.getName()
); );
private final BasicServiceRegistry serviceRegistry; private final ServiceRegistry serviceRegistry;
private final Options options; private final Options options;
private final Value<ClassLoaderService> classLoaderService; private final Value<ClassLoaderService> classLoaderService;
@ -341,7 +341,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
} }
@Override @Override
public BasicServiceRegistry getServiceRegistry() { public ServiceRegistry getServiceRegistry() {
return serviceRegistry; return serviceRegistry;
} }

View File

@ -1,30 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.service;
/**
* @author Steve Ebersole
*/
public interface BasicServiceRegistry extends ServiceRegistry {
}

View File

@ -0,0 +1,127 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.service;
import java.util.LinkedHashSet;
import org.hibernate.integrator.internal.IntegratorServiceImpl;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.service.classloading.internal.ClassLoaderServiceImpl;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
/**
* Builder for bootstrap {@link ServiceRegistry} instances.
*
* @author Steve Ebersole
*
* @see BootstrapServiceRegistryImpl
* @see ServiceRegistryBuilder#ServiceRegistryBuilder(BootstrapServiceRegistryImpl)
*/
public class BootstrapServiceRegistryBuilder {
private final LinkedHashSet<Integrator> providedIntegrators = new LinkedHashSet<Integrator>();
private ClassLoader applicationClassLoader;
private ClassLoader resourcesClassLoader;
private ClassLoader hibernateClassLoader;
private ClassLoader environmentClassLoader;
/**
* Add an {@link Integrator} to be applied to the bootstrap registry.
*
* @param integrator The integrator to add.
* @return {@code this}, for method chaining
*/
public BootstrapServiceRegistryBuilder with(Integrator integrator) {
providedIntegrators.add( integrator );
return this;
}
/**
* Applies the specified {@link ClassLoader} as the application class loader for the bootstrap registry
*
* @param classLoader The class loader to use
* @return {@code this}, for method chaining
*/
@SuppressWarnings( {"UnusedDeclaration"})
public BootstrapServiceRegistryBuilder withApplicationClassLoader(ClassLoader classLoader) {
this.applicationClassLoader = classLoader;
return this;
}
/**
* Applies the specified {@link ClassLoader} as the resource class loader for the bootstrap registry
*
* @param classLoader The class loader to use
* @return {@code this}, for method chaining
*/
@SuppressWarnings( {"UnusedDeclaration"})
public BootstrapServiceRegistryBuilder withResourceClassLoader(ClassLoader classLoader) {
this.resourcesClassLoader = classLoader;
return this;
}
/**
* Applies the specified {@link ClassLoader} as the Hibernate class loader for the bootstrap registry
*
* @param classLoader The class loader to use
* @return {@code this}, for method chaining
*/
@SuppressWarnings( {"UnusedDeclaration"})
public BootstrapServiceRegistryBuilder withHibernateClassLoader(ClassLoader classLoader) {
this.hibernateClassLoader = classLoader;
return this;
}
/**
* Applies the specified {@link ClassLoader} as the environment (or system) class loader for the bootstrap registry
*
* @param classLoader The class loader to use
* @return {@code this}, for method chaining
*/
@SuppressWarnings( {"UnusedDeclaration"})
public BootstrapServiceRegistryBuilder withEnvironmentClassLoader(ClassLoader classLoader) {
this.environmentClassLoader = classLoader;
return this;
}
/**
* Build the bootstrap registry.
*
* @return The built bootstrap registry
*/
public ServiceRegistry build() {
final ClassLoaderServiceImpl classLoaderService = new ClassLoaderServiceImpl(
applicationClassLoader,
resourcesClassLoader,
hibernateClassLoader,
environmentClassLoader
);
final IntegratorServiceImpl integratorService = new IntegratorServiceImpl(
providedIntegrators,
classLoaderService
);
return new BootstrapServiceRegistryImpl( classLoaderService, integratorService );
}
}

View File

@ -24,7 +24,7 @@
package org.hibernate.service; package org.hibernate.service;
/** /**
* The registry of {@link Service services}. * A registry of {@link Service services}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -44,16 +44,19 @@ import org.hibernate.internal.util.config.ConfigurationException;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.internal.jaxb.cfg.JaxbHibernateConfiguration; import org.hibernate.internal.jaxb.cfg.JaxbHibernateConfiguration;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
import org.hibernate.service.internal.JaxbProcessor; import org.hibernate.service.internal.JaxbProcessor;
import org.hibernate.service.internal.ProvidedService; import org.hibernate.service.internal.ProvidedService;
import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.BasicServiceInitiator;
/** /**
* Builder for basic service registry instances. * Builder for standard {@link ServiceRegistry} instances.
* *
* @author Steve Ebersole * @author Steve Ebersole
*
* @see StandardServiceRegistryImpl
* @see BootstrapServiceRegistryBuilder
*/ */
public class ServiceRegistryBuilder { public class ServiceRegistryBuilder {
private static final Logger log = Logger.getLogger( ServiceRegistryBuilder.class ); private static final Logger log = Logger.getLogger( ServiceRegistryBuilder.class );
@ -235,7 +238,7 @@ public class ServiceRegistryBuilder {
* *
* @return The built service registry * @return The built service registry
*/ */
public BasicServiceRegistry buildServiceRegistry() { public ServiceRegistry buildServiceRegistry() {
Map<?,?> settingsCopy = new HashMap(); Map<?,?> settingsCopy = new HashMap();
settingsCopy.putAll( settings ); settingsCopy.putAll( settings );
Environment.verifyProperties( settingsCopy ); Environment.verifyProperties( settingsCopy );
@ -247,7 +250,7 @@ public class ServiceRegistryBuilder {
} }
} }
return new BasicServiceRegistryImpl( bootstrapServiceRegistry, initiators, providedServices, settingsCopy ); return new StandardServiceRegistryImpl( bootstrapServiceRegistry, initiators, providedServices, settingsCopy );
} }
/** /**
@ -255,7 +258,7 @@ public class ServiceRegistryBuilder {
* *
* @param serviceRegistry The registry to be closed. * @param serviceRegistry The registry to be closed.
*/ */
public static void destroy(BasicServiceRegistry serviceRegistry) { public static void destroy(ServiceRegistry serviceRegistry) {
( (BasicServiceRegistryImpl) serviceRegistry ).destroy(); ( (StandardServiceRegistryImpl) serviceRegistry ).destroy();
} }
} }

View File

@ -24,6 +24,7 @@
package org.hibernate.service; package org.hibernate.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.hibernate.cache.internal.RegionFactoryInitiator; import org.hibernate.cache.internal.RegionFactoryInitiator;
@ -45,6 +46,8 @@ import org.hibernate.service.jta.platform.internal.JtaPlatformInitiator;
import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.BasicServiceInitiator;
/** /**
* Central definition of the standard set of service initiators defined by Hibernate.
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class StandardServiceInitiators { public class StandardServiceInitiators {
@ -77,6 +80,6 @@ public class StandardServiceInitiators {
serviceInitiators.add( RegionFactoryInitiator.INSTANCE ); serviceInitiators.add( RegionFactoryInitiator.INSTANCE );
return serviceInitiators; return Collections.unmodifiableList( serviceInitiators );
} }
} }

View File

@ -59,6 +59,7 @@ public abstract class AbstractServiceRegistryImpl implements ServiceRegistryImpl
// iterate it in reverse order which is only available through ListIterator // iterate it in reverse order which is only available through ListIterator
private List<Service> serviceList = new ArrayList<Service>(); private List<Service> serviceList = new ArrayList<Service>();
@SuppressWarnings( {"UnusedDeclaration"})
protected AbstractServiceRegistryImpl() { protected AbstractServiceRegistryImpl() {
this( null ); this( null );
} }

View File

@ -28,6 +28,7 @@ import java.util.LinkedHashSet;
import org.hibernate.integrator.internal.IntegratorServiceImpl; import org.hibernate.integrator.internal.IntegratorServiceImpl;
import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService; import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.Service; import org.hibernate.service.Service;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.internal.ClassLoaderServiceImpl; import org.hibernate.service.classloading.internal.ClassLoaderServiceImpl;
@ -51,8 +52,8 @@ public class BootstrapServiceRegistryImpl implements ServiceRegistryImplementor,
private final ServiceBinding<ClassLoaderService> classLoaderServiceBinding; private final ServiceBinding<ClassLoaderService> classLoaderServiceBinding;
private final ServiceBinding<IntegratorService> integratorServiceBinding; private final ServiceBinding<IntegratorService> integratorServiceBinding;
public static Builder builder() { public static BootstrapServiceRegistryBuilder builder() {
return new Builder(); return new BootstrapServiceRegistryBuilder();
} }
public BootstrapServiceRegistryImpl() { public BootstrapServiceRegistryImpl() {
@ -118,52 +119,4 @@ public class BootstrapServiceRegistryImpl implements ServiceRegistryImplementor,
throw new ServiceException( "Boot-strap registry should only contain directly built services" ); throw new ServiceException( "Boot-strap registry should only contain directly built services" );
} }
public static class Builder {
private final LinkedHashSet<Integrator> providedIntegrators = new LinkedHashSet<Integrator>();
private ClassLoader applicationClassLoader;
private ClassLoader resourcesClassLoader;
private ClassLoader hibernateClassLoader;
private ClassLoader environmentClassLoader;
public Builder with(Integrator integrator) {
providedIntegrators.add( integrator );
return this;
}
public Builder withApplicationClassLoader(ClassLoader classLoader) {
this.applicationClassLoader = classLoader;
return this;
}
public Builder withResourceClassLoader(ClassLoader classLoader) {
this.resourcesClassLoader = classLoader;
return this;
}
public Builder withHibernateClassLoader(ClassLoader classLoader) {
this.hibernateClassLoader = classLoader;
return this;
}
public Builder withEnvironmentClassLoader(ClassLoader classLoader) {
this.environmentClassLoader = classLoader;
return this;
}
public BootstrapServiceRegistryImpl build() {
final ClassLoaderServiceImpl classLoaderService = new ClassLoaderServiceImpl(
applicationClassLoader,
resourcesClassLoader,
hibernateClassLoader,
environmentClassLoader
);
final IntegratorServiceImpl integratorService = new IntegratorServiceImpl(
providedIntegrators,
classLoaderService
);
return new BootstrapServiceRegistryImpl( classLoaderService, integratorService );
}
}
} }

View File

@ -1,38 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.service.internal;
import org.hibernate.service.Service;
/**
* Marker interface for a service proxy which allows mixed-in ability to unproxy.
*
* @author Steve Ebersole
*/
public interface ServiceProxy extends Service {
/**
* Get the target service instance represented by this proxy.
*/
public <T extends Service> T getTargetInstance();
}

View File

@ -31,7 +31,7 @@ import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistryFactory; import org.hibernate.service.spi.SessionFactoryServiceRegistryFactory;
/** /**
* Acts as a {@link Service} in the {@link BasicServiceRegistryImpl} whose function is as a factory for * Acts as a {@link Service} in the {@link StandardServiceRegistryImpl} whose function is as a factory for
* {@link SessionFactoryServiceRegistryImpl} implementations. * {@link SessionFactoryServiceRegistryImpl} implementations.
* *
* @author Steve Ebersole * @author Steve Ebersole

View File

@ -27,7 +27,6 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.Service; import org.hibernate.service.Service;
import org.hibernate.service.StandardSessionFactoryServiceInitiators;
import org.hibernate.service.spi.ServiceInitiator; import org.hibernate.service.spi.ServiceInitiator;
import org.hibernate.service.spi.ServiceRegistryAwareService; import org.hibernate.service.spi.ServiceRegistryAwareService;
import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor;

View File

@ -26,7 +26,7 @@ package org.hibernate.service.internal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.Service; import org.hibernate.service.Service;
import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.BasicServiceInitiator;
import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.Configurable;
@ -35,15 +35,15 @@ import org.hibernate.service.spi.ServiceRegistryAwareService;
import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor;
/** /**
* Standard Hibernate implementation of the service registry. * Hibernate implementation of the standard service registry.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl implements BasicServiceRegistry { public class StandardServiceRegistryImpl extends AbstractServiceRegistryImpl implements ServiceRegistry {
private final Map configurationValues; private final Map configurationValues;
@SuppressWarnings( {"unchecked"}) @SuppressWarnings( {"unchecked"})
public BasicServiceRegistryImpl( public StandardServiceRegistryImpl(
ServiceRegistryImplementor bootstrapServiceRegistry, ServiceRegistryImplementor bootstrapServiceRegistry,
List<BasicServiceInitiator> serviceInitiators, List<BasicServiceInitiator> serviceInitiators,
List<ProvidedService> providedServices, List<ProvidedService> providedServices,

View File

@ -21,9 +21,10 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.service; package org.hibernate.service.internal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.hibernate.event.service.internal.EventListenerServiceInitiator; import org.hibernate.event.service.internal.EventListenerServiceInitiator;
@ -31,6 +32,9 @@ import org.hibernate.service.spi.SessionFactoryServiceInitiator;
import org.hibernate.stat.internal.StatisticsInitiator; import org.hibernate.stat.internal.StatisticsInitiator;
/** /**
* Central definition of the standard set of initiators defined by Hibernate for the
* {@link org.hibernate.service.spi.SessionFactoryServiceRegistry}
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class StandardSessionFactoryServiceInitiators { public class StandardSessionFactoryServiceInitiators {
@ -42,6 +46,6 @@ public class StandardSessionFactoryServiceInitiators {
serviceInitiators.add( EventListenerServiceInitiator.INSTANCE ); serviceInitiators.add( EventListenerServiceInitiator.INSTANCE );
serviceInitiators.add( StatisticsInitiator.INSTANCE ); serviceInitiators.add( StatisticsInitiator.INSTANCE );
return serviceInitiators; return Collections.unmodifiableList( serviceInitiators );
} }
} }

View File

@ -28,7 +28,7 @@ import java.util.Map;
import org.hibernate.service.Service; import org.hibernate.service.Service;
/** /**
* Responsible for initiating services. * Contract for an initiator of services that target the standard {@link org.hibernate.service.ServiceRegistry}
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -23,7 +23,6 @@
*/ */
package org.hibernate.service.spi; package org.hibernate.service.spi;
/** /**
* Optional {@link org.hibernate.service.Service} contract for services which can be managed in JMX * Optional {@link org.hibernate.service.Service} contract for services which can be managed in JMX
* *

View File

@ -29,6 +29,7 @@ import org.hibernate.service.Service;
/** /**
* Models a binding for a particular service * Models a binding for a particular service
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public final class ServiceBinding<R extends Service> { public final class ServiceBinding<R extends Service> {

View File

@ -26,6 +26,8 @@ package org.hibernate.service.spi;
import org.hibernate.service.Service; import org.hibernate.service.Service;
/** /**
* Base contract for an initiator of a service.
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface ServiceInitiator<R extends Service> { public interface ServiceInitiator<R extends Service> {

View File

@ -27,9 +27,23 @@ import org.hibernate.service.Service;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
/** /**
* Additional integration contracts for a service registry.
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface ServiceRegistryImplementor extends ServiceRegistry { public interface ServiceRegistryImplementor extends ServiceRegistry {
/**
* Locate the binding for the given role. Should, generally speaking, look into parent registry if one.
*
* @param serviceRole The service role for which to locate a binding.
* @param <R> generic return type.
*
* @return The located binding; may be {@code null}
*/
public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole); public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole);
/**
* Release resources
*/
public void destroy(); public void destroy();
} }

View File

@ -29,6 +29,9 @@ import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.Service; import org.hibernate.service.Service;
/** /**
* Contract for an initiator of services that target the specialized service registry
* {@link SessionFactoryServiceRegistry}
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface SessionFactoryServiceInitiator<R extends Service> extends ServiceInitiator<R>{ public interface SessionFactoryServiceInitiator<R extends Service> extends ServiceInitiator<R>{

View File

@ -24,8 +24,8 @@
package org.hibernate.service.spi; package org.hibernate.service.spi;
/** /**
* Acts as a {@link org.hibernate.service.Service} in the {@link org.hibernate.service.internal.BasicServiceRegistryImpl} whose function is as a factory for * Specialized {@link org.hibernate.service.ServiceRegistry} implementation that holds services which need access
* {@link org.hibernate.service.internal.SessionFactoryServiceRegistryImpl} implementations. * to the {@link org.hibernate.SessionFactory} during initialization.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -30,8 +30,9 @@ import org.hibernate.service.Service;
import org.hibernate.service.internal.SessionFactoryServiceRegistryImpl; import org.hibernate.service.internal.SessionFactoryServiceRegistryImpl;
/** /**
* Contract for builder of {@link SessionFactoryServiceRegistry} instances. Defined as a service to * Contract for builder of {@link SessionFactoryServiceRegistry} instances.
* "sit inside" the {@link org.hibernate.service.BasicServiceRegistry}. * <p/>
* Is itself a service within the standard service registry.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -25,7 +25,7 @@ package org.hibernate.service.spi;
/** /**
* Lifecyle contract for services which wish to be notified when it is time to start. * Lifecycle contract for services which wish to be notified when it is time to start.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -23,9 +23,8 @@
*/ */
package org.hibernate.service.spi; package org.hibernate.service.spi;
/** /**
* Lifecyle contract for services which wish to be notified when it is time to stop. * Lifecycle contract for services which wish to be notified when it is time to stop.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -24,6 +24,10 @@
package org.hibernate.service.spi; package org.hibernate.service.spi;
/** /**
* Optional contract for services that wrap stuff that to which it is useful to have access. For example, a service
* that maintains a {@link javax.sql.DataSource} might want to expose access to the {@link javax.sql.DataSource} or
* its {@link java.sql.Connection} instances.
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface Wrapped { public interface Wrapped {

View File

@ -32,7 +32,7 @@ import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
/** /**
@ -43,7 +43,7 @@ import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
*/ */
class ManagedProviderConnectionHelper implements ConnectionHelper { class ManagedProviderConnectionHelper implements ConnectionHelper {
private Properties cfgProperties; private Properties cfgProperties;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private Connection connection; private Connection connection;
public ManagedProviderConnectionHelper(Properties cfgProperties) { public ManagedProviderConnectionHelper(Properties cfgProperties) {
@ -59,10 +59,10 @@ class ManagedProviderConnectionHelper implements ConnectionHelper {
} }
} }
private static BasicServiceRegistryImpl createServiceRegistry(Properties properties) { private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
Environment.verifyProperties( properties ); Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
return (BasicServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry();
} }
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {

View File

@ -60,7 +60,7 @@ import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.config.spi.ConfigurationService; import org.hibernate.service.config.spi.ConfigurationService;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
/** /**
@ -490,10 +490,10 @@ public class SchemaExport {
} }
private static BasicServiceRegistryImpl createServiceRegistry(Properties properties) { private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
Environment.verifyProperties( properties ); Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
return (BasicServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry();
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -576,7 +576,7 @@ public class SchemaExport {
cfg.setProperty( Environment.HBM2DDL_IMPORT_FILES, importFile ); cfg.setProperty( Environment.HBM2DDL_IMPORT_FILES, importFile );
} }
BasicServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() ); StandardServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() );
try { try {
SchemaExport se = new SchemaExport( serviceRegistry, cfg ) SchemaExport se = new SchemaExport( serviceRegistry, cfg )
.setHaltOnError( halt ) .setHaltOnError( halt )

View File

@ -51,7 +51,7 @@ import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
/** /**
* A commandline tool to update a database schema. May also be called from inside an application. * A commandline tool to update a database schema. May also be called from inside an application.
@ -107,10 +107,10 @@ public class SchemaUpdate {
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter(); this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
} }
private static BasicServiceRegistryImpl createServiceRegistry(Properties properties) { private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
Environment.verifyProperties( properties ); Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
return (BasicServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry();
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -155,7 +155,7 @@ public class SchemaUpdate {
cfg.setProperties( props ); cfg.setProperties( props );
} }
BasicServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() ); StandardServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() );
try { try {
new SchemaUpdate( serviceRegistry, cfg ).execute( script, doUpdate ); new SchemaUpdate( serviceRegistry, cfg ).execute( script, doUpdate );
} }

View File

@ -41,7 +41,7 @@ import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
/** /**
* A commandline tool to update a database schema. May also be called from * A commandline tool to update a database schema. May also be called from
@ -76,10 +76,10 @@ public class SchemaValidator {
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() ); this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() );
} }
private static BasicServiceRegistryImpl createServiceRegistry(Properties properties) { private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
Environment.verifyProperties( properties ); Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
return (BasicServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry(); return (StandardServiceRegistryImpl) new ServiceRegistryBuilder().applySettings( properties ).buildServiceRegistry();
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -115,7 +115,7 @@ public class SchemaValidator {
cfg.setProperties( props ); cfg.setProperties( props );
} }
BasicServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() ); StandardServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() );
try { try {
new SchemaValidator( serviceRegistry, cfg ).validate(); new SchemaValidator( serviceRegistry, cfg ).validate();
} }

View File

@ -24,7 +24,7 @@ import org.hibernate.MappingException;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterClassResolver;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.Test; import org.junit.Test;
@ -42,7 +42,7 @@ public class PersisterClassProviderTest extends BaseUnitTestCase {
Configuration cfg = new Configuration(); Configuration cfg = new Configuration();
cfg.addAnnotatedClass( Gate.class ); cfg.addAnnotatedClass( Gate.class );
BasicServiceRegistry serviceRegistry = new ServiceRegistryBuilder() ServiceRegistry serviceRegistry = new ServiceRegistryBuilder()
.applySettings( cfg.getProperties() ) .applySettings( cfg.getProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
//no exception as the GoofyPersisterClassProvider is not set //no exception as the GoofyPersisterClassProvider is not set

View File

@ -36,7 +36,7 @@ import org.hibernate.event.spi.DeleteEventListener;
import org.hibernate.event.spi.EventType; import org.hibernate.event.spi.EventType;
import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.spi.SessionFactoryServiceRegistry; import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.junit.Test; import org.junit.Test;
@ -66,7 +66,7 @@ public class CallbackTest extends BaseCoreFunctionalTestCase {
} }
@Override @Override
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryImpl.Builder builder) { protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
super.prepareBootstrapRegistryBuilder( builder ); super.prepareBootstrapRegistryBuilder( builder );
builder.with( builder.with(
new Integrator() { new Integrator() {

View File

@ -3,7 +3,7 @@ package org.hibernate.test.extendshbm;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -20,7 +20,7 @@ import static org.junit.Assert.fail;
* @author Gavin King * @author Gavin King
*/ */
public class ExtendsTest extends BaseUnitTestCase { public class ExtendsTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
public void setUp() { public void setUp() {

View File

@ -30,7 +30,7 @@ import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType; import org.hibernate.event.spi.EventType;
import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.spi.SessionFactoryServiceRegistry; import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.junit.Test; import org.junit.Test;
@ -50,7 +50,7 @@ public class TestCollectionInitializingDuringFlush extends BaseCoreFunctionalTes
} }
@Override @Override
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryImpl.Builder builder) { protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
super.prepareBootstrapRegistryBuilder( builder ); super.prepareBootstrapRegistryBuilder( builder );
builder.with( builder.with(
new Integrator() { new Integrator() {

View File

@ -44,7 +44,7 @@ import org.hibernate.integrator.spi.Integrator;
import org.hibernate.internal.util.collections.IdentityMap; import org.hibernate.internal.util.collections.IdentityMap;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.spi.SessionFactoryServiceRegistry; import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -69,7 +69,7 @@ public abstract class AbstractJPATest extends BaseCoreFunctionalTestCase {
} }
@Override @Override
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryImpl.Builder builder) { protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
builder.with( builder.with(
new Integrator() { new Integrator() {

View File

@ -35,7 +35,7 @@ import org.hibernate.event.spi.LoadEvent;
import org.hibernate.event.spi.LoadEventListener; import org.hibernate.event.spi.LoadEventListener;
import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.spi.SessionFactoryServiceRegistry; import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.junit.Test; import org.junit.Test;
@ -63,7 +63,7 @@ public class EagerKeyManyToOneTest extends BaseCoreFunctionalTestCase {
} }
@Override @Override
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryImpl.Builder builder) { protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
super.prepareBootstrapRegistryBuilder( builder ); super.prepareBootstrapRegistryBuilder( builder );
builder.with( builder.with(
new Integrator() { new Integrator() {

View File

@ -27,26 +27,26 @@ import java.sql.Types;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.metamodel.domain.BasicType; import org.hibernate.metamodel.domain.BasicType;
import org.hibernate.metamodel.domain.SingularAttribute; import org.hibernate.metamodel.domain.SingularAttribute;
import org.hibernate.metamodel.relational.Column; import org.hibernate.metamodel.relational.Column;
import org.hibernate.metamodel.relational.Datatype; import org.hibernate.metamodel.relational.Datatype;
import org.hibernate.metamodel.relational.SimpleValue; import org.hibernate.metamodel.relational.SimpleValue;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.type.LongType; import org.hibernate.type.LongType;
import org.hibernate.type.StringType; import org.hibernate.type.StringType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNotNull;
@ -61,11 +61,11 @@ import static org.junit.Assert.assertTrue;
*/ */
public abstract class AbstractBasicBindingTests extends BaseUnitTestCase { public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
public void setUp() { public void setUp() {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry();
} }
@After @After
@ -73,7 +73,7 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
serviceRegistry.destroy(); serviceRegistry.destroy();
} }
protected BasicServiceRegistry basicServiceRegistry() { protected ServiceRegistry basicServiceRegistry() {
return serviceRegistry; return serviceRegistry;
} }

View File

@ -27,7 +27,7 @@ import org.hibernate.metamodel.MetadataSourceProcessingOrder;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.source.internal.MetadataImpl; import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -43,11 +43,11 @@ import static org.junit.Assert.assertSame;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class BasicCollectionBindingTests extends BaseUnitTestCase { public class BasicCollectionBindingTests extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
public void setUp() { public void setUp() {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry();
} }
@After @After

View File

@ -40,7 +40,7 @@ import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.internal.MetadataImpl; import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
import static junit.framework.Assert.fail; import static junit.framework.Assert.fail;
@ -52,13 +52,13 @@ import static org.junit.Assert.assertTrue;
*/ */
public class FetchProfileBinderTest extends BaseUnitTestCase { public class FetchProfileBinderTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private ClassLoaderService service; private ClassLoaderService service;
private MetadataImpl meta; private MetadataImpl meta;
@Before @Before
public void setUp() { public void setUp() {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry();
service = serviceRegistry.getService( ClassLoaderService.class ); service = serviceRegistry.getService( ClassLoaderService.class );
meta = (MetadataImpl) new MetadataSources( serviceRegistry ).buildMetadata(); meta = (MetadataImpl) new MetadataSources( serviceRegistry ).buildMetadata();
} }

View File

@ -40,7 +40,7 @@ import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.internal.MetadataImpl; import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;
@ -52,13 +52,13 @@ import static junit.framework.Assert.assertTrue;
*/ */
public class QueryBinderTest extends BaseUnitTestCase { public class QueryBinderTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private ClassLoaderService service; private ClassLoaderService service;
private MetadataImpl meta; private MetadataImpl meta;
@Before @Before
public void setUp() { public void setUp() {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry();
service = serviceRegistry.getService( ClassLoaderService.class ); service = serviceRegistry.getService( ClassLoaderService.class );
meta = (MetadataImpl) new MetadataSources( serviceRegistry ).buildMetadata(); meta = (MetadataImpl) new MetadataSources( serviceRegistry ).buildMetadata();
} }

View File

@ -48,7 +48,7 @@ import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper; import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.assertTrue;
@ -62,12 +62,12 @@ import static org.junit.Assert.fail;
* @author Hardy Ferentschik * @author Hardy Ferentschik
*/ */
public class JandexHelperTest extends BaseUnitTestCase { public class JandexHelperTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private ClassLoaderService classLoaderService; private ClassLoaderService classLoaderService;
@Before @Before
public void setUp() { public void setUp() {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry();
classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
} }

View File

@ -42,7 +42,7 @@ import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.jdbc.Expectation; import org.hibernate.jdbc.Expectation;
import org.hibernate.jdbc.Expectations; import org.hibernate.jdbc.Expectations;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -64,11 +64,11 @@ import static org.junit.Assert.assertTrue;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class BatchingTest extends BaseUnitTestCase implements BatchKey { public class BatchingTest extends BaseUnitTestCase implements BatchKey {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() ) .applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
} }

View File

@ -33,7 +33,7 @@ import org.hibernate.cfg.Environment;
import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.H2Dialect;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl; import org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
import org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl; import org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl;
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
@ -47,7 +47,7 @@ import org.hibernate.testing.junit4.BaseUnitTestCase;
public class ServiceBootstrappingTest extends BaseUnitTestCase { public class ServiceBootstrappingTest extends BaseUnitTestCase {
@Test @Test
public void testBasicBuild() { public void testBasicBuild() {
BasicServiceRegistryImpl serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() StandardServiceRegistryImpl serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() ) .applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
@ -64,7 +64,7 @@ public class ServiceBootstrappingTest extends BaseUnitTestCase {
Properties props = ConnectionProviderBuilder.getConnectionProviderProperties(); Properties props = ConnectionProviderBuilder.getConnectionProviderProperties();
props.put( Environment.SHOW_SQL, "true" ); props.put( Environment.SHOW_SQL, "true" );
BasicServiceRegistryImpl serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() StandardServiceRegistryImpl serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( props ) .applySettings( props )
.buildServiceRegistry(); .buildServiceRegistry();
@ -79,7 +79,7 @@ public class ServiceBootstrappingTest extends BaseUnitTestCase {
@Test @Test
public void testBuildWithServiceOverride() { public void testBuildWithServiceOverride() {
BasicServiceRegistryImpl serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() StandardServiceRegistryImpl serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() ) .applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
@ -90,7 +90,7 @@ public class ServiceBootstrappingTest extends BaseUnitTestCase {
Properties props = ConnectionProviderBuilder.getConnectionProviderProperties(); Properties props = ConnectionProviderBuilder.getConnectionProviderProperties();
props.setProperty( Environment.DIALECT, H2Dialect.class.getName() ); props.setProperty( Environment.DIALECT, H2Dialect.class.getName() );
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( props ) .applySettings( props )
.addService( ConnectionProvider.class, new UserSuppliedConnectionProviderImpl() ) .addService( ConnectionProvider.class, new UserSuppliedConnectionProviderImpl() )
.buildServiceRegistry(); .buildServiceRegistry();

View File

@ -34,7 +34,7 @@ import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl;
import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionContext;
import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -55,11 +55,11 @@ import static org.junit.Assert.fail;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class TestExpectedUsage extends BaseUnitTestCase { public class TestExpectedUsage extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() ) .applySettings( ConnectionProviderBuilder.getConnectionProviderProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
} }

View File

@ -30,10 +30,6 @@ import java.sql.Statement;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor; import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor;
import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl;
@ -41,15 +37,19 @@ import org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory;
import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionContext;
import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.internal.ServiceProxy;
import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.jta.platform.spi.JtaPlatform;
import org.hibernate.test.common.JournalingTransactionObserver;
import org.hibernate.test.common.TransactionContextImpl; import org.junit.After;
import org.hibernate.test.common.TransactionEnvironmentImpl; import org.junit.Before;
import org.junit.Test;
import org.hibernate.testing.env.ConnectionProviderBuilder; import org.hibernate.testing.env.ConnectionProviderBuilder;
import org.hibernate.testing.jta.TestingJtaBootstrap; import org.hibernate.testing.jta.TestingJtaBootstrap;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.test.common.JournalingTransactionObserver;
import org.hibernate.test.common.TransactionContextImpl;
import org.hibernate.test.common.TransactionEnvironmentImpl;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -62,7 +62,7 @@ import static org.junit.Assert.fail;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class BasicDrivingTest extends BaseUnitTestCase { public class BasicDrivingTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
@SuppressWarnings( {"unchecked"}) @SuppressWarnings( {"unchecked"})
@ -71,7 +71,7 @@ public class BasicDrivingTest extends BaseUnitTestCase {
configValues.putAll( ConnectionProviderBuilder.getConnectionProviderProperties() ); configValues.putAll( ConnectionProviderBuilder.getConnectionProviderProperties() );
configValues.put( Environment.TRANSACTION_STRATEGY, JtaTransactionFactory.class.getName() ); configValues.put( Environment.TRANSACTION_STRATEGY, JtaTransactionFactory.class.getName() );
TestingJtaBootstrap.prepare( configValues ); TestingJtaBootstrap.prepare( configValues );
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( configValues ) .applySettings( configValues )
.buildServiceRegistry(); .buildServiceRegistry();
} }
@ -142,8 +142,7 @@ public class BasicDrivingTest extends BaseUnitTestCase {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
try { try {
JtaPlatform instance = ( (ServiceProxy) serviceRegistry.getService( JtaPlatform.class ) ).getTargetInstance(); serviceRegistry.getService( JtaPlatform.class ).retrieveTransactionManager().rollback();
instance.retrieveTransactionManager().rollback();
} }
catch (Exception ignore) { catch (Exception ignore) {
} }
@ -151,8 +150,7 @@ public class BasicDrivingTest extends BaseUnitTestCase {
} }
catch (Throwable reThrowable) { catch (Throwable reThrowable) {
try { try {
JtaPlatform instance = ( (ServiceProxy) serviceRegistry.getService( JtaPlatform.class ) ).getTargetInstance(); serviceRegistry.getService( JtaPlatform.class ).retrieveTransactionManager().rollback();
instance.retrieveTransactionManager().rollback();
} }
catch (Exception ignore) { catch (Exception ignore) {
} }

View File

@ -43,7 +43,7 @@ import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory;
import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionContext;
import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.jta.platform.spi.JtaPlatform;
import org.hibernate.test.common.JournalingTransactionObserver; import org.hibernate.test.common.JournalingTransactionObserver;
import org.hibernate.test.common.TransactionContextImpl; import org.hibernate.test.common.TransactionContextImpl;
@ -62,7 +62,7 @@ import static org.junit.Assert.fail;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class ManagedDrivingTest extends BaseUnitTestCase { public class ManagedDrivingTest extends BaseUnitTestCase {
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
@Before @Before
@SuppressWarnings( {"unchecked"}) @SuppressWarnings( {"unchecked"})
@ -71,7 +71,7 @@ public class ManagedDrivingTest extends BaseUnitTestCase {
TestingJtaBootstrap.prepare( configValues ); TestingJtaBootstrap.prepare( configValues );
configValues.put( Environment.TRANSACTION_STRATEGY, CMTTransactionFactory.class.getName() ); configValues.put( Environment.TRANSACTION_STRATEGY, CMTTransactionFactory.class.getName() );
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( configValues ) .applySettings( configValues )
.buildServiceRegistry(); .buildServiceRegistry();
} }

View File

@ -102,6 +102,7 @@ import org.hibernate.mapping.AuxiliaryDatabaseObject;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.secure.internal.JACCConfiguration; import org.hibernate.secure.internal.JACCConfiguration;
import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl; import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl;
@ -886,7 +887,7 @@ public class Ejb3Configuration implements Serializable, Referenceable {
return buildEntityManagerFactory( BootstrapServiceRegistryImpl.builder() ); return buildEntityManagerFactory( BootstrapServiceRegistryImpl.builder() );
} }
public EntityManagerFactory buildEntityManagerFactory(BootstrapServiceRegistryImpl.Builder builder) { public EntityManagerFactory buildEntityManagerFactory(BootstrapServiceRegistryBuilder builder) {
Thread thread = null; Thread thread = null;
ClassLoader contextClassLoader = null; ClassLoader contextClassLoader = null;

View File

@ -43,8 +43,9 @@ import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.Ejb3Configuration; import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.EntityManagerFactoryImpl; import org.hibernate.ejb.EntityManagerFactoryImpl;
import org.hibernate.internal.SessionFactoryImpl; import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
import org.junit.After; import org.junit.After;
@ -67,7 +68,7 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa
private static final Dialect dialect = Dialect.getDialect(); private static final Dialect dialect = Dialect.getDialect();
private Ejb3Configuration ejb3Configuration; private Ejb3Configuration ejb3Configuration;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private EntityManagerFactoryImpl entityManagerFactory; private EntityManagerFactoryImpl entityManagerFactory;
private EntityManager em; private EntityManager em;
@ -81,7 +82,7 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa
return entityManagerFactory; return entityManagerFactory;
} }
protected BasicServiceRegistryImpl serviceRegistry() { protected StandardServiceRegistryImpl serviceRegistry() {
return serviceRegistry; return serviceRegistry;
} }
@ -94,12 +95,12 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa
afterConfigurationBuilt( ejb3Configuration ); afterConfigurationBuilt( ejb3Configuration );
entityManagerFactory = (EntityManagerFactoryImpl) ejb3Configuration.buildEntityManagerFactory( bootstrapRegistryBuilder() ); entityManagerFactory = (EntityManagerFactoryImpl) ejb3Configuration.buildEntityManagerFactory( bootstrapRegistryBuilder() );
serviceRegistry = (BasicServiceRegistryImpl) ( (SessionFactoryImpl) entityManagerFactory.getSessionFactory() ).getServiceRegistry().getParentServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) ( (SessionFactoryImpl) entityManagerFactory.getSessionFactory() ).getServiceRegistry().getParentServiceRegistry();
afterEntityManagerFactoryBuilt(); afterEntityManagerFactoryBuilt();
} }
private BootstrapServiceRegistryImpl.Builder bootstrapRegistryBuilder() { private BootstrapServiceRegistryBuilder bootstrapRegistryBuilder() {
return BootstrapServiceRegistryImpl.builder(); return BootstrapServiceRegistryImpl.builder();
} }

View File

@ -34,7 +34,8 @@ import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory; import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.event.EnversIntegrator; import org.hibernate.envers.event.EnversIntegrator;
import org.hibernate.internal.SessionFactoryImpl; import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
import org.junit.Before; import org.junit.Before;
@ -50,7 +51,7 @@ public abstract class AbstractEntityTest extends AbstractEnversTest {
private EntityManager entityManager; private EntityManager entityManager;
private AuditReader auditReader; private AuditReader auditReader;
private Ejb3Configuration cfg; private Ejb3Configuration cfg;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private boolean audited; private boolean audited;
public abstract void configure(Ejb3Configuration cfg); public abstract void configure(Ejb3Configuration cfg);
@ -108,12 +109,12 @@ public abstract class AbstractEntityTest extends AbstractEnversTest {
emf = (EntityManagerFactoryImpl) cfg.buildEntityManagerFactory( createBootstrapRegistryBuilder() ); emf = (EntityManagerFactoryImpl) cfg.buildEntityManagerFactory( createBootstrapRegistryBuilder() );
serviceRegistry = (BasicServiceRegistryImpl) ( (SessionFactoryImpl) emf.getSessionFactory() ).getServiceRegistry().getParentServiceRegistry(); serviceRegistry = (StandardServiceRegistryImpl) ( (SessionFactoryImpl) emf.getSessionFactory() ).getServiceRegistry().getParentServiceRegistry();
newEntityManager(); newEntityManager();
} }
private BootstrapServiceRegistryImpl.Builder createBootstrapRegistryBuilder() { private BootstrapServiceRegistryBuilder createBootstrapRegistryBuilder() {
return BootstrapServiceRegistryImpl.builder(); return BootstrapServiceRegistryImpl.builder();
} }

View File

@ -33,7 +33,7 @@ import org.hibernate.cache.infinispan.entity.EntityRegionImpl;
import org.hibernate.cache.infinispan.util.FlagAdapter; import org.hibernate.cache.infinispan.util.FlagAdapter;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.hibernate.test.cache.infinispan.util.CacheTestUtil; import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
@ -45,7 +45,7 @@ import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
public class NodeEnvironment { public class NodeEnvironment {
private final Configuration configuration; private final Configuration configuration;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private InfinispanRegionFactory regionFactory; private InfinispanRegionFactory regionFactory;
private Map<String,EntityRegionImpl> entityRegionMap; private Map<String,EntityRegionImpl> entityRegionMap;
@ -59,7 +59,7 @@ public class NodeEnvironment {
return configuration; return configuration;
} }
public BasicServiceRegistryImpl getServiceRegistry() { public StandardServiceRegistryImpl getServiceRegistry() {
return serviceRegistry; return serviceRegistry;
} }
@ -109,7 +109,7 @@ public class NodeEnvironment {
} }
public void prepare() throws Exception { public void prepare() throws Exception {
serviceRegistry = (BasicServiceRegistryImpl) new ServiceRegistryBuilder() serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder()
.applySettings( configuration.getProperties() ) .applySettings( configuration.getProperties() )
.buildServiceRegistry(); .buildServiceRegistry();
regionFactory = CacheTestUtil.startRegionFactory( serviceRegistry, configuration ); regionFactory = CacheTestUtil.startRegionFactory( serviceRegistry, configuration );

View File

@ -31,7 +31,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory; import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -142,7 +142,7 @@ public abstract class DualNodeTestCase extends BaseCoreFunctionalTestCase {
public class SecondNodeEnvironment { public class SecondNodeEnvironment {
private Configuration configuration; private Configuration configuration;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private SessionFactoryImplementor sessionFactory; private SessionFactoryImplementor sessionFactory;
public SecondNodeEnvironment() { public SecondNodeEnvironment() {
@ -163,7 +163,7 @@ public abstract class DualNodeTestCase extends BaseCoreFunctionalTestCase {
return configuration; return configuration;
} }
public BasicServiceRegistryImpl getServiceRegistry() { public StandardServiceRegistryImpl getServiceRegistry() {
return serviceRegistry; return serviceRegistry;
} }

View File

@ -27,23 +27,23 @@ import java.util.Map;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.StandardServiceRegistryImpl;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class ServiceRegistryBuilder { public class ServiceRegistryBuilder {
public static BasicServiceRegistryImpl buildServiceRegistry() { public static StandardServiceRegistryImpl buildServiceRegistry() {
return buildServiceRegistry( Environment.getProperties() ); return buildServiceRegistry( Environment.getProperties() );
} }
public static BasicServiceRegistryImpl buildServiceRegistry(Map serviceRegistryConfig) { public static StandardServiceRegistryImpl buildServiceRegistry(Map serviceRegistryConfig) {
return (BasicServiceRegistryImpl) new org.hibernate.service.ServiceRegistryBuilder() return (StandardServiceRegistryImpl) new org.hibernate.service.ServiceRegistryBuilder()
.applySettings( serviceRegistryConfig ) .applySettings( serviceRegistryConfig )
.buildServiceRegistry(); .buildServiceRegistry();
} }
public static void destroy(ServiceRegistry serviceRegistry) { public static void destroy(ServiceRegistry serviceRegistry) {
( (BasicServiceRegistryImpl) serviceRegistry ).destroy(); ( (StandardServiceRegistryImpl) serviceRegistry ).destroy();
} }
} }

View File

@ -53,11 +53,12 @@ import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.SimpleValue;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.source.MetadataImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.BasicServiceRegistry; import org.hibernate.service.BootstrapServiceRegistryBuilder;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.config.spi.ConfigurationService; import org.hibernate.service.config.spi.ConfigurationService;
import org.hibernate.service.internal.BasicServiceRegistryImpl;
import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.BootstrapServiceRegistryImpl;
import org.hibernate.service.internal.StandardServiceRegistryImpl;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -85,7 +86,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
private boolean isMetadataUsed; private boolean isMetadataUsed;
private Configuration configuration; private Configuration configuration;
private BasicServiceRegistryImpl serviceRegistry; private StandardServiceRegistryImpl serviceRegistry;
private SessionFactoryImplementor sessionFactory; private SessionFactoryImplementor sessionFactory;
private Session session; private Session session;
@ -98,7 +99,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
return configuration; return configuration;
} }
protected BasicServiceRegistryImpl serviceRegistry() { protected StandardServiceRegistryImpl serviceRegistry() {
return serviceRegistry; return serviceRegistry;
} }
@ -146,7 +147,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
afterSessionFactoryBuilt(); afterSessionFactoryBuilt();
} }
private MetadataImplementor buildMetadata(BasicServiceRegistry serviceRegistry) { private MetadataImplementor buildMetadata(ServiceRegistry serviceRegistry) {
MetadataSources sources = new MetadataSources( serviceRegistry ); MetadataSources sources = new MetadataSources( serviceRegistry );
addMappings( sources ); addMappings( sources );
return (MetadataImplementor) sources.buildMetadata(); return (MetadataImplementor) sources.buildMetadata();
@ -318,7 +319,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) { protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
} }
protected BasicServiceRegistryImpl buildServiceRegistry(Configuration configuration) { protected StandardServiceRegistryImpl buildServiceRegistry(Configuration configuration) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.putAll( configuration.getProperties() ); properties.putAll( configuration.getProperties() );
Environment.verifyProperties( properties ); Environment.verifyProperties( properties );
@ -328,16 +329,16 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
ServiceRegistryBuilder registryBuilder = new ServiceRegistryBuilder( bootstrapServiceRegistry ) ServiceRegistryBuilder registryBuilder = new ServiceRegistryBuilder( bootstrapServiceRegistry )
.applySettings( properties ); .applySettings( properties );
prepareBasicRegistryBuilder( registryBuilder ); prepareBasicRegistryBuilder( registryBuilder );
return (BasicServiceRegistryImpl) registryBuilder.buildServiceRegistry(); return (StandardServiceRegistryImpl) registryBuilder.buildServiceRegistry();
} }
protected BootstrapServiceRegistryImpl generateBootstrapRegistry(Properties properties) { protected BootstrapServiceRegistryImpl generateBootstrapRegistry(Properties properties) {
final BootstrapServiceRegistryImpl.Builder builder = BootstrapServiceRegistryImpl.builder(); final BootstrapServiceRegistryBuilder builder = BootstrapServiceRegistryImpl.builder();
prepareBootstrapRegistryBuilder( builder ); prepareBootstrapRegistryBuilder( builder );
return builder.build(); return builder.build();
} }
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryImpl.Builder builder) { protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
} }
protected void prepareBasicRegistryBuilder(ServiceRegistryBuilder serviceRegistryBuilder) { protected void prepareBasicRegistryBuilder(ServiceRegistryBuilder serviceRegistryBuilder) {