Package org.jboss.weld.bootstrap.api
Interface Bootstrap
-
- All Known Subinterfaces:
CDI11Bootstrap
- All Known Implementing Classes:
ForwardingBootstrap
public interface Bootstrap
Application container initialization API for Weld. To initialize the container you must call, in this order:startContainer(Environment, Deployment)
startInitialization()
deployBeans()
validateBeans()
endInitialization()
shutdown()
- Author:
- Pete Muir
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Bootstrap
deployBeans()
Creates and deploys the application's beans: Creates and deploys the discovered beans Creates and deploys the built-in beans defined by the CDI specification Finally theAfterBeanDiscovery
is event is firedBootstrap
endInitialization()
Cleans up after the initializationWeldManager
getManager(BeanDeploymentArchive beanDeploymentArchive)
Get the manager used for the given beanDeploymentArchive.Iterable<Metadata<jakarta.enterprise.inject.spi.Extension>>
loadExtensions(ClassLoader classLoader)
Load CDI extensions using the provided ClassLoaderBeansXml
parse(Iterable<URL> urls)
Parse the specified URLs as a series of beans.xml file and merge the result.BeansXml
parse(Iterable<URL> urls, boolean removeDuplicates)
Parse the specified URLs as a series of beans.xml file and merge the result.BeansXml
parse(Iterable<URL> urls, boolean removeDuplicates, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URLs as a series of beans.xml file and merge the result.BeansXml
parse(Iterable<URL> urls, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URLs as a series of beans.xml file and merge the result.BeansXml
parse(URL url)
Parse the specified URL as a beans.xml file.BeansXml
parse(URL url, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URL as a beans.xml file with a parameter allowing to specify what bean discovery mode should be used when beans.xml is an empty file.void
shutdown()
Causes the container to clean up and shutdown Before the contain is shutdown theBeforeShutdown
event is firedBootstrap
startContainer(Environment environment, Deployment deployment)
Creates the application container: Checks that the services required by the environment have been provided Adds container provided services Creates and initializes the built in contexts Creates the manager contextBootstrap
startInitialization()
Starts the application container initialization process: Reads metadata from beans.xml and theDeployment
service Starts the application context Starts the request context which lasts untilendInitialization()
is called Discovers and createsExtension
service providers Finally, theBeforeBeanDiscovery
event is fired.Bootstrap
validateBeans()
Validates the deployment.
-
-
-
Method Detail
-
startContainer
Bootstrap startContainer(Environment environment, Deployment deployment)
Creates the application container:- Checks that the services required by the environment have been provided
- Adds container provided services
- Creates and initializes the built in contexts
- Creates the manager
- Parameters:
environment
- the environment in use, by defaultEnvironments.EE
deployment
- the Deployment to be booted- Returns:
- self
- Throws:
IllegalStateException
- if not all the services required for the given environment are available
-
startInitialization
Bootstrap startInitialization()
Starts the application container initialization process:- Reads metadata from beans.xml and the
Deployment
service - Starts the application context
- Starts the request context which lasts until
endInitialization()
is called - Discovers and creates
Extension
service providers
BeforeBeanDiscovery
event is fired.- Returns:
- self
- Reads metadata from beans.xml and the
-
deployBeans
Bootstrap deployBeans()
Creates and deploys the application's beans:- Creates and deploys the discovered beans
- Creates and deploys the built-in beans defined by the CDI specification
AfterBeanDiscovery
is event is fired- Returns:
- self
-
validateBeans
Bootstrap validateBeans()
Validates the deployment. After validation, theAfterDeploymentValidation
event is fired- Returns:
- self
-
endInitialization
Bootstrap endInitialization()
Cleans up after the initialization- Returns:
- self
-
shutdown
void shutdown()
Causes the container to clean up and shutdown Before the contain is shutdown theBeforeShutdown
event is fired
-
getManager
WeldManager getManager(BeanDeploymentArchive beanDeploymentArchive)
Get the manager used for the given beanDeploymentArchive. IfstartContainer(Environment, Deployment)
has not been called, this method will return null. If the beanDeploymentArchive is not known to Weld (for example, it was not passed to the Weld as part of theDeployment
, or has not yet been requested byDeployment.loadBeanDeploymentArchive(Class)
), null will be returned.- Parameters:
beanDeploymentArchive
- the given beanDeploymentArchive- Returns:
- the manager or null if not yet available or not found.
-
parse
BeansXml parse(URL url)
Parse the specified URL as a beans.xml file.- Parameters:
url
- the url to parse- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
parse
BeansXml parse(Iterable<URL> urls)
Parse the specified URLs as a series of beans.xml file and merge the result. Duplicate entries are not removed.- Parameters:
urls
- the urls to parse- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
parse
BeansXml parse(Iterable<URL> urls, boolean removeDuplicates)
Parse the specified URLs as a series of beans.xml file and merge the result.- Parameters:
urls
- the urls to parseremoveDuplicates
- whether duplicate entries (alternatives, interceptors, etc) are removed- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
parse
BeansXml parse(URL url, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URL as a beans.xml file with a parameter allowing to specify what bean discovery mode should be used when beans.xml is an empty file.- Parameters:
url
- the url to parseemptyBeansXmlDiscoveryMode
- Discovery mode to be used when beans.xml is an empty file- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
parse
BeansXml parse(Iterable<URL> urls, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URLs as a series of beans.xml file and merge the result.BeanDiscoveryMode
specifies what discovery mode should be used when beans.xml is an empty file. Duplicate entries are not removed.- Parameters:
urls
- the urls to parseemptyBeansXmlDiscoveryMode
- Discovery mode to be used when beans.xml is an empty file- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
parse
BeansXml parse(Iterable<URL> urls, boolean removeDuplicates, BeanDiscoveryMode emptyBeansXmlDiscoveryMode)
Parse the specified URLs as a series of beans.xml file and merge the result.BeanDiscoveryMode
specifies what discovery mode should be used when beans.xml is an empty file.- Parameters:
urls
- the urls to parseremoveDuplicates
- whether duplicate entries (alternatives, interceptors, etc) are removedemptyBeansXmlDiscoveryMode
- Discovery mode to be used when beans.xml is an empty file- Returns:
- the BeansXml data structure which represents the URL
- Throws:
IllegalArgumentException
- if the URL cannot be opened
-
loadExtensions
Iterable<Metadata<jakarta.enterprise.inject.spi.Extension>> loadExtensions(ClassLoader classLoader)
Load CDI extensions using the provided ClassLoader- Parameters:
classLoader
- the ClassLoader to use to load the extensions- Returns:
- loaded extensions
- Throws:
IllegalArgumentException
- if classLoader is null
-
-