Skip to content

Commit

Permalink
Fixes piranhacloud#3335 - Use the new extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Thihup committed Jun 20, 2023
1 parent fd87ae3 commit d573b52
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 16 deletions.
6 changes: 6 additions & 0 deletions extension/coreprofile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-annotationscan-classfile</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-naming</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.api.WebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension;
import cloud.piranha.extension.naming.NamingExtension;
import cloud.piranha.extension.scinitializer.ServletContainerInitializerExtension;

Expand All @@ -43,7 +44,15 @@ public class CoreProfileExtension implements WebApplicationExtension {
@Override
public void extend(WebApplicationExtensionContext context) {
context.add(NamingExtension.class); // Naming (JNDI)
context.add(AnnotationScanExtension.class);
context.add(getAnnotationScanExtensionClass());
context.add(ServletContainerInitializerExtension.class); // ServletContainerInitializer
}

private static Class<? extends WebApplicationExtension> getAnnotationScanExtensionClass() {
if (System.getProperty(ClassfileAnnotationScanExtension.EXPERIMENTAL_PROPERTY) != null) {
return ClassfileAnnotationScanExtension.class; // Annotation scanning using the new Classfile API
}
return AnnotationScanExtension.class; // Annotation scanning
}

}
1 change: 1 addition & 0 deletions extension/coreprofile/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
opens cloud.piranha.extension.coreprofile;
requires cloud.piranha.core.api;
requires cloud.piranha.extension.annotationscan;
requires cloud.piranha.extension.annotationscan.classfile;
requires cloud.piranha.extension.naming;
requires cloud.piranha.extension.scinitializer;
requires jakarta.ws.rs;
Expand Down
6 changes: 6 additions & 0 deletions extension/microprofile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-annotationscan-classfile</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-naming</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.api.WebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension;
import cloud.piranha.extension.naming.NamingExtension;
import cloud.piranha.extension.scinitializer.ServletContainerInitializerExtension;

Expand All @@ -43,7 +44,15 @@ public class MicroProfileExtension implements WebApplicationExtension {
@Override
public void extend(WebApplicationExtensionContext context) {
context.add(NamingExtension.class); // Naming (JNDI)
context.add(AnnotationScanExtension.class);
context.add(getAnnotationScanExtensionClass());
context.add(ServletContainerInitializerExtension.class); // ServletContainerInitializer
}

private static Class<? extends WebApplicationExtension> getAnnotationScanExtensionClass() {
if (System.getProperty(ClassfileAnnotationScanExtension.EXPERIMENTAL_PROPERTY) != null) {
return ClassfileAnnotationScanExtension.class; // Annotation scanning using the new Classfile API
}
return AnnotationScanExtension.class; // Annotation scanning
}

}
1 change: 1 addition & 0 deletions extension/microprofile/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
opens cloud.piranha.extension.microprofile;
requires cloud.piranha.core.api;
requires cloud.piranha.extension.annotationscan;
requires cloud.piranha.extension.annotationscan.classfile;
requires cloud.piranha.extension.naming;
requires cloud.piranha.extension.scinitializer;
requires jakarta.ws.rs;
Expand Down
6 changes: 6 additions & 0 deletions extension/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-annotationscan-classfile</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-naming</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.api.WebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension;
import cloud.piranha.extension.naming.NamingExtension;
import cloud.piranha.extension.scinitializer.ServletContainerInitializerExtension;

Expand All @@ -43,7 +44,15 @@ public class PlatformExtension implements WebApplicationExtension {
@Override
public void extend(WebApplicationExtensionContext context) {
context.add(NamingExtension.class); // Naming (JNDI)
context.add(AnnotationScanExtension.class); // Annotation scanning
context.add(getAnnotationScanExtensionClass()); // Annotation scanning
context.add(ServletContainerInitializerExtension.class); // ServletContainerInitializer
}

private static Class<? extends WebApplicationExtension> getAnnotationScanExtensionClass() {
if (System.getProperty(ClassfileAnnotationScanExtension.EXPERIMENTAL_PROPERTY) != null) {
return ClassfileAnnotationScanExtension.class; // Annotation scanning using the new Classfile API
}
return AnnotationScanExtension.class; // Annotation scanning
}

}
1 change: 1 addition & 0 deletions extension/platform/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
opens cloud.piranha.extension.platform;
requires cloud.piranha.core.api;
requires cloud.piranha.extension.annotationscan;
requires cloud.piranha.extension.annotationscan.classfile;
requires cloud.piranha.extension.naming;
requires cloud.piranha.extension.scinitializer;
requires jakarta.ws.rs;
Expand Down
6 changes: 6 additions & 0 deletions extension/servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-annotationscan-classfile</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-apache-fileupload</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.api.WebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension;
import cloud.piranha.extension.apache.fileupload.ApacheMultiPartExtension;
import cloud.piranha.extension.naming.NamingExtension;
import cloud.piranha.extension.policy.PolicyExtension;
Expand Down Expand Up @@ -60,10 +61,17 @@ public void extend(WebApplicationExtensionContext context) {
context.add(WaspJspManagerExtension.class); // addJspFile
context.add(NamingExtension.class); // Naming (JNDI)
context.add(WebXmlExtension.class); // web.xml
context.add(AnnotationScanExtension.class); // Annotation scanning
context.add(getAnnotationScanExtensionClass()); // Annotation scanning
context.add(ServletAnnotationsExtension.class); // Servlet annotations
context.add(WaspExtension.class); // WaSP
context.add(ServletContainerInitializerExtension.class); // ServletContainerInitializer
context.add(ServletSecurityExtension.class); // Security implementation
}

private static Class<? extends WebApplicationExtension> getAnnotationScanExtensionClass() {
if (System.getProperty(ClassfileAnnotationScanExtension.EXPERIMENTAL_PROPERTY) != null) {
return ClassfileAnnotationScanExtension.class; // Annotation scanning using the new Classfile API
}
return AnnotationScanExtension.class; // Annotation scanning
}
}
1 change: 1 addition & 0 deletions extension/servlet/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
opens cloud.piranha.extension.servlet;
requires cloud.piranha.core.api;
requires cloud.piranha.extension.annotationscan;
requires cloud.piranha.extension.annotationscan.classfile;
requires cloud.piranha.extension.apache.fileupload;
requires cloud.piranha.extension.naming;
requires cloud.piranha.extension.policy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import cloud.piranha.core.impl.DefaultWebApplication;
import cloud.piranha.core.impl.DefaultWebApplicationClassLoader;
import cloud.piranha.core.impl.DefaultWebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanInitializer;
import cloud.piranha.extension.annotationscan.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.extension.annotationscan.AnnotationScanInitializer;
import cloud.piranha.resource.impl.ClassResource;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.ServletRegistration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import cloud.piranha.embedded.EmbeddedRequestBuilder;
import cloud.piranha.embedded.EmbeddedResponse;
import cloud.piranha.embedded.EmbeddedResponseBuilder;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanInitializer;
import cloud.piranha.extension.annotationscan.classfile.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.extension.annotationscan.AnnotationScanInitializer;
import cloud.piranha.extension.annotationscan.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.extension.webxml.WebXmlInitializer;
import cloud.piranha.resource.impl.ClassResource;
import cloud.piranha.resource.impl.DirectoryResource;
Expand Down
6 changes: 6 additions & 0 deletions extension/webprofile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-annotationscan-classfile</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.extension</groupId>
<artifactId>piranha-extension-apache-fileupload</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.api.WebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.AnnotationScanExtension;
import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension;
import cloud.piranha.extension.apache.fileupload.ApacheMultiPartExtension;
import cloud.piranha.extension.datasource.DefaultDatasourceExtension;
import cloud.piranha.extension.eclipselink.EclipseLinkExtension;
Expand Down Expand Up @@ -64,7 +65,7 @@ public void extend(WebApplicationExtensionContext context) {
context.add(WaspJspManagerExtension.class); // addJspFile
context.add(NamingExtension.class); // Naming (JNDI)
context.add(WebXmlExtension.class); // web.xml
context.add(AnnotationScanExtension.class); // Annotation scanning
context.add(getAnnotationScanExtensionClass()); // Annotation scanning
context.add(ServletAnnotationsExtension.class); // Servlet annotations
context.add(WeldExtension.class);
context.add(DefaultDatasourceExtension.class); // Default data source
Expand All @@ -74,4 +75,12 @@ public void extend(WebApplicationExtensionContext context) {
context.add(EclipseLinkExtension.class); // Jakarta Persistence
context.add(ServletContainerInitializerExtension.class); // ServletContainerInitializer
}

private static Class<? extends WebApplicationExtension> getAnnotationScanExtensionClass() {
if (System.getProperty(ClassfileAnnotationScanExtension.EXPERIMENTAL_PROPERTY) != null) {
return ClassfileAnnotationScanExtension.class; // Annotation scanning using the new Classfile API
}
return AnnotationScanExtension.class; // Annotation scanning
}

}
1 change: 1 addition & 0 deletions extension/webprofile/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
opens cloud.piranha.extension.webprofile;
requires cloud.piranha.core.api;
requires cloud.piranha.extension.annotationscan;
requires cloud.piranha.extension.annotationscan.classfile;
requires cloud.piranha.extension.apache.fileupload;
requires cloud.piranha.extension.datasource;
requires cloud.piranha.extension.eclipselink;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import cloud.piranha.core.api.WebApplicationExtension;
import cloud.piranha.core.impl.DefaultWebApplication;
import cloud.piranha.core.impl.DefaultWebApplicationExtensionContext;
import cloud.piranha.extension.annotationscan.classfile.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.extension.annotationscan.internal.InternalAnnotationScanAnnotationManager;
import cloud.piranha.http.api.HttpServer;
import cloud.piranha.http.impl.DefaultHttpServer;
import cloud.piranha.http.webapp.HttpWebApplicationServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public DefaultResourceManagerClassLoader(ResourceManager resourceManager) {

/**
* Yet another Constructor.
*
* @param classLoader the class loader.
* @param resourceManager the resource manager.
*/
public DefaultResourceManagerClassLoader(ClassLoader classLoader, ResourceManager resourceManager) {
Expand Down

0 comments on commit d573b52

Please sign in to comment.