Skip to content

Commit

Permalink
5809 doc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkec committed Sep 6, 2023
1 parent deb4854 commit e00cdf9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 6 additions & 4 deletions docs/common/guides/metrics.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,10 @@ into Kubernetes, then verify that it discovered the Helidon metrics in your appl
[source,bash]
.Install Prometheus and wait until the pod is ready:
----
helm install stable/prometheus --name metrics
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install metrics prometheus-community/prometheus
export POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=prometheus -l app.kubernetes.io/component=server -o jsonpath="{.items[0].metadata.name}")
kubectl get pod $POD_NAME
----
Expand All @@ -536,12 +538,12 @@ metrics-prometheus-server-5fc5dc86cb-79lk4 2/2 Running 0 46s
----
[source,bash]
.Create a port-forward so you can access the server URL:
.Create a port-forward, so you can access the server URL:
----
kubectl --namespace default port-forward $POD_NAME 7090:9090
----
Now open your browser and navigate to `http://localhost:7090/targets`. Search for helidon on the page and you will see your
Now open your browser and navigate to `http://localhost:7090/targets`. Search for helidon on the page, and you will see your
Helidon application as one of the Prometheus targets.
==== Final Cleanup
Expand Down
30 changes: 14 additions & 16 deletions docs/mp/guides/07_datasource.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2019, 2021 Oracle and/or its affiliates.
Copyright (c) 2019, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,9 +54,7 @@ mvn -U archetype:generate \
-DarchetypeVersion={helidon-version} \
-DgroupId=io.helidon.example \
-DartifactId=helidon-ds \
-Dpackage=io.helidon.example.ds \
-DrestResourceName=ExampleResource \
-DapplicationName=ExampleApplication
-Dpackage=io.helidon.example.ds
----
Now `cd` into `helidon-ds`. The rest of this guide will assume all
Expand All @@ -72,7 +70,6 @@ Add the following dependency in your `pom.xml`:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<scope>runtime</scope>
</dependency>
----
Expand Down Expand Up @@ -137,11 +134,11 @@ class].
NOTE: For more information about datasources, see https://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html
In the `src/main/java/io/helidon/example/ds/ExampleResource.java` file, add the following
In the `src/main/java/io/helidon/example/ds/GreetResource.java` file, add the following
imports:
[source,java]
.`src/main/java/io/helidon/example/ds/ExampleResource.java`
.`src/main/java/io/helidon/example/ds/GreetResource.java`
----
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
Expand All @@ -152,19 +149,20 @@ import javax.sql.DataSource;
Annotate the resource class declaration with `@Dependent`:
[source,java]
.`src/main/java/io/helidon/example/ds/ExampleResource.java`
.`src/main/java/io/helidon/example/ds/GreetResource.java`
----
@Path("/greet")
@Dependent <1>
public class ExampleResource {
public class GreetResource {
----
<1> This ensures that `io.helidon.example.jpa.ExampleResource` is a
<1> This ensures that `io.helidon.example.jpa.GreetResource` is a
discoverable CDI bean.
Then add the following annotated field declaration:
[source,java]
.`src/main/java/io/helidon/example/ds/ExampleResource.java`
.`src/main/java/io/helidon/example/ds/GreetResource.java`
----
@Inject <1>
@Named("test") <2>
Expand All @@ -185,22 +183,22 @@ Here, the `test` data source is requested.
Now that you have a `DataSource`, you'll use it to connect to the database.
First, ensure the `io.helidon.example.ds.ExampleResource` resource
First, ensure the `io.helidon.example.ds.GreetResource` resource
class imports various `java.sql` classes:
[source,java]
.`src/main/java/io/helidon/example/ds/ExampleResource.java`
.`src/main/java/io/helidon/example/ds/GreetResource.java`
----
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
----
Add the following resource method to the `ExampleResource` class:
Add the following resource method to the `GreetResource` class:
[source,java]
.`src/main/java/io/helidon/example/ds/ExampleResource.java`
.`src/main/java/io/helidon/example/ds/GreetResource.java`
----
@GET
@Path("tables")
Expand Down Expand Up @@ -252,7 +250,7 @@ Execute the following:
[source,bash]
----
curl http://localhost:8080/example/tables
curl http://localhost:8080/greet/tables
----
Observe that the result will be a list of database table names.
Expand Down

0 comments on commit e00cdf9

Please sign in to comment.