removed old providers

This commit is contained in:
Lucio Lelii 2022-05-30 18:55:35 +02:00
parent 64bef37271
commit 4b619414a7
2 changed files with 4 additions and 27 deletions

View File

@ -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<P extends Resource> 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<String>(contexts));
@ -56,8 +50,6 @@ public abstract class AbstractProfilePublisher<P extends Resource> 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<P extends Resource> 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<P extends Resource> 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<String>(contexts));
if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
profile = publisher.create(profile, new ArrayList<String>(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<P extends Resource> 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<P extends Resource> implements Pr
} catch (Exception e) {
rethrowUnchecked(e);
} finally{
SecurityTokenProvider.instance.set(previousToken);
ScopeProvider.instance.set(previousScope);
if (isRoot())
Thread.currentThread().setContextClassLoader(contextCL);
}

View File

@ -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<String> threadMethod =