diff --git a/pom.xml b/pom.xml index ee8fc74..63f6af3 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ io.gravitee.policy gravitee-policy-groovy - 2.6.2 + 3.0.0-archi-401-opentelemetry-SNAPSHOT Gravitee.io APIM - Policy - Groovy Run Groovy scripts at any stage of request or message processing diff --git a/src/main/java/io/gravitee/policy/groovy/model/BindableExecutionContext.java b/src/main/java/io/gravitee/policy/groovy/model/BindableExecutionContext.java index eeeebb9..e13d8eb 100644 --- a/src/main/java/io/gravitee/policy/groovy/model/BindableExecutionContext.java +++ b/src/main/java/io/gravitee/policy/groovy/model/BindableExecutionContext.java @@ -30,7 +30,7 @@ * @author GraviteeSource Team */ @Value -public class BindableExecutionContext implements GenericExecutionContext { +public class BindableExecutionContext { private static final String CONTEXT_DICTIONARIES_VARIABLE = "dictionaries"; @@ -44,17 +44,14 @@ public Map getDictionaries() { .lookupVariable(CONTEXT_DICTIONARIES_VARIABLE); } - @Override public GenericRequest request() { throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); } - @Override public GenericResponse response() { throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); } - @Override public Metrics metrics() { return executionContext.metrics(); } @@ -63,73 +60,31 @@ public Metrics getMetrics() { return executionContext.metrics(); } - @Override - public T getComponent(Class aClass) { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override public void setAttribute(String s, Object o) { executionContext.setAttribute(s, o); } - @Override public void putAttribute(String s, Object o) { executionContext.putAttribute(s, o); } - @Override public void removeAttribute(String s) { executionContext.removeAttribute(s); } - @Override public T getAttribute(String s) { return executionContext.getAttribute(s); } - @Override public List getAttributeAsList(String s) { return executionContext.getAttributeAsList(s); } - @Override public Set getAttributeNames() { return executionContext.getAttributeNames(); } - @Override public Map getAttributes() { return executionContext.getAttributes(); } - - @Override - public void setInternalAttribute(String s, Object o) { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override - public void putInternalAttribute(String s, Object o) { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override - public void removeInternalAttribute(String s) { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override - public T getInternalAttribute(String s) { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override - public Map getInternalAttributes() { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } - - @Override - public TemplateEngine getTemplateEngine() { - throw new UnsupportedOperationException("Groovy scripts do not support accessing this method"); - } } diff --git a/src/main/java/io/gravitee/policy/groovy/utils/AttributesBasedExecutionContext.java b/src/main/java/io/gravitee/policy/groovy/utils/AttributesBasedExecutionContext.java index 2a2b9af..faf0b11 100644 --- a/src/main/java/io/gravitee/policy/groovy/utils/AttributesBasedExecutionContext.java +++ b/src/main/java/io/gravitee/policy/groovy/utils/AttributesBasedExecutionContext.java @@ -27,7 +27,7 @@ * @author David BRASSELY (david.brassely at graviteesource.com) * @author GraviteeSource Team */ -public class AttributesBasedExecutionContext implements ExecutionContext { +public class AttributesBasedExecutionContext { private static final String CONTEXT_DICTIONARIES_VARIABLE = "dictionaries"; private final ExecutionContext context; @@ -42,53 +42,35 @@ public Map> getDictionaries() { .lookupVariable(CONTEXT_DICTIONARIES_VARIABLE); } - @Override public Request request() { return context.request(); } - @Override public Response response() { return context.response(); } - @Override - public T getComponent(Class aClass) { - return context.getComponent(aClass); - } - - @Override public void setAttribute(String s, Object o) { context.setAttribute(s, o); } - @Override public void removeAttribute(String s) { context.removeAttribute(s); } - @Override public Object getAttribute(String s) { return context.getAttribute(s); } - @Override public Enumeration getAttributeNames() { return context.getAttributeNames(); } - @Override public Map getAttributes() { return context.getAttributes(); } - @Override public TemplateEngine getTemplateEngine() { return context.getTemplateEngine(); } - - @Override - public Tracer getTracer() { - return context.getTracer(); - } }