public class WeldBootstrap extends Object implements CDI11Bootstrap
| Constructor and Description |
|---|
WeldBootstrap() |
| Modifier and Type | Method and 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 the
AfterBeanDiscovery is event is fired |
Bootstrap |
endInitialization()
Cleans up after the initialization
|
BeanManagerImpl |
getManager(BeanDeploymentArchive beanDeploymentArchive)
Get the manager used for the given beanDeploymentArchive.
|
Iterable<Metadata<Extension>> |
loadExtensions(ClassLoader classLoader)
Load CDI extensions using the provided ClassLoader
|
BeansXml |
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(URL url)
Parse the specified URL as a beans.xml file.
|
void |
shutdown()
Causes the container to clean up and shutdown
Before the contain is shutdown the
BeforeShutdown event is fired |
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
context
|
Bootstrap |
startContainer(String contextId,
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
In addition to
Bootstrap.startContainer(Environment, Deployment), this method allows an identifier (contextId) to
be assigned to the container. |
TypeDiscoveryConfiguration |
startExtensions(Iterable<Metadata<Extension>> extensions)
The container bootstrap sequence begins with initializing extensions.
|
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 Bootstrap.endInitialization() is called
Discovers and creates Extension service providers
Finally, the BeforeBeanDiscovery event is fired. |
Bootstrap |
validateBeans()
Validates the deployment.
|
public TypeDiscoveryConfiguration startExtensions(Iterable<Metadata<Extension>> extensions)
CDI11BootstrapThe container bootstrap sequence begins with initializing extensions. The container performs the following actions:
The container fires the BeforeBeanDiscovery event which allows extensions to register scopes and stereotypes.
The container combines the registered scopes and stereotypes with scopes associated with the built-in contexts and built-in
stereotypes and makes the resulting set available through TypeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()
Afterwards, an EE7-compatible integrator performs type discovery in the following locations:
These locations are referred to as available archives hereafter.
Next, the integrator builds the set of bean defining annotations. The set contains:
TypeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()NormalScope or StereotypeThe resulting set is referred to as bean defining annotations hereafter.
Next, the integrator processes available archives according to these rules. The rules are exclusive.
If an archive:
beans.xml file and the file does not contain the bean-discovery-mode
attribute, orbeans.xml file and the value of the bean-discovery-mode attribute is set to
allthis archive is an explicit bean archive.
If an archive:
beans.xml file and the bean-discovery-mode attribute is set to
annotated, orbeans.xml file nor any implementation of the Extension interface but the
archive contains types annotated with a bean defining annotation or session beansthis archive is an implicit bean archive.
If an archive:
beans.xml file and the bean-discovery-mode attribute is set to
none, orbeans.xml file and contains an implementation of the Extension interface,
orbeans.xml file and does not contain any types annotated with a bean defining
annotation nor session beanthis archive is not a bean archive.
For each explicit bean archive the integrator creates an instance of BeanDeploymentArchive representing this
archive. The BeanDeploymentArchive.getBeanClasses() method returns a collection of all types present within the
archive. Filtering rules defined in BeansXml.getScanning() are not required to be applied by the integrator and
are applied later on by Weld. The BeanDeploymentArchive.getEjbs() method returns a collection of EJB descriptors
for EJBs present in the archive.
For each implicit bean archive the integrator creates an instance of BeanDeploymentArchive representing this
archive. The BeanDeploymentArchive.getBeanClasses() of the bean archive returns all the types found in the
archive which are annotated with a bean defining annotations or are Session bean definitions. Filtering rules (
BeansXml.getScanning()) are not required to be applied by the integrator. The
BeanDeploymentArchive.getEjbs() method returns a collection of EJB descriptors for Session beans present in the
archive.
Initially, the integrator does not need to create a BeanDeploymentArchive instance for an archive which is not a
bean archive. Note that although these archives are ignored when building the initial collection of bean archives, the
integrator may be required to create a BeanDeploymentArchive later upon a call to
Deployment.loadBeanDeploymentArchive(Class). For example, when the method is called for a extension class that is
deployed in an archive that is not a bean archive.
startExtensions in interface CDI11Bootstrapextensions - discovered CDI extensionspublic Bootstrap startContainer(Environment environment, Deployment deployment)
BootstrapstartContainer in interface Bootstrapenvironment - the environment in use, by default Environments.EEdeployment - the Deployment to be bootedpublic Bootstrap startContainer(String contextId, Environment environment, Deployment deployment)
CDI11Bootstrap
In addition to Bootstrap.startContainer(Environment, Deployment), this method allows an identifier (contextId) to
be assigned to the container. This identifier will be used to identify this application when invoking Singleton methods.
startContainer in interface CDI11BootstrapcontextId - the identifier of this application container instanceenvironment - the environment in use, by default Environments.EEdeployment - the Deployment to be bootedpublic Bootstrap startInitialization()
BootstrapDeployment serviceBootstrap.endInitialization() is calledExtension service providersBeforeBeanDiscovery event is fired.startInitialization in interface Bootstrappublic Bootstrap deployBeans()
BootstrapAfterBeanDiscovery is event is fireddeployBeans in interface Bootstrappublic Bootstrap validateBeans()
BootstrapAfterDeploymentValidation event is firedvalidateBeans in interface Bootstrappublic Bootstrap endInitialization()
BootstrapendInitialization in interface Bootstrappublic BeanManagerImpl getManager(BeanDeploymentArchive beanDeploymentArchive)
BootstrapBootstrap.startContainer(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 the
Deployment, or has not yet been requested by Deployment.loadBeanDeploymentArchive(Class)), null will be
returned.getManager in interface BootstrapbeanDeploymentArchive - the given beanDeploymentArchivepublic void shutdown()
BootstrapBeforeShutdown event is firedpublic BeansXml parse(Iterable<URL> urls)
Bootstrappublic BeansXml parse(Iterable<URL> urls, boolean removeDuplicates)
Bootstrappublic BeansXml parse(URL url)
Bootstrappublic Iterable<Metadata<Extension>> loadExtensions(ClassLoader classLoader)
BootstraploadExtensions in interface BootstrapclassLoader - the ClassLoader to use to load the extensionsCopyright © 2015. All Rights Reserved.