generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from paulparkinson/main
init for graalvm workshops - spring boot, quarkus, micronaut, helidon
- Loading branch information
Showing
83 changed files
with
3,290 additions
and
84,212 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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-mp</artifactId> | ||
<version>4.1.1</version> | ||
<relativePath/> | ||
</parent> | ||
<groupId>com.oracle.helidon.datasource</groupId> | ||
<artifactId>com-oracle-helidon-datasource</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<!-- Compile-scoped dependencies. --> | ||
<dependency> | ||
<groupId>jakarta.enterprise</groupId> | ||
<artifactId>jakarta.enterprise.cdi-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.ws.rs</groupId> | ||
<artifactId>jakarta.ws.rs-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.microprofile.config</groupId> | ||
<artifactId>microprofile-config-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<!-- Runtime-scoped dependencies. --> | ||
<dependency> | ||
<groupId>io.helidon.integrations.db</groupId> | ||
<artifactId>ojdbc</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-datasource-ucp</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>jandex</artifactId> | ||
<scope>runtime</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.server</groupId> | ||
<artifactId>helidon-microprofile-server</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.config</groupId> | ||
<artifactId>helidon-microprofile-config</artifactId> | ||
<scope>runtime</scope> | ||
</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> | ||
<plugin> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>jandex-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>make-index</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
78 changes: 78 additions & 0 deletions
78
graalvm-nativeimage/helidon/src/main/java/com/oracle/helidon/datasource/TablesResource.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,78 @@ | ||
package com.oracle.helidon.datasource; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.Objects; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import jakarta.inject.Named; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
/** | ||
* A JAX-RS resource class in {@linkplain ApplicationScoped | ||
* application scope} rooted at {@code /tables}. | ||
* | ||
* @see #get() | ||
*/ | ||
@Path("/tables") | ||
@ApplicationScoped | ||
public class TablesResource { | ||
|
||
private final DataSource dataSource; | ||
|
||
/** | ||
* Creates a new {@link TablesResource}. | ||
* | ||
* @param dataSource the {@link DataSource} to use to acquire | ||
* database table names; must not be {@code null} | ||
* | ||
* @exception NullPointerException if {@code dataSource} is {@code | ||
* null} | ||
*/ | ||
@Inject | ||
public TablesResource(@Named("example") final DataSource dataSource) { | ||
super(); | ||
this.dataSource = Objects.requireNonNull(dataSource); | ||
} | ||
|
||
/** | ||
* Returns a {@link Response} which, if successful, contains a | ||
* newline-separated list of Oracle database table names. | ||
* | ||
* <p>This method never returns {@code null}.</p> | ||
* | ||
* @return a non-{@code null} {@link Response} | ||
* | ||
* @exception SQLException if a database error occurs | ||
*/ | ||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public Response get() throws SQLException { | ||
final StringBuilder sb = new StringBuilder(); | ||
try (Connection connection = this.dataSource.getConnection(); | ||
PreparedStatement ps = | ||
connection.prepareStatement(" SELECT TABLE_NAME" | ||
+ " FROM ALL_TABLES " | ||
+ "ORDER BY TABLE_NAME ASC"); | ||
ResultSet rs = ps.executeQuery()) { | ||
System.out.println("Connection is : " + connection); | ||
while (rs.next()) { | ||
sb.append(rs.getString(1)).append("\n"); | ||
} | ||
} | ||
final Response returnValue = Response.ok() | ||
.entity(sb.toString()) | ||
.build(); | ||
return returnValue; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
graalvm-nativeimage/helidon/src/main/resources/META-INF/beans.xml
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee | ||
https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" | ||
version="4.0" | ||
bean-discovery-mode="annotated"> | ||
</beans> |
7 changes: 7 additions & 0 deletions
7
...tiveimage/helidon/src/main/resources/META-INF/helidon/native-image/reflection-config.json
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,7 @@ | ||
{ | ||
"classes": [ | ||
"oracle.ucp.jdbc.PoolDataSource", | ||
"oracle.ucp.jdbc.PoolDataSourceImpl", | ||
"javax.sql.DataSource" | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
...vm-nativeimage/helidon/src/main/resources/META-INF/helidon/native-image/weld-proxies.json
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,30 @@ | ||
[ | ||
{ | ||
"bean-class": "io.helidon.integrations.datasource.ucp.cdi.UCPBackedDataSourceExtension", | ||
"ifaces": [ | ||
"java.io.Serializable", | ||
"java.sql.Wrapper", | ||
"javax.naming.Referenceable", | ||
"javax.naming.spi.ObjectFactory", | ||
"javax.sql.CommonDataSource", | ||
"javax.sql.DataSource", | ||
"oracle.ucp.jdbc.PoolDataSource", | ||
"oracle.ucp.UniversalConnectionPoolAdapter" | ||
] | ||
}, | ||
{ | ||
"bean-class": "io.helidon.integrations.datasource.ucp.cdi.UniversalConnectionPoolExtension", | ||
"ifaces": [ | ||
"java.io.Serializable", | ||
"java.sql.Wrapper", | ||
"javax.naming.Referenceable", | ||
"javax.naming.spi.ObjectFactory", | ||
"javax.sql.CommonDataSource", | ||
"javax.sql.DataSource", | ||
"javax.sql.XADataSource", | ||
"oracle.ucp.jdbc.PoolDataSource", | ||
"oracle.ucp.jdbc.PoolXADataSource", | ||
"oracle.ucp.UniversalConnectionPoolAdapter" | ||
] | ||
} | ||
] |
9 changes: 9 additions & 0 deletions
9
graalvm-nativeimage/helidon/src/main/resources/META-INF/microprofile-config.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,9 @@ | ||
# Microprofile server properties | ||
server.port=8080 | ||
server.host=0.0.0.0 | ||
|
||
# DataSource properties | ||
javax.sql.DataSource.example.connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource | ||
javax.sql.DataSource.example.URL=jdbc:oracle:thin:@<ATP_NAME>_high?TNS_ADMIN=/home/<YOUR_USER>/myatpwallet | ||
javax.sql.DataSource.example.user=ADMIN | ||
javax.sql.DataSource.example.password=<ADMIN_PASSWORD> |
4 changes: 4 additions & 0 deletions
4
...image/com.oracle.helidon.datasource/com-oracle-helidon-datasource/native-image.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,4 @@ | ||
Args=-H:+RemoveSaturatedTypeFlows --initialize-at-build-time=com.oracle.helidon.datasource \ | ||
--initialize-at-run-time=io.helidon.integrations.datasource.ucp.cdi.UniversalConnectionPool$_$$_WeldClientProxy \ | ||
--initialize-at-run-time=oracle.jdbc.driver.NTFListener \ | ||
--initialize-at-run-time=oracle.ucp.common.Service |
10 changes: 10 additions & 0 deletions
10
...ive-image/com.oracle.helidon.datasource/com-oracle-helidon-datasource/reflect-config.json
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,10 @@ | ||
[ | ||
{ | ||
"name": "oracle.ucp.jdbc.PoolDataSourceImpl", | ||
"allPublicMethods" : true | ||
}, | ||
{ | ||
"name" : "oracle.ucp.jdbc.PoolXADataSourceImpl", | ||
"allPublicMethods" : true | ||
} | ||
] |
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,68 @@ | ||
#!/bin/bash | ||
|
||
# Exit immediately if a command exits with a non-zero status | ||
set -e | ||
|
||
# Treat unset variables as an error | ||
set -u | ||
|
||
# Variables | ||
MAVEN_VERSION="3.9.8" | ||
DOWNLOAD_URL="https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" | ||
INSTALL_DIR="$HOME/mvn-upgrade" | ||
ARCHIVE_NAME="apache-maven-${MAVEN_VERSION}-bin.tar.gz" | ||
|
||
# Functions | ||
log() { | ||
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | ||
} | ||
|
||
create_directory() { | ||
if [ ! -d "$INSTALL_DIR" ]; then | ||
mkdir -p "$INSTALL_DIR" | ||
log "Created directory: $INSTALL_DIR" | ||
else | ||
log "Directory already exists: $INSTALL_DIR" | ||
fi | ||
} | ||
|
||
download_maven() { | ||
if wget -q --spider "$DOWNLOAD_URL"; then | ||
wget -O "${INSTALL_DIR}/${ARCHIVE_NAME}" "$DOWNLOAD_URL" | ||
log "Downloaded Maven: $DOWNLOAD_URL" | ||
else | ||
log "Maven download URL does not exist: $DOWNLOAD_URL" | ||
exit 1 | ||
fi | ||
} | ||
|
||
extract_and_cleanup() { | ||
tar -xvzf "${INSTALL_DIR}/${ARCHIVE_NAME}" -C "$INSTALL_DIR" | ||
log "Extracted Maven archive" | ||
|
||
rm -f "${INSTALL_DIR}/${ARCHIVE_NAME}" | ||
log "Removed Maven archive: ${INSTALL_DIR}/${ARCHIVE_NAME}" | ||
} | ||
|
||
# Main Script | ||
log "Starting Maven upgrade script" | ||
|
||
log "Changing directory to home" | ||
cd ~ | ||
|
||
log "Printing current directory" | ||
pwd | ||
|
||
log "Creating installation directory" | ||
create_directory | ||
|
||
log "Changing directory to installation directory" | ||
cd "$INSTALL_DIR" | ||
|
||
log "Downloading Maven" | ||
download_maven | ||
|
||
log "Extracting and cleaning up Maven archive" | ||
extract_and_cleanup | ||
|
||
log "Maven upgrade script completed successfully" |
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,34 @@ | ||
# AOT configuration properties for jar packaging | ||
# Please review carefully the optimizations enabled below | ||
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
|
||
# Caches environment property values: environment properties will be deemed immutable after application startup. | ||
cached.environment.enabled=true | ||
|
||
# Precomputes Micronaut configuration property keys from the current environment variables | ||
precompute.environment.properties.enabled=true | ||
|
||
# Converts YAML configuration files to Java configuration | ||
yaml.to.java.config.enabled=true | ||
|
||
# Scans for service types ahead-of-time, avoiding classpath scanning at startup | ||
serviceloading.jit.enabled=true | ||
|
||
# Scans reactive types at build time instead of runtime | ||
scan.reactive.types.enabled=true | ||
|
||
# Deduces the environment at build time instead of runtime | ||
deduce.environment.enabled=true | ||
|
||
# Checks of existence of some types at build time instead of runtime | ||
known.missing.types.enabled=true | ||
|
||
# Precomputes property sources at build time | ||
sealed.property.source.enabled=true | ||
|
||
# The list of service types to be scanned (comma separated) | ||
service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver | ||
|
||
# A list of types that the AOT analyzer needs to check for existence (comma separated) | ||
known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable | ||
|
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,6 @@ | ||
applicationType: default | ||
defaultPackage: com.oracle.dev.jdbc.micronaut | ||
testFramework: junit | ||
sourceLanguage: java | ||
buildTool: maven | ||
features: [app-name, data, data-jdbc, flyway, http-client-test, java, java-application, jdbc-hikari, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, netty-server, oracle-cloud-atp, oracle-cloud-sdk, properties, readme, serialization-jackson, shade, testcontainers] |
Oops, something went wrong.