org.hibernate.service.internal
Class AbstractServiceRegistryImpl

java.lang.Object
  extended by org.hibernate.service.internal.AbstractServiceRegistryImpl
All Implemented Interfaces:
ServiceRegistry, ServiceBinding.ServiceLifecycleOwner, ServiceRegistryImplementor
Direct Known Subclasses:
SessionFactoryServiceRegistryImpl, StandardServiceRegistryImpl

public abstract class AbstractServiceRegistryImpl
extends Object
implements ServiceRegistryImplementor, ServiceBinding.ServiceLifecycleOwner


Constructor Summary
protected AbstractServiceRegistryImpl()
           
  AbstractServiceRegistryImpl(BootstrapServiceRegistry bootstrapServiceRegistry)
           
protected AbstractServiceRegistryImpl(ServiceRegistryImplementor parent)
           
 
Method Summary
protected
<R extends Service>
R
createService(ServiceBinding<R> serviceBinding)
           
protected
<R extends Service>
void
createServiceBinding(ProvidedService<R> providedService)
           
protected
<R extends Service>
void
createServiceBinding(ServiceInitiator<R> initiator)
           
 void destroy()
          Release resources
 ServiceRegistry getParentServiceRegistry()
          Retrieve this registry's parent registry.
<R extends Service>
R
getService(Class<R> serviceRole)
          Retrieve a service by role.
<R extends Service>
void
injectDependencies(ServiceBinding<R> serviceBinding)
           
<R extends Service>
ServiceBinding<R>
locateServiceBinding(Class<R> serviceRole)
          Locate the binding for the given role.
protected
<R extends Service>
ServiceBinding<R>
locateServiceBinding(Class<R> serviceRole, boolean checkParent)
           
protected
<R extends Service>
void
registerService(ServiceBinding<R> serviceBinding, R service)
           
<R extends Service>
void
startService(ServiceBinding<R> serviceBinding)
           
<R extends Service>
void
stopService(ServiceBinding<R> binding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.service.spi.ServiceBinding.ServiceLifecycleOwner
configureService, initiateService
 

Constructor Detail

AbstractServiceRegistryImpl

protected AbstractServiceRegistryImpl()

AbstractServiceRegistryImpl

protected AbstractServiceRegistryImpl(ServiceRegistryImplementor parent)

AbstractServiceRegistryImpl

public AbstractServiceRegistryImpl(BootstrapServiceRegistry bootstrapServiceRegistry)
Method Detail

createServiceBinding

protected <R extends Service> void createServiceBinding(ServiceInitiator<R> initiator)

createServiceBinding

protected <R extends Service> void createServiceBinding(ProvidedService<R> providedService)

getParentServiceRegistry

public ServiceRegistry getParentServiceRegistry()
Description copied from interface: ServiceRegistry
Retrieve this registry's parent registry.

Specified by:
getParentServiceRegistry in interface ServiceRegistry
Returns:
The parent registry. May be null.

locateServiceBinding

public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole)
Description copied from interface: ServiceRegistryImplementor
Locate the binding for the given role. Should, generally speaking, look into parent registry if one.

Specified by:
locateServiceBinding in interface ServiceRegistryImplementor
Type Parameters:
R - generic return type.
Parameters:
serviceRole - The service role for which to locate a binding.
Returns:
The located binding; may be null

locateServiceBinding

protected <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole,
                                                                     boolean checkParent)

getService

public <R extends Service> R getService(Class<R> serviceRole)
Description copied from interface: ServiceRegistry
Retrieve a service by role. If service is not found, but a BasicServiceInitiator is registered for this service role, the service will be initialized and returned.

NOTE: We cannot return <R extends Service<T>> here because the service might come from the parent...

Specified by:
getService in interface ServiceRegistry
Type Parameters:
R - The service role type
Parameters:
serviceRole - The service role
Returns:
The requested service.

registerService

protected <R extends Service> void registerService(ServiceBinding<R> serviceBinding,
                                                   R service)

createService

protected <R extends Service> R createService(ServiceBinding<R> serviceBinding)

injectDependencies

public <R extends Service> void injectDependencies(ServiceBinding<R> serviceBinding)
Specified by:
injectDependencies in interface ServiceBinding.ServiceLifecycleOwner

startService

public <R extends Service> void startService(ServiceBinding<R> serviceBinding)
Specified by:
startService in interface ServiceBinding.ServiceLifecycleOwner

destroy

public void destroy()
Description copied from interface: ServiceRegistryImplementor
Release resources

Specified by:
destroy in interface ServiceRegistryImplementor

stopService

public <R extends Service> void stopService(ServiceBinding<R> binding)
Specified by:
stopService in interface ServiceBinding.ServiceLifecycleOwner


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.