forked from helidon-io/helidon-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helidon 2.x examples (helidon-io#39)
* Helidon 2 examples * Use Java 11 * Fix project versions * Fix copyright * Add suppressions for Helidon 2 examples * Use v4 of github actions
- Loading branch information
Showing
1,377 changed files
with
88,101 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<p align="center"> | ||
<img src="../etc/images/Primary_logo_blue.png" height="180"> | ||
</p> | ||
|
||
# Helidon Examples | ||
|
||
Welcome to the Helidon Examples! If this is your first experience with | ||
Helidon we recommend you start with our | ||
[quickstart](https://helidon.io/docs/v2/#/about/03_prerequisites) | ||
That will quickly get you going with your first Helidon application. | ||
|
||
After that you can come back here and dig into the examples. | ||
|
||
Our examples are Maven projects and can be built and run with | ||
Java 11 or newer -- so make sure you have those: | ||
|
||
``` | ||
java -version | ||
mvn -version | ||
``` | ||
|
||
# Building an Example | ||
|
||
Each example has a `README` that you will follow. To build most examples | ||
just `cd` to the directory and run `mvn package`: | ||
|
||
``` | ||
cd examples/microprofile/hello-world-explicit | ||
mvn package | ||
``` | ||
|
||
Usually the example will produce an application jar file that you can run: | ||
|
||
``` | ||
java -jar target/example-name.jar | ||
``` | ||
|
||
But always see the example's `README` for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
# Helidon SE Config Examples | ||
|
||
Each subdirectory contains example code that highlights specific aspects of | ||
Helidon configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Helidon Config Basic Example | ||
|
||
This example shows the basics of using Helidon SE Config. The | ||
[Main.java](./src/main/java/io/helidon/config/examples/basics/Main.java) class shows: | ||
|
||
* loading configuration from a resource | ||
[`application.conf`](./src/main/resources/application.conf) on the classpath | ||
containing config in HOCON (Human-Optimized Config Object Notation) format | ||
* getting configuration values of various types | ||
|
||
## Build and run | ||
|
||
```shell | ||
mvn package | ||
java -jar target/helidon-examples-config-basics.jar | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2017, 2024 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. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.helidon.applications</groupId> | ||
<artifactId>helidon-se</artifactId> | ||
<version>2.6.8-SNAPSHOT</version> | ||
<relativePath/> | ||
</parent> | ||
<groupId>io.helidon.examples.config</groupId> | ||
<artifactId>helidon-examples-config-basics</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Helidon Config Examples Basics</name> | ||
|
||
<description> | ||
The simplest example shows how to use Configuration API. | ||
</description> | ||
|
||
<properties> | ||
<mainClass>io.helidon.config.examples.basics.Main</mainClass> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.helidon.config</groupId> | ||
<artifactId>helidon-config</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.config</groupId> | ||
<artifactId>helidon-config-hocon</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-libs</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
56 changes: 56 additions & 0 deletions
56
examples/config/basics/src/main/java/io/helidon/config/examples/basics/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2017, 2024 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon.config.examples.basics; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import io.helidon.config.Config; | ||
|
||
import static io.helidon.config.ConfigSources.classpath; | ||
|
||
/** | ||
* Basics example. | ||
*/ | ||
public class Main { | ||
|
||
private Main() { | ||
} | ||
|
||
/** | ||
* Executes the example. | ||
* | ||
* @param args arguments | ||
*/ | ||
public static void main(String... args) { | ||
Config config = Config.create(classpath("application.conf")); | ||
|
||
int pageSize = config.get("app.page-size").asInt().get(); | ||
|
||
boolean storageEnabled = config.get("app.storageEnabled").asBoolean().orElse(false); | ||
|
||
List<Integer> basicRange = config.get("app.basic-range").asList(Integer.class).get(); | ||
|
||
Path loggingOutputPath = config.get("logging.outputs.file.name").as(Path.class).get(); | ||
|
||
System.out.println(pageSize); | ||
System.out.println(storageEnabled); | ||
System.out.println(basicRange); | ||
System.out.println(loggingOutputPath); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
examples/config/basics/src/main/java/io/helidon/config/examples/basics/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2017, 2024 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* The simplest example shows how to use Configuration API. | ||
*/ | ||
package io.helidon.config.examples.basics; |
69 changes: 69 additions & 0 deletions
69
examples/config/basics/src/main/resources/application.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
# Copyright (c) 2017, 2024 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. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
app { | ||
greeting = "Hello" | ||
name = "Demo" | ||
page-size = 20 | ||
basic-range = [ -20, 20 ] | ||
storagePassphrase = "${AES=thisIsEncriptedPassphrase}" | ||
} | ||
|
||
logging { | ||
outputs { | ||
console { | ||
pattern = simple.colored | ||
level = INFO | ||
} | ||
file { | ||
pattern = verbose.colored | ||
level = DEBUG | ||
name = target/root.log | ||
} | ||
} | ||
level = INFO | ||
app.level = DEBUG | ||
com.oracle.prime.level = WARN | ||
} | ||
|
||
# (this is snippet of complex configuration of security component) | ||
security { | ||
providers: [ # First provider in the list is the default one | ||
{ | ||
name = "BMCS" | ||
class = "com.oracle.prime.security.bmcs.BmcsProvider" | ||
BmcsProvider { | ||
# Configuration of OPC (Bare metal) security provider | ||
# (configuration cleaned to be short ...) | ||
|
||
# targets for outbound configuration | ||
targets: [ | ||
{ | ||
name = "s2s" | ||
transports = ["http"] | ||
hosts = ["127.0.0.1"] | ||
s2sType = "S2S" | ||
} | ||
#, other targets ... | ||
] | ||
} | ||
}, | ||
{ | ||
name = "ForEndUsers" | ||
class = "com.oracle.prime.examples.security.primeruntime.bmcs.ExampleSecurityProvider" | ||
} | ||
] | ||
} |
Oops, something went wrong.