From fd657808d43d57d91090df84852d5500f70b6551 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 16 Jun 2022 13:50:23 +0200 Subject: [PATCH 1/4] Removed uneeded property --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1086eec..eeeaf02 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,6 @@ UTF-8 ${project.basedir}/distro - Common From 5c752762286b88cf11495ebac2b61153b7a0ae58 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 29 Jun 2022 10:41:42 +0200 Subject: [PATCH 2/4] Fixed imports --- .../smartgears/handler/resourceregistry/HostingNodeHandler.java | 2 -- 1 file changed, 2 deletions(-) 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 84e4fe5..2061971 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/HostingNodeHandler.java @@ -27,7 +27,6 @@ import org.gcube.common.events.Observes; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; -import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.resourcemanagement.model.reference.entities.facets.StateFacet; import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode; @@ -37,7 +36,6 @@ import org.gcube.smartgears.handler.resourceregistry.resourcemanager.HostingNode import org.gcube.smartgears.handlers.container.ContainerHandler; import org.gcube.smartgears.handlers.container.ContainerLifecycleEvent.Start; import org.gcube.smartgears.lifecycle.container.ContainerLifecycle; -import org.gcube.smartgears.lifecycle.container.ContainerState; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From 717a57b365bfeb8fc915214f7b645144f38051ef Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 29 Jun 2022 15:40:04 +0200 Subject: [PATCH 3/4] Fixed logs --- .../smartgears/handler/resourceregistry/ContextUtility.java | 5 +++++ .../resourceregistry/resourcemanager/EServiceManager.java | 6 +++--- .../resourcemanager/HostingNodeManager.java | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/smartgears/handler/resourceregistry/ContextUtility.java b/src/main/java/org/gcube/smartgears/handler/resourceregistry/ContextUtility.java index 500ea0d..2159c45 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/ContextUtility.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/ContextUtility.java @@ -84,4 +84,9 @@ public class ContextUtility { return contextsUUID; } + public static String getContextNameFromUUID(UUID contextUUID) throws ResourceRegistryException { + ContextCache contextCache = ContextCache.getInstance(); + return contextCache.getContextFullNameByUUID(contextUUID); + } + } 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 0e45143..66336d4 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 @@ -147,9 +147,9 @@ public class EServiceManager { UUID uuid = UUID.fromString(applicationContext.container().id()); try { resourceRegistryPublisher.addToContext(HostingNode.NAME, uuid, contextUUID, false); - logger.info("{} with UUID {} successfully added to context ({})", HostingNode.NAME, uuid, ContextUtility.getCurrentContextName()); + logger.info("{} with UUID {} successfully added to context ({})", HostingNode.NAME, uuid, ContextUtility.getContextNameFromUUID(contextUUID)); } catch (Exception e) { - logger.error("Unable to add {} with UUID {} to context ({})", HostingNode.NAME, uuid, ContextUtility.getCurrentContextName(), e); + logger.error("Unable to add {} with UUID {} to context ({})", HostingNode.NAME, uuid, ContextUtility.getContextNameFromUUID(contextUUID), e); } } @@ -167,7 +167,7 @@ public class EServiceManager { public void removeFromContext(UUID contextUUID) throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { - String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID); + String contextFullName = ContextUtility.getContextNameFromUUID(contextUUID); UUID uuid = UUID.fromString(applicationContext.container().id()); try { resourceRegistryPublisher.removeResourceFromContext(HostingNode.NAME, uuid, contextUUID, false); diff --git a/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/HostingNodeManager.java b/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/HostingNodeManager.java index 59a60ae..9b768eb 100644 --- a/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/HostingNodeManager.java +++ b/src/main/java/org/gcube/smartgears/handler/resourceregistry/resourcemanager/HostingNodeManager.java @@ -145,9 +145,9 @@ public class HostingNodeManager { UUID uuid = UUID.fromString(containerContext.id()); try { resourceRegistryPublisher.addToContext(HostingNode.NAME, uuid, contextUUID, false); - logger.info("{} with UUID {} successfully added to context ({})", HostingNode.NAME, uuid, ContextUtility.getCurrentContextName()); + logger.info("{} with UUID {} successfully added to context ({})", HostingNode.NAME, uuid, ContextUtility.getContextNameFromUUID(contextUUID)); } catch (Exception e) { - logger.error("Unable to add {} with UUID {} to context ({})", HostingNode.NAME, uuid, ContextUtility.getCurrentContextName(), e); + logger.error("Unable to add {} with UUID {} to context ({})", HostingNode.NAME, uuid, ContextUtility.getContextNameFromUUID(contextUUID), e); } } @@ -165,7 +165,7 @@ public class HostingNodeManager { public void removeFromContext(UUID contextUUID) throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { - String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID); + String contextFullName = ContextUtility.getContextNameFromUUID(contextUUID); UUID uuid = UUID.fromString(containerContext.id()); try { resourceRegistryPublisher.removeResourceFromContext(HostingNode.NAME, uuid, contextUUID, false); From 0ee7641bdbca6fb29a7f0e6fb7901be7b0480937 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 29 Jun 2022 16:03:27 +0200 Subject: [PATCH 4/4] Removed uberjar creation which is not needed --- pom.xml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pom.xml b/pom.xml index eeeaf02..f070d2a 100644 --- a/pom.xml +++ b/pom.xml @@ -80,18 +80,4 @@ test - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-uberjar - install - - - - - \ No newline at end of file