Skip to content

Commit

Permalink
Merge pull request #10769 from FroMage/panache-reactive
Browse files Browse the repository at this point in the history
Panache reactive based on Hibernate Reactive
  • Loading branch information
stuartwdouglas committed Sep 17, 2020
2 parents 8b2653a + 74d8b71 commit 796808c
Show file tree
Hide file tree
Showing 124 changed files with 8,942 additions and 236 deletions.
30 changes: 30 additions & 0 deletions bom/application/pom.xml
Expand Up @@ -664,6 +664,16 @@
<artifactId>quarkus-mongodb-panache-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-hibernate-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-hibernate-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-mock</artifactId>
Expand All @@ -684,6 +694,16 @@
<artifactId>quarkus-hibernate-orm-panache-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache-kotlin</artifactId>
Expand All @@ -704,6 +724,16 @@
<artifactId>quarkus-hibernate-orm-panache-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive-panache-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-data-panache</artifactId>
Expand Down
Expand Up @@ -35,6 +35,7 @@ public enum Feature {
HIBERNATE_ORM_PANACHE_KOTLIN,
HIBERNATE_ORM_REST_DATA_PANACHE,
HIBERNATE_REACTIVE,
HIBERNATE_REACTIVE_PANACHE,
HIBERNATE_SEARCH_ELASTICSEARCH,
HIBERNATE_VALIDATOR,
INFINISPAN_CLIENT,
Expand Down
Expand Up @@ -30,6 +30,8 @@

/**
* A collection of ASM and Jandex utilities.
* NOTE: this has a copy in AsmUtilCopy in arc-processor with some extra methods for knowing if we need a
* signature and getting the signature of a class.
*/
public class AsmUtil {

Expand Down Expand Up @@ -635,4 +637,22 @@ public static void printValueOnStderr(MethodVisitor mv, Runnable valuePusher) {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println",
"(Ljava/lang/Object;)V", false);
}

/**
* Copy the parameter names to the given MethodVisitor, unless we don't have parameter name info
*
* @param mv the visitor to copy to
* @param method the method to copy from
*/
public static void copyParameterNames(MethodVisitor mv, MethodInfo method) {
int parameterSize = method.parameters().size();
if (parameterSize > 0) {
// perhaps we don't have parameter names
if (method.parameterName(0) == null)
return;
for (int i = 0; i < parameterSize; i++) {
mv.visitParameter(method.parameterName(i), 0 /* modifiers */);
}
}
}
}
Expand Up @@ -31,6 +31,7 @@
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
import io.quarkus.deployment.builditem.CapabilityBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
Expand Down Expand Up @@ -70,11 +71,18 @@ CapabilityBuildItem capability() {
}

@BuildStep
void registerBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
additionalBeans.produce(AdditionalBeanBuildItem.builder()
.addBeanClass(ReactiveSessionFactoryProducer.class)
.addBeanClass(ReactiveSessionProducer.class)
.build());
void registerBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeans, CombinedIndexBuildItem combinedIndex,
List<PersistenceUnitDescriptorBuildItem> descriptors,
JpaEntitiesBuildItem jpaEntities, List<NonJpaModelBuildItem> nonJpaModels) {
if (!hasEntities(jpaEntities, nonJpaModels)) {
return;
}

if (descriptors.size() == 1) {
// Only register those beans if their EMF dependency is also available, so use the same guard as the ORM extension
additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveSessionFactoryProducer.class));
additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveSessionProducer.class));
}
}

@BuildStep
Expand Down
@@ -1,6 +1,5 @@
package io.quarkus.hibernate.reactive.runtime;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.Typed;
import javax.inject.Inject;
Expand All @@ -13,7 +12,6 @@

import io.quarkus.arc.DefaultBean;

@ApplicationScoped
public class ReactiveSessionFactoryProducer {

@Inject
Expand Down
@@ -1,6 +1,5 @@
package io.quarkus.hibernate.reactive.runtime;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
Expand All @@ -11,7 +10,6 @@

import io.quarkus.arc.DefaultBean;

@ApplicationScoped
public class ReactiveSessionProducer {

@Inject
Expand Down
Expand Up @@ -29,6 +29,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-hibernate-common</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down

0 comments on commit 796808c

Please sign in to comment.