diff --git a/core/builder/src/main/java/org/jboss/builder/BuildContext.java b/core/builder/src/main/java/org/jboss/builder/BuildContext.java index ec6c57a7e0d2a..9a4c370e5ded6 100644 --- a/core/builder/src/main/java/org/jboss/builder/BuildContext.java +++ b/core/builder/src/main/java/org/jboss/builder/BuildContext.java @@ -394,6 +394,7 @@ void run() { final Execution execution = this.execution; final StepInfo stepInfo = this.stepInfo; final BuildStep buildStep = stepInfo.getBuildStep(); + final long start = System.currentTimeMillis(); log.tracef("Starting step \"%s\"", buildStep); try { if (! execution.isErrorReported()) { @@ -408,7 +409,7 @@ void run() { } } } finally { - log.tracef("Finished step \"%s\"", buildStep); + log.tracef("Finished step \"%s\" in %s ms", buildStep, System.currentTimeMillis() - start); execution.removeBuildContext(stepInfo, this); } final Set dependents = stepInfo.getDependents(); diff --git a/core/builder/src/main/java/org/jboss/builder/Execution.java b/core/builder/src/main/java/org/jboss/builder/Execution.java index 5202f971bc143..61d53b89a203e 100644 --- a/core/builder/src/main/java/org/jboss/builder/Execution.java +++ b/core/builder/src/main/java/org/jboss/builder/Execution.java @@ -62,7 +62,7 @@ final class Execution { final EnhancedQueueExecutor.Builder executorBuilder = new EnhancedQueueExecutor.Builder(); executorBuilder.setCorePoolSize(8).setMaximumPoolSize(1024); executorBuilder.setExceptionHandler(JBossExecutors.loggingExceptionHandler()); - executorBuilder.setThreadFactory(new JBossThreadFactory(new ThreadGroup("build group"), Boolean.FALSE, null, "build-%n", JBossExecutors.loggingExceptionHandler(), null)); + executorBuilder.setThreadFactory(new JBossThreadFactory(new ThreadGroup("build group"), Boolean.FALSE, null, "build-%t", JBossExecutors.loggingExceptionHandler(), null)); buildTargetName = builder.getBuildTargetName(); executor = executorBuilder.build(); lastStepCount.set(builder.getChain().getEndStepCount()); diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/Capabilities.java b/core/deployment/src/main/java/org/jboss/shamrock/deployment/Capabilities.java index 3f61ca63c3467..d593ac3c52560 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/Capabilities.java +++ b/core/deployment/src/main/java/org/jboss/shamrock/deployment/Capabilities.java @@ -28,6 +28,7 @@ public final class Capabilities extends SimpleBuildItem { public static final String CDI_ARC = "org.jboss.shamrock.cdi"; public static final String TRANSACTIONS = "org.jboss.shamrock.transactions"; + public static final String UNDERTOW = "org.jboss.shamrock.undertow"; private final Set capabilities; diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/CoreBuildStep.java b/core/deployment/src/main/java/org/jboss/shamrock/deployment/CoreBuildStep.java deleted file mode 100644 index 45585e58cff5f..0000000000000 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/CoreBuildStep.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. - * - * 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 org.jboss.shamrock.deployment; - -import java.util.Collections; -import java.util.List; - -import javax.inject.Inject; - -import org.jboss.jandex.DotName; -import org.jboss.shamrock.annotations.BuildStep; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanDefiningAnnotationBuildItem; - -import io.smallrye.config.inject.ConfigProducer; - -public class CoreBuildStep { - - @Inject - Capabilities capabilities; - - @BuildStep - List beanDefiningAnnotations() { - if (capabilities.isCapabilityPresent(Capabilities.CDI_ARC)) { - // Enables injection into shamrock unit tests - // TODO: we should only add this when running the tests - return Collections.singletonList(new BeanDefiningAnnotationBuildItem(DotName.createSimple("org.junit.runner.RunWith"))); - } - return Collections.emptyList(); - } - - @BuildStep - List beans() { - if (capabilities.isCapabilityPresent(Capabilities.CDI_ARC)) { - return Collections.singletonList(new AdditionalBeanBuildItem(ConfigProducer.class.getName())); - } - return Collections.emptyList(); - } - -} diff --git a/core/runtime/src/main/java/org/jboss/shamrock/runtime/InterceptorBindingService.java b/core/runtime/src/main/java/org/jboss/shamrock/runtime/InterceptorBindingService.java deleted file mode 100644 index d161cf62540ca..0000000000000 --- a/core/runtime/src/main/java/org/jboss/shamrock/runtime/InterceptorBindingService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. - * - * 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 org.jboss.shamrock.runtime; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ServiceLoader; -import java.util.Set; - -import javax.interceptor.InvocationContext; - -/** - * This is a service that allows an app to get interceptor bindings from the {@link javax.interceptor.InvocationContext} - *

- * It is in core so that no direct dep is needed on either arc or weld, as they both do this differently - *

- * TODO: this should really be moved to some kind of CDI common module or something, also this should probably be temporary - */ -public class InterceptorBindingService { - - - public static List providers; - - static { - List a = new ArrayList<>(); - for (Provider i : ServiceLoader.load(Provider.class)) { - a.add(i); - } - providers = Collections.unmodifiableList(a); - } - - public static Set getInterceptorBindings(InvocationContext ic) { - for (Provider i : providers) { - Set ret = i.getInterceptorBindings(ic); - if (ret != null) { - return ret; - } - } - return Collections.emptySet(); - } - - - public interface Provider { - - Set getInterceptorBindings(InvocationContext invocationContext); - - } - -} diff --git a/extensions/agroal/deployment/pom.xml b/extensions/agroal/deployment/pom.xml index 641e712440ad6..2eae8eb5d5a47 100644 --- a/extensions/agroal/deployment/pom.xml +++ b/extensions/agroal/deployment/pom.xml @@ -34,6 +34,10 @@ org.jboss.shamrock shamrock-core-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-agroal-runtime diff --git a/extensions/agroal/deployment/src/main/java/org/jboss/shamrock/agroal/AgroalProcessor.java b/extensions/agroal/deployment/src/main/java/org/jboss/shamrock/agroal/AgroalProcessor.java index fc61e4a29fb64..f8f6379d4f569 100644 --- a/extensions/agroal/deployment/src/main/java/org/jboss/shamrock/agroal/AgroalProcessor.java +++ b/extensions/agroal/deployment/src/main/java/org/jboss/shamrock/agroal/AgroalProcessor.java @@ -28,9 +28,9 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerListenerBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanContainerListenerBuildItem; class AgroalProcessor { diff --git a/extensions/agroal/runtime/pom.xml b/extensions/agroal/runtime/pom.xml index b1aa15870b909..22fda4d6575a7 100644 --- a/extensions/agroal/runtime/pom.xml +++ b/extensions/agroal/runtime/pom.xml @@ -34,6 +34,10 @@ org.jboss.shamrock shamrock-core-runtime + + org.jboss.shamrock + shamrock-arc-runtime + com.oracle.substratevm svm diff --git a/extensions/agroal/runtime/src/main/java/org/jboss/shamrock/agroal/runtime/DataSourceTemplate.java b/extensions/agroal/runtime/src/main/java/org/jboss/shamrock/agroal/runtime/DataSourceTemplate.java index 5e0b089528a3d..276bb72f413d0 100644 --- a/extensions/agroal/runtime/src/main/java/org/jboss/shamrock/agroal/runtime/DataSourceTemplate.java +++ b/extensions/agroal/runtime/src/main/java/org/jboss/shamrock/agroal/runtime/DataSourceTemplate.java @@ -16,9 +16,9 @@ package org.jboss.shamrock.agroal.runtime; +import org.jboss.shamrock.arc.runtime.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainerListener; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; @Template public class DataSourceTemplate { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/AdditionalBeanBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/AdditionalBeanBuildItem.java similarity index 89% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/AdditionalBeanBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/AdditionalBeanBuildItem.java index 0e469c157b6d4..c70510c504279 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/AdditionalBeanBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/AdditionalBeanBuildItem.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.builditem; +package org.jboss.shamrock.arc.deployment; import java.util.ArrayList; import java.util.Arrays; @@ -31,9 +31,9 @@ public AdditionalBeanBuildItem(String... beanNames) { this.beanNames = Arrays.asList(beanNames); } - public AdditionalBeanBuildItem(Class... beanClasss) { + public AdditionalBeanBuildItem(Class... beanClasss) { beanNames = new ArrayList<>(beanClasss.length); - for (Class i : beanClasss) { + for (Class i : beanClasss) { beanNames.add(i.getName()); } } diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java index e61ff19726848..2a7f882ace621 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java @@ -16,7 +16,6 @@ package org.jboss.shamrock.arc.deployment; -import static org.jboss.shamrock.annotations.ExecutionTime.RUNTIME_INIT; import static org.jboss.shamrock.annotations.ExecutionTime.STATIC_INIT; import java.io.ByteArrayInputStream; @@ -44,39 +43,29 @@ import org.jboss.protean.arc.processor.BeanDefiningAnnotation; import org.jboss.protean.arc.processor.BeanProcessor; import org.jboss.protean.arc.processor.BeanProcessor.Builder; +import org.jboss.protean.arc.processor.DotNames; import org.jboss.protean.arc.processor.ReflectionRegistration; import org.jboss.protean.arc.processor.ResourceOutput; import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; import org.jboss.shamrock.arc.runtime.ArcDeploymentTemplate; +import org.jboss.shamrock.arc.runtime.BeanContainer; import org.jboss.shamrock.arc.runtime.LifecycleEventRunner; import org.jboss.shamrock.deployment.Capabilities; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.ApplicationArchivesBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanArchiveIndexBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.GeneratedClassBuildItem; import org.jboss.shamrock.deployment.builditem.GeneratedResourceBuildItem; -import org.jboss.shamrock.deployment.builditem.HotDeploymentConfigFileBuildItem; import org.jboss.shamrock.deployment.builditem.InjectionProviderBuildItem; -import org.jboss.shamrock.deployment.builditem.ServiceStartBuildItem; import org.jboss.shamrock.deployment.builditem.ShutdownContextBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveFieldBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveMethodBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanContainerListenerBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanDefiningAnnotationBuildItem; -import org.jboss.shamrock.deployment.cdi.GeneratedBeanBuildItem; -import org.jboss.shamrock.deployment.cdi.ResourceAnnotationBuildItem; -import org.jboss.shamrock.runtime.cdi.BeanContainer; import org.jboss.shamrock.undertow.ServletExtensionBuildItem; public class ArcAnnotationProcessor { - private static final DotName JAVA_LANG_OBJECT = DotName.createSimple(Object.class.getName()); - private static final Logger log = Logger.getLogger("org.jboss.shamrock.arc.deployment.processor"); @Inject @@ -212,13 +201,6 @@ public void writeResource(Resource resource) throws IOException { return new BeanContainerBuildItem(bc); } - @BuildStep - @Record(RUNTIME_INIT) - void startupEvent(ArcDeploymentTemplate template, List startList, BeanContainerBuildItem beanContainer, - ShutdownContextBuildItem shutdown) { - template.handleLifecycleEvents(shutdown, beanContainer.getValue()); - } - private void indexBeanClass(String beanClass, Indexer indexer, IndexView shamrockIndex, Set additionalIndex) { DotName beanClassName = DotName.createSimple(beanClass); if (additionalIndex.contains(beanClassName)) { @@ -249,15 +231,9 @@ private void indexBeanClass(String beanClass, Indexer indexer, IndexView shamroc } } } - if (!beanInfo.superName().equals(JAVA_LANG_OBJECT)) { + if (!beanInfo.superName().equals(DotNames.OBJECT)) { indexBeanClass(beanInfo.superName().toString(), indexer, shamrockIndex, additionalIndex); } - - } - - @BuildStep - HotDeploymentConfigFileBuildItem configFile() { - return new HotDeploymentConfigFileBuildItem("META-INF/beans.xml"); } private void indexBeanClass(String beanClass, Indexer indexer, IndexView shamrockIndex, Set additionalIndex, byte[] beanData) { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanArchiveIndexBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveIndexBuildItem.java similarity index 95% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanArchiveIndexBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveIndexBuildItem.java index a1748a4d6d98b..8babcdc4417e0 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanArchiveIndexBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveIndexBuildItem.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.builditem; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.SimpleBuildItem; import org.jboss.jandex.IndexView; diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveProcessor.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveProcessor.java index 86afb01833287..d56774328aeac 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveProcessor.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanArchiveProcessor.java @@ -37,8 +37,6 @@ import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.deployment.ApplicationArchive; import org.jboss.shamrock.deployment.builditem.ApplicationArchivesBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanArchiveIndexBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanDefiningAnnotationBuildItem; public class BeanArchiveProcessor { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanContainerBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerBuildItem.java similarity index 89% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanContainerBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerBuildItem.java index 61c9ad75f4868..a71717a23afd7 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/builditem/BeanContainerBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerBuildItem.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.builditem; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.SimpleBuildItem; -import org.jboss.shamrock.runtime.cdi.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainer; public final class BeanContainerBuildItem extends SimpleBuildItem { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanContainerListenerBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerListenerBuildItem.java similarity index 90% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanContainerListenerBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerListenerBuildItem.java index e3d6fbaf66d0d..2c8036d671b32 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanContainerListenerBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanContainerListenerBuildItem.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.cdi; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.MultiBuildItem; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; +import org.jboss.shamrock.arc.runtime.BeanContainerListener; public final class BeanContainerListenerBuildItem extends MultiBuildItem { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanDefiningAnnotationBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationBuildItem.java similarity index 91% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanDefiningAnnotationBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationBuildItem.java index a3cae1095b0ba..ef5625d12ca1b 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/BeanDefiningAnnotationBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationBuildItem.java @@ -14,17 +14,14 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.cdi; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.MultiBuildItem; import org.jboss.jandex.DotName; -import org.jboss.shamrock.deployment.Capabilities; /** * This build item is used to specify additional bean defining annotations. See also * 2.5.1. Bean defining annotations. - * - * @see Capabilities#CDI_ARC */ public final class BeanDefiningAnnotationBuildItem extends MultiBuildItem { diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationsBuildStep.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationsBuildStep.java new file mode 100644 index 0000000000000..636240edf4c54 --- /dev/null +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/BeanDefiningAnnotationsBuildStep.java @@ -0,0 +1,24 @@ +package org.jboss.shamrock.arc.deployment; + +import org.jboss.jandex.DotName; +import org.jboss.shamrock.annotations.BuildProducer; +import org.jboss.shamrock.annotations.BuildStep; +import org.jboss.shamrock.deployment.Capabilities; +import org.jboss.shamrock.undertow.UndertowBuildStep; + +public class BeanDefiningAnnotationsBuildStep { + + @BuildStep + void beanDefiningAnnotations(Capabilities capabilities, BuildProducer annotations) { + if (capabilities.isCapabilityPresent(Capabilities.UNDERTOW)) { + // Arc integration depends on undertow so we want to avoid cyclic dependencies + annotations.produce(new BeanDefiningAnnotationBuildItem(UndertowBuildStep.WEB_FILTER)); + annotations.produce(new BeanDefiningAnnotationBuildItem(UndertowBuildStep.WEB_SERVLET)); + annotations.produce(new BeanDefiningAnnotationBuildItem(UndertowBuildStep.WEB_LISTENER)); + } + + // TODO: we should only add this when running the tests + annotations.produce(new BeanDefiningAnnotationBuildItem(DotName.createSimple("org.junit.runner.RunWith"))); + } + +} diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigValidationBuildStep.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigBuildStep.java similarity index 94% rename from extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigValidationBuildStep.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigBuildStep.java index c37bd6f82066e..37c6bfffbc3ff 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigValidationBuildStep.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ConfigBuildStep.java @@ -12,12 +12,17 @@ import org.jboss.protean.arc.processor.InjectionPointInfo; import org.jboss.shamrock.annotations.BuildStep; +import io.smallrye.config.inject.ConfigProducer; + /** - * TODO: we should move this to the core-deployment module * - * @author Martin Kouba */ -public class ConfigValidationBuildStep { +public class ConfigBuildStep { + + @BuildStep + AdditionalBeanBuildItem bean() { + return new AdditionalBeanBuildItem(ConfigProducer.class.getName()); + } @BuildStep BeanDeploymentValidatorBuildItem beanDeploymentValidator() { diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/GeneratedBeanBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/GeneratedBeanBuildItem.java similarity index 95% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/GeneratedBeanBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/GeneratedBeanBuildItem.java index a3cb0903d3d3c..b08e959e178b9 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/GeneratedBeanBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/GeneratedBeanBuildItem.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.cdi; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.MultiBuildItem; diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/HotDeploymentConfigBuildStep.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/HotDeploymentConfigBuildStep.java new file mode 100644 index 0000000000000..4495325a88cb6 --- /dev/null +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/HotDeploymentConfigBuildStep.java @@ -0,0 +1,13 @@ +package org.jboss.shamrock.arc.deployment; + +import org.jboss.shamrock.annotations.BuildStep; +import org.jboss.shamrock.deployment.builditem.HotDeploymentConfigFileBuildItem; + +public class HotDeploymentConfigBuildStep { + + @BuildStep + HotDeploymentConfigFileBuildItem configFile() { + return new HotDeploymentConfigFileBuildItem("META-INF/beans.xml"); + } + +} diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/LifecycleEventsBuildStep.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/LifecycleEventsBuildStep.java new file mode 100644 index 0000000000000..7cf67d96e5cb3 --- /dev/null +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/LifecycleEventsBuildStep.java @@ -0,0 +1,22 @@ +package org.jboss.shamrock.arc.deployment; + +import static org.jboss.shamrock.annotations.ExecutionTime.RUNTIME_INIT; + +import java.util.List; + +import org.jboss.shamrock.annotations.BuildStep; +import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.runtime.ArcDeploymentTemplate; +import org.jboss.shamrock.deployment.builditem.ServiceStartBuildItem; +import org.jboss.shamrock.deployment.builditem.ShutdownContextBuildItem; + +public class LifecycleEventsBuildStep { + + @BuildStep + @Record(RUNTIME_INIT) + void startupEvent(ArcDeploymentTemplate template, List startList, BeanContainerBuildItem beanContainer, + ShutdownContextBuildItem shutdown) { + template.handleLifecycleEvents(shutdown, beanContainer.getValue()); + } + +} diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ProxyUnwrapProcessor.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ProxyUnwrapProcessor.java index 563d02b20052f..2635f93821cf6 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ProxyUnwrapProcessor.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ProxyUnwrapProcessor.java @@ -17,13 +17,13 @@ package org.jboss.shamrock.arc.deployment; import org.jboss.shamrock.annotations.BuildStep; -import org.jboss.shamrock.arc.runtime.ArcClientProxyUnwrapper; +import org.jboss.shamrock.arc.runtime.ClientProxyUnwrapper; import org.jboss.shamrock.deployment.builditem.ProxyUnwrapperBuildItem; public class ProxyUnwrapProcessor { @BuildStep ProxyUnwrapperBuildItem wrapper() { - return new ProxyUnwrapperBuildItem(new ArcClientProxyUnwrapper()); + return new ProxyUnwrapperBuildItem(new ClientProxyUnwrapper()); } } diff --git a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/ResourceAnnotationBuildItem.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ResourceAnnotationBuildItem.java similarity index 96% rename from core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/ResourceAnnotationBuildItem.java rename to extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ResourceAnnotationBuildItem.java index b62fe53215e62..911d779e6111f 100644 --- a/core/deployment/src/main/java/org/jboss/shamrock/deployment/cdi/ResourceAnnotationBuildItem.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ResourceAnnotationBuildItem.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.deployment.cdi; +package org.jboss.shamrock.arc.deployment; import org.jboss.builder.item.MultiBuildItem; import org.jboss.jandex.DotName; diff --git a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcDeploymentTemplate.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcDeploymentTemplate.java index dd7f97c13a4d2..aadd3766def04 100644 --- a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcDeploymentTemplate.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcDeploymentTemplate.java @@ -30,8 +30,6 @@ import org.jboss.shamrock.runtime.InjectionInstance; import org.jboss.shamrock.runtime.ShutdownContext; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; import io.undertow.server.HttpServerExchange; import io.undertow.servlet.ServletExtension; diff --git a/core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainer.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainer.java similarity index 95% rename from core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainer.java rename to extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainer.java index 542098e24d69b..30b600577d623 100644 --- a/core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainer.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.runtime.cdi; +package org.jboss.shamrock.arc.runtime; import java.lang.annotation.Annotation; diff --git a/core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainerListener.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainerListener.java similarity index 96% rename from core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainerListener.java rename to extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainerListener.java index ace28157f8dd1..16b630fe8d0a9 100644 --- a/core/runtime/src/main/java/org/jboss/shamrock/runtime/cdi/BeanContainerListener.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/BeanContainerListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.jboss.shamrock.runtime.cdi; +package org.jboss.shamrock.arc.runtime; /** * An interface that can be used to configure beans immediately after the {@link BeanContainer} has been diff --git a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcClientProxyUnwrapper.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ClientProxyUnwrapper.java similarity index 92% rename from extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcClientProxyUnwrapper.java rename to extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ClientProxyUnwrapper.java index f15eb16f1a34d..55c05eba8bae5 100644 --- a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ArcClientProxyUnwrapper.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/ClientProxyUnwrapper.java @@ -20,7 +20,7 @@ import org.jboss.protean.arc.ClientProxy; -public class ArcClientProxyUnwrapper implements Function { +public class ClientProxyUnwrapper implements Function { @Override public Object apply(Object o) { if (o instanceof ClientProxy) { diff --git a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindingProvider.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindings.java similarity index 79% rename from extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindingProvider.java rename to extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindings.java index f7e8c5e31dfe9..24eb2d33d43fb 100644 --- a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindingProvider.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/InterceptorBindings.java @@ -22,11 +22,10 @@ import javax.interceptor.InvocationContext; import org.jboss.protean.arc.InvocationContextImpl; -import org.jboss.shamrock.runtime.InterceptorBindingService; -public class InterceptorBindingProvider implements InterceptorBindingService.Provider { - @Override - public Set getInterceptorBindings(InvocationContext invocationContext) { +public class InterceptorBindings { + + public static Set getInterceptorBindings(InvocationContext invocationContext) { if (invocationContext instanceof InvocationContextImpl) { return ((InvocationContextImpl) invocationContext).getInterceptorBindings(); } diff --git a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/LifecycleEventRunner.java b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/LifecycleEventRunner.java index b43be5d00ed31..eea6588d8e454 100644 --- a/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/LifecycleEventRunner.java +++ b/extensions/arc/runtime/src/main/java/org/jboss/shamrock/arc/runtime/LifecycleEventRunner.java @@ -32,11 +32,9 @@ public class LifecycleEventRunner { @Inject Event startup; - @Inject Event shutdown; - public void fireStartupEvent() { startup.fire(new StartupEvent()); } diff --git a/extensions/bean-validation/deployment/src/main/java/org/jboss/shamrock/beanvalidation/BeanValidationProcessor.java b/extensions/bean-validation/deployment/src/main/java/org/jboss/shamrock/beanvalidation/BeanValidationProcessor.java index c55a341741aca..a7a8ae52d4f9f 100644 --- a/extensions/bean-validation/deployment/src/main/java/org/jboss/shamrock/beanvalidation/BeanValidationProcessor.java +++ b/extensions/bean-validation/deployment/src/main/java/org/jboss/shamrock/beanvalidation/BeanValidationProcessor.java @@ -39,11 +39,11 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.arc.deployment.AnnotationsTransformerBuildItem; import org.jboss.shamrock.beanvalidation.runtime.ValidatorProvider; import org.jboss.shamrock.beanvalidation.runtime.ValidatorTemplate; import org.jboss.shamrock.beanvalidation.runtime.interceptor.MethodValidationInterceptor; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.HotDeploymentConfigFileBuildItem; diff --git a/extensions/fault-tolerance/deployment/src/main/java/org/jboss/shamrock/faulttolerance/deployment/FaultToleranceAnnotationProcessor.java b/extensions/fault-tolerance/deployment/src/main/java/org/jboss/shamrock/faulttolerance/deployment/FaultToleranceAnnotationProcessor.java index 63b8a7e167857..e2c83552c64f1 100644 --- a/extensions/fault-tolerance/deployment/src/main/java/org/jboss/shamrock/faulttolerance/deployment/FaultToleranceAnnotationProcessor.java +++ b/extensions/fault-tolerance/deployment/src/main/java/org/jboss/shamrock/faulttolerance/deployment/FaultToleranceAnnotationProcessor.java @@ -37,8 +37,8 @@ import org.jboss.protean.arc.processor.AnnotationsTransformer; import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.arc.deployment.AnnotationsTransformerBuildItem; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; diff --git a/extensions/health/deployment/pom.xml b/extensions/health/deployment/pom.xml index 09bab0f625b5e..846add3fd0603 100644 --- a/extensions/health/deployment/pom.xml +++ b/extensions/health/deployment/pom.xml @@ -37,7 +37,6 @@ org.jboss.shamrock shamrock-arc-deployment - test org.jboss.shamrock diff --git a/extensions/health/deployment/src/main/java/org/jboss/shamrock/health/HealthProcessor.java b/extensions/health/deployment/src/main/java/org/jboss/shamrock/health/HealthProcessor.java index 742104ec3693b..ee01bd1b5cd7c 100644 --- a/extensions/health/deployment/src/main/java/org/jboss/shamrock/health/HealthProcessor.java +++ b/extensions/health/deployment/src/main/java/org/jboss/shamrock/health/HealthProcessor.java @@ -21,14 +21,13 @@ import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.shamrock.annotations.BuildStep; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.health.runtime.HealthServlet; import org.jboss.shamrock.undertow.ServletBuildItem; import io.smallrye.health.SmallRyeHealthReporter; - class HealthProcessor { /** @@ -46,7 +45,7 @@ ServletBuildItem produceServlet() { } @BuildStep - List produceCdi() { + List additionalBeans() { return Arrays.asList( new AdditionalBeanBuildItem(SmallRyeHealthReporter.class), new AdditionalBeanBuildItem(HealthServlet.class)); diff --git a/extensions/jaxrs/deployment/pom.xml b/extensions/jaxrs/deployment/pom.xml index 22f6ed4839800..578e178ad9d71 100644 --- a/extensions/jaxrs/deployment/pom.xml +++ b/extensions/jaxrs/deployment/pom.xml @@ -38,6 +38,10 @@ org.jboss.shamrock shamrock-undertow-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-jaxrs-runtime diff --git a/extensions/jaxrs/deployment/src/main/java/org/jboss/shamrock/jaxrs/JaxrsScanningProcessor.java b/extensions/jaxrs/deployment/src/main/java/org/jboss/shamrock/jaxrs/JaxrsScanningProcessor.java index c808a0ee3ed66..37c9335518154 100755 --- a/extensions/jaxrs/deployment/src/main/java/org/jboss/shamrock/jaxrs/JaxrsScanningProcessor.java +++ b/extensions/jaxrs/deployment/src/main/java/org/jboss/shamrock/jaxrs/JaxrsScanningProcessor.java @@ -67,7 +67,8 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerBuildItem; +import org.jboss.shamrock.arc.deployment.BeanDefiningAnnotationBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.ProxyUnwrapperBuildItem; @@ -77,7 +78,6 @@ import org.jboss.shamrock.deployment.builditem.substrate.SubstrateConfigBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateProxyDefinitionBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanDefiningAnnotationBuildItem; import org.jboss.shamrock.jaxrs.runtime.ResteasyFilter; import org.jboss.shamrock.jaxrs.runtime.graal.JaxrsTemplate; import org.jboss.shamrock.jaxrs.runtime.graal.ShamrockInjectorFactory; diff --git a/extensions/jaxrs/runtime/pom.xml b/extensions/jaxrs/runtime/pom.xml index 9fbffeb1732ac..1856acaa09904 100644 --- a/extensions/jaxrs/runtime/pom.xml +++ b/extensions/jaxrs/runtime/pom.xml @@ -42,6 +42,10 @@ org.jboss.shamrock shamrock-undertow-runtime + + org.jboss.shamrock + shamrock-arc-runtime + org.jboss.resteasy resteasy-core diff --git a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/JaxrsTemplate.java b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/JaxrsTemplate.java index 05a3837d5c797..9db2df1913222 100644 --- a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/JaxrsTemplate.java +++ b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/JaxrsTemplate.java @@ -19,8 +19,8 @@ import java.util.List; import java.util.function.Function; +import org.jboss.shamrock.arc.runtime.BeanContainer; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; /** * Created by bob on 7/31/18. diff --git a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockConstructorInjector.java b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockConstructorInjector.java index e86a3acb30848..0cc343b698afd 100644 --- a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockConstructorInjector.java +++ b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockConstructorInjector.java @@ -27,7 +27,7 @@ import org.jboss.resteasy.spi.Failure; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; -import org.jboss.shamrock.runtime.cdi.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainer; public class ShamrockConstructorInjector implements ConstructorInjector { diff --git a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockInjectorFactory.java b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockInjectorFactory.java index 8e8afb0f68158..418a7056ad203 100644 --- a/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockInjectorFactory.java +++ b/extensions/jaxrs/runtime/src/main/java/org/jboss/shamrock/jaxrs/runtime/graal/ShamrockInjectorFactory.java @@ -33,7 +33,7 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.jboss.resteasy.spi.metadata.ResourceClass; import org.jboss.resteasy.spi.metadata.ResourceConstructor; -import org.jboss.shamrock.runtime.cdi.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainer; public class ShamrockInjectorFactory extends InjectorFactoryImpl { diff --git a/extensions/jpa/deployment/src/main/java/org/jboss/shamrock/jpa/HibernateResourceProcessor.java b/extensions/jpa/deployment/src/main/java/org/jboss/shamrock/jpa/HibernateResourceProcessor.java index 55e883e9a27e4..e05690a56f0a7 100644 --- a/extensions/jpa/deployment/src/main/java/org/jboss/shamrock/jpa/HibernateResourceProcessor.java +++ b/extensions/jpa/deployment/src/main/java/org/jboss/shamrock/jpa/HibernateResourceProcessor.java @@ -20,7 +20,11 @@ import static org.jboss.shamrock.annotations.ExecutionTime.STATIC_INIT; import java.net.URL; -import java.util.*; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import javax.enterprise.inject.Produces; @@ -43,9 +47,11 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerListenerBuildItem; +import org.jboss.shamrock.arc.deployment.ResourceAnnotationBuildItem; import org.jboss.shamrock.deployment.Capabilities; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; import org.jboss.shamrock.deployment.builditem.BytecodeTransformerBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; @@ -53,8 +59,6 @@ import org.jboss.shamrock.deployment.builditem.HotDeploymentConfigFileBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanContainerListenerBuildItem; -import org.jboss.shamrock.deployment.cdi.ResourceAnnotationBuildItem; import org.jboss.shamrock.deployment.configuration.ConfigurationError; import org.jboss.shamrock.deployment.recording.RecorderContext; import org.jboss.shamrock.jpa.runtime.DefaultEntityManagerFactoryProducer; @@ -227,14 +231,10 @@ void registerBeans(BuildProducer additionalBeans, Combi @BuildStep void setupResourceInjection(BuildProducer resourceAnnotations, Capabilities capabilities, BuildProducer resources) { - - if (capabilities.isCapabilityPresent(Capabilities.CDI_ARC)) { resources.produce(new GeneratedResourceBuildItem("META-INF/services/org.jboss.protean.arc.ResourceReferenceProvider", "org.jboss.shamrock.jpa.runtime.JPAResourceReferenceProvider".getBytes())); resourceAnnotations.produce(new ResourceAnnotationBuildItem(PERSISTENCE_CONTEXT)); resourceAnnotations.produce(new ResourceAnnotationBuildItem(PERSISTENCE_UNIT)); - } - } @BuildStep diff --git a/extensions/jpa/runtime/src/main/java/org/jboss/shamrock/jpa/runtime/JPADeploymentTemplate.java b/extensions/jpa/runtime/src/main/java/org/jboss/shamrock/jpa/runtime/JPADeploymentTemplate.java index f8a750587f7f3..e1c821ae169fc 100644 --- a/extensions/jpa/runtime/src/main/java/org/jboss/shamrock/jpa/runtime/JPADeploymentTemplate.java +++ b/extensions/jpa/runtime/src/main/java/org/jboss/shamrock/jpa/runtime/JPADeploymentTemplate.java @@ -26,9 +26,9 @@ import org.hibernate.protean.Hibernate; import org.hibernate.protean.impl.PersistenceUnitsHolder; import org.jboss.logging.Logger; +import org.jboss.shamrock.arc.runtime.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainerListener; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; /** * @author Emmanuel Bernard emmanuel@hibernate.org diff --git a/extensions/metrics/deployment/pom.xml b/extensions/metrics/deployment/pom.xml index 268d4e3b5dfef..7f10481ba6ccc 100644 --- a/extensions/metrics/deployment/pom.xml +++ b/extensions/metrics/deployment/pom.xml @@ -38,6 +38,10 @@ org.jboss.shamrock shamrock-undertow-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-metrics-runtime diff --git a/extensions/metrics/deployment/src/main/java/org/jboss/shamrock/metrics/MetricsProcessor.java b/extensions/metrics/deployment/src/main/java/org/jboss/shamrock/metrics/MetricsProcessor.java index 6983be5994134..9736875d5432d 100644 --- a/extensions/metrics/deployment/src/main/java/org/jboss/shamrock/metrics/MetricsProcessor.java +++ b/extensions/metrics/deployment/src/main/java/org/jboss/shamrock/metrics/MetricsProcessor.java @@ -35,9 +35,9 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanArchiveIndexBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanArchiveIndexBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.metrics.runtime.MetricsDeploymentTemplate; @@ -95,7 +95,6 @@ public void build(BeanContainerBuildItem beanContainerBuildItem, reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, Counted.class.getName())); reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, MetricsBinding.class.getName())); - metrics.createRegistries(beanContainerBuildItem.getValue()); IndexView index = beanArchiveIndex.getIndex(); diff --git a/extensions/metrics/runtime/pom.xml b/extensions/metrics/runtime/pom.xml index 899454c4a5289..57860b26403d8 100644 --- a/extensions/metrics/runtime/pom.xml +++ b/extensions/metrics/runtime/pom.xml @@ -43,6 +43,10 @@ org.jboss.shamrock shamrock-undertow-runtime + + org.jboss.shamrock + shamrock-arc-runtime + org.glassfish javax.json diff --git a/extensions/metrics/runtime/src/main/java/org/jboss/shamrock/metrics/runtime/MetricsDeploymentTemplate.java b/extensions/metrics/runtime/src/main/java/org/jboss/shamrock/metrics/runtime/MetricsDeploymentTemplate.java index 89b7a3cb219ef..09ef049cb9d4b 100644 --- a/extensions/metrics/runtime/src/main/java/org/jboss/shamrock/metrics/runtime/MetricsDeploymentTemplate.java +++ b/extensions/metrics/runtime/src/main/java/org/jboss/shamrock/metrics/runtime/MetricsDeploymentTemplate.java @@ -26,8 +26,8 @@ import org.eclipse.microprofile.metrics.MetricRegistry; import org.eclipse.microprofile.metrics.MetricType; import org.jboss.logging.Logger; +import org.jboss.shamrock.arc.runtime.BeanContainer; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; import io.smallrye.metrics.MetricRegistries; import io.smallrye.metrics.app.CounterImpl; diff --git a/extensions/openapi/deployment/pom.xml b/extensions/openapi/deployment/pom.xml index 287d742965561..960aa152aa1ee 100644 --- a/extensions/openapi/deployment/pom.xml +++ b/extensions/openapi/deployment/pom.xml @@ -42,6 +42,10 @@ org.jboss.shamrock shamrock-jaxrs-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-openapi-runtime diff --git a/extensions/openapi/deployment/src/main/java/org/jboss/shamrock/openapi/OpenApiProcessor.java b/extensions/openapi/deployment/src/main/java/org/jboss/shamrock/openapi/OpenApiProcessor.java index cf0b3b428a0c1..90a14294fd78f 100644 --- a/extensions/openapi/deployment/src/main/java/org/jboss/shamrock/openapi/OpenApiProcessor.java +++ b/extensions/openapi/deployment/src/main/java/org/jboss/shamrock/openapi/OpenApiProcessor.java @@ -35,12 +35,12 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerListenerBuildItem; import org.jboss.shamrock.deployment.builditem.ApplicationArchivesBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.HotDeploymentConfigFileBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanContainerListenerBuildItem; import org.jboss.shamrock.jaxrs.JaxrsConfig; import org.jboss.shamrock.openapi.runtime.OpenApiDeploymentTemplate; import org.jboss.shamrock.openapi.runtime.OpenApiDocumentProducer; diff --git a/extensions/openapi/runtime/pom.xml b/extensions/openapi/runtime/pom.xml index cc651ba648d0f..732ff41aa662d 100644 --- a/extensions/openapi/runtime/pom.xml +++ b/extensions/openapi/runtime/pom.xml @@ -52,6 +52,10 @@ org.jboss.shamrock shamrock-undertow-runtime + + org.jboss.shamrock + shamrock-arc-runtime + com.fasterxml.jackson.core diff --git a/extensions/openapi/runtime/src/main/java/org/jboss/shamrock/openapi/runtime/OpenApiDeploymentTemplate.java b/extensions/openapi/runtime/src/main/java/org/jboss/shamrock/openapi/runtime/OpenApiDeploymentTemplate.java index 06cf78cd234f0..cb5a1a06fff80 100644 --- a/extensions/openapi/runtime/src/main/java/org/jboss/shamrock/openapi/runtime/OpenApiDeploymentTemplate.java +++ b/extensions/openapi/runtime/src/main/java/org/jboss/shamrock/openapi/runtime/OpenApiDeploymentTemplate.java @@ -20,10 +20,10 @@ import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.openapi.OASFilter; import org.eclipse.microprofile.openapi.models.OpenAPI; -import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainer; +import org.jboss.shamrock.arc.runtime.BeanContainerListener; import org.jboss.shamrock.runtime.Shamrock; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; +import org.jboss.shamrock.runtime.Template; import io.smallrye.openapi.api.OpenApiConfig; import io.smallrye.openapi.api.OpenApiConfigImpl; diff --git a/extensions/opentracing/deployment/pom.xml b/extensions/opentracing/deployment/pom.xml index aa60587376c28..f4fdf7f5fa7ef 100644 --- a/extensions/opentracing/deployment/pom.xml +++ b/extensions/opentracing/deployment/pom.xml @@ -42,6 +42,10 @@ org.jboss.shamrock shamrock-undertow-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-opentracing-runtime diff --git a/extensions/opentracing/deployment/src/main/java/org/jboss/shamrock/opentracing/OpentracingProcessor.java b/extensions/opentracing/deployment/src/main/java/org/jboss/shamrock/opentracing/OpentracingProcessor.java index caf0567b24753..0a0131b88d196 100644 --- a/extensions/opentracing/deployment/src/main/java/org/jboss/shamrock/opentracing/OpentracingProcessor.java +++ b/extensions/opentracing/deployment/src/main/java/org/jboss/shamrock/opentracing/OpentracingProcessor.java @@ -25,8 +25,8 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveMethodBuildItem; import org.jboss.shamrock.jaxrs.JaxrsProviderBuildItem; import org.jboss.shamrock.opentracing.runtime.ShamrockTracingDynamicFeature; @@ -66,7 +66,6 @@ void setupFilter(BuildProducer providers, filterInfo.addFilterUrlMapping("*", DispatcherType.ASYNC); filterInfo.addFilterUrlMapping("*", DispatcherType.ERROR); filterProducer.produce(filterInfo); - } } diff --git a/extensions/reactive-messaging/deployment/src/main/java/org/jboss/shamrock/reactivemessaging/deployment/ReactiveMessagingProcessor.java b/extensions/reactive-messaging/deployment/src/main/java/org/jboss/shamrock/reactivemessaging/deployment/ReactiveMessagingProcessor.java index 407f0c3f2f38c..5732d4c5b5bf5 100644 --- a/extensions/reactive-messaging/deployment/src/main/java/org/jboss/shamrock/reactivemessaging/deployment/ReactiveMessagingProcessor.java +++ b/extensions/reactive-messaging/deployment/src/main/java/org/jboss/shamrock/reactivemessaging/deployment/ReactiveMessagingProcessor.java @@ -33,9 +33,9 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerBuildItem; import org.jboss.shamrock.arc.deployment.BeanDeploymentValidatorBuildItem; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.reactivemessaging.runtime.ReactiveMessagingLifecycle; diff --git a/extensions/reactive-messaging/runtime/src/main/java/org/jboss/shamrock/reactivemessaging/runtime/ReactiveMessagingTemplate.java b/extensions/reactive-messaging/runtime/src/main/java/org/jboss/shamrock/reactivemessaging/runtime/ReactiveMessagingTemplate.java index b4e8745b9f72a..9717f4de3b1c2 100644 --- a/extensions/reactive-messaging/runtime/src/main/java/org/jboss/shamrock/reactivemessaging/runtime/ReactiveMessagingTemplate.java +++ b/extensions/reactive-messaging/runtime/src/main/java/org/jboss/shamrock/reactivemessaging/runtime/ReactiveMessagingTemplate.java @@ -4,8 +4,8 @@ import java.util.Map.Entry; import org.jboss.protean.arc.Arc; +import org.jboss.shamrock.arc.runtime.BeanContainer; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; import io.smallrye.reactive.messaging.extension.MediatorManager; diff --git a/extensions/rest-client/deployment/pom.xml b/extensions/rest-client/deployment/pom.xml index 125665e5e0939..14fce98af699a 100644 --- a/extensions/rest-client/deployment/pom.xml +++ b/extensions/rest-client/deployment/pom.xml @@ -32,7 +32,7 @@ org.jboss.shamrock - shamrock-core-deployment + shamrock-arc-deployment org.jboss.shamrock diff --git a/extensions/rest-client/deployment/src/main/java/org/jboss/shamrock/restclient/RestClientProcessor.java b/extensions/rest-client/deployment/src/main/java/org/jboss/shamrock/restclient/RestClientProcessor.java index df374f3c530ea..72dad9c3b0646 100644 --- a/extensions/rest-client/deployment/src/main/java/org/jboss/shamrock/restclient/RestClientProcessor.java +++ b/extensions/rest-client/deployment/src/main/java/org/jboss/shamrock/restclient/RestClientProcessor.java @@ -46,14 +46,14 @@ import org.jboss.resteasy.spi.ResteasyConfiguration; import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.GeneratedBeanBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.GeneratedClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateProxyDefinitionBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBuildItem; -import org.jboss.shamrock.deployment.cdi.GeneratedBeanBuildItem; import org.jboss.shamrock.restclient.runtime.DefaultResponseExceptionMapper; import org.jboss.shamrock.restclient.runtime.RestClientBase; import org.jboss.shamrock.restclient.runtime.RestClientProxy; diff --git a/extensions/scheduler/deployment/src/main/java/org/jboss/shamrock/scheduler/deployment/SchedulerProcessor.java b/extensions/scheduler/deployment/src/main/java/org/jboss/shamrock/scheduler/deployment/SchedulerProcessor.java index 01ba4f106e04d..fef004b2b078a 100644 --- a/extensions/scheduler/deployment/src/main/java/org/jboss/shamrock/scheduler/deployment/SchedulerProcessor.java +++ b/extensions/scheduler/deployment/src/main/java/org/jboss/shamrock/scheduler/deployment/SchedulerProcessor.java @@ -54,10 +54,10 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.arc.deployment.AnnotationsTransformerBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerBuildItem; import org.jboss.shamrock.arc.deployment.BeanDeploymentValidatorBuildItem; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; -import org.jboss.shamrock.deployment.builditem.BeanContainerBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.GeneratedClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; diff --git a/extensions/scheduler/runtime/src/main/java/org/jboss/shamrock/scheduler/runtime/SchedulerDeploymentTemplate.java b/extensions/scheduler/runtime/src/main/java/org/jboss/shamrock/scheduler/runtime/SchedulerDeploymentTemplate.java index 1ae406afbd5c9..faa2c8d68424d 100644 --- a/extensions/scheduler/runtime/src/main/java/org/jboss/shamrock/scheduler/runtime/SchedulerDeploymentTemplate.java +++ b/extensions/scheduler/runtime/src/main/java/org/jboss/shamrock/scheduler/runtime/SchedulerDeploymentTemplate.java @@ -19,8 +19,8 @@ import java.util.List; import java.util.Map; +import org.jboss.shamrock.arc.runtime.BeanContainer; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainer; import org.jboss.shamrock.scheduler.api.Scheduled; import org.jboss.shamrock.scheduler.runtime.ScheduledLiteral.Builder; diff --git a/extensions/transactions/deployment/pom.xml b/extensions/transactions/deployment/pom.xml index 4deabfa040fae..b98d160faa1b9 100644 --- a/extensions/transactions/deployment/pom.xml +++ b/extensions/transactions/deployment/pom.xml @@ -34,6 +34,10 @@ org.jboss.shamrock shamrock-core-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-transactions-runtime diff --git a/extensions/transactions/deployment/src/main/java/org/jboss/shamrock/transactions/TransactionsProcessor.java b/extensions/transactions/deployment/src/main/java/org/jboss/shamrock/transactions/TransactionsProcessor.java index 45587f48d947d..04cf8fe408caf 100644 --- a/extensions/transactions/deployment/src/main/java/org/jboss/shamrock/transactions/TransactionsProcessor.java +++ b/extensions/transactions/deployment/src/main/java/org/jboss/shamrock/transactions/TransactionsProcessor.java @@ -26,8 +26,8 @@ import org.jboss.shamrock.annotations.BuildProducer; import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.Capabilities; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.RuntimeInitializedClassBuildItem; diff --git a/extensions/transactions/runtime/pom.xml b/extensions/transactions/runtime/pom.xml index 9f01bc0040925..76661cb795691 100644 --- a/extensions/transactions/runtime/pom.xml +++ b/extensions/transactions/runtime/pom.xml @@ -34,26 +34,26 @@ org.jboss.shamrock shamrock-core-runtime + + org.jboss.shamrock + shamrock-arc-runtime + com.oracle.substratevm svm - org.jboss.narayana.jta narayana-jta - org.jboss.narayana.jts narayana-jts-integration - org.jboss.spec.javax.transaction jboss-transaction-api_1.2_spec - diff --git a/extensions/transactions/runtime/src/main/java/org/jboss/shamrock/transactions/runtime/interceptor/TransactionalInterceptorBase.java b/extensions/transactions/runtime/src/main/java/org/jboss/shamrock/transactions/runtime/interceptor/TransactionalInterceptorBase.java index 967b1e4dbb2a7..f4265940ba0d0 100644 --- a/extensions/transactions/runtime/src/main/java/org/jboss/shamrock/transactions/runtime/interceptor/TransactionalInterceptorBase.java +++ b/extensions/transactions/runtime/src/main/java/org/jboss/shamrock/transactions/runtime/interceptor/TransactionalInterceptorBase.java @@ -28,7 +28,7 @@ import javax.transaction.TransactionManager; import javax.transaction.Transactional; -import org.jboss.shamrock.runtime.InterceptorBindingService; +import org.jboss.shamrock.arc.runtime.InterceptorBindings; import org.jboss.tm.usertx.client.ServerVMClientUserTransaction; import com.arjuna.ats.jta.logging.jtaLogger; @@ -76,7 +76,7 @@ public Object intercept(InvocationContext ic) throws Exception { * @return instance of {@link Transactional} annotation or null */ private Transactional getTransactional(InvocationContext ic) { - Set bindings = InterceptorBindingService.getInterceptorBindings(ic); + Set bindings = InterceptorBindings.getInterceptorBindings(ic); for (Annotation i : bindings) { if (i.annotationType() == Transactional.class) { return (Transactional) i; diff --git a/extensions/undertow/deployment/src/main/java/org/jboss/shamrock/undertow/UndertowBuildStep.java b/extensions/undertow/deployment/src/main/java/org/jboss/shamrock/undertow/UndertowBuildStep.java index 5aa6cccda8817..ded6649011e08 100644 --- a/extensions/undertow/deployment/src/main/java/org/jboss/shamrock/undertow/UndertowBuildStep.java +++ b/extensions/undertow/deployment/src/main/java/org/jboss/shamrock/undertow/UndertowBuildStep.java @@ -90,6 +90,7 @@ import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.Record; import org.jboss.shamrock.deployment.ApplicationArchive; +import org.jboss.shamrock.deployment.Capabilities; import org.jboss.shamrock.deployment.builditem.ApplicationArchivesBuildItem; import org.jboss.shamrock.deployment.builditem.ArchiveRootBuildItem; import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem; @@ -101,7 +102,6 @@ import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateConfigBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateResourceBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanDefiningAnnotationBuildItem; import org.jboss.shamrock.deployment.recording.RecorderContext; import org.jboss.shamrock.runtime.RuntimeValue; import org.jboss.shamrock.undertow.runtime.HttpConfig; @@ -117,15 +117,14 @@ public class UndertowBuildStep { - - private static final DotName webFilter = DotName.createSimple(WebFilter.class.getName()); - private static final DotName webListener = DotName.createSimple(WebListener.class.getName()); - private static final DotName webServlet = DotName.createSimple(WebServlet.class.getName()); - private static final DotName runAs = DotName.createSimple(RunAs.class.getName()); - private static final DotName declareRoles = DotName.createSimple(DeclareRoles.class.getName()); - private static final DotName multipartConfig = DotName.createSimple(MultipartConfig.class.getName()); - private static final DotName servletSecurity = DotName.createSimple(ServletSecurity.class.getName()); - private static final String WEB_XML = "META-INF/web.xml"; + public static final DotName WEB_FILTER = DotName.createSimple(WebFilter.class.getName()); + public static final DotName WEB_LISTENER = DotName.createSimple(WebListener.class.getName()); + public static final DotName WEB_SERVLET = DotName.createSimple(WebServlet.class.getName()); + public static final DotName RUN_AS = DotName.createSimple(RunAs.class.getName()); + public static final DotName DECLARE_ROLES = DotName.createSimple(DeclareRoles.class.getName()); + public static final DotName MULTIPART_CONFIG = DotName.createSimple(MultipartConfig.class.getName()); + public static final DotName SERVLET_SECURITY = DotName.createSimple(ServletSecurity.class.getName()); + public static final String WEB_XML = "META-INF/web.xml"; @Inject CombinedIndexBuildItem combinedIndexBuildItem; @@ -157,23 +156,13 @@ SubstrateConfigBuildItem config() { .build(); } - @BuildStep - List beanDefiningAnnotations() { - List annotations = new ArrayList<>(); - annotations.add(new BeanDefiningAnnotationBuildItem(webFilter)); - annotations.add(new BeanDefiningAnnotationBuildItem(webServlet)); - annotations.add(new BeanDefiningAnnotationBuildItem(webListener)); - return annotations; - } - - @BuildStep HotDeploymentConfigFileBuildItem configFile() { return new HotDeploymentConfigFileBuildItem(WEB_XML); } @Record(STATIC_INIT) - @BuildStep + @BuildStep(providesCapabilities = Capabilities.UNDERTOW) public ServletDeploymentBuildItem build(ApplicationArchivesBuildItem applicationArchivesBuildItem, List servlets, List filters, @@ -388,7 +377,7 @@ public void accept(Path path) { */ private void processAnnotations(IndexView index, WebMetaData metaData) { // @WebServlet - final Collection webServletAnnotations = index.getAnnotations(webServlet); + final Collection webServletAnnotations = index.getAnnotations(WEB_SERVLET); if (webServletAnnotations != null && webServletAnnotations.size() > 0) { ServletsMetaData servlets = new ServletsMetaData(); List servletMappings = new ArrayList(); @@ -471,7 +460,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { metaData.setServletMappings(servletMappings); } // @WebFilter - final Collection webFilterAnnotations = index.getAnnotations(webFilter); + final Collection webFilterAnnotations = index.getAnnotations(WEB_FILTER); if (webFilterAnnotations != null && webFilterAnnotations.size() > 0) { FiltersMetaData filters = new FiltersMetaData(); List filterMappings = new ArrayList(); @@ -572,7 +561,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { metaData.setFilterMappings(filterMappings); } // @WebListener - final Collection webListenerAnnotations = index.getAnnotations(webListener); + final Collection webListenerAnnotations = index.getAnnotations(WEB_LISTENER); if (webListenerAnnotations != null && webListenerAnnotations.size() > 0) { List listeners = new ArrayList(); for (final AnnotationInstance annotation : webListenerAnnotations) { @@ -592,7 +581,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { metaData.setListeners(listeners); } // @RunAs - final Collection runAsAnnotations = index.getAnnotations(runAs); + final Collection runAsAnnotations = index.getAnnotations(RUN_AS); if (runAsAnnotations != null && runAsAnnotations.size() > 0) { AnnotationsMetaData annotations = metaData.getAnnotations(); if (annotations == null) { @@ -617,7 +606,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { } } // @DeclareRoles - final Collection declareRolesAnnotations = index.getAnnotations(declareRoles); + final Collection declareRolesAnnotations = index.getAnnotations(DECLARE_ROLES); if (declareRolesAnnotations != null && declareRolesAnnotations.size() > 0) { SecurityRolesMetaData securityRoles = metaData.getSecurityRoles(); if (securityRoles == null) { @@ -633,7 +622,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { } } // @MultipartConfig - final Collection multipartConfigAnnotations = index.getAnnotations(multipartConfig); + final Collection multipartConfigAnnotations = index.getAnnotations(MULTIPART_CONFIG); if (multipartConfigAnnotations != null && multipartConfigAnnotations.size() > 0) { AnnotationsMetaData annotations = metaData.getAnnotations(); if (annotations == null) { @@ -670,7 +659,7 @@ private void processAnnotations(IndexView index, WebMetaData metaData) { } } // @ServletSecurity - final Collection servletSecurityAnnotations = index.getAnnotations(servletSecurity); + final Collection servletSecurityAnnotations = index.getAnnotations(SERVLET_SECURITY); if (servletSecurityAnnotations != null && servletSecurityAnnotations.size() > 0) { AnnotationsMetaData annotations = metaData.getAnnotations(); if (annotations == null) { diff --git a/extensions/vertx/deployment/pom.xml b/extensions/vertx/deployment/pom.xml index 69b1d3c1263e9..723b9ab60ef38 100644 --- a/extensions/vertx/deployment/pom.xml +++ b/extensions/vertx/deployment/pom.xml @@ -34,6 +34,10 @@ org.jboss.shamrock shamrock-core-deployment + + org.jboss.shamrock + shamrock-arc-deployment + org.jboss.shamrock shamrock-vertx-runtime diff --git a/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java b/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java index b5d0d4869549f..53b5c8973abc8 100644 --- a/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java +++ b/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java @@ -25,11 +25,11 @@ import org.jboss.shamrock.annotations.BuildStep; import org.jboss.shamrock.annotations.ExecutionTime; import org.jboss.shamrock.annotations.Record; -import org.jboss.shamrock.deployment.builditem.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.AdditionalBeanBuildItem; +import org.jboss.shamrock.arc.deployment.BeanContainerListenerBuildItem; import org.jboss.shamrock.deployment.builditem.FeatureBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem; import org.jboss.shamrock.deployment.builditem.substrate.SubstrateConfigBuildItem; -import org.jboss.shamrock.deployment.cdi.BeanContainerListenerBuildItem; import org.jboss.shamrock.vertx.runtime.VertxConfiguration; import org.jboss.shamrock.vertx.runtime.VertxProducer; import org.jboss.shamrock.vertx.runtime.VertxTemplate; diff --git a/extensions/vertx/runtime/pom.xml b/extensions/vertx/runtime/pom.xml index 0db77aaa0bfbc..d32519a24c189 100644 --- a/extensions/vertx/runtime/pom.xml +++ b/extensions/vertx/runtime/pom.xml @@ -34,6 +34,10 @@ org.jboss.shamrock shamrock-core-runtime + + org.jboss.shamrock + shamrock-arc-runtime + io.vertx vertx-core diff --git a/extensions/vertx/runtime/src/main/java/org/jboss/shamrock/vertx/runtime/VertxTemplate.java b/extensions/vertx/runtime/src/main/java/org/jboss/shamrock/vertx/runtime/VertxTemplate.java index f7da73884c370..89b49b7d9eab2 100644 --- a/extensions/vertx/runtime/src/main/java/org/jboss/shamrock/vertx/runtime/VertxTemplate.java +++ b/extensions/vertx/runtime/src/main/java/org/jboss/shamrock/vertx/runtime/VertxTemplate.java @@ -1,7 +1,7 @@ package org.jboss.shamrock.vertx.runtime; +import org.jboss.shamrock.arc.runtime.BeanContainerListener; import org.jboss.shamrock.runtime.Template; -import org.jboss.shamrock.runtime.cdi.BeanContainerListener; @Template public class VertxTemplate { diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanDeployment.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanDeployment.java index 364db335e03ab..b1547b87e7988 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanDeployment.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanDeployment.java @@ -534,7 +534,9 @@ public static Set initBeanDefiningAnnotations(Collection beanToGeneratedName = new HashMap<>(); Map observerToGeneratedName = new HashMap<>(); - Map interceptorToGeneratedName = new HashMap<>(); long start = System.currentTimeMillis(); List resources = new ArrayList<>(); @@ -171,7 +170,6 @@ public BeanDeployment process() throws IOException { for (Resource resource : interceptorGenerator.generate(interceptor, reflectionRegistration)) { resources.add(resource); if (SpecialType.INTERCEPTOR_BEAN.equals(resource.getSpecialType())) { - interceptorToGeneratedName.put(interceptor, resource.getName()); beanToGeneratedName.put(interceptor, resource.getName()); } } diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/DotNames.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/DotNames.java index 38a59a00cb812..465f5644f1ffb 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/DotNames.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/DotNames.java @@ -87,14 +87,14 @@ public final class DotNames { public static final DotName OPTIONAL = create(Optional.class); public static final DotName NAMED = create(Named.class); - public static final DotName BOOLEAN = create(Boolean.class.getName()); - public static final DotName BYTE = create(Byte.class.getName()); - public static final DotName CHARACTER = create(Character.class.getName()); - public static final DotName DOUBLE = create(Double.class.getName()); - public static final DotName FLOAT = create(Float.class.getName()); - public static final DotName INTEGER = create(Integer.class.getName()); - public static final DotName LONG = create(Long.class.getName()); - public static final DotName SHORT = create(Short.class.getName()); + public static final DotName BOOLEAN = create(Boolean.class); + public static final DotName BYTE = create(Byte.class); + public static final DotName CHARACTER = create(Character.class); + public static final DotName DOUBLE = create(Double.class); + public static final DotName FLOAT = create(Float.class); + public static final DotName INTEGER = create(Integer.class); + public static final DotName LONG = create(Long.class); + public static final DotName SHORT = create(Short.class); private DotNames() { } @@ -104,12 +104,13 @@ static DotName create(Class clazz) { } static DotName create(String name) { - if (!name.contains(".")) { + int lastDot = name.lastIndexOf('.'); + if (lastDot < 0) { return DotName.createComponentized(null, name); } - String prefix = name.substring(0, name.lastIndexOf('.')); + String prefix = name.substring(0, lastDot); DotName prefixName = NAMES.getValue(prefix); - String local = name.substring(name.lastIndexOf('.') + 1); + String local = name.substring(lastDot + 1); return DotName.createComponentized(prefixName, local); } diff --git a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java index 7f75f45335360..8e2167ef368bf 100644 --- a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java +++ b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java @@ -67,7 +67,7 @@ public void destroy(Contextual contextual) { @Override public synchronized void destroy() { - instances.forEachExistingValue(InstanceHandleImpl::destroyInternal); + instances.forEachValue(InstanceHandleImpl::destroyInternal); instances.clear(); } diff --git a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java index 6fdedbd3a9035..02cd2d0879168 100644 --- a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java +++ b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java @@ -33,35 +33,33 @@ */ public class ComputingCache { - private final ConcurrentMap> map; + private final ConcurrentMap map; - private final Function> function; + private final Function function; public ComputingCache(Function computingFunction) { this.map = new ConcurrentHashMap<>(); - this.function = new CacheFunction(computingFunction); + this.function = computingFunction; } public V getValue(K key) { - LazyValue value = map.get(key); + V value = map.get(key); if (value == null) { value = function.apply(key); - LazyValue previous = map.putIfAbsent(key, value); + V previous = map.putIfAbsent(key, value); if (previous != null) { value = previous; } } - return value.get(); + return value; } public V getValueIfPresent(K key) { - LazyValue value = map.get(key); - return value != null ? value.getIfPresent() :null; + return map.get(key); } public V remove(K key) { - LazyValue previous = map.remove(key); - return previous != null ? previous.get() : null; + return map.remove(key); } public void clear() { @@ -70,24 +68,15 @@ public void clear() { public void forEachValue(Consumer action) { Objects.requireNonNull(action); - for (LazyValue value : map.values()) { - action.accept(value.get()); - } - } - - public void forEachExistingValue(Consumer action) { - Objects.requireNonNull(action); - for (LazyValue value : map.values()) { - if(value.isSet()) { - action.accept(value.get()); - } + for (V value : map.values()) { + action.accept(value); } } public void forEachEntry(BiConsumer action) { Objects.requireNonNull(action); - for (Map.Entry> entry : map.entrySet()) { - action.accept(entry.getKey(), entry.getValue().get()); + for (Map.Entry entry : map.entrySet()) { + action.accept(entry.getKey(), entry.getValue()); } } @@ -95,19 +84,4 @@ public boolean isEmpty() { return map.isEmpty(); } - class CacheFunction implements Function> { - - private final Function computingFunction; - - public CacheFunction(Function computingFunction) { - this.computingFunction = computingFunction; - } - - @Override - public LazyValue apply(K key) { - return new LazyValue(() -> computingFunction.apply(key)); - } - - } - }