forked from helidon-io/helidon
-
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.
Addresses helidon-io#496. Signed-off-by: Laird Nelson <[email protected]>
- Loading branch information
Showing
67 changed files
with
7,680 additions
and
16 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 |
---|---|---|
|
@@ -67,3 +67,5 @@ node/ | |
# Other | ||
*~ | ||
user.txt | ||
ObjectStore/ | ||
PutObjectStoreDirHere/ |
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,84 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. | ||
|
||
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. | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
= CDI extension for JTA | ||
:description: Helidon CDI extension for JTA | ||
:keywords: helidon, java, microservices, microprofile, extensions, cdi, jta | ||
This https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#spi[CDI | ||
portable extension] provides support for JTA (Java Transaction API) | ||
transactions in your Helidon MicroProfile applications. | ||
== Prerequsites | ||
Declare the following dependency fragment in your project's `pom.xml`: | ||
[source,xml] | ||
---- | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-jta-weld</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.transaction</groupId> | ||
<artifactId>javax.transaction-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
---- | ||
== Declaring a method to be transactional | ||
The following example shows how to declare a transactional method. | ||
[source,java] | ||
.Transactional method declaration | ||
---- | ||
@Transactional(Transactional.TxType.REQUIRED) | ||
public void doSomethingTransactionally() { | ||
} | ||
---- | ||
The extension ensures that a transaction is started before and | ||
committed after the method executes. If the method throws an | ||
exception, the transaction will be rolled back. | ||
You can further specify the transactional behavior of the extension by | ||
using different instances of the `Transactional` annotation. For more | ||
information, see the | ||
https://static.javadoc.io/javax.transaction/javax.transaction-api/1.2/javax/transaction/Transactional.html[`Transactional` | ||
annotation documentation]. | ||
Transactional method support is implemented by CDI interception | ||
facilities. Among other things, this means that the method to which | ||
you apply the `Transactional` annotation must not be `private` and | ||
must in all other ways be a _business method_. See the | ||
https://jcp.org/aboutJava/communityprocess/mrel/jsr318/index3.html[Java | ||
Interceptors specification] for more details. | ||
During a transactional method invocation, the extension makes the | ||
following objects available for injection via the `Inject` annotation: | ||
* https://static.javadoc.io/javax.transaction/javax.transaction-api/1.2/javax/transaction/UserTransaction.html[`UserTransaction`] | ||
* https://static.javadoc.io/javax.transaction/javax.transaction-api/1.2/javax/transaction/Transaction.html[`Transaction`] | ||
* https://static.javadoc.io/javax.transaction/javax.transaction-api/1.2/javax/transaction/UserTransactionManager.html[`TransactionManager`] | ||
* https://static.javadoc.io/javax.transaction/javax.transaction-api/1.2/javax/transaction/UserTransactionSynchronizationRegistry.html[`TransactionSynchronizationRegistry`] | ||
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,245 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. | ||
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 | ||
http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.helidon.examples.integrations.cdi</groupId> | ||
<artifactId>helidon-examples-integrations-cdi-project</artifactId> | ||
<version>1.0.4-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>helidon-integrations-examples-jpa</artifactId> | ||
<name>Helidon CDI Extensions Examples JPA</name> | ||
|
||
<properties> | ||
<dependenciesDirectory>libs</dependenciesDirectory> | ||
</properties> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.ethlo.persistence.tools</groupId> | ||
<artifactId>eclipselink-maven-plugin</artifactId> | ||
<version>2.7.1.1</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<version>${version.lib.annotation-api}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.xml.bind</groupId> | ||
<artifactId>jaxb-api</artifactId> | ||
<version>${version.lib.jaxb-api}</version> | ||
</dependency> | ||
</dependencies> | ||
<executions> | ||
<execution> | ||
<id>weave</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>weave</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>modelgen</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>modelgen</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jboss.jandex</groupId> | ||
<artifactId>jandex-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>make-index</id> | ||
<goals> | ||
<goal>jandex</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-dependencies</id> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>copy-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.directory}/${dependenciesDirectory}</outputDirectory> | ||
<overWriteReleases>false</overWriteReleases> | ||
<overWriteSnapshots>false</overWriteSnapshots> | ||
<overWriteIfNewer>true</overWriteIfNewer> | ||
<overWriteIfNewer>true</overWriteIfNewer> | ||
<includeScope>runtime</includeScope> | ||
<excludeScope>test</excludeScope> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<classpathPrefix>${dependenciesDirectory}</classpathPrefix> | ||
<mainClass>io.helidon.microprofile.server.Main</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<!-- Test-scoped dependencies. --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Runtime-scoped dependencies. --> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.weld.se</groupId> | ||
<artifactId>weld-se-core</artifactId> | ||
<scope>runtime</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.jboss.spec.javax.el</groupId> | ||
<artifactId>jboss-el-api_3.0_spec</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.jboss.spec.javax.interceptor</groupId> | ||
<artifactId>jboss-interceptors-api_1.2_spec</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-eclipselink</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-jta-weld</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-datasource-hikaricp</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.integrations.cdi</groupId> | ||
<artifactId>helidon-integrations-cdi-jpa-weld</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss</groupId> | ||
<artifactId>jandex</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.server</groupId> | ||
<artifactId>helidon-microprofile-server</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.glassfish.hk2.external</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.config</groupId> | ||
<artifactId>helidon-microprofile-config-cdi</artifactId> | ||
<version>${project.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.microprofile.config</groupId> | ||
<artifactId>microprofile-config-api</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<!-- Provided-scoped dependencies. --> | ||
<dependency> | ||
<groupId>jakarta.persistence</groupId> | ||
<artifactId>jakarta.persistence-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.transaction</groupId> | ||
<artifactId>javax.transaction-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Compile-scoped dependencies. --> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.enterprise</groupId> | ||
<artifactId>cdi-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.ws.rs</groupId> | ||
<artifactId>javax.ws.rs-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.