Class StandardServiceRegistryBuilder
ServiceRegistry
instances.
Configuration properties are enumerated by AvailableSettings
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default resource name for a Hibernate configuration XML file. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a default builder.StandardServiceRegistryBuilder
(BootstrapServiceRegistry bootstrapServiceRegistry) Create a builder with the specified bootstrap services.protected
StandardServiceRegistryBuilder
(BootstrapServiceRegistry bootstrapServiceRegistry, Map<String, Object> settings, ConfigLoader loader, LoadedConfig loadedConfig, List<StandardServiceInitiator<?>> initiators) Intended for use exclusively from Quarkus bootstrapping, or extensions of this class which need to override the standard ServiceInitiator list.protected
StandardServiceRegistryBuilder
(BootstrapServiceRegistry bootstrapServiceRegistry, Map<String, Object> settings, LoadedConfig loadedConfig) Intended for use exclusively from JPA bootstrapping, or extensions of this class.StandardServiceRegistryBuilder
(BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) Create a builder with the specified bootstrap services. -
Method Summary
Modifier and TypeMethodDescriptionaddInitiator
(StandardServiceInitiator<?> initiator) Adds a service initiator.<T extends Service>
StandardServiceRegistryBuilderaddService
(Class<T> serviceRole, T service) Adds a user-provided service.applySetting
(String settingName, Object value) Apply a setting value.applySettings
(Map<String, Object> settings) Apply a group of settings.applySettings
(Properties settings) Apply a group of settings.build()
Build and return theStandardServiceRegistry
.Discard all the settings applied so far.Read setting information from an XML file using the standard resource location.Read setting information from an XML file using the named resource location.configure
(LoadedConfig loadedConfig) static void
destroy
(ServiceRegistry serviceRegistry) Destroy a service registry.By default, when aServiceRegistry
is no longer referenced by any other registries as a parent it will be closed.Enablesauto-closing
.forJpa
(BootstrapServiceRegistry bootstrapServiceRegistry) Creates aStandardServiceRegistryBuilder
specific to the needs of bootstrapping JPA.Intended for internal testing use only!!Obtain the current aggregated settings.loadProperties
(File file) Read settings from aProperties
file by File referenceloadProperties
(String resourceName) Read settings from aProperties
file by resource name.
-
Field Details
-
DEFAULT_CFG_RESOURCE_NAME
The default resource name for a Hibernate configuration XML file.- See Also:
-
-
Constructor Details
-
StandardServiceRegistryBuilder
public StandardServiceRegistryBuilder()Create a default builder. -
StandardServiceRegistryBuilder
Create a builder with the specified bootstrap services.- Parameters:
bootstrapServiceRegistry
- Provided bootstrap registry to use.
-
StandardServiceRegistryBuilder
protected StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry, Map<String, Object> settings, LoadedConfig loadedConfig) Intended for use exclusively from JPA bootstrapping, or extensions of this class. Consider this an SPI. -
StandardServiceRegistryBuilder
protected StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry, Map<String, Object> settings, ConfigLoader loader, LoadedConfig loadedConfig, List<StandardServiceInitiator<?>> initiators) Intended for use exclusively from Quarkus bootstrapping, or extensions of this class which need to override the standard ServiceInitiator list. Consider this an SPI. -
StandardServiceRegistryBuilder
public StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) Create a builder with the specified bootstrap services.- Parameters:
bootstrapServiceRegistry
- Provided bootstrap registry to use.
-
-
Method Details
-
forJpa
public static StandardServiceRegistryBuilder forJpa(BootstrapServiceRegistry bootstrapServiceRegistry) Creates aStandardServiceRegistryBuilder
specific to the needs of bootstrapping JPA.Intended only for use from
EntityManagerFactoryBuilderImpl
.In particular, we ignore properties found in
cfg.xml
files.EntityManagerFactoryBuilderImpl
collects these properties later.- See Also:
-
getConfigLoader
-
getAggregatedCfgXml
Intended for internal testing use only!! -
getBootstrapServiceRegistry
-
loadProperties
Read settings from aProperties
file by resource name.Differs from
configure()
andconfigure(String)
in that here we expect to read a properties file, while forconfigure()
we read the configuration from XML.- Parameters:
resourceName
- The name by which to perform a resource look up for the properties file- Returns:
- this, for method chaining
- See Also:
-
loadProperties
Read settings from aProperties
file by File referenceDiffers from
configure()
andconfigure(String)
in that here we expect to read a properties file, while forconfigure()
we read the configuration from XML.- Parameters:
file
- The properties File reference- Returns:
- this, for method chaining
- See Also:
-
configure
Read setting information from an XML file using the standard resource location.- Returns:
- this, for method chaining
- See Also:
-
configure
Read setting information from an XML file using the named resource location.- Parameters:
resourceName
- The named resource- Returns:
- this, for method chaining
-
configure
-
configure
-
configure
-
applySetting
Apply a setting value.- Parameters:
settingName
- The name of the settingvalue
- The value to use.- Returns:
- this, for method chaining
-
applySettings
Apply a group of settings.- Parameters:
settings
- The incoming settings to apply- Returns:
- this, for method chaining
-
applySettings
Apply a group of settings.- Parameters:
settings
- The incoming settings to apply- Returns:
- this, for method chaining
-
clearSettings
Discard all the settings applied so far. -
addInitiator
Adds a service initiator.- Parameters:
initiator
- The initiator to be added- Returns:
- this, for method chaining
-
addService
public <T extends Service> StandardServiceRegistryBuilder addService(Class<T> serviceRole, T service) Adds a user-provided service.- Parameters:
serviceRole
- The role of the service being addedservice
- The service implementation- Returns:
- this, for method chaining
-
disableAutoClose
By default, when aServiceRegistry
is no longer referenced by any other registries as a parent it will be closed. Some applications that explicitly build "shared registries" may need to circumvent that behavior.This method indicates that the registry being built should not be automatically closed. The caller takes responsibility for closing it.
- Returns:
- this, for method chaining
-
enableAutoClose
Enablesauto-closing
.- Returns:
- this, for method chaining
-
build
Build and return theStandardServiceRegistry
.- Returns:
- A newly-instantiated
StandardServiceRegistry
-
getSettings
Obtain the current aggregated settings. -
destroy
Destroy a service registry.Applications should only destroy registries they have explicitly created.
- Parameters:
serviceRegistry
- The registry to be closed.
-