Fixed log

This commit is contained in:
Luca Frosini 2024-10-30 15:07:35 +01:00
parent 28ea920a05
commit aeba8ba06a
1 changed files with 3 additions and 4 deletions

View File

@ -14,7 +14,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException;
import org.gcube.informationsystem.resourceregistry.base.ElementManagementUtility; import org.gcube.informationsystem.resourceregistry.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.environments.Environment;
import org.gcube.informationsystem.resourceregistry.environments.Environment.PermissionMode; import org.gcube.informationsystem.resourceregistry.environments.Environment.PermissionMode;
import org.gcube.informationsystem.resourceregistry.environments.administration.AdminEnvironment; import org.gcube.informationsystem.resourceregistry.environments.administration.AdminEnvironment;
import org.gcube.informationsystem.resourceregistry.environments.instances.InstanceEnvironment; import org.gcube.informationsystem.resourceregistry.environments.instances.InstanceEnvironment;
@ -56,7 +55,7 @@ public class ContextUtility {
return SecretManagerProvider.instance.get().getContext(); return SecretManagerProvider.instance.get().getContext();
} }
public static Environment getCurrentRequestEnvironment() throws ResourceRegistryException { public static InstanceEnvironment getCurrentRequestEnvironment() throws ResourceRegistryException {
String fullName = getCurrentContextFullName(); String fullName = getCurrentContextFullName();
if(fullName == null) { if(fullName == null) {
throw new ContextException("Null Token and Scope. Please set your token first."); throw new ContextException("Null Token and Scope. Please set your token first.");
@ -83,7 +82,7 @@ public class ContextUtility {
try { try {
InstanceEnvironment securityContext = null; InstanceEnvironment securityContext = null;
logger.trace("Trying to get {} for {}", Environment.class.getSimpleName(), fullName); logger.trace("Trying to get {} for {}", InstanceEnvironment.class.getSimpleName(), fullName);
UUID uuid = ServerContextCache.getInstance().getUUIDByFullName(fullName); UUID uuid = ServerContextCache.getInstance().getUUIDByFullName(fullName);
if(uuid != null) { if(uuid != null) {
@ -91,7 +90,7 @@ public class ContextUtility {
} }
if(securityContext==null) { if(securityContext==null) {
logger.trace("{} for {} is not in cache. Going to get it", Environment.class.getSimpleName(), logger.trace("{} for {} is not in cache. Going to get it", InstanceEnvironment.class.getSimpleName(),
fullName); fullName);
oDatabaseDocument = AdminEnvironment.getInstance().getDatabaseDocument(PermissionMode.READER); oDatabaseDocument = AdminEnvironment.getInstance().getDatabaseDocument(PermissionMode.READER);