public class WeldBootstrap extends Object implements CDI11Bootstrap
| Constructor and Description |
|---|
WeldBootstrap() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<ContextHolder<? extends Context>> |
createContexts(ServiceRegistry services) |
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 this 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
|
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.
|
protected static void |
verifyServices(ServiceRegistry services,
Set<Class<? extends Service>> requiredServices) |
public TypeDiscoveryConfiguration startExtensions(Iterable<Metadata<Extension>> extensions)
CDI11BootstrapThe container bootstrap sequence begins with initializing extensions. The container performs the following actions:
ProcessAnnotatedType observer methods defined on the extensions and enumerates the
set of annotations which these observer methods require using the WithAnnotations annotation. This final set is
available through TypeDiscoveryConfiguration.getAdditionalTypeMarkerAnnotations()BeforeBeanDiscovery event which allows extensions to register scopes. The container
combines the registered scopes with scopes associated with the built-in contexts 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.
Firstly, the integrator discovers every Java annotation annotated with Scope or NormalScope and combines
these annotations with the annotations returned from TypeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()
. The resulting set is referred to as bean defining annotations hereafter.
Secondly, the integrator processes available archives according to these rules. The rules are exclusive.
beans.xml file and the file either does not contain the
bean-discovery-mode attribute or its value is set to all, this archive is an explicit 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. The CDI11BeanDeploymentArchive.getAdditionalTypes() method returns
an empty collection for an explicit bean archive.beans.xml file and the bean-discovery-mode attribute is set to
annotated or if the archive does not contain the beans.xml file but the archive contains types
annotated with a bean defining annotation or session beans or types annotated with a required annotation, this archive is
an implicit bean 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. The CDI11BeanDeploymentArchive.getAdditionalTypes() method returns a collection of types present in the
archive which are not contained within BeanDeploymentArchive.getBeanClasses() (are not annotated with a
bean-defining annotation nor define a Sesion bean) but contain a required annotation.beans.xml file and does not contain a type annotated with a bean
defining annotation and does not contain a type containing a required annotation, this archive is not a bean archive and
the integrator does not need to create a BeanDeploymentArchive instance for this archive.beans.xml file and the bean-discovery-mode attribute is set to
none, the archive is not a bean archive. The integrator does not need to create a
BeanDeploymentArchive instance for this 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 BeanManagerImpl getManager(BeanDeploymentArchive beanDeploymentArchive)
Bootstrap#startContainer() 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 Bootstrappublic 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 Bootstrapprotected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services)
public void shutdown()
BootstrapBeforeShutdown event is firedprotected static void verifyServices(ServiceRegistry services, Set<Class<? extends Service>> requiredServices)
public 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 © 2013 Seam Framework. All Rights Reserved.