removed old providers
This commit is contained in:
parent
64bef37271
commit
4b619414a7
|
@ -7,9 +7,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.resources.gcore.Resource;
|
import org.gcube.common.resources.gcore.Resource;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.gcube.informationsystem.publisher.ScopedPublisher;
|
import org.gcube.informationsystem.publisher.ScopedPublisher;
|
||||||
import org.gcube.smartgears.provider.ProviderFactory;
|
import org.gcube.smartgears.provider.ProviderFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -44,11 +42,7 @@ public abstract class AbstractProfilePublisher<P extends Resource> implements Pr
|
||||||
|
|
||||||
log.debug("using context {}",contextCL.getClass().getSimpleName());
|
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
|
try{//This classloader set is needed for the jaxb context
|
||||||
if (previousToken!=null)
|
|
||||||
SecurityTokenProvider.instance.reset();
|
|
||||||
if (isRoot())
|
if (isRoot())
|
||||||
Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
||||||
profile = publisher.remove(profile, new ArrayList<String>(contexts));
|
profile = publisher.remove(profile, new ArrayList<String>(contexts));
|
||||||
|
@ -56,8 +50,6 @@ public abstract class AbstractProfilePublisher<P extends Resource> implements Pr
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
rethrowUnchecked(e);
|
rethrowUnchecked(e);
|
||||||
} finally{
|
} finally{
|
||||||
SecurityTokenProvider.instance.set(previousToken);
|
|
||||||
ScopeProvider.instance.set(previousScope);
|
|
||||||
if (isRoot())
|
if (isRoot())
|
||||||
Thread.currentThread().setContextClassLoader(contextCL);
|
Thread.currentThread().setContextClassLoader(contextCL);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +61,7 @@ public abstract class AbstractProfilePublisher<P extends Resource> implements Pr
|
||||||
public void addToAll(){
|
public void addToAll(){
|
||||||
this.addTo(getAllowedContexts());
|
this.addTo(getAllowedContexts());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds for the first time the current resource profile of the application in one or more scopes.
|
* Adds for the first time the current resource profile of the application in one or more scopes.
|
||||||
* @param contexts the contexts
|
* @param contexts the contexts
|
||||||
|
@ -83,20 +75,12 @@ public abstract class AbstractProfilePublisher<P extends Resource> implements Pr
|
||||||
|
|
||||||
log.debug("using context {}",contextCL.getClass().getSimpleName());
|
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
|
try{//This classloader set is needed for the jaxb context
|
||||||
if (previousToken!=null)
|
if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
||||||
SecurityTokenProvider.instance.reset();;
|
profile = publisher.create(profile, new ArrayList<String>(contexts));
|
||||||
if (isRoot()) Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
|
||||||
ScopeProvider.instance.set(contexts.stream().findFirst().get());
|
|
||||||
profile = publisher.create(profile, new ArrayList<String>(contexts));
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
rethrowUnchecked(e);
|
rethrowUnchecked(e);
|
||||||
} finally{
|
} finally{
|
||||||
SecurityTokenProvider.instance.set(previousToken);
|
|
||||||
ScopeProvider.instance.set(previousScope);
|
|
||||||
if (isRoot()) Thread.currentThread().setContextClassLoader(contextCL);
|
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());
|
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
|
try{//This classloader set is needed for the jaxb context
|
||||||
if (previousToken!=null)
|
|
||||||
SecurityTokenProvider.instance.reset();
|
|
||||||
|
|
||||||
if (isRoot())
|
if (isRoot())
|
||||||
Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
Thread.currentThread().setContextClassLoader(AbstractProfilePublisher.class.getClassLoader());
|
||||||
|
@ -125,8 +105,6 @@ public abstract class AbstractProfilePublisher<P extends Resource> implements Pr
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
rethrowUnchecked(e);
|
rethrowUnchecked(e);
|
||||||
} finally{
|
} finally{
|
||||||
SecurityTokenProvider.instance.set(previousToken);
|
|
||||||
ScopeProvider.instance.set(previousScope);
|
|
||||||
if (isRoot())
|
if (isRoot())
|
||||||
Thread.currentThread().setContextClassLoader(contextCL);
|
Thread.currentThread().setContextClassLoader(contextCL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.gcube.smartgears.utils;
|
package org.gcube.smartgears.utils;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -8,7 +7,7 @@ public class InnerMethodName {
|
||||||
|
|
||||||
public static InnerMethodName instance = new 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
|
// Thread local variable containing each thread's ID
|
||||||
private static final InheritableThreadLocal<String> threadMethod =
|
private static final InheritableThreadLocal<String> threadMethod =
|
||||||
|
|
Loading…
Reference in New Issue