Author: rafabene
Date: Mon Apr 6 23:56:06 2015
New Revision: 1671713
URL: http://svn.apache.org/r1671713
Log:
Site checkin for project Apache DeltaSpike Documentation
Modified:
deltaspike/site/trunk/content/documentation/cdiimp.html
deltaspike/site/trunk/content/documentation/container-control.html
Modified: deltaspike/site/trunk/content/documentation/cdiimp.html
URL:
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/cdiimp.html?rev=1671713&r1=1671712&r2=1671713&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/cdiimp.html (original)
+++ deltaspike/site/trunk/content/documentation/cdiimp.html Mon Apr 6 23:56:06
2015
@@ -196,13 +196,12 @@ body {
<li><a href="#_java_ee5_and_servlet_containers">Java EE5 and Servlet
Containers</a></li>
<li><a href="#javase6">Java SE6+</a>
<ul class="sectlevel2">
-<li><a href="#_1_declare_cdi_dependencies">1. Declare CDI Dependencies</a>
+<li><a href="#_declare_cdi_dependencies">Declare CDI Dependencies</a>
<ul class="sectlevel3">
<li><a href="#_option_a_declare_dependencies_for_maven_based_projects">Option
A: Declare Dependencies for Maven-based Projects</a></li>
<li><a
href="#_option_b_declare_dependencies_for_maven_independent_projects">Option B:
Declare Dependencies for Maven-independent Projects</a></li>
</ul>
</li>
-<li><a href="#_2_start_the_cdi_container_from_your_project">2. Start the CDI
Container from Your Project</a></li>
</ul>
</li>
<li><a href="#_next">Next</a></li>
@@ -250,7 +249,7 @@ body {
<p>Instructions are provided here for adding the required resources to both
Maven-based and Maven-independent projects and subsequently booting the CDI
container from your project source code.</p>
</div>
<div class="sect2">
-<h3 id="_1_declare_cdi_dependencies">1. Declare CDI Dependencies</h3>
+<h3 id="_declare_cdi_dependencies">Declare CDI Dependencies</h3>
<div class="sect3">
<h4 id="_option_a_declare_dependencies_for_maven_based_projects">Option A:
Declare Dependencies for Maven-based Projects</h4>
<div class="paragraph">
@@ -387,66 +386,6 @@ body {
</div>
</div>
</div>
-<div class="sect2">
-<h3 id="_2_start_the_cdi_container_from_your_project">2. Start the CDI
Container from Your Project</h3>
-<div class="paragraph">
-<p>To start a CDI container in your application, you must instantiate a
<code>CdiContainer</code> object and call the <code>#boot</code> method. When
<code>#boot</code> is called, the <code>CdiContainer</code> scans CDI-enabled
-archives for beans and CDI extensions. Before the application exits,
<code>#shutdown</code> must be called to correctly destroy all beans. An
example is given in the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span
class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
-<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
-
-<span class="directive">public</span> <span class="type">class</span> <span
class="class">MainApp</span> {
- <span class="directive">public</span> <span
class="directive">static</span> <span class="type">void</span> main(<span
class="predefined-type">String</span><span class="type">[]</span> args) {
-
- CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
- cdiContainer.boot();
-
- <span class="comment">// You can use CDI here</span>
-
- cdiContainer.shutdown();
- }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Starting the container does not automatically start all CDI Contexts.
Contexts must be started independently using the provided
<code>ContextControl</code> class. An example of starting the Context for
<code>@ApplicationScoped</code> beans is added to the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span
class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
-<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
-<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.ContextControl</span>;
-<span class="keyword">import</span> <span
class="include">javax.enterprise.context.ApplicationScoped</span>;
-
-<span class="directive">public</span> <span class="type">class</span> <span
class="class">MainApp</span> {
- <span class="directive">public</span> <span
class="directive">static</span> <span class="type">void</span> main(<span
class="predefined-type">String</span><span class="type">[]</span> args) {
-
- CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
- cdiContainer.boot();
-
- <span class="comment">// Starting the application-context enables use
of @ApplicationScoped beans</span>
- ContextControl contextControl = cdiContainer.getContextControl();
- contextControl.startContext(ApplicationScoped.class);
-
- <span class="comment">// You can use CDI here</span>
-
- cdiContainer.shutdown();
- }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>To resolve project beans, you can use the DeltaSpike
<code>BeanProvider</code> class. Whether <code>EchoService</code> is a concrete
implementation or just an interface depends on the application. In the case
that it is an interface, the corresponding implementation is resolved. The
resolved bean is a standard CDI bean and it can be used for all CDI concepts,
such as <code>@Inject</code>, in the class without further uses of
<code>BeanProvider</code>. An example of resolving the bean without qualifiers
is given in the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java">EchoService echoService
= BeanProvider.getContextualReference(EchoService.class, <span
class="predefined-constant">false</span>);</code></pre>
-</div>
-</div>
-</div>
</div>
</div>
<div class="sect1">
Modified: deltaspike/site/trunk/content/documentation/container-control.html
URL:
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/container-control.html?rev=1671713&r1=1671712&r2=1671713&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/container-control.html
(original)
+++ deltaspike/site/trunk/content/documentation/container-control.html Mon Apr
6 23:56:06 2015
@@ -195,11 +195,13 @@ body {
<li><a href="#_overview">Overview</a></li>
<li><a href="#_configure_your_projects">Configure Your Projects</a>
<ul class="sectlevel2">
+<li><a href="#_enable_cdi_for_your_java_environment">Enable CDI For Your Java
Environment</a></li>
<li><a href="#_declare_container_control_module_dependencies">Declare
Container Control Module Dependencies</a></li>
</ul>
</li>
<li><a href="#_use_the_module_features">Use the Module Features</a>
<ul class="sectlevel2">
+<li><a href="#_start_the_cdi_container_from_your_project">Start the CDI
Container from Your Project</a></li>
<li><a href="#_cdicontainer">CdiContainer</a></li>
<li><a href="#_contextcontrol_usage">ContextControl Usage</a></li>
<li><a href="#_procedure_for_builing_uber_jar">Procedure for builing Uber
jar</a>
@@ -234,6 +236,12 @@ body {
<p>The configuration information provided here is for Maven-based projects and
it assumes that you have already declared the DeltaSpike version and DeltaSpike
Core module for your projects, as detailed in <a
href="configure.html">Configure DeltaSpike in Your Projects</a>. For
Maven-independent projects, see <a
href="configure.html#config-maven-indep">Configure DeltaSpike in
Maven-independent Projects</a>.</p>
</div>
<div class="sect2">
+<h3 id="_enable_cdi_for_your_java_environment">Enable CDI For Your Java
Environment</h3>
+<div class="paragraph">
+<p>This module requires a CDI implementation to be available in the Java
environment where your projects are deployed. Dependent on the Java environment
you choose, some setup may be necessary as detailed at the <a
href="cdiimp.html">Enable CDI For Your Java Environment</a> page.</p>
+</div>
+</div>
+<div class="sect2">
<h3 id="_declare_container_control_module_dependencies">Declare Container
Control Module Dependencies</h3>
<div class="paragraph">
<p>Add the Container Control module to the list of dependencies in the project
<code>pom.xml</code> file using this code snippet:</p>
@@ -255,6 +263,66 @@ body {
<h2 id="_use_the_module_features">Use the Module Features</h2>
<div class="sectionbody">
<div class="sect2">
+<h3 id="_start_the_cdi_container_from_your_project">Start the CDI Container
from Your Project</h3>
+<div class="paragraph">
+<p>To start a CDI container in your application, you must instantiate a
<code>CdiContainer</code> object and call the <code>#boot</code> method. When
<code>#boot</code> is called, the <code>CdiContainer</code> scans CDI-enabled
+archives for beans and CDI extensions. Before the application exits,
<code>#shutdown</code> must be called to correctly destroy all beans. An
example is given in the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span
class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
+<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
+
+<span class="directive">public</span> <span class="type">class</span> <span
class="class">MainApp</span> {
+ <span class="directive">public</span> <span
class="directive">static</span> <span class="type">void</span> main(<span
class="predefined-type">String</span><span class="type">[]</span> args) {
+
+ CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+ cdiContainer.boot();
+
+ <span class="comment">// You can use CDI here</span>
+
+ cdiContainer.shutdown();
+ }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Starting the container does not automatically start all CDI Contexts.
Contexts must be started independently using the provided
<code>ContextControl</code> class. An example of starting the Context for
<code>@ApplicationScoped</code> beans is added to the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span
class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
+<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
+<span class="keyword">import</span> <span
class="include">org.apache.deltaspike.cdise.api.ContextControl</span>;
+<span class="keyword">import</span> <span
class="include">javax.enterprise.context.ApplicationScoped</span>;
+
+<span class="directive">public</span> <span class="type">class</span> <span
class="class">MainApp</span> {
+ <span class="directive">public</span> <span
class="directive">static</span> <span class="type">void</span> main(<span
class="predefined-type">String</span><span class="type">[]</span> args) {
+
+ CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+ cdiContainer.boot();
+
+ <span class="comment">// Starting the application-context enables use
of @ApplicationScoped beans</span>
+ ContextControl contextControl = cdiContainer.getContextControl();
+ contextControl.startContext(ApplicationScoped.class);
+
+ <span class="comment">// You can use CDI here</span>
+
+ cdiContainer.shutdown();
+ }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>To resolve project beans, you can use the DeltaSpike
<code>BeanProvider</code> class. Whether <code>EchoService</code> is a concrete
implementation or just an interface depends on the application. In the case
that it is an interface, the corresponding implementation is resolved. The
resolved bean is a standard CDI bean and it can be used for all CDI concepts,
such as <code>@Inject</code>, in the class without further uses of
<code>BeanProvider</code>. An example of resolving the bean without qualifiers
is given in the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java">EchoService echoService
= BeanProvider.getContextualReference(EchoService.class, <span
class="predefined-constant">false</span>);</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
<h3 id="_cdicontainer">CdiContainer</h3>
<div class="paragraph">
<p>The <code>CdiContainer</code> interface provides booting and shutdown of
the CDI containers from deployed applications, with
<code>CdiContainerLoader</code> a simple factory providing access to the
underlying <code>CdiContainer</code> implementation.</p>