diff --git a/hibernate-c3p0/src/main/java/org/hibernate/service/jdbc/connections/internal/C3P0ConnectionProvider.java b/hibernate-c3p0/src/main/java/org/hibernate/service/jdbc/connections/internal/C3P0ConnectionProvider.java index a3c7ea42d5..d946835a6e 100644 --- a/hibernate-c3p0/src/main/java/org/hibernate/service/jdbc/connections/internal/C3P0ConnectionProvider.java +++ b/hibernate-c3p0/src/main/java/org/hibernate/service/jdbc/connections/internal/C3P0ConnectionProvider.java @@ -33,7 +33,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.UnknownUnwrapTypeException; +import org.hibernate.service.UnknownUnwrapTypeException; import org.jboss.logging.Logger; import com.mchange.v2.c3p0.DataSources; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index 9f1b1b2afa..d89accc9e3 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -159,8 +159,8 @@ import org.hibernate.mapping.TypeDef; import org.hibernate.mapping.UniqueKey; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.secure.JACCConfiguration; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.internal.BasicServiceRegistryImpl; -import org.hibernate.service.spi.ServiceRegistry; import org.hibernate.tool.hbm2ddl.DatabaseMetadata; import org.hibernate.tool.hbm2ddl.IndexMetadata; import org.hibernate.tool.hbm2ddl.TableMetadata; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java index 0a222063e4..fe355cc039 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -42,7 +42,7 @@ import org.hibernate.internal.util.ReflectHelper; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.jta.platform.spi.JtaPlatform; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.jboss.logging.Logger; /** diff --git a/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java index d3cea25517..d06b800ec4 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java @@ -34,6 +34,7 @@ import org.hibernate.Interceptor; import org.hibernate.MappingException; import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.SessionFactoryObserver; import org.hibernate.cache.QueryCache; import org.hibernate.cache.Region; import org.hibernate.cache.UpdateTimestampsCache; @@ -49,8 +50,8 @@ import org.hibernate.id.IdentifierGenerator; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.proxy.EntityNotFoundDelegate; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.ServiceRegistry; import org.hibernate.stat.spi.StatisticsImplementor; import org.hibernate.type.Type; import org.hibernate.type.TypeResolver; @@ -255,4 +256,6 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory { public FetchProfile getFetchProfile(String name); public ServiceRegistry getServiceRegistry(); + + public void addObserver(SessionFactoryObserver observer); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java index 65dbc8676c..588337f749 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java @@ -29,7 +29,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.engine.jdbc.batch.spi.BatchBuilder; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.ServiceException; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/spi/BatchBuilder.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/spi/BatchBuilder.java index 4715c13faa..8af7370ee1 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/spi/BatchBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/spi/BatchBuilder.java @@ -25,7 +25,7 @@ package org.hibernate.engine.jdbc.batch.spi; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.service.spi.Manageable; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * A builder for {@link Batch} instances diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesInitiator.java index 65aa06a6b5..8c824c2099 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesInitiator.java @@ -26,7 +26,7 @@ package org.hibernate.engine.jdbc.internal; import java.util.Map; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; /** diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java index ba6f0b1de3..a09ecb1773 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java @@ -30,7 +30,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.LobCreationContext; import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Contract for services around JDBC operations. These represent shared resources, aka not varied by session/use. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionFactoryInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionFactoryInitiator.java index f1a32c06cd..b1c4813107 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionFactoryInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionFactoryInitiator.java @@ -36,7 +36,7 @@ import org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory; import org.hibernate.engine.transaction.spi.TransactionFactory; import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; /** diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionFactory.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionFactory.java index ae5d34aab2..56276f3888 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionFactory.java @@ -24,7 +24,7 @@ package org.hibernate.engine.transaction.spi; import org.hibernate.ConnectionReleaseMode; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Contract for transaction creation, as well as providing metadata and contextual information about that creation. diff --git a/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java index 90e538ff49..478b376a55 100644 --- a/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java @@ -113,9 +113,11 @@ import org.hibernate.persister.entity.Queryable; import org.hibernate.persister.spi.PersisterFactory; import org.hibernate.pretty.MessageHelper; import org.hibernate.proxy.EntityNotFoundDelegate; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jta.platform.spi.JtaPlatform; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.service.spi.SessionFactoryServiceRegistryFactory; import org.hibernate.stat.internal.ConcurrentStatisticsImpl; import org.hibernate.stat.Statistics; import org.hibernate.stat.spi.StatisticsImplementor; @@ -174,7 +176,7 @@ public final class SessionFactoryImpl private final transient Map fetchProfiles; private final transient Map imports; private final transient Interceptor interceptor; - private final transient ServiceRegistry serviceRegistry; + private final transient ServiceRegistryImplementor serviceRegistry; private final transient Settings settings; private final transient Properties properties; private transient SchemaExport schemaExport; @@ -187,7 +189,7 @@ public final class SessionFactoryImpl private final transient CurrentSessionContext currentSessionContext; private final transient EntityNotFoundDelegate entityNotFoundDelegate; private final transient SQLFunctionRegistry sqlFunctionRegistry; - private final transient SessionFactoryObserver observer; + private final transient SessionFactoryObserverChain observer = new SessionFactoryObserverChain(); private final transient HashMap entityNameResolvers = new HashMap(); private final transient QueryPlanCache queryPlanCache; private final transient Cache cacheAccess = new CacheImpl(); @@ -210,16 +212,16 @@ public final class SessionFactoryImpl this.properties = new Properties(); this.properties.putAll( cfg.getProperties() ); this.interceptor = cfg.getInterceptor(); - this.serviceRegistry = serviceRegistry; + this.serviceRegistry = serviceRegistry.getService( SessionFactoryServiceRegistryFactory.class ).buildServiceRegistry( + this, + cfg + ); this.settings = settings; this.sqlFunctionRegistry = new SQLFunctionRegistry( getDialect(), cfg.getSqlFunctions() ); this.eventListeners = listeners; - this.observer = observer != null ? observer : new SessionFactoryObserver() { - public void sessionFactoryCreated(SessionFactory factory) { - } - public void sessionFactoryClosed(SessionFactory factory) { - } - }; + if ( observer != null ) { + this.observer.addObserver( observer ); + } this.typeResolver = cfg.getTypeResolver().scope( this ); this.typeHelper = new TypeLocatorImpl( typeResolver ); @@ -472,6 +474,11 @@ public final class SessionFactoryImpl this.observer.sessionFactoryCreated( this ); } + @Override + public void addObserver(SessionFactoryObserver observer) { + this.observer.addObserver( observer ); + } + private Statistics buildStatistics(Settings settings, ServiceRegistry serviceRegistry) { Statistics statistics = new ConcurrentStatisticsImpl( this ); statistics.setStatisticsEnabled( settings.isStatisticsEnabled() ); @@ -964,6 +971,7 @@ public final class SessionFactoryImpl SessionFactoryObjectFactory.removeInstance(uuid, name, properties); observer.sessionFactoryClosed( this ); + serviceRegistry.destroy(); eventListeners.destroyListeners(); } diff --git a/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryObserverChain.java b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryObserverChain.java new file mode 100644 index 0000000000..c7ecb0e48b --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryObserverChain.java @@ -0,0 +1,66 @@ +/* + * 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.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.SessionFactory; +import org.hibernate.SessionFactoryObserver; + +/** + * @author Steve Ebersole + */ +public class SessionFactoryObserverChain implements SessionFactoryObserver { + private List observers; + + public void addObserver(SessionFactoryObserver observer) { + if ( observers == null ) { + observers = new ArrayList(); + } + observers.add( observer ); + } + + @Override + public void sessionFactoryCreated(SessionFactory factory) { + if ( observers == null ) { + return; + } + + for ( SessionFactoryObserver observer : observers ) { + observer.sessionFactoryCreated( factory ); + } + } + + @Override + public void sessionFactoryClosed(SessionFactory factory) { + if ( observers == null ) { + return; + } + + for ( SessionFactoryObserver observer : observers ) { + observer.sessionFactoryClosed( factory ); + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/impl/TransactionEnvironmentImpl.java b/hibernate-core/src/main/java/org/hibernate/impl/TransactionEnvironmentImpl.java index 145e801df4..6e96517276 100644 --- a/hibernate-core/src/main/java/org/hibernate/impl/TransactionEnvironmentImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/impl/TransactionEnvironmentImpl.java @@ -28,7 +28,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.transaction.spi.TransactionEnvironment; import org.hibernate.engine.transaction.spi.TransactionFactory; import org.hibernate.service.jta.platform.spi.JtaPlatform; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.stat.spi.StatisticsImplementor; /** diff --git a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterClassResolverInitiator.java b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterClassResolverInitiator.java index dd710d3bcd..2344ab8052 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterClassResolverInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterClassResolverInitiator.java @@ -27,7 +27,7 @@ import java.util.Map; import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.ServiceException; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java index c56523a9b9..4f34548b2c 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java @@ -36,7 +36,7 @@ import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterFactory; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.ServiceRegistryAwareService; import java.lang.reflect.Constructor; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryInitiator.java b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryInitiator.java index 68cc54643f..420769808f 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryInitiator.java @@ -27,7 +27,7 @@ import java.util.Map; import org.hibernate.persister.spi.PersisterFactory; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.ServiceException; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterClassResolver.java b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterClassResolver.java index 7bfd7e7aa9..9ec5515f84 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterClassResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterClassResolver.java @@ -27,7 +27,7 @@ import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Provides persister classes based on the entity or collection role. diff --git a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java index e71e41d349..72e37635a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java @@ -33,7 +33,7 @@ import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Contract for creating persister instances (both {@link EntityPersister} and {@link CollectionPersister} varieties). diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceBinding.java b/hibernate-core/src/main/java/org/hibernate/service/BasicServiceRegistry.java similarity index 77% rename from hibernate-core/src/main/java/org/hibernate/service/internal/ServiceBinding.java rename to hibernate-core/src/main/java/org/hibernate/service/BasicServiceRegistry.java index 0289c4fec2..56d66cda9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/service/BasicServiceRegistry.java @@ -21,28 +21,13 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.internal; +package org.hibernate.service; + +import org.hibernate.service.spi.BasicServiceInitiator; /** * @author Steve Ebersole */ -final class ServiceBinding { - private final R proxy; - private R target; - - ServiceBinding(R proxy) { - this.proxy = proxy; - } - - public R getProxy() { - return proxy; - } - - public R getTarget() { - return target; - } - - public void setTarget(R target) { - this.target = target; - } +public interface BasicServiceRegistry extends ServiceRegistry { + public void registerServiceInitiator(BasicServiceInitiator initiator); } diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/Service.java b/hibernate-core/src/main/java/org/hibernate/service/Service.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/service/spi/Service.java rename to hibernate-core/src/main/java/org/hibernate/service/Service.java index 796e1afd83..6fa598ea0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/Service.java +++ b/hibernate-core/src/main/java/org/hibernate/service/Service.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.spi; +package org.hibernate.service; import java.io.Serializable; diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistry.java b/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistry.java similarity index 95% rename from hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistry.java rename to hibernate-core/src/main/java/org/hibernate/service/ServiceRegistry.java index 6672ebf719..3e8170ae8c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistry.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.spi; +package org.hibernate.service; /** * The registry of {@link Service services}. @@ -37,7 +37,7 @@ public interface ServiceRegistry { public ServiceRegistry getParentServiceRegistry(); /** - * Retrieve a service by role. If service is not found, but a {@link BasicServiceInitiator} is registered for + * Retrieve a service by role. If service is not found, but a {@link org.hibernate.service.spi.BasicServiceInitiator} is registered for * this service role, the service will be initialized and returned. *

* NOTE: We cannot return {@code >} here because the service might come from the parent... diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/StandardServiceInitiators.java b/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java similarity index 92% rename from hibernate-core/src/main/java/org/hibernate/service/spi/StandardServiceInitiators.java rename to hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java index 512279b38d..247e5199ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/StandardServiceInitiators.java +++ b/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.spi; +package org.hibernate.service; import org.hibernate.engine.jdbc.batch.internal.BatchBuilderInitiator; import org.hibernate.engine.jdbc.internal.JdbcServicesInitiator; @@ -29,12 +29,14 @@ import org.hibernate.engine.transaction.internal.TransactionFactoryInitiator; import org.hibernate.persister.internal.PersisterClassResolverInitiator; import org.hibernate.persister.internal.PersisterFactoryInitiator; import org.hibernate.service.classloading.internal.ClassLoaderServiceInitiator; +import org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator; import org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator; import org.hibernate.service.jdbc.dialect.internal.DialectFactoryInitiator; import org.hibernate.service.jdbc.dialect.internal.DialectResolverInitiator; import org.hibernate.service.jmx.internal.JmxServiceInitiator; import org.hibernate.service.jndi.internal.JndiServiceInitiator; import org.hibernate.service.jta.platform.internal.JtaPlatformInitiator; +import org.hibernate.service.spi.BasicServiceInitiator; import java.util.ArrayList; import java.util.List; @@ -64,6 +66,8 @@ public class StandardServiceInitiators { serviceInitiators.add( JtaPlatformInitiator.INSTANCE ); serviceInitiators.add( TransactionFactoryInitiator.INSTANCE ); + serviceInitiators.add( SessionFactoryServiceRegistryFactoryInitiator.INSTANCE ); + return serviceInitiators; } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/UnknownServiceException.java b/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/service/spi/UnknownServiceException.java rename to hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java index b7f5180fe3..0b6badf4c7 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/UnknownServiceException.java +++ b/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.spi; +package org.hibernate.service; import org.hibernate.HibernateException; /** diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/UnknownUnwrapTypeException.java b/hibernate-core/src/main/java/org/hibernate/service/UnknownUnwrapTypeException.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/service/spi/UnknownUnwrapTypeException.java rename to hibernate-core/src/main/java/org/hibernate/service/UnknownUnwrapTypeException.java index 5e2406dcab..684e5b7fdf 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/UnknownUnwrapTypeException.java +++ b/hibernate-core/src/main/java/org/hibernate/service/UnknownUnwrapTypeException.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.spi; +package org.hibernate.service; import org.hibernate.HibernateException; diff --git a/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceInitiator.java index ebdb52b4aa..861f677cf1 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceInitiator.java @@ -26,7 +26,7 @@ package org.hibernate.service.classloading.internal; import java.util.Map; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.BasicServiceInitiator; /** diff --git a/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/ClassLoaderService.java b/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/ClassLoaderService.java index b10175e9a0..abd25bce8c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/ClassLoaderService.java +++ b/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/ClassLoaderService.java @@ -27,7 +27,7 @@ import java.io.InputStream; import java.net.URL; import java.util.List; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * A service for interacting with class loaders diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java index a2c92818ab..58c91f69d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java @@ -23,6 +23,7 @@ */ package org.hibernate.service.internal; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; @@ -33,11 +34,16 @@ import org.jboss.logging.Logger; import org.hibernate.HibernateException; import org.hibernate.HibernateLogger; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.service.Service; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.internal.proxy.javassist.ServiceProxyFactoryFactoryImpl; -import org.hibernate.service.spi.Service; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.jmx.spi.JmxService; +import org.hibernate.service.spi.InjectService; +import org.hibernate.service.spi.Manageable; +import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.service.spi.Startable; import org.hibernate.service.spi.Stoppable; -import org.hibernate.service.spi.UnknownServiceException; +import org.hibernate.service.UnknownServiceException; import org.hibernate.service.spi.proxy.ServiceProxyFactory; /** @@ -116,7 +122,86 @@ public abstract class AbstractServiceRegistryImpl implements ServiceRegistryImpl serviceList.add( service ); } - protected abstract R initializeService(Class serviceRole); + private R initializeService(Class serviceRole) { + LOG.trace("Initializing service [role=" + serviceRole.getName() + "]"); + + // PHASE 1 : create service + R service = createService( serviceRole ); + if ( service == null ) { + return null; + } + + // PHASE 2 : configure service (***potentially recursive***) + configureService( service ); + + // PHASE 3 : Start service + startService( service, serviceRole ); + + return service; + } + + protected abstract T createService(Class serviceRole); + protected abstract void configureService(T service); + + protected void applyInjections(T service) { + try { + for ( Method method : service.getClass().getMethods() ) { + InjectService injectService = method.getAnnotation( InjectService.class ); + if ( injectService == null ) { + continue; + } + + applyInjection( service, method, injectService ); + } + } + catch (NullPointerException e) { + LOG.error("NPE injecting service deps : " + service.getClass().getName()); + } + } + + @SuppressWarnings({ "unchecked" }) + private void applyInjection(T service, Method injectionMethod, InjectService injectService) { + if ( injectionMethod.getParameterTypes() == null || injectionMethod.getParameterTypes().length != 1 ) { + throw new ServiceDependencyException( + "Encountered @InjectService on method with unexpected number of parameters" + ); + } + + Class dependentServiceRole = injectService.serviceRole(); + if ( dependentServiceRole == null || dependentServiceRole.equals( Void.class ) ) { + dependentServiceRole = injectionMethod.getParameterTypes()[0]; + } + + // todo : because of the use of proxies, this is no longer returning null here... + + final Service dependantService = getService( dependentServiceRole ); + if ( dependantService == null ) { + if ( injectService.required() ) { + throw new ServiceDependencyException( + "Dependency [" + dependentServiceRole + "] declared by service [" + service + "] not found" + ); + } + } + else { + try { + injectionMethod.invoke( service, dependantService ); + } + catch ( Exception e ) { + throw new ServiceDependencyException( "Cannot inject dependency service", e ); + } + } + } + + @SuppressWarnings({ "unchecked" }) + protected void startService(T service, Class serviceRole) { + if ( Startable.class.isInstance( service ) ) { + ( (Startable) service ).start(); + } + + if ( Manageable.class.isInstance( service ) ) { + getService( JmxService.class ).registerService( (Manageable) service, serviceRole ); + } + } @Override @SuppressWarnings( {"unchecked"}) diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/BasicServiceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/BasicServiceRegistryImpl.java index cb4661a578..5623092564 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/BasicServiceRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/BasicServiceRegistryImpl.java @@ -31,24 +31,22 @@ import java.util.Map; import org.jboss.logging.Logger; import org.hibernate.HibernateLogger; -import org.hibernate.service.jmx.spi.JmxService; +import org.hibernate.service.BasicServiceRegistry; +import org.hibernate.service.Service; +import org.hibernate.service.StandardServiceInitiators; +import org.hibernate.service.UnknownServiceException; import org.hibernate.service.spi.BasicServiceInitiator; import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.InjectService; -import org.hibernate.service.spi.Manageable; -import org.hibernate.service.spi.Service; import org.hibernate.service.spi.ServiceException; import org.hibernate.service.spi.ServiceRegistryAwareService; -import org.hibernate.service.spi.StandardServiceInitiators; -import org.hibernate.service.spi.Startable; -import org.hibernate.service.spi.UnknownServiceException; /** * Standard Hibernate implementation of the service registry. * * @author Steve Ebersole */ -public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl { +public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl implements BasicServiceRegistry { private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BasicServiceRegistryImpl.class.getName()); private final Map serviceInitiatorMap; @@ -82,6 +80,7 @@ public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl { return result; } + @Override @SuppressWarnings( {"unchecked"}) public void registerServiceInitiator(BasicServiceInitiator initiator) { ServiceBinding serviceBinding = locateServiceBinding( initiator.getServiceInitiated(), false ); @@ -95,26 +94,8 @@ public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl { } @Override - protected R initializeService(Class serviceRole) { - LOG.trace("Initializing service [role=" + serviceRole.getName() + "]"); - - // PHASE 1 : create service - R service = createService( serviceRole ); - if ( service == null ) { - return null; - } - - // PHASE 2 : configure service (***potentially recursive***) - configureService( service ); - - // PHASE 3 : Start service - startService( service, serviceRole ); - - return service; - } - @SuppressWarnings({ "unchecked" }) - private T createService(Class serviceRole) { + protected T createService(Class serviceRole) { BasicServiceInitiator initiator = serviceInitiatorMap.get( serviceRole ); if ( initiator == null ) { throw new UnknownServiceException( serviceRole ); @@ -134,7 +115,8 @@ public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl { } } - private void configureService(T service) { + @Override + protected void configureService(T service) { applyInjections( service ); if ( Configurable.class.isInstance( service ) ) { @@ -145,64 +127,4 @@ public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl { ( (ServiceRegistryAwareService) service ).injectServices( this ); } } - - private void applyInjections(T service) { - try { - for ( Method method : service.getClass().getMethods() ) { - InjectService injectService = method.getAnnotation( InjectService.class ); - if ( injectService == null ) { - continue; - } - - applyInjection( service, method, injectService ); - } - } - catch (NullPointerException e) { - LOG.error("NPE injecting service deps : " + service.getClass().getName()); - } - } - - @SuppressWarnings({ "unchecked" }) - private void applyInjection(T service, Method injectionMethod, InjectService injectService) { - if ( injectionMethod.getParameterTypes() == null || injectionMethod.getParameterTypes().length != 1 ) { - throw new ServiceDependencyException( - "Encountered @InjectService on method with unexpected number of parameters" - ); - } - - Class dependentServiceRole = injectService.serviceRole(); - if ( dependentServiceRole == null || dependentServiceRole.equals( Void.class ) ) { - dependentServiceRole = injectionMethod.getParameterTypes()[0]; - } - - // todo : because of the use of proxies, this is no longer returning null here... - - final Service dependantService = getService( dependentServiceRole ); - if ( dependantService == null ) { - if ( injectService.required() ) { - throw new ServiceDependencyException( - "Dependency [" + dependentServiceRole + "] declared by service [" + service + "] not found" - ); - } - } - else { - try { - injectionMethod.invoke( service, dependantService ); - } - catch ( Exception e ) { - throw new ServiceDependencyException( "Cannot inject dependency service", e ); - } - } - } - - @SuppressWarnings({ "unchecked" }) - private void startService(T service, Class serviceRole) { - if ( Startable.class.isInstance( service ) ) { - ( (Startable) service ).start(); - } - - if ( Manageable.class.isInstance( service ) ) { - getService( JmxService.class ).registerService( (Manageable) service, serviceRole ); - } - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceProxy.java b/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceProxy.java index a8bae0dffa..4d32804f12 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceProxy.java @@ -23,7 +23,7 @@ */ package org.hibernate.service.internal; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Marker interface for a service proxy which allows mixed-in ability to unproxy. diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryImpl.java new file mode 100644 index 0000000000..446a2a71ae --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryImpl.java @@ -0,0 +1,51 @@ +/* + * 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.cfg.Configuration; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.service.Service; +import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.service.spi.SessionFactoryServiceRegistryFactory; + +/** + * Acts as a {@link Service} in the {@link BasicServiceRegistryImpl} whose function is as a factory for + * {@link SessionFactoryServiceRegistryImpl} implementations. + * + * @author Steve Ebersole + */ +public class SessionFactoryServiceRegistryFactoryImpl implements SessionFactoryServiceRegistryFactory { + private final ServiceRegistryImplementor theBasicServiceRegistry; + + public SessionFactoryServiceRegistryFactoryImpl(ServiceRegistryImplementor theBasicServiceRegistry) { + this.theBasicServiceRegistry = theBasicServiceRegistry; + } + + @Override + public SessionFactoryServiceRegistryImpl buildServiceRegistry( + SessionFactoryImplementor sessionFactory, + Configuration configuration) { + return new SessionFactoryServiceRegistryImpl( theBasicServiceRegistry, sessionFactory, configuration ); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryInitiator.java new file mode 100644 index 0000000000..5cabc73b87 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryInitiator.java @@ -0,0 +1,47 @@ +/* + * 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 java.util.Map; + +import org.hibernate.service.spi.BasicServiceInitiator; +import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.service.spi.SessionFactoryServiceRegistryFactory; + +/** + * @author Steve Ebersole + */ +public class SessionFactoryServiceRegistryFactoryInitiator implements BasicServiceInitiator { + public static final SessionFactoryServiceRegistryFactoryInitiator INSTANCE = new SessionFactoryServiceRegistryFactoryInitiator(); + + @Override + public Class getServiceInitiated() { + return SessionFactoryServiceRegistryFactory.class; + } + + @Override + public SessionFactoryServiceRegistryFactoryImpl initiateService(Map configurationValues, ServiceRegistryImplementor registry) { + return new SessionFactoryServiceRegistryFactoryImpl( registry ); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryImpl.java new file mode 100644 index 0000000000..50c3a99286 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/SessionFactoryServiceRegistryImpl.java @@ -0,0 +1,62 @@ +/* + * 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.cfg.Configuration; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.service.Service; +import org.hibernate.service.spi.ServiceRegistryImplementor; +import org.hibernate.service.spi.SessionFactoryServiceRegistry; + +/** + * @author Steve Ebersole + */ +public class SessionFactoryServiceRegistryImpl + extends AbstractServiceRegistryImpl + implements SessionFactoryServiceRegistry { + + private final SessionFactoryImplementor sessionFactory; + private Configuration configuration; + + // for now we need to hold on to the Configuration... :( + + public SessionFactoryServiceRegistryImpl( + ServiceRegistryImplementor parent, + SessionFactoryImplementor sessionFactory, + Configuration configuration) { + super( parent ); + this.sessionFactory = sessionFactory; + this.configuration = configuration; + } + + @Override + protected T createService(Class serviceRole) { + return null; // todo : implement method body + } + + @Override + protected void configureService(T service) { + // todo : implement method body + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/proxy/javassist/ServiceProxyFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/proxy/javassist/ServiceProxyFactoryImpl.java index 9d823a9a44..9be3b2daa5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/proxy/javassist/ServiceProxyFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/proxy/javassist/ServiceProxyFactoryImpl.java @@ -30,7 +30,7 @@ import javassist.util.proxy.ProxyObject; import org.hibernate.service.internal.ServiceProxy; import org.hibernate.service.internal.ServiceProxyGenerationException; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; import org.hibernate.service.spi.proxy.ServiceProxyFactory; import org.hibernate.service.spi.proxy.ServiceProxyTargetSource; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java index 0fd0a267d3..a7cb84e174 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java @@ -39,7 +39,7 @@ import org.hibernate.HibernateLogger; import org.hibernate.cfg.Environment; import org.hibernate.internal.util.beans.BeanInfoHelper; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DatasourceConnectionProviderImpl.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DatasourceConnectionProviderImpl.java index 14c59ab4ec..00dcc8c01d 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DatasourceConnectionProviderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DatasourceConnectionProviderImpl.java @@ -28,12 +28,12 @@ import java.util.Map; import javax.sql.DataSource; import org.hibernate.HibernateException; import org.hibernate.cfg.Environment; +import org.hibernate.service.UnknownUnwrapTypeException; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jndi.spi.JndiService; import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.InjectService; import org.hibernate.service.spi.Stoppable; -import org.hibernate.service.spi.UnknownUnwrapTypeException; /** * A {@link ConnectionProvider} that manages connections from an underlying {@link DataSource}. diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java index aaf414fbfb..73af9e393a 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java @@ -37,7 +37,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.Stoppable; -import org.hibernate.service.spi.UnknownUnwrapTypeException; +import org.hibernate.service.UnknownUnwrapTypeException; import org.jboss.logging.Logger; /** diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java index 03c459748f..ff3fbb3f0b 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java @@ -25,7 +25,7 @@ package org.hibernate.service.jdbc.connections.internal; import java.sql.Connection; import java.sql.SQLException; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.UnknownUnwrapTypeException; +import org.hibernate.service.UnknownUnwrapTypeException; /** * An implementation of the {@link ConnectionProvider} interface that simply throws an exception when a connection diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/spi/ConnectionProvider.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/spi/ConnectionProvider.java index 8a67c92d2e..3603152023 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/spi/ConnectionProvider.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/spi/ConnectionProvider.java @@ -25,7 +25,7 @@ package org.hibernate.service.jdbc.connections.spi; import java.sql.Connection; import java.sql.SQLException; import org.hibernate.HibernateException; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; import org.hibernate.service.spi.Wrapped; /** diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectFactoryInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectFactoryInitiator.java index d6f77a0103..8b07b31280 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectFactoryInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectFactoryInitiator.java @@ -25,7 +25,7 @@ package org.hibernate.service.jdbc.dialect.internal; import java.util.Map; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jdbc.dialect.spi.DialectFactory; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectResolverInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectResolverInitiator.java index 21ee769af0..ef2ded0cf8 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectResolverInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/DialectResolverInitiator.java @@ -25,7 +25,7 @@ package org.hibernate.service.jdbc.dialect.internal; import java.util.Map; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jdbc.dialect.spi.DialectResolver; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectFactory.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectFactory.java index f6e048c5d5..33e9c1dcad 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectFactory.java @@ -28,7 +28,7 @@ import java.util.Map; import org.hibernate.HibernateException; import org.hibernate.dialect.Dialect; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * A factory for generating Dialect instances. diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectResolver.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectResolver.java index 32bb10ea08..1adfae2ecf 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/spi/DialectResolver.java @@ -27,7 +27,7 @@ import java.sql.DatabaseMetaData; import org.hibernate.dialect.Dialect; import org.hibernate.exception.JDBCConnectionException; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Contract for determining the {@link Dialect} to use based on a JDBC {@link java.sql.Connection}. diff --git a/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceImpl.java b/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceImpl.java index 40de850b54..2c1c0d2cc3 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceImpl.java @@ -33,9 +33,9 @@ import org.hibernate.HibernateException; import org.hibernate.HibernateLogger; import org.hibernate.cfg.Environment; import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.service.Service; import org.hibernate.service.jmx.spi.JmxService; import org.hibernate.service.spi.Manageable; -import org.hibernate.service.spi.Service; import org.hibernate.service.spi.Stoppable; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceInitiator.java index 237761663d..5cf071b5d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jmx/internal/JmxServiceInitiator.java @@ -26,7 +26,7 @@ package org.hibernate.service.jmx.internal; import java.util.Map; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jmx.spi.JmxService; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jmx/spi/JmxService.java b/hibernate-core/src/main/java/org/hibernate/service/jmx/spi/JmxService.java index 6fcc1386b2..629cf8faec 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jmx/spi/JmxService.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jmx/spi/JmxService.java @@ -25,8 +25,8 @@ package org.hibernate.service.jmx.spi; import javax.management.ObjectName; +import org.hibernate.service.Service; import org.hibernate.service.spi.Manageable; -import org.hibernate.service.spi.Service; /** * Service providing simplified access to JMX related features needed by Hibernate. diff --git a/hibernate-core/src/main/java/org/hibernate/service/jndi/internal/JndiServiceInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jndi/internal/JndiServiceInitiator.java index ece7f2e05b..fafeb0e640 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jndi/internal/JndiServiceInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jndi/internal/JndiServiceInitiator.java @@ -25,7 +25,7 @@ package org.hibernate.service.jndi.internal; import java.util.Map; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jndi.spi.JndiService; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java b/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java index 7d16f1d4ff..55b8a8b417 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java @@ -23,7 +23,7 @@ */ package org.hibernate.service.jndi.spi; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Service providing simplified access to JNDI related features needed by Hibernate. diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java index 8a6f696b17..b3200900ca 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java @@ -27,7 +27,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.jndi.spi.JndiService; import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.spi.Configurable; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.ServiceRegistryAwareService; import javax.transaction.Synchronization; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java index a6320d272c..02622c1cd2 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java @@ -32,7 +32,7 @@ import org.hibernate.HibernateLogger; import org.hibernate.cfg.Environment; import org.hibernate.internal.util.jndi.JndiHelper; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.jta.platform.spi.JtaPlatformException; import org.hibernate.service.spi.BasicServiceInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/spi/JtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/spi/JtaPlatform.java index 4f81875f18..32e303fbcb 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/spi/JtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/spi/JtaPlatform.java @@ -29,7 +29,7 @@ import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Defines how we interact with various JTA services on the given platform/environment. diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/BasicServiceInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/spi/BasicServiceInitiator.java index 706bb0e0b3..1b9ed5fe15 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/BasicServiceInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/BasicServiceInitiator.java @@ -1,7 +1,7 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2010, Red Hat Inc. or third-party contributors as + * 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. @@ -25,7 +25,7 @@ package org.hibernate.service.spi; import java.util.Map; -import org.hibernate.service.internal.ServiceRegistryImplementor; +import org.hibernate.service.Service; /** * Responsible for initiating services. diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java b/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java index f730ad93f0..7fe42b8820 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java @@ -25,7 +25,7 @@ package org.hibernate.service.spi; /** - * Optional {@link 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 * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryAwareService.java b/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryAwareService.java index 67763b52a1..62941d4a61 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryAwareService.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryAwareService.java @@ -23,8 +23,10 @@ */ package org.hibernate.service.spi; +import org.hibernate.service.ServiceRegistry; + /** - * Allows services to be injected with the {@link ServiceRegistry} during configuration phase. + * Allows services to be injected with the {@link org.hibernate.service.ServiceRegistry} during configuration phase. * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceRegistryImplementor.java b/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryImplementor.java similarity index 74% rename from hibernate-core/src/main/java/org/hibernate/service/internal/ServiceRegistryImplementor.java rename to hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryImplementor.java index 27b5cbdf8b..70179376d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceRegistryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/ServiceRegistryImplementor.java @@ -21,10 +21,10 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.service.internal; +package org.hibernate.service.spi; -import org.hibernate.service.spi.Service; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.Service; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.proxy.ServiceProxyTargetSource; /** @@ -32,4 +32,27 @@ import org.hibernate.service.spi.proxy.ServiceProxyTargetSource; */ public interface ServiceRegistryImplementor extends ServiceRegistry, ServiceProxyTargetSource { public ServiceBinding locateServiceBinding(Class serviceRole); + + public void destroy(); + + public final class ServiceBinding { + private final R proxy; + private R target; + + public ServiceBinding(R proxy) { + this.proxy = proxy; + } + + public R getProxy() { + return proxy; + } + + public R getTarget() { + return target; + } + + public void setTarget(R target) { + this.target = target; + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistry.java b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistry.java new file mode 100644 index 0000000000..78e2fbb00f --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistry.java @@ -0,0 +1,34 @@ +/* + * 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.spi; + +/** + * Acts as a {@link org.hibernate.service.Service} in the {@link org.hibernate.service.internal.BasicServiceRegistryImpl} whose function is as a factory for + * {@link org.hibernate.service.internal.SessionFactoryServiceRegistryImpl} implementations. + * + * @author Steve Ebersole + */ +public interface SessionFactoryServiceRegistry extends ServiceRegistryImplementor { + // todo : add regsitration of service initiator +} diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java new file mode 100644 index 0000000000..8d5106ee5d --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java @@ -0,0 +1,53 @@ +/* + * 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.spi; + +import org.hibernate.cfg.Configuration; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.service.Service; +import org.hibernate.service.internal.SessionFactoryServiceRegistryImpl; + +/** + * Contract for builder of {@link SessionFactoryServiceRegistry} instances. Defined as a service to + * "sit inside" the {@link org.hibernate.service.BasicServiceRegistry}. + * + * @author Steve Ebersole + */ +public interface SessionFactoryServiceRegistryFactory extends Service { + /** + * Create the registry. + * + * @todo : fully expect this signature to change! + * + * @param sessionFactory The (in flux) session factory. Generally this is useful for grabbing a reference for later + * use. However, care should be taken when invoking on the session factory until after it has been fully + * initialized. + * @param configuration The configuration object. + * + * @return The registry + */ + public SessionFactoryServiceRegistryImpl buildServiceRegistry( + SessionFactoryImplementor sessionFactory, + Configuration configuration); +} diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyFactory.java index cc90536ca7..9d81709a1e 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyFactory.java @@ -23,7 +23,7 @@ */ package org.hibernate.service.spi.proxy; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; /** * Contract for creating proxy instances for {@link Service} instances. diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyTargetSource.java b/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyTargetSource.java index e7b50c0b7f..45419fa2f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyTargetSource.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/proxy/ServiceProxyTargetSource.java @@ -23,8 +23,8 @@ */ package org.hibernate.service.spi.proxy; -import org.hibernate.service.spi.Service; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.Service; +import org.hibernate.service.ServiceRegistry; /** * Additional contract for service proxies. This allows the proxies access to their actual service instances. @@ -40,7 +40,7 @@ public interface ServiceProxyTargetSource extends ServiceRegistry { * * @return The requested service. * - * @throws org.hibernate.service.spi.UnknownServiceException Indicates the service was not known. + * @throws org.hibernate.service.UnknownServiceException Indicates the service was not known. */ public R getServiceInternal(Class serviceRole); } diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentStatisticsImpl.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentStatisticsImpl.java index f951841469..3bb2bced11 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentStatisticsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentStatisticsImpl.java @@ -33,7 +33,7 @@ import org.hibernate.HibernateLogger; import org.hibernate.cache.Region; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.internal.util.collections.ArrayHelper; -import org.hibernate.service.spi.Service; +import org.hibernate.service.Service; import org.hibernate.stat.CollectionStatistics; import org.hibernate.stat.EntityStatistics; import org.hibernate.stat.QueryStatistics; diff --git a/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java b/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java index f4e9b1e7d0..5cac2329da 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java @@ -42,7 +42,7 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.impl.SessionImpl; import org.hibernate.jdbc.Work; import org.hibernate.mapping.SimpleAuxiliaryDatabaseObject; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.junit.After; import org.junit.Before; diff --git a/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java index ab072fb57b..a0e9885080 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java @@ -42,7 +42,7 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.impl.SessionImpl; import org.hibernate.jdbc.Work; import org.hibernate.mapping.SimpleAuxiliaryDatabaseObject; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.junit.After; import org.junit.Before; diff --git a/hibernate-core/src/test/java/org/hibernate/id/TableHiLoGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/id/TableHiLoGeneratorTest.java index b4ca8ad832..e45b00821c 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/TableHiLoGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/TableHiLoGeneratorTest.java @@ -42,7 +42,7 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.impl.SessionImpl; import org.hibernate.jdbc.Work; import org.hibernate.mapping.SimpleAuxiliaryDatabaseObject; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.junit.After; import org.junit.Before; diff --git a/hibernate-core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java b/hibernate-core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java index 72c0126c50..50665f8b53 100644 --- a/hibernate-core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java @@ -28,7 +28,8 @@ import org.junit.Test; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; import org.hibernate.testing.junit4.BaseUnitTestCase; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java index 357d5f9bc9..a49fdaa4a2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java @@ -7,7 +7,8 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/SafeMappingTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/SafeMappingTest.java index 179dd9c4ab..db1d0c8b68 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/SafeMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/SafeMappingTest.java @@ -3,7 +3,7 @@ package org.hibernate.test.annotations; import org.hibernate.AnnotationException; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/SecuredBindingTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/SecuredBindingTest.java index e4921f0b6d..af454c2c00 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/SecuredBindingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/SecuredBindingTest.java @@ -7,7 +7,8 @@ import org.hibernate.HibernateException; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/access/jpa/AccessMappingTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/access/jpa/AccessMappingTest.java index bdfe9207e0..5b90b5e026 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/access/jpa/AccessMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/access/jpa/AccessMappingTest.java @@ -31,7 +31,8 @@ import org.hibernate.cfg.Environment; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.property.BasicPropertyAccessor; import org.hibernate.property.DirectPropertyAccessor; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.tuple.entity.PojoEntityTuplizer; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/access/xml/XmlAccessTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/access/xml/XmlAccessTest.java index 48c3b1b215..4e072098ef 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/access/xml/XmlAccessTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/access/xml/XmlAccessTest.java @@ -36,7 +36,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.property.BasicPropertyAccessor; import org.hibernate.property.DirectPropertyAccessor; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.tuple.entity.PojoEntityTuplizer; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java index 387d445e9b..58b7587514 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java @@ -8,7 +8,7 @@ import junit.framework.TestCase; import org.hibernate.MappingException; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/duplicatedgenerator/DuplicateTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/duplicatedgenerator/DuplicateTest.java index c963dc9549..d3a7e515a0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/duplicatedgenerator/DuplicateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/duplicatedgenerator/DuplicateTest.java @@ -5,7 +5,8 @@ import junit.framework.TestCase; import org.hibernate.AnnotationException; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java index 1659e92650..1b62f1604a 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java @@ -33,7 +33,8 @@ import org.hibernate.MappingException; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; import org.hibernate.engine.SessionFactoryImplementor; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/fkcircularity/FkCircularityTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/fkcircularity/FkCircularityTest.java index 8bbfaac1ca..a9a3307c03 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/fkcircularity/FkCircularityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/fkcircularity/FkCircularityTest.java @@ -9,7 +9,8 @@ import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/namingstrategy/NamingStrategyTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/namingstrategy/NamingStrategyTest.java index 890801bbbc..65f41277fe 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/namingstrategy/NamingStrategyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/namingstrategy/NamingStrategyTest.java @@ -11,7 +11,8 @@ import org.hibernate.cfg.EJB3NamingStrategy; import org.hibernate.cfg.Environment; import org.hibernate.cfg.Mappings; import org.hibernate.mapping.Table; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; + import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneErrorTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneErrorTest.java index 4c8204ded0..522b8e617d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneErrorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneErrorTest.java @@ -4,7 +4,7 @@ package org.hibernate.test.annotations.onetoone; import org.hibernate.AnnotationException; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java index a562ad605f..6517a7b5d3 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetoone/primarykey/NullablePrimaryKeyTest.java @@ -6,7 +6,7 @@ import junit.framework.TestCase; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/ConfigurationSerializationTest.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/ConfigurationSerializationTest.java index 414f58269a..ff980410d0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cfg/ConfigurationSerializationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/ConfigurationSerializationTest.java @@ -29,7 +29,7 @@ import javax.persistence.Id; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.internal.util.SerializationHelper; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.junit.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/persister/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/persister/PersisterClassProviderTest.java index a8154b1b47..8597d932c8 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cfg/persister/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/persister/PersisterClassProviderTest.java @@ -24,7 +24,7 @@ import org.hibernate.MappingException; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.persister.spi.PersisterClassResolver; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.junit.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/test/common/TransactionEnvironmentImpl.java b/hibernate-core/src/test/java/org/hibernate/test/common/TransactionEnvironmentImpl.java index ebc840dd5f..21497aa6ab 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/common/TransactionEnvironmentImpl.java +++ b/hibernate-core/src/test/java/org/hibernate/test/common/TransactionEnvironmentImpl.java @@ -28,8 +28,8 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.transaction.spi.TransactionEnvironment; import org.hibernate.engine.transaction.spi.TransactionFactory; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.jta.platform.spi.JtaPlatform; -import org.hibernate.service.spi.ServiceRegistry; import org.hibernate.stat.internal.ConcurrentStatisticsImpl; import org.hibernate.stat.spi.StatisticsImplementor; diff --git a/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/AbstractExecutable.java b/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/AbstractExecutable.java index 1ee2efe875..7665886fa3 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/AbstractExecutable.java +++ b/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/AbstractExecutable.java @@ -3,47 +3,47 @@ package org.hibernate.test.instrument.cases; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; - -/** - * @author Steve Ebersole - */ -public abstract class AbstractExecutable implements Executable { - - private ServiceRegistry serviceRegistry; - private SessionFactory factory; - - public final void prepare() { - Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" ); - String[] resources = getResources(); - for ( String resource : resources ) { - cfg.addResource( resource ); - } - serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() ); - factory = cfg.buildSessionFactory( serviceRegistry ); - } - - public final void complete() { - try { - cleanup(); - } - finally { - factory.close(); - if ( serviceRegistry != null ) { - ServiceRegistryBuilder.destroy( serviceRegistry ); - } - } - } - - protected SessionFactory getFactory() { - return factory; - } - - protected void cleanup() { - } - - protected String[] getResources() { - return new String[] { "org/hibernate/test/instrument/domain/Documents.hbm.xml" }; - } -} + +/** + * @author Steve Ebersole + */ +public abstract class AbstractExecutable implements Executable { + + private ServiceRegistry serviceRegistry; + private SessionFactory factory; + + public final void prepare() { + Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" ); + String[] resources = getResources(); + for ( String resource : resources ) { + cfg.addResource( resource ); + } + serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() ); + factory = cfg.buildSessionFactory( serviceRegistry ); + } + + public final void complete() { + try { + cleanup(); + } + finally { + factory.close(); + if ( serviceRegistry != null ) { + ServiceRegistryBuilder.destroy( serviceRegistry ); + } + } + } + + protected SessionFactory getFactory() { + return factory; + } + + protected void cleanup() { + } + + protected String[] getResources() { + return new String[] { "org/hibernate/test/instrument/domain/Documents.hbm.xml" }; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/jdbc/proxies/BatchingTest.java b/hibernate-core/src/test/java/org/hibernate/test/jdbc/proxies/BatchingTest.java index 78fd6f5585..26cd2739d5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/jdbc/proxies/BatchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/jdbc/proxies/BatchingTest.java @@ -41,8 +41,8 @@ import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.jdbc.Expectation; import org.hibernate.jdbc.Expectations; +import org.hibernate.service.StandardServiceInitiators; import org.hibernate.service.internal.BasicServiceRegistryImpl; -import org.hibernate.service.spi.StandardServiceInitiators; import org.junit.After; import org.junit.Before; diff --git a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java index 966beecec3..a5e94a44b6 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java @@ -35,7 +35,7 @@ import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.cfg.Environment; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.hibernate.tool.hbm2ddl.SchemaUpdate; diff --git a/hibernate-core/src/test/java/org/hibernate/test/transaction/jdbc/TestExpectedUsage.java b/hibernate-core/src/test/java/org/hibernate/test/transaction/jdbc/TestExpectedUsage.java index f4b1adc387..7b47132d88 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/transaction/jdbc/TestExpectedUsage.java +++ b/hibernate-core/src/test/java/org/hibernate/test/transaction/jdbc/TestExpectedUsage.java @@ -33,8 +33,8 @@ import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionImplementor; +import org.hibernate.service.StandardServiceInitiators; import org.hibernate.service.internal.BasicServiceRegistryImpl; -import org.hibernate.service.spi.StandardServiceInitiators; import org.junit.After; import org.junit.Before; diff --git a/hibernate-core/src/test/java/org/hibernate/test/transaction/jta/ManagedDrivingTest.java b/hibernate-core/src/test/java/org/hibernate/test/transaction/jta/ManagedDrivingTest.java index 90694dc042..0f0413535d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/transaction/jta/ManagedDrivingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/transaction/jta/ManagedDrivingTest.java @@ -38,10 +38,10 @@ import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory; import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.engine.transaction.spi.TransactionImplementor; +import org.hibernate.service.StandardServiceInitiators; import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.internal.ServiceProxy; import org.hibernate.service.jta.platform.spi.JtaPlatform; -import org.hibernate.service.spi.StandardServiceInitiators; import org.junit.After; import org.junit.Before; diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java index 0a14e81301..80f4182b08 100644 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java @@ -99,9 +99,9 @@ import org.hibernate.mapping.AuxiliaryDatabaseObject; import org.hibernate.mapping.PersistentClass; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.secure.JACCConfiguration; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.internal.BasicServiceRegistryImpl; import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl; -import org.hibernate.service.spi.ServiceRegistry; /** * Allow a fine tuned configuration of an EJB 3.0 EntityManagerFactory diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java index 070524c50b..8231afe8b8 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java @@ -46,7 +46,7 @@ import org.hibernate.ejb.util.PersistenceUtilHelper; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.mapping.PersistentClass; import org.hibernate.metadata.ClassMetadata; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; /** * Actual Hiberate implementation of {@link javax.persistence.EntityManagerFactory}. diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractOneSessionTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractOneSessionTest.java index f098a9c3d1..8c5e97aa5c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractOneSessionTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractOneSessionTest.java @@ -7,10 +7,9 @@ import org.hibernate.MappingException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; import org.hibernate.envers.AuditReader; import org.hibernate.envers.AuditReaderFactory; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractSessionTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractSessionTest.java index 0e60545efb..0cb650dd56 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractSessionTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/AbstractSessionTest.java @@ -7,10 +7,9 @@ import org.hibernate.MappingException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; import org.hibernate.envers.AuditReader; import org.hibernate.envers.AuditReaderFactory; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.testing.ServiceRegistryBuilder; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/DualNodeConnectionProviderImpl.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/DualNodeConnectionProviderImpl.java index 60a6564eaf..182c1913b0 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/DualNodeConnectionProviderImpl.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/DualNodeConnectionProviderImpl.java @@ -30,7 +30,7 @@ import org.hibernate.HibernateException; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.Stoppable; -import org.hibernate.service.spi.UnknownUnwrapTypeException; +import org.hibernate.service.UnknownUnwrapTypeException; import org.hibernate.testing.env.ConnectionProviderBuilder; diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java index a3eb3d42ad..a479df3be1 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java @@ -44,7 +44,7 @@ import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; -import org.hibernate.service.spi.ServiceRegistry; +import org.hibernate.service.ServiceRegistry; import org.hibernate.stat.Statistics; import org.hibernate.test.cache.infinispan.functional.Item; import org.hibernate.testing.ServiceRegistryBuilder; diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaConnectionProvider.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaConnectionProvider.java index bc5b867503..0e4e008ad9 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaConnectionProvider.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/XaConnectionProvider.java @@ -24,9 +24,9 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import org.hibernate.HibernateException; +import org.hibernate.service.UnknownUnwrapTypeException; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.Stoppable; -import org.hibernate.service.spi.UnknownUnwrapTypeException; import org.hibernate.testing.env.ConnectionProviderBuilder; diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/util/CacheTestUtil.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/util/CacheTestUtil.java index 9d8800356e..4739d9e27d 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/util/CacheTestUtil.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/util/CacheTestUtil.java @@ -33,9 +33,8 @@ import org.hibernate.cache.infinispan.InfinispanRegionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.cfg.Settings; -import org.hibernate.engine.jdbc.spi.JdbcServices; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.jta.platform.internal.JtaPlatformInitiator; -import org.hibernate.service.spi.ServiceRegistry; /** * Utilities for cache testing. diff --git a/hibernate-proxool/src/main/java/org/hibernate/service/jdbc/connections/internal/ProxoolConnectionProvider.java b/hibernate-proxool/src/main/java/org/hibernate/service/jdbc/connections/internal/ProxoolConnectionProvider.java index de27989fcf..e084a6db29 100644 --- a/hibernate-proxool/src/main/java/org/hibernate/service/jdbc/connections/internal/ProxoolConnectionProvider.java +++ b/hibernate-proxool/src/main/java/org/hibernate/service/jdbc/connections/internal/ProxoolConnectionProvider.java @@ -33,7 +33,7 @@ import org.hibernate.internal.util.ConfigHelper; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.UnknownUnwrapTypeException; +import org.hibernate.service.UnknownUnwrapTypeException; import org.jboss.logging.Logger; import org.logicalcobwebs.proxool.ProxoolException; import org.logicalcobwebs.proxool.ProxoolFacade; diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/ServiceRegistryBuilder.java b/hibernate-testing/src/main/java/org/hibernate/testing/ServiceRegistryBuilder.java index cb96628a0a..f110dcbfad 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/ServiceRegistryBuilder.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/ServiceRegistryBuilder.java @@ -25,8 +25,8 @@ package org.hibernate.testing; import org.hibernate.cfg.Environment; import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.service.ServiceRegistry; import org.hibernate.service.internal.BasicServiceRegistryImpl; -import org.hibernate.service.spi.ServiceRegistry; import java.util.Map; import java.util.Properties;