diff --git a/src/main/java/org/gcube/smartgears/handler/resourceregistry/EServiceHandler.java b/src/main/java/org/gcube/smartgears/handler/resourceregistry/EServiceHandler.java index 0425697..62396ae 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/EServiceHandler.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/EServiceHandler.java @@ -105,12 +105,12 @@ public class EServiceHandler extends ApplicationLifecycleHandler { Set startContextsUUID = new HashSet<>(); ContextCache contextCache = ContextCache.getInstance(); for (String token : startTokens) { - ContextUtility.setContextFromToken(token); String contextFullName = ContextUtility.getContextName(token); UUID contextUUID = contextCache.getUUIDByFullName(contextFullName); startContextsUUID.add(contextUUID); try { if (create) { + ContextUtility.setContextFromToken(token); eServiceManager = new EServiceManager(applicationContext); eServiceManager.createEService(); applicationContext.properties() @@ -147,8 +147,7 @@ public class EServiceHandler extends ApplicationLifecycleHandler { ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); String previousToken = SecurityTokenProvider.instance.get(); if (previousToken == null) { - ContextUtility - .setContextFromToken(applicationContext.configuration().startTokens().iterator().next()); + ContextUtility.setContextFromToken(applicationContext.configuration().startTokens().iterator().next()); } try { Thread.currentThread().setContextClassLoader(EServiceHandler.class.getClassLoader()); diff --git a/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java b/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java index 89add5d..2d5e868 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java @@ -105,12 +105,12 @@ public class HostingNodeHandler extends ContainerHandler { Set startContextsUUID = new HashSet<>(); ContextCache contextCache = ContextCache.getInstance(); for (String token : startTokens) { - ContextUtility.setContextFromToken(token); String contextFullName = ContextUtility.getContextName(token); UUID contextUUID = contextCache.getUUIDByFullName(contextFullName); startContextsUUID.add(contextUUID); try { if (create) { + ContextUtility.setContextFromToken(token); hostingNodeManager = new HostingNodeManager(containerContext); hostingNodeManager.createHostingNode(); containerContext.properties() diff --git a/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/EServiceManager.java b/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/EServiceManager.java index a89337c..e8de3bf 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/EServiceManager.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/EServiceManager.java @@ -47,7 +47,6 @@ import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activa import org.gcube.smartgears.configuration.application.ApplicationConfiguration; import org.gcube.smartgears.configuration.container.ContainerConfiguration; import org.gcube.smartgears.context.application.ApplicationContext; -import org.gcube.smartgears.handler.resourceregistry.Constants; import org.gcube.smartgears.handler.resourceregistry.ContextUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory;