public class StandardServiceRegistryBuilder extends Object
Builder for standard ServiceRegistry
instances.
StandardServiceRegistryImpl
,
BootstrapServiceRegistryBuilder
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CFG_RESOURCE_NAME
The default resource name for a hibernate configuration xml file.
|
Constructor and Description |
---|
StandardServiceRegistryBuilder()
Create a default builder.
|
StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry)
Create a builder with the specified bootstrap services.
|
StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry,
LoadedConfig loadedConfigBaseline)
Create a builder with the specified bootstrap services.
|
Modifier and Type | Method and Description |
---|---|
StandardServiceRegistryBuilder |
addInitiator(StandardServiceInitiator initiator)
Adds a service initiator.
|
StandardServiceRegistryBuilder |
addService(Class serviceRole,
Service service)
Adds a user-provided service.
|
StandardServiceRegistryBuilder |
applySetting(String settingName,
Object value)
Apply a setting value.
|
StandardServiceRegistryBuilder |
applySettings(Map settings)
Apply a groups of setting values.
|
StandardServiceRegistry |
build()
Build the StandardServiceRegistry.
|
void |
clearSettings() |
StandardServiceRegistryBuilder |
configure()
Read setting information from an XML file using the standard resource location.
|
StandardServiceRegistryBuilder |
configure(File configurationFile) |
StandardServiceRegistryBuilder |
configure(LoadedConfig loadedConfig) |
StandardServiceRegistryBuilder |
configure(String resourceName)
Read setting information from an XML file using the named resource location.
|
StandardServiceRegistryBuilder |
configure(URL url) |
static void |
destroy(ServiceRegistry serviceRegistry)
Destroy a service registry.
|
StandardServiceRegistryBuilder |
disableAutoClose()
By default, when a ServiceRegistry is no longer referenced by any other
registries as a parent it will be closed.
|
StandardServiceRegistryBuilder |
enableAutoClose()
See the discussion on
disableAutoClose() . |
LoadedConfig |
getAggregatedCfgXml()
Intended for internal testing use only!!
|
BootstrapServiceRegistry |
getBootstrapServiceRegistry() |
Map |
getSettings()
Deprecated.
Temporarily exposed since Configuration is still around and much code still uses Configuration.
This allows code to configure the builder and access that to configure Configuration object.
|
StandardServiceRegistryBuilder |
loadProperties(File file)
Read settings from a
Properties file by File reference
<p>
Differs from configure() and configure(String) in that here we expect to read a
Properties file while for configure() we read the XML variant. |
StandardServiceRegistryBuilder |
loadProperties(String resourceName)
Read settings from a
Properties file by resource name. |
public static final String DEFAULT_CFG_RESOURCE_NAME
The default resource name for a hibernate configuration xml file.
public StandardServiceRegistryBuilder()
Create a default builder.
public StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry)
Create a builder with the specified bootstrap services.
bootstrapServiceRegistry
- Provided bootstrap registry to use.public StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline)
Create a builder with the specified bootstrap services.
bootstrapServiceRegistry
- Provided bootstrap registry to use.public LoadedConfig getAggregatedCfgXml()
Intended for internal testing use only!!
public BootstrapServiceRegistry getBootstrapServiceRegistry()
public StandardServiceRegistryBuilder loadProperties(String resourceName)
Read settings from a Properties
file by resource name.
<p>
Differs from configure()
and configure(String)
in that here we expect to read a
Properties
file while for configure()
we read the XML variant.
resourceName
- The name by which to perform a resource look up for the properties file.configure()
,
configure(String)
public StandardServiceRegistryBuilder loadProperties(File file)
Read settings from a Properties
file by File reference
<p>
Differs from configure()
and configure(String)
in that here we expect to read a
Properties
file while for configure()
we read the XML variant.
file
- The properties File referenceconfigure()
,
configure(String)
public StandardServiceRegistryBuilder configure()
Read setting information from an XML file using the standard resource location.
DEFAULT_CFG_RESOURCE_NAME
,
configure(String)
,
loadProperties(String)
public StandardServiceRegistryBuilder configure(String resourceName)
Read setting information from an XML file using the named resource location.
resourceName
- The named resourcepublic StandardServiceRegistryBuilder configure(File configurationFile)
public StandardServiceRegistryBuilder configure(URL url)
public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig)
public StandardServiceRegistryBuilder applySetting(String settingName, Object value)
Apply a setting value.
settingName
- The name of the settingvalue
- The value to use.public StandardServiceRegistryBuilder applySettings(Map settings)
Apply a groups of setting values.
settings
- The incoming settings to applypublic void clearSettings()
public StandardServiceRegistryBuilder addInitiator(StandardServiceInitiator initiator)
Adds a service initiator.
initiator
- The initiator to be addedpublic StandardServiceRegistryBuilder addService(Class serviceRole, Service service)
Adds a user-provided service.
serviceRole
- The role of the service being addedservice
- The service implementationpublic StandardServiceRegistryBuilder disableAutoClose()
By default, when a ServiceRegistry is no longer referenced by any other registries as a parent it will be closed. <p/> Some applications that explicitly build "shared registries" may want to circumvent that behavior. <p/> This method indicates that the registry being built should not be automatically closed. The caller agrees to take responsibility to close it themselves.
public StandardServiceRegistryBuilder enableAutoClose()
See the discussion on disableAutoClose()
. This method enables
the auto-closing.
public StandardServiceRegistry build()
Build the StandardServiceRegistry.
@Deprecated public Map getSettings()
Temporarily exposed since Configuration is still around and much code still uses Configuration. This allows code to configure the builder and access that to configure Configuration object (used from HEM atm).
public static void destroy(ServiceRegistry serviceRegistry)
Destroy a service registry. Applications should only destroy registries they have explicitly created.
serviceRegistry
- The registry to be closed.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.