HHH-6051 - Create a sessionfactory scoped ServiceRegistry
This commit is contained in:
parent
731d00fd6d
commit
815baf4348
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SessionFactoryObserver> observers;
|
||||
|
||||
public void addObserver(SessionFactoryObserver observer) {
|
||||
if ( observers == null ) {
|
||||
observers = new ArrayList<SessionFactoryObserver>();
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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<R> {
|
||||
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);
|
||||
}
|
|
@ -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;
|
||||
|
|
@ -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.
|
||||
* <p/>
|
||||
* NOTE: We cannot return {@code <R extends Service<T>>} here because the service might come from the parent...
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 extends Service> R initializeService(Class<R> serviceRole);
|
||||
private <R extends Service> R initializeService(Class<R> 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 extends Service> T createService(Class<T> serviceRole);
|
||||
protected abstract <T extends Service> void configureService(T service);
|
||||
|
||||
protected <T extends Service> 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 <T extends Service> 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 <T extends Service> 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"})
|
||||
|
|
|
@ -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<Class,BasicServiceInitiator> 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 extends Service> R initializeService(Class<R> 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 extends Service> T createService(Class<T> serviceRole) {
|
||||
protected <T extends Service> T createService(Class<T> serviceRole) {
|
||||
BasicServiceInitiator<T> initiator = serviceInitiatorMap.get( serviceRole );
|
||||
if ( initiator == null ) {
|
||||
throw new UnknownServiceException( serviceRole );
|
||||
|
@ -134,7 +115,8 @@ public class BasicServiceRegistryImpl extends AbstractServiceRegistryImpl {
|
|||
}
|
||||
}
|
||||
|
||||
private <T extends Service> void configureService(T service) {
|
||||
@Override
|
||||
protected <T extends Service> 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 <T extends Service> 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 <T extends Service> 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 <T extends Service> 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
|
@ -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<SessionFactoryServiceRegistryFactory> {
|
||||
public static final SessionFactoryServiceRegistryFactoryInitiator INSTANCE = new SessionFactoryServiceRegistryFactoryInitiator();
|
||||
|
||||
@Override
|
||||
public Class<SessionFactoryServiceRegistryFactory> getServiceInitiated() {
|
||||
return SessionFactoryServiceRegistryFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryServiceRegistryFactoryImpl initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
|
||||
return new SessionFactoryServiceRegistryFactoryImpl( registry );
|
||||
}
|
||||
}
|
|
@ -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 extends Service> T createService(Class<T> serviceRole) {
|
||||
return null; // todo : implement method body
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T extends Service> void configureService(T service) {
|
||||
// todo : implement method body
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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 <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole);
|
||||
|
||||
public void destroy();
|
||||
|
||||
public final class ServiceBinding<R> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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.
|
||||
|
|
|
@ -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 extends Service> R getServiceInternal(Class<R> serviceRole);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue