Repository: deltaspike
Updated Branches:
  refs/heads/master 8b43ecd7e -> 4dbfd08ea


DELTASPIKE-809 - Clean up cdi ctrl and cdi imp pages


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/4dbfd08e
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/4dbfd08e
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/4dbfd08e

Branch: refs/heads/master
Commit: 4dbfd08eaaa34aa8f3aa6f9d0553148035bd4f6f
Parents: 8b43ecd
Author: Rafael Benevides <[email protected]>
Authored: Tue Jan 6 14:20:55 2015 -0200
Committer: Rafael Benevides <[email protected]>
Committed: Mon Apr 6 19:54:49 2015 -0400

----------------------------------------------------------------------
 documentation/src/main/asciidoc/cdiimp.adoc     | 57 +------------------
 .../src/main/asciidoc/container-control.adoc    | 58 ++++++++++++++++++++
 2 files changed, 59 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4dbfd08e/documentation/src/main/asciidoc/cdiimp.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/cdiimp.adoc 
b/documentation/src/main/asciidoc/cdiimp.adoc
index 4b352a8..1476ea6 100644
--- a/documentation/src/main/asciidoc/cdiimp.adoc
+++ b/documentation/src/main/asciidoc/cdiimp.adoc
@@ -24,7 +24,7 @@ DeltaSpike provides a dedicated Container Control module to 
enable applications
 
 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.
 
-=== 1. Declare CDI Dependencies 
+=== Declare CDI Dependencies 
 
 ==== Option A: Declare Dependencies for Maven-based Projects
 For Maven-based projects, the Container Control module is available in Maven 
Central together with the other DeltaSpike modules. You must configure your 
project to use the DeltaSpike Container Control API and one of the CDI 
container-specific modules.
@@ -131,61 +131,6 @@ mvn clean install
 ==== Option B: Declare Dependencies for Maven-independent Projects
 For Maven-independent projects, the Container Control module is distributed 
together with the other DeltaSpike modules in 
`distribution-fill-<version>.zip`. You must add two of the files from the 
`cdictrl` directory to your project, namely `deltaspike-cdictrl-api.jar` and 
the .jar file that corresponds to the CDI container you have chosen. Add these 
files to the project `WEB-INF/lib` or `EAR/lib` directory for .war and .ear 
projects respectively.
 
-=== 2. Start the CDI Container from Your Project
-To start a CDI container in your application, you must instantiate a 
`CdiContainer` object and call the `#boot` method. When `#boot` is called, the 
`CdiContainer` scans CDI-enabled
-archives for beans and CDI extensions. Before the application exits, 
`#shutdown` must be called to correctly destroy all beans. An example is given 
in the code snippet here.
-
-[source,java]
-----
-import org.apache.deltaspike.cdise.api.CdiContainer;
-import org.apache.deltaspike.cdise.api.CdiContainerLoader;
-
-public class MainApp {
-    public static void main(String[] args) {
-
-        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
-        cdiContainer.boot();
-
-        // You can use CDI here
-
-        cdiContainer.shutdown();
-    }
-}
-----
-
-Starting the container does not automatically start all CDI Contexts. Contexts 
must be started independently using the provided `ContextControl` class. An 
example of starting the Context for `@ApplicationScoped` beans is added to the 
code snippet here.
-
-[source,java]
-----
-import org.apache.deltaspike.cdise.api.CdiContainer;
-import org.apache.deltaspike.cdise.api.CdiContainerLoader;
-import org.apache.deltaspike.cdise.api.ContextControl;
-import javax.enterprise.context.ApplicationScoped;
-
-public class MainApp {
-    public static void main(String[] args) {
-
-        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
-        cdiContainer.boot();
-
-        // Starting the application-context enables use of @ApplicationScoped 
beans
-        ContextControl contextControl = cdiContainer.getContextControl();
-        contextControl.startContext(ApplicationScoped.class);
-
-        // You can use CDI here
-
-        cdiContainer.shutdown();
-    }
-}
-----
-
-To resolve project beans, you can use the DeltaSpike `BeanProvider` class. 
Whether `EchoService` 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 `@Inject`, in the class without further 
uses of `BeanProvider`. An example of resolving the bean without qualifiers is 
given in the code snippet here.
-
-[source,java]
-----
-EchoService echoService = 
BeanProvider.getContextualReference(EchoService.class, false);
-----
-
 == Next
 * For more information about the Container Control module, see 
<<container-control#,Container Control Module>>.
 * To understand how the various DeltaSpike modules can enhance and extend your 
applications, see <<modules#,Overview of DeltaSpike Modules>> and the 
individual module pages.

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4dbfd08e/documentation/src/main/asciidoc/container-control.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/container-control.adoc 
b/documentation/src/main/asciidoc/container-control.adoc
index 6bcec63..2ccf555 100644
--- a/documentation/src/main/asciidoc/container-control.adoc
+++ b/documentation/src/main/asciidoc/container-control.adoc
@@ -10,6 +10,9 @@ The Container Control module provides CDI container booting 
and shutdown, crucia
 == Configure Your Projects
 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 <<configure#, Configure 
DeltaSpike in Your Projects>>. For Maven-independent projects, see 
<<configure#config-maven-indep,Configure DeltaSpike in Maven-independent 
Projects>>.
 
+=== Enable CDI For Your Java Environment
+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 <<cdiimp#,Enable CDI 
For Your Java Environment>> page.
+
 === Declare Container Control Module Dependencies
 Add the Container Control module to the list of dependencies in the project 
`pom.xml` file using this code snippet:
 
@@ -25,6 +28,61 @@ Add the Container Control module to the list of dependencies 
in the project `pom
 
 == Use the Module Features
 
+=== Start the CDI Container from Your Project
+To start a CDI container in your application, you must instantiate a 
`CdiContainer` object and call the `#boot` method. When `#boot` is called, the 
`CdiContainer` scans CDI-enabled
+archives for beans and CDI extensions. Before the application exits, 
`#shutdown` must be called to correctly destroy all beans. An example is given 
in the code snippet here.
+
+[source,java]
+----
+import org.apache.deltaspike.cdise.api.CdiContainer;
+import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+
+public class MainApp {
+    public static void main(String[] args) {
+
+        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+        cdiContainer.boot();
+
+        // You can use CDI here
+
+        cdiContainer.shutdown();
+    }
+}
+----
+
+Starting the container does not automatically start all CDI Contexts. Contexts 
must be started independently using the provided `ContextControl` class. An 
example of starting the Context for `@ApplicationScoped` beans is added to the 
code snippet here.
+
+[source,java]
+----
+import org.apache.deltaspike.cdise.api.CdiContainer;
+import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+import org.apache.deltaspike.cdise.api.ContextControl;
+import javax.enterprise.context.ApplicationScoped;
+
+public class MainApp {
+    public static void main(String[] args) {
+
+        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+        cdiContainer.boot();
+
+        // Starting the application-context enables use of @ApplicationScoped 
beans
+        ContextControl contextControl = cdiContainer.getContextControl();
+        contextControl.startContext(ApplicationScoped.class);
+
+        // You can use CDI here
+
+        cdiContainer.shutdown();
+    }
+}
+----
+
+To resolve project beans, you can use the DeltaSpike `BeanProvider` class. 
Whether `EchoService` 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 `@Inject`, in the class without further 
uses of `BeanProvider`. An example of resolving the bean without qualifiers is 
given in the code snippet here.
+
+[source,java]
+----
+EchoService echoService = 
BeanProvider.getContextualReference(EchoService.class, false);
+----
+
 === CdiContainer
 The `CdiContainer` interface provides booting and shutdown of the CDI 
containers from deployed applications, with `CdiContainerLoader` a simple 
factory providing access to the underlying `CdiContainer` implementation.
 

Reply via email to