Skip to content

Commit 27940cf

Browse files
committed
refactor: Rename the jaxrs.WasmPlugin* classes to jars.ProxyWasm* as WasmPlugin was a bit too generic.
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
1 parent f9cfd35 commit 27940cf

File tree

8 files changed

+64
-48
lines changed

8 files changed

+64
-48
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "maven" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: daily

proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPlugin.java renamed to proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/ProxyWasm.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
*
1313
* <p>Apply this annotation to JAX-RS resource classes or methods to enable filtering
1414
* by the Proxy-Wasm plugins identified by the names specified in the {@link #value()} attribute.
15-
* The {@link WasmPluginFeature} must be registered for this annotation to have effect.
15+
* The {@link ProxyWasmFeature} must be registered for this annotation to have effect.
1616
*
17-
* @see WasmPluginFeature
18-
* @see WasmPluginFilter
17+
* @see ProxyWasmFeature
18+
* @see ProxyWasmFilter
1919
*/
2020
@NameBinding
2121
@Retention(RetentionPolicy.RUNTIME)
2222
@Target({ElementType.TYPE, ElementType.METHOD})
23-
public @interface WasmPlugin {
23+
public @interface ProxyWasm {
2424
/**
2525
* Specifies the names of the Proxy-Wasm plugins that should filter the annotated
2626
* resource class or method.

proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFeature.java renamed to proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/ProxyWasmFeature.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
import io.roastedroot.proxywasm.PluginFactory;
44
import io.roastedroot.proxywasm.StartException;
55
import io.roastedroot.proxywasm.internal.ServerAdaptor;
6-
import io.roastedroot.proxywasm.jaxrs.internal.AbstractWasmPluginFeature;
6+
import io.roastedroot.proxywasm.jaxrs.internal.AbstractProxyWasmFeature;
77
import java.util.Arrays;
88
import java.util.List;
99

1010
/**
1111
* A JAX-RS {@link jakarta.ws.rs.core.Feature} that enables Proxy-Wasm plugin filtering
12-
* for JAX-RS applications. This feature registers the necessary {@link WasmPluginFilter}
13-
* to intercept requests and responses for resources annotated with {@link WasmPlugin}.
12+
* for JAX-RS applications. This feature registers the necessary {@link ProxyWasmFilter}
13+
* to intercept requests and responses for resources annotated with {@link ProxyWasm}.
1414
*
1515
* <p>To use this feature, register an instance of it with your JAX-RS application, providing
1616
* the required {@link ServerAdaptor} and a list of {@link PluginFactory} instances.
1717
*
1818
* <p>If you are using a CDI container like quarkus, you will be using the
19-
* {@link io.roastedroot.proxywasm.jaxrs.cdi.WasmPluginFeature} instead.
19+
* {@link io.roastedroot.proxywasm.jaxrs.cdi.ProxyWasmFeature} instead.
2020
*
2121
* <pre>
2222
* public class MyApplication extends jakarta.ws.rs.core.Application {
@@ -34,24 +34,24 @@
3434
* // Assuming a ServerAdaptor and PluginFactory are available
3535
* ServerAdaptor serverAdaptor = ...;
3636
* PluginFactory myPluginFactory = ...;
37-
* singletons.add(new WasmPluginFeature(serverAdaptor, myPluginFactory));
37+
* singletons.add(new ProxyWasmFeature(serverAdaptor, myPluginFactory));
3838
* } catch (StartException e) {
39-
* throw new RuntimeException("Failed to initialize WasmPluginFeature", e);
39+
* throw new RuntimeException("Failed to initialize ProxyWasmFeature", e);
4040
* }
4141
* return singletons;
4242
* }
4343
* }
4444
* </pre>
4545
*
46-
* @see WasmPlugin
47-
* @see WasmPluginFilter
46+
* @see ProxyWasm
47+
* @see ProxyWasmFilter
4848
* @see PluginFactory
4949
* @see ServerAdaptor
5050
*/
51-
public class WasmPluginFeature extends AbstractWasmPluginFeature {
51+
public class ProxyWasmFeature extends AbstractProxyWasmFeature {
5252

5353
/**
54-
* Constructs a new WasmPluginFeature.
54+
* Constructs a new ProxyWasmFeature.
5555
*
5656
* @param httpServer The {@link ServerAdaptor} used to adapt JAX-RS specific request/response
5757
* objects for the Proxy-Wasm host.
@@ -60,13 +60,13 @@ public class WasmPluginFeature extends AbstractWasmPluginFeature {
6060
* @throws StartException If an error occurs during the initialization or startup of the
6161
* underlying Proxy-Wasm plugins.
6262
*/
63-
public WasmPluginFeature(ServerAdaptor httpServer, PluginFactory... factories)
63+
public ProxyWasmFeature(ServerAdaptor httpServer, PluginFactory... factories)
6464
throws StartException {
6565
this(httpServer, Arrays.asList(factories));
6666
}
6767

6868
/**
69-
* Constructs a new WasmPluginFeature with a list of factories.
69+
* Constructs a new ProxyWasmFeature with a list of factories.
7070
*
7171
* @param httpServer The {@link ServerAdaptor} used to adapt JAX-RS specific request/response
7272
* objects for the Proxy-Wasm host.
@@ -75,7 +75,7 @@ public WasmPluginFeature(ServerAdaptor httpServer, PluginFactory... factories)
7575
* @throws StartException If an error occurs during the initialization or startup of the
7676
* underlying Proxy-Wasm plugins.
7777
*/
78-
public WasmPluginFeature(ServerAdaptor httpServer, List<PluginFactory> factories)
78+
public ProxyWasmFeature(ServerAdaptor httpServer, List<PluginFactory> factories)
7979
throws StartException {
8080
init(factories, httpServer);
8181
}

proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/WasmPluginFilter.java renamed to proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/ProxyWasmFilter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,31 @@
2929
* and {@link WriterInterceptor} interfaces to intercept HTTP requests and responses,
3030
* allowing Proxy-Wasm plugins to process them.
3131
*
32-
* <p>This filter is registered by the {@link WasmPluginFeature}. It interacts with
32+
* <p>This filter is registered by the {@link ProxyWasmFeature}. It interacts with
3333
* {@link Plugin} instances obtained from configured {@link Pool}s to execute the
3434
* appropriate Proxy-Wasm ABI functions (e.g., {@code on_http_request_headers},
3535
* {@code on_http_response_body}) at different stages of the JAX-RS request/response lifecycle.
3636
*
37-
* @see WasmPluginFeature
38-
* @see WasmPlugin
37+
* @see ProxyWasmFeature
38+
* @see ProxyWasm
3939
* @see Plugin
4040
*/
41-
public class WasmPluginFilter
41+
public class ProxyWasmFilter
4242
implements ContainerRequestFilter, WriterInterceptor, ContainerResponseFilter {
4343

4444
private static final String FILTER_CONTEXT = PluginHttpContext.class.getName() + ".context";
4545

46-
private static final Logger LOGGER = Logger.getLogger(WasmPluginFilter.class.getName());
46+
private static final Logger LOGGER = Logger.getLogger(ProxyWasmFilter.class.getName());
4747

4848
private final List<Pool> pluginPools;
4949

5050
/**
51-
* Constructs a WasmPluginFilter.
51+
* Constructs a ProxyWasmFilter.
5252
*
5353
* @param pluginPools A list of {@link Pool} instances, each managing a pool of {@link Plugin}
5454
* instances for a specific Wasm module.
5555
*/
56-
public WasmPluginFilter(List<Pool> pluginPools) {
56+
public ProxyWasmFilter(List<Pool> pluginPools) {
5757
this.pluginPools = List.copyOf(pluginPools);
5858
}
5959

proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/cdi/WasmPluginFeature.java renamed to proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/cdi/ProxyWasmFeature.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import io.roastedroot.proxywasm.PluginFactory;
44
import io.roastedroot.proxywasm.StartException;
55
import io.roastedroot.proxywasm.internal.ServerAdaptor;
6-
import io.roastedroot.proxywasm.jaxrs.internal.AbstractWasmPluginFeature;
6+
import io.roastedroot.proxywasm.jaxrs.ProxyWasmFilter;
7+
import io.roastedroot.proxywasm.jaxrs.internal.AbstractProxyWasmFeature;
78
import jakarta.annotation.PostConstruct;
89
import jakarta.annotation.PreDestroy;
910
import jakarta.enterprise.context.ApplicationScoped;
@@ -26,11 +27,11 @@
2627
* will then automatically register the necessary filters.
2728
*
2829
* <p>Note: This class is intended for use in CDI environments. If you are not using CDI, you can
29-
* use the {@link io.roastedroot.proxywasm.jaxrs.WasmPluginFeature} class directly to register the
30+
* use the {@link io.roastedroot.proxywasm.jaxrs.ProxyWasmFeature} class directly to register the
3031
* feature with your JAX-RS application.
3132
*
32-
* @see io.roastedroot.proxywasm.jaxrs.WasmPluginFeature
33-
* @see io.roastedroot.proxywasm.jaxrs.WasmPluginFilter
33+
* @see io.roastedroot.proxywasm.jaxrs.ProxyWasmFeature
34+
* @see ProxyWasmFilter
3435
* @see PluginFactory
3536
* @see ServerAdaptor
3637
* @see Provider
@@ -40,19 +41,19 @@
4041
*/
4142
@Provider
4243
@ApplicationScoped
43-
public class WasmPluginFeature extends AbstractWasmPluginFeature {
44+
public class ProxyWasmFeature extends AbstractProxyWasmFeature {
4445

4546
@Inject Instance<PluginFactory> factories;
4647

4748
@Inject @Any ServerAdaptor serverAdaptor;
4849

4950
/**
50-
* Creates a new instance of the WasmPluginFeature.
51+
* Creates a new instance of the ProxyWasmFeature.
5152
*/
52-
public WasmPluginFeature() {}
53+
public ProxyWasmFeature() {}
5354

5455
/**
55-
* Initializes the WasmPluginFeature using injected CDI dependencies.
56+
* Initializes the ProxyWasmFeature using injected CDI dependencies.
5657
* This method is automatically called by the CDI container after dependency injection
5758
* is complete.
5859
*

proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/internal/AbstractWasmPluginFeature.java renamed to proxy-wasm-jaxrs/src/main/java/io/roastedroot/proxywasm/jaxrs/internal/AbstractProxyWasmFeature.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import io.roastedroot.proxywasm.internal.Plugin;
66
import io.roastedroot.proxywasm.internal.Pool;
77
import io.roastedroot.proxywasm.internal.ServerAdaptor;
8-
import io.roastedroot.proxywasm.jaxrs.WasmPlugin;
9-
import io.roastedroot.proxywasm.jaxrs.WasmPluginFilter;
8+
import io.roastedroot.proxywasm.jaxrs.ProxyWasm;
9+
import io.roastedroot.proxywasm.jaxrs.ProxyWasmFilter;
1010
import jakarta.ws.rs.container.DynamicFeature;
1111
import jakarta.ws.rs.container.ResourceInfo;
1212
import jakarta.ws.rs.core.FeatureContext;
@@ -15,7 +15,7 @@
1515
import java.util.HashMap;
1616
import java.util.stream.Collectors;
1717

18-
public abstract class AbstractWasmPluginFeature implements DynamicFeature {
18+
public abstract class AbstractProxyWasmFeature implements DynamicFeature {
1919

2020
private final HashMap<String, Pool> pluginPools = new HashMap<>();
2121

@@ -68,11 +68,11 @@ public void configure(ResourceInfo resourceInfo, FeatureContext context) {
6868

6969
var resourceMethod = resourceInfo.getResourceMethod();
7070
if (resourceMethod != null) {
71-
WasmPlugin pluignNameAnnotation = resourceMethod.getAnnotation(WasmPlugin.class);
71+
ProxyWasm pluignNameAnnotation = resourceMethod.getAnnotation(ProxyWasm.class);
7272
if (pluignNameAnnotation == null) {
7373
// If no annotation on method, check the class level
7474
pluignNameAnnotation =
75-
resourceInfo.getResourceClass().getAnnotation(WasmPlugin.class);
75+
resourceInfo.getResourceClass().getAnnotation(ProxyWasm.class);
7676
}
7777
if (pluignNameAnnotation != null) {
7878
var pools =
@@ -95,7 +95,7 @@ public void configure(ResourceInfo resourceInfo, FeatureContext context) {
9595
}
9696
})
9797
.collect(Collectors.toList());
98-
context.register(new WasmPluginFilter(pools));
98+
context.register(new ProxyWasmFilter(pools));
9999
}
100100
}
101101
}

proxy-wasm-jaxrs/src/test/java/io/roastedroot/proxywasm/jaxrs/example/Resources.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.roastedroot.proxywasm.jaxrs.example;
22

3-
import io.roastedroot.proxywasm.jaxrs.WasmPlugin;
3+
import io.roastedroot.proxywasm.jaxrs.ProxyWasm;
44
import jakarta.ws.rs.GET;
55
import jakarta.ws.rs.HeaderParam;
66
import jakarta.ws.rs.POST;
@@ -37,42 +37,42 @@ public Response ok() {
3737

3838
@Path("/headerTests")
3939
@GET
40-
@WasmPlugin("headerTests")
40+
@ProxyWasm("headerTests")
4141
public String httpHeaders(@HeaderParam("x-request-counter") String counter) {
4242
return String.format("counter: %s", counter);
4343
}
4444

4545
@Path("/headerTestsNotShared")
4646
@GET
47-
@WasmPlugin("headerTestsNotShared")
47+
@ProxyWasm("headerTestsNotShared")
4848
public String notSharedHttpHeaders(@HeaderParam("x-request-counter") String counter) {
4949
return String.format("counter: %s", counter);
5050
}
5151

5252
@Path("/tickTests/{sub: .+ }")
5353
@GET
54-
@WasmPlugin("tickTests")
54+
@ProxyWasm("tickTests")
5555
public String tickTests(@PathParam("sub") String sub) {
5656
return "hello world";
5757
}
5858

5959
@Path("/ffiTests/reverse")
6060
@POST
61-
@WasmPlugin("ffiTests")
61+
@ProxyWasm("ffiTests")
6262
public String ffiTests(String body) {
6363
return body;
6464
}
6565

6666
@Path("/httpCallTests")
6767
@GET
68-
@WasmPlugin("httpCallTests")
68+
@ProxyWasm("httpCallTests")
6969
public String httpCallTests() {
7070
return "hello world";
7171
}
7272

7373
@Path("/httpCallTestsAndFFI")
7474
@GET
75-
@WasmPlugin({"ffiTests", "httpCallTests"})
75+
@ProxyWasm({"ffiTests", "httpCallTests"})
7676
public String httpCallTestsAndFFI() {
7777
return "hello world";
7878
}

proxy-wasm-jaxrs/src/test/java/io/roastedroot/proxywasm/jaxrs/example/tests/BaseTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.roastedroot.proxywasm.jaxrs.example.tests;
22

33
import io.restassured.specification.RequestSpecification;
4-
import io.roastedroot.proxywasm.jaxrs.WasmPluginFeature;
4+
import io.roastedroot.proxywasm.jaxrs.ProxyWasmFeature;
55
import io.roastedroot.proxywasm.jaxrs.example.App;
66
import io.roastedroot.proxywasm.jaxrs.example.Resources;
77
import io.roastedroot.proxywasm.jaxrs.internal.BlockingServerAdaptor;
@@ -30,9 +30,9 @@ public void setUp() throws Exception {
3030
ResourceConfig resourceConfig = new ResourceConfig();
3131
resourceConfig.register(Resources.class);
3232

33-
// Create mock Instance<PluginFactory> for WasmPluginFeature
33+
// Create mock Instance<PluginFactory> for ProxyWasmFeature
3434
resourceConfig.register(
35-
new WasmPluginFeature(
35+
new ProxyWasmFeature(
3636
new BlockingServerAdaptor(),
3737
App.headerTests(),
3838
App.headerTestsNotShared(),

0 commit comments

Comments
 (0)