-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev-4.x] Initial migration commit (#53)
* Initial migration commit Signed-off-by: Maxim Nesen <[email protected]> * CP exclude Signed-off-by: Maxim Nesen <[email protected]> * README.md validations Signed-off-by: Maxim Nesen <[email protected]> * Project versions update Signed-off-by: Maxim Nesen <[email protected]> --------- Signed-off-by: Maxim Nesen <[email protected]>
- Loading branch information
Showing
1,220 changed files
with
74,642 additions
and
15 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
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/examples/config/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,65 @@ | ||
<?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>4.1.0-SNAPSHOT</version> | ||
</parent> | ||
<groupId>io.helidon.examples.config</groupId> | ||
<artifactId>helidon-examples-config-basics</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Helidon Examples Config Basics</name> | ||
|
||
<description> | ||
The simplest example shows how to use Configuration API. | ||
</description> | ||
|
||
<properties> | ||
<mainClass>io.helidon.examples.config.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/examples/config/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.examples.config.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/examples/config/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.examples.config.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" | ||
} | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
examples/config/basics/src/main/resources/logging.properties
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,26 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
|
||
handlers = java.util.logging.ConsoleHandler | ||
|
||
java.util.logging.ConsoleHandler.level = FINEST | ||
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter | ||
java.util.logging.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n | ||
|
||
.level = INFO | ||
io.helidon.config.level = WARNING | ||
io.helidon.config.examples.level = FINEST |
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,29 @@ | ||
# Helidon Config Changes Example | ||
|
||
This example shows how an application can deal with changes to | ||
configuration. | ||
|
||
## Change notification | ||
|
||
[`OnChangeExample.java`](src/main/java/io/helidon/examples/config/changes/OnChangeExample.java): | ||
uses `Config.onChange`, passing either a method reference (a lambda expression | ||
would also work) which the config system invokes when the config source changes | ||
) | ||
|
||
## Latest-value supplier | ||
|
||
Recall that once your application obtains a `Config` instance, its config values | ||
do not change. The | ||
[`AsSupplierExample.java`](src/main/java/io/helidon/examples/config/changes/AsSupplierExample.java) | ||
example shows how your application can get a config _supplier_ that always reports | ||
the latest config value for a key, including any changes made after your | ||
application obtained the `Config` object. Although this approach does not notify | ||
your application _when_ changes occur, it _does_ permit your code to always use | ||
the most up-to-date value. Sometimes that is all you need. | ||
|
||
## Build and run | ||
|
||
```shell | ||
mvn package | ||
java -jar target/helidon-examples-config-changes.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,21 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
# In config.yaml we are going to override default configuration. | ||
# It is supposed to be deployment dependent configuration. | ||
|
||
app: | ||
greeting: Hello |
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,25 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
# In dev.yaml we are going to override all lower layer configuration files. | ||
# It is supposed to be development specific configuration. | ||
|
||
# IT SHOULD NOT BE PLACED IN VCS. EACH DEVELOPER CAN CUSTOMIZE THE FILE AS NEEDED. | ||
# I.e. for example with GIT place following line into .gitignore file: | ||
#*/conf/dev.yaml | ||
|
||
app: | ||
name: Developer |
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 @@ | ||
changeit |
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 @@ | ||
libor |
Oops, something went wrong.