Skip to content

Commit

Permalink
Merge pull request #452 from mkouba/docs-minors
Browse files Browse the repository at this point in the history
Minor docs updates
  • Loading branch information
cescoffier authored Jan 9, 2019
2 parents eb595cf + 23c741c commit 7072012
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Configuring your application
= {project-name} - Configuring Your Application

Hardcoded values in your code is a _no go_ (even if we all did it at some point ;-)).
In this guide, we learn how to configure your application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Executing actions on application startup and termination
= {project-name} - Application Initialization and Termination

You often need to execute custom actions when the application starts and clean up everything when the application stops.
This guide explains how to:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-native-image-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Building a native image
= {project-name} - Building a Native Image

This guide covers:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-substrate-hotwo.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
== Building a custom SubstrateVM
== {project-name} - Building a Custom SubstrateVM

=== Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/cdi-reference.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Contexts and Dependency Injection
= {project-name} - Contexts and Dependency Injection

{project-name} DI solution is based on the http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html[Contexts and Dependency Injection for Java 2.0, window="_blank"] specification.
However, it is not a full CDI implementation verified by the TCK.
Expand Down
4 changes: 4 additions & 0 deletions docs/src/main/asciidoc/docinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@
#preamble>.sectionbody>[class="paragraph"]:first-of-type p {
font-size: 1.6rem;
}

#header, #content, #footer, #footnotes {
max-width: 72em;
}
</style>
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/extension-authors-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Extension Authors Guide
= {project-name} - Extension Authors Guide

Shamrock extensions add a new developer focused behavior to the core offering, and consist of two distinct parts, buildtime augmentation and runtime container. The augmentation part is responsible for all metadata processing, such as reading annotations, XML descriptors etc. The output of this augmentation phase is recorded bytecode which is responsible for directly instantiating the relevant runtime services.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/faq.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Frequently Asked Questions
= {project-name} - Frequently Asked Questions

:toc: macro
:toclevels: 4
Expand Down
71 changes: 32 additions & 39 deletions docs/src/main/asciidoc/getting-started-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Creating your first {project-name} application
= {project-name} - Creating Your First Application

:toc: macro
:toclevels: 4
Expand Down Expand Up @@ -76,6 +76,18 @@ Add the Shamrock Maven plugin to the `pom.xml` file:
<surefire.version>{surefire-version}</surefire.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-bom</artifactId>
<version>${shamrock.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -108,19 +120,19 @@ As we are going to create a JAX-RS endpoint, you also need to add the following
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-jaxrs-deployment</artifactId>
<scope>provided</scope>
<version>${shamrock.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-arc-deployment</artifactId>
<scope>provided</scope>
<version>${shamrock.version}</version>
</dependency>
</dependencies>
----

Arc is a CDI-lite implementation providing dependency injection.
[NOTE]
.What's ArC?
====
ArC is a CDI-based dependency injection solution - see also link:cdi-reference.html[Contexts and Dependency Injection].
====

== Creating the Application class

Expand Down Expand Up @@ -170,45 +182,26 @@ Use: `mvn compile shamrock:dev`:

[source, text]
----
[INFO]
[INFO] --------------------< org.acme:shamrock-quickstart >--------------------
[INFO] Building shamrock-quickstart 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ shamrock-quickstart ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/source/protean/quickstarts/getting-started/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ shamrock-quickstart ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- shamrock-maven-plugin:....:dev (default-cli) @ shamrock-quickstart ---
Nov 23, 2018 10:48:57 AM org.jboss.shamrock.undertow.runtime.UndertowDeploymentTemplate startUndertowEagerly
INFO: Starting Undertow on port 8080
Nov 23, 2018 10:48:57 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Nov 23, 2018 10:48:57 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
Nov 23, 2018 10:48:57 AM org.jboss.shamrock.deployment.ShamrockAugmentor run
INFO: Beginning shamrock augmentation
Nov 23, 2018 10:48:57 AM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.0.0.Alpha3
Nov 23, 2018 10:48:57 AM org.jboss.protean.arc.processor.BeanDeployment <init>
INFO: Build deployment created in 24 ms
Nov 23, 2018 10:48:57 AM org.jboss.protean.arc.processor.BeanDeployment init
INFO: Bean deployment initialized in 7 ms
Nov 23, 2018 10:48:57 AM org.jboss.protean.arc.processor.BeanProcessor process
INFO: 27 resources generated/written in 48 ms
Nov 23, 2018 10:48:57 AM org.jboss.shamrock.deployment.ShamrockAugmentor run
INFO: Shamrock augmentation completed in 382ms
Nov 23, 2018 10:48:57 AM org.jboss.protean.arc.ArcContainerImpl init
INFO: ArC DI container initialized [beans=12, observers=0]
Nov 23, 2018 10:48:57 AM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap createDeployment
WARN: RESTEASY002175: The use of javax.ws.rs.core.Application is deprecated, please use javax.ws.rs.Application as a context-param instead
Nov 23, 2018 10:48:58 AM org.jboss.resteasy.core.ResteasyDeploymentImpl processApplication
INFO: RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.acme.quickstart.MyApplication
Nov 23, 2018 10:48:58 AM org.jboss.shamrock.runtime.Timing printStartupTime
INFO: Shamrock started in 929.915ms
[INFO]
[INFO] --- shamrock-maven-plugin:0.4.0:dev (default-cli) @ shamrock-quickstart ---
INFO [o.j.s.u.r.UndertowDeploymentTemplate] (main) Starting Undertow on port 8080
INFO [o.xnio] (main) XNIO version 3.6.5.Final
INFO [o.x.nio] (main) XNIO NIO Implementation Version 3.6.5.Final
INFO [o.j.threads] (main) JBoss Threads version 3.0.0.Alpha4
INFO [o.j.s.d.ShamrockAugmentor] (main) Beginning shamrock augmentation
INFO [o.j.s.d.ShamrockAugmentor] (main) Shamrock augmentation completed in 322ms
INFO [o.j.r.r.i18n] (main) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.acme.quickstart.MyApplication
INFO [o.j.shamrock] (main) Shamrock started in 697.982ms
----

Once started, you can request the provided endpoint:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/hibernate-orm-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Using Hibernate ORM and JPA
= {project-name} - Using Hibernate ORM and JPA
:config-file: microprofile-config.properties

Hibernate ORM is the de facto JPA implementation and offers you the full breath of an Object Relational Mapper.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/ide-configuration.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Developing with {project-name}
= {project-name} - Project Scaffolding and IDE

[[project-creation]]
== Creating a new project
Expand Down
18 changes: 9 additions & 9 deletions docs/src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ include::protean-intro.adoc[tag=intro]

* link:getting-started-guide.html[Getting Started]
* link:building-native-image-guide.html[Building Native Image]
* link:kubernetes-guide.html[Deploy your application on Kubernetes]
* link:ide-configuration.html[Project scaffolding and IDE]
* link:kubernetes-guide.html[Deploy Application on Kubernetes]
* link:ide-configuration.html[Project Scaffolding and IDE]

== Other guides

* link:application-configuration-guide.html[Configuring your application]
* link:application-lifecycle-events-guide.html[Application initialization and termination]
* link:json-and-validation-guide.html[Using JSON and validation]
* link:scheduled-guide.html[Schedule periodic tasks]
* link:websocket-guide.html[Using websockets]
* link:application-configuration-guide.html[Configuring Your Application]
* link:application-lifecycle-events-guide.html[Application Initialization and Termination]
* link:json-and-validation-guide.html[Using JSON and Validation]
* link:scheduled-guide.html[Schedule Periodic Tasks]
* link:websocket-guide.html[Using Websockets]
* link:hibernate-orm-guide.html[Using Hibernate ORM]
* link:extension-authors-guide.html[Write your own extension] _(advanced)_
* link:performance-measure.html[Measuring performance] _(advanced)_
* link:extension-authors-guide.html[Write Your Own Extension] _(advanced)_
* link:performance-measure.html[Measuring Performance] _(advanced)_
* link:cdi-reference.html[Contexts and Dependency Injection] _(advanced)_

* link:faq.html[FAQs]
Expand Down
54 changes: 20 additions & 34 deletions docs/src/main/asciidoc/json-and-validation-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Using JSON and Validation
= {project-name} - Using JSON and Validation

JSON is now the _lingua franca_ between microservices.
In this guide, we see how you can consume and produce JSON payloads.
Expand Down Expand Up @@ -121,17 +121,11 @@ Add the following method:
@Consumes(MediaType.APPLICATION_JSON)
public Result tryMeManualValidation(Book book) {
Set<ConstraintViolation<Book>> violations = validator.validate(book);
Result res = new Result();
if (violations.isEmpty()) {
res.success = true;
res.message = "Book is valid! It was validated by manual validation.";
return new Result("Book is valid! It was validated by manual validation.");
} else {
res.success = false;
res.message = violations.stream()
.map(cv -> cv.getMessage())
.collect(Collectors.joining(", "));
return new Result(violations);
}
return res;
}
----

Expand All @@ -150,25 +144,30 @@ Let's now create the `Result` class as an inner class:
[source, java]
----
private class Result {
Result(String message) {
this.success = true;
this.message = message;
}
Result(Set<? extends ConstraintViolation<?>> violations) {
this.success = false;
this.message = violations.stream()
.map(cv -> cv.getMessage())
.collect(Collectors.joining(", "));
}
private String message;
private boolean success;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
----

Expand All @@ -191,10 +190,7 @@ Let's create an end point validating the `Book` provided in the request:
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result tryMeEndPointMethodValidation(@Valid Book book) {
Result res = new Result();
res.success = true;
res.message = "Book is valid! It was validated by end point method validation.";
return res;
return new Result("Book is valid! It was validated by end point method validation.");
}
----

Expand Down Expand Up @@ -229,22 +225,12 @@ Calling the service in your rest end point triggers the `Book` validation automa
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result tryMeServiceMethodValidation(Book book) {
Result res = new Result();
try {
bookService.validateBook(book);
res.success = true;
res.message = "Book is valid! It was validated by service method validation.";
}
catch (ConstraintViolationException e) {
res.success = false;
res.message = e.getConstraintViolations().stream()
.map(cv -> cv.getMessage())
.collect(Collectors.joining(", "));
return new Result("Book is valid! It was validated by service method validation.");
} catch (ConstraintViolationException e) {
return new Result(e.getConstraintViolations());
}
return res;
}
----

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/kubernetes-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Deploying the application to Kubernetes and OpenShift
= {project-name} - Deploying Application to Kubernetes and OpenShift

This guide covers:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/maven-config.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= {project-name} Maven repositories
= {project-name} - Maven Repositories

// tag::repositories[]
{project-name} releases are not yet available on Maven Central, so you need to configure the repositories.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/performance-measure.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= How do we measure performance
= {project-name} - Measuring Performance

This guide covers:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/main/asciidoc/scheduled-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Schedule periodic tasks
= {project-name} - Schedule Periodic Tasks

Modern applications often need to run specific tasks periodically.
In this guide, you learn how to schedule periodic tasks.
Expand Down Expand Up @@ -86,6 +86,8 @@ public class CounterBean {
The code is pretty straightforward. Every 10 seconds, the counter is incremented.
The `get()` method allows retrieving the current value.

NOTE: Cron-like expressions are also supported. The syntax is currently based on http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html[Quartz Cron Trigger, window="_blank"]. For example a method annotated with `@Scheduled(cron="0 15 10 * * ?")` is executed at 10:15am every day.

== Updating the resource and the test


Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/websocket-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Using Web Sockets
= {project-name} - Using Web Sockets

This guide explains how your Shamrock application can utilize web sockets to create interactive web applications.
Because it's the _canonical_ web socket application, we are going to create a simple chat application.
Expand Down

0 comments on commit 7072012

Please sign in to comment.