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)
CDI11Bootstrap
The 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. 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.
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
all
this 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 CDI11Bootstrap
extensions
- discovered CDI extensionspublic Bootstrap startContainer(Environment environment, Deployment deployment)
Bootstrap
startContainer
in interface Bootstrap
environment
- the environment in use, by default Environments.EE
deployment
- 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 Bootstrap
public Bootstrap startInitialization()
Bootstrap
Deployment
serviceBootstrap.endInitialization()
is calledExtension
service providersBeforeBeanDiscovery
event is fired.startInitialization
in interface Bootstrap
public Bootstrap deployBeans()
Bootstrap
AfterBeanDiscovery
is event is fireddeployBeans
in interface Bootstrap
public Bootstrap validateBeans()
Bootstrap
AfterDeploymentValidation
event is firedvalidateBeans
in interface Bootstrap
public Bootstrap endInitialization()
Bootstrap
endInitialization
in interface Bootstrap
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services)
public void shutdown()
Bootstrap
BeforeShutdown
event is firedprotected static void verifyServices(ServiceRegistry services, Set<Class<? extends Service>> requiredServices)
public BeansXml parse(Iterable<URL> urls)
Bootstrap
public BeansXml parse(Iterable<URL> urls, boolean removeDuplicates)
Bootstrap
public BeansXml parse(URL url)
Bootstrap
public Iterable<Metadata<Extension>> loadExtensions(ClassLoader classLoader)
Bootstrap
loadExtensions
in interface Bootstrap
classLoader
- the ClassLoader to use to load the extensionsCopyright © 2013 Seam Framework. All Rights Reserved.