From 4b619414a70d42305798fbab6d9367c7047f2ce0 Mon Sep 17 00:00:00 2001 From: lucio Date: Mon, 30 May 2022 18:55:35 +0200 Subject: [PATCH] removed old providers --- .../handlers/AbstractProfilePublisher.java | 28 ++----------------- .../smartgears/utils/InnerMethodName.java | 3 +- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/gcube/smartgears/handlers/AbstractProfilePublisher.java b/src/main/java/org/gcube/smartgears/handlers/AbstractProfilePublisher.java index eaa3752..9bf4931 100644 --- a/src/main/java/org/gcube/smartgears/handlers/AbstractProfilePublisher.java +++ b/src/main/java/org/gcube/smartgears/handlers/AbstractProfilePublisher.java @@ -7,9 +7,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Set; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.resources.gcore.Resource; -import org.gcube.common.scope.api.ScopeProvider; import org.gcube.informationsystem.publisher.ScopedPublisher; import org.gcube.smartgears.provider.ProviderFactory; import org.slf4j.Logger; @@ -44,11 +42,7 @@ public abstract class AbstractProfilePublisher

implements Pr log.debug("using context {}",contextCL.getClass().getSimpleName()); - String previousToken = SecurityTokenProvider.instance.get(); - String previousScope = ScopeProvider.instance.get(); try{//This classloader set is needed for the jaxb context - if (previousToken!=null) - SecurityTokenProvider.instance.reset(); if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader()); profile = publisher.remove(profile, new ArrayList(contexts)); @@ -56,8 +50,6 @@ public abstract class AbstractProfilePublisher

implements Pr } catch (Exception e) { rethrowUnchecked(e); } finally{ - SecurityTokenProvider.instance.set(previousToken); - ScopeProvider.instance.set(previousScope); if (isRoot()) Thread.currentThread().setContextClassLoader(contextCL); } @@ -69,7 +61,7 @@ public abstract class AbstractProfilePublisher

implements Pr public void addToAll(){ this.addTo(getAllowedContexts()); } - + /** * Adds for the first time the current resource profile of the application in one or more scopes. * @param contexts the contexts @@ -83,20 +75,12 @@ public abstract class AbstractProfilePublisher

implements Pr log.debug("using context {}",contextCL.getClass().getSimpleName()); - String previousToken = SecurityTokenProvider.instance.get(); - String previousScope = ScopeProvider.instance.get(); try{//This classloader set is needed for the jaxb context - if (previousToken!=null) - SecurityTokenProvider.instance.reset();; - if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader()); - ScopeProvider.instance.set(contexts.stream().findFirst().get()); - profile = publisher.create(profile, new ArrayList(contexts)); - + if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader()); + profile = publisher.create(profile, new ArrayList(contexts)); } catch (Exception e) { rethrowUnchecked(e); } finally{ - SecurityTokenProvider.instance.set(previousToken); - ScopeProvider.instance.set(previousScope); if (isRoot()) Thread.currentThread().setContextClassLoader(contextCL); } @@ -112,11 +96,7 @@ public abstract class AbstractProfilePublisher

implements Pr log.debug("using context {}",contextCL.getClass().getSimpleName()); - String previousToken = SecurityTokenProvider.instance.get(); - String previousScope = ScopeProvider.instance.get(); try{//This classloader set is needed for the jaxb context - if (previousToken!=null) - SecurityTokenProvider.instance.reset(); if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader()); @@ -125,8 +105,6 @@ public abstract class AbstractProfilePublisher

implements Pr } catch (Exception e) { rethrowUnchecked(e); } finally{ - SecurityTokenProvider.instance.set(previousToken); - ScopeProvider.instance.set(previousScope); if (isRoot()) Thread.currentThread().setContextClassLoader(contextCL); } diff --git a/src/main/java/org/gcube/smartgears/utils/InnerMethodName.java b/src/main/java/org/gcube/smartgears/utils/InnerMethodName.java index 9c81c21..692975d 100644 --- a/src/main/java/org/gcube/smartgears/utils/InnerMethodName.java +++ b/src/main/java/org/gcube/smartgears/utils/InnerMethodName.java @@ -1,6 +1,5 @@ package org.gcube.smartgears.utils; -import org.gcube.common.authorization.library.provider.CalledMethodProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -8,7 +7,7 @@ public class InnerMethodName { public static InnerMethodName instance = new InnerMethodName(); - private static Logger logger = LoggerFactory.getLogger(CalledMethodProvider.class); + private static Logger logger = LoggerFactory.getLogger(InnerMethodName.class); // Thread local variable containing each thread's ID private static final InheritableThreadLocal threadMethod =