diff --git a/.classpath b/.classpath
index 534b5e5..e43402f 100644
--- a/.classpath
+++ b/.classpath
@@ -22,7 +22,7 @@
-
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index daa8f83..6d5894a 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,6 +1,95 @@
-#Tue Sep 17 11:10:21 CEST 2013
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/distro/README b/distro/README
index 8ba3d75..b1b1dfa 100644
--- a/distro/README
+++ b/distro/README
@@ -1,8 +1,9 @@
The gCube System - ${name}
----------------------
-This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
-D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
+This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2),
+D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
+and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1).
Authors
-------
diff --git a/distro/changelog.xml b/distro/changelog.xml
index a4d71f9..c8f3003 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -2,4 +2,7 @@
First Release
+
+ added Method interceptor
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 51b35be..acc2d92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
org.gcube.core
common-jaxws-calls
- 1.0.0-SNAPSHOT
+ 1.0.1-SNAPSHOT
distro
@@ -33,7 +33,7 @@
org.gcube.core
common-gcube-calls
- 1.0.0-SNAPSHOT
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
org.slf4j
diff --git a/src/main/java/org/gcube/common/calls/jaxws/StubFactory.java b/src/main/java/org/gcube/common/calls/jaxws/StubFactory.java
index ec986ae..f0e7396 100644
--- a/src/main/java/org/gcube/common/calls/jaxws/StubFactory.java
+++ b/src/main/java/org/gcube/common/calls/jaxws/StubFactory.java
@@ -9,6 +9,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.handler.Handler;
import org.gcube.common.calls.jaxws.handlers.JaxWSHandler;
+import org.gcube.common.calls.jaxws.proxies.GenericProxyFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,13 +42,13 @@ public class StubFactory implements StubFactoryDSL.AtClause{
// get JAXWS stub
T stub = service.getPort(target.type());
-
+
BindingProvider provider = (BindingProvider) stub;
// configure stub for gCube calls
registerHandler(provider, target);
- return stub;
+ return GenericProxyFactory.getProxy(target.type(), endpointAddress, stub);
}catch (Exception e) {
log.error("error building service",e);
diff --git a/src/main/java/org/gcube/common/calls/jaxws/handlers/JaxWSHandler.java b/src/main/java/org/gcube/common/calls/jaxws/handlers/JaxWSHandler.java
index 0bc1d50..b9901f8 100644
--- a/src/main/java/org/gcube/common/calls/jaxws/handlers/JaxWSHandler.java
+++ b/src/main/java/org/gcube/common/calls/jaxws/handlers/JaxWSHandler.java
@@ -43,7 +43,7 @@ public class JaxWSHandler implements SOAPHandler{
logger.trace("handling message");
if (outbound){
- Request requestContext = Interceptors.executeRequestChain(context.call());
+ Request requestContext = Interceptors.executeRequestChain(null);
@SuppressWarnings("unchecked")
Map> headers = (Map>) messageContext.get(MessageContext.HTTP_REQUEST_HEADERS);
diff --git a/src/main/java/org/gcube/common/calls/jaxws/proxies/GenericProxyFactory.java b/src/main/java/org/gcube/common/calls/jaxws/proxies/GenericProxyFactory.java
new file mode 100644
index 0000000..c26a942
--- /dev/null
+++ b/src/main/java/org/gcube/common/calls/jaxws/proxies/GenericProxyFactory.java
@@ -0,0 +1,21 @@
+package org.gcube.common.calls.jaxws.proxies;
+
+import java.lang.reflect.Proxy;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GenericProxyFactory {
+
+public static Logger log = LoggerFactory.getLogger(MethodRetriever.class);
+
+ @SuppressWarnings("unchecked")
+ public static T getProxy(Class intf, String endpointAddress,
+ final I obj) {
+ T proxy = (T) Proxy.newProxyInstance(obj.getClass().getClassLoader(),
+ new Class[] { intf },
+ new MethodRetriever(obj));
+ log.debug("for interface "+intf.getCanonicalName()+" the proxy class is "+proxy.getClass().getCanonicalName());
+ return proxy;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/common/calls/jaxws/proxies/MethodRetriever.java b/src/main/java/org/gcube/common/calls/jaxws/proxies/MethodRetriever.java
new file mode 100644
index 0000000..c8afcd3
--- /dev/null
+++ b/src/main/java/org/gcube/common/calls/jaxws/proxies/MethodRetriever.java
@@ -0,0 +1,37 @@
+package org.gcube.common.calls.jaxws.proxies;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.gcube.common.authorization.library.provider.CalledMethodProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MethodRetriever implements InvocationHandler{
+
+ public static Logger log = LoggerFactory.getLogger(MethodRetriever.class);
+
+ private T service;
+
+ public MethodRetriever(T service){
+ this.service= service;
+ }
+
+ public Object invoke(Object proxy, Method method,
+ Object[] args) throws Throwable{
+ CalledMethodProvider.instance.set(method.getName());
+ try{
+ return method.invoke(service, args);
+ }catch(IllegalAccessException | IllegalArgumentException proxyEx){
+ log.error("error invoking method "+method.getName()+" in service "+service.getClass().getCanonicalName()+" using proxy ",proxyEx);
+ throw new RuntimeException(proxyEx);
+ }catch(InvocationTargetException ite){
+ log.error("error invoking method "+method.getName()+" in service "+service.getClass().getCanonicalName()+" using proxy ",ite);
+ throw ite.getCause();
+ }finally{
+ CalledMethodProvider.instance.reset();
+ }
+ }
+
+}