From 5b44e9ad0cc0c0484ee99b63538171aa827e3014 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 9 Jun 2015 15:51:59 +0000 Subject: [PATCH] Fix for Incident #187, remove scope operation not passing through Resource Manager git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@115273 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 16 +++++++--- pom.xml | 2 +- .../resources/AbstractResourceManager.java | 30 +++++++++++-------- .../managers/resources/ManagementUtils.java | 6 ++-- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 7b3c234..2b47585 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,13 +1,19 @@ + + Fix for Incident #187, remove scope operation not passing through Resource Manager + - Fix for Incident #148, Resource Sweeper does not sweep GHN Resources + Fix for Incident #148, Resource Sweeper does not sweep GHN + Resources Modified xqueries for showing SmartGears and SmarGearsBundle - version + version + Updated label names for the gHN grid columns Modified xquery to fix bug about wrong scoped generic resource @@ -15,9 +21,11 @@ Modified xquery to get also the hostname info about service - endpoints in a given scope + endpoints in a given scope + Modified the Resource detail model class to in shared package - to support the change explained above + to support the change explained above + diff --git a/pom.xml b/pom.xml index bb7f1a3..a0510b0 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.gcube.portlets.admin rmp-common-library - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT Resource Management Library gCube Resource Management Library is a common library containing shared code for Information System Operations diff --git a/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java b/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java index 6f8fc51..383b1c1 100644 --- a/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java +++ b/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java @@ -232,11 +232,11 @@ public abstract class AbstractResourceManager { LOG_PREFIX, "[BIND-SCOPE-ENTER] Adding " + this.getType() + " " + this.getID() + " to scope [" + targetScope.toString() + "]"); - + System.out.println("***\n\n[BIND-SCOPE-ENTER] Adding " + this.getType() + " " + this.getID() + " to scope [" + - targetScope.toString() + "]"); - - + targetScope.toString() + "]"); + + String curr = ScopeProvider.instance.get(); ScopeProvider.instance.set(targetScope.toString()); @@ -261,7 +261,7 @@ public abstract class AbstractResourceManager { } else ScopeProvider.instance.set(targetScope); System.out.println("***\n\nCalling manager.addResources(addParam) addParam.toString()=" + addParam.toString()); - + String reportID = manager.addResources(addParam); ServerConsole.trace( @@ -270,8 +270,8 @@ public abstract class AbstractResourceManager { targetScope.toString() + "]... reportID: " + reportID); System.out.println("***\n\n[BIND-SCOPE-EXIT] Applyed Adding " + this.getType() + " " + this.getID() + " to scope [" + - targetScope.toString() + "]... reportID: " + reportID); - + targetScope.toString() + "]... reportID: " + reportID); + RMReportingLibrary pt = this.getReportResourceManager(scope.toString()); String toReturn = pt.getReport(reportID); @@ -485,6 +485,7 @@ public abstract class AbstractResourceManager { * @param nestingRemoval true for resources different from gHN and RI */ public final String removeFromScope(final ScopeBean scope) throws AbstractResourceException { + ServerConsole.trace(LOG_PREFIX, "[BASIC-FROM-SCOPE] Removing from scope [" + scope.toString() + "] " + this.getType() + " " + this.getID()); Assertion checker = new Assertion(); checker.validate(scope != null, new ResourceParameterException("Invalid parameter scope. null not allowed.")); checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. null not allowed.")); @@ -557,14 +558,17 @@ public abstract class AbstractResourceManager { ServerConsole.trace(LOG_PREFIX, "[DELETE] " + this.getType() + " " + this.getID() + " is bound to (" + boundedScopes.size() + ") scopes"); - if (boundedScopes.size() > 1) + if (boundedScopes.size() > 1) { ServerConsole.trace(LOG_PREFIX, "[DELETE] [DELETE-BRANCH] deleting resource is a remove from scope since more than 1 scope is present " + resStub.id()); - else if (boundedScopes.size() == 1) + this.basicRemoveFromScope(scope); + } + else if (boundedScopes.size() == 1) { ServerConsole.trace(LOG_PREFIX, "[DELETE] [DELETE-BRANCH] deleting resource since is bound to 1 scope only " + resStub.id()); - try { - this.getRegistryPublisher().remove(resStub); - } catch (Exception e) { - ScopeProvider.instance.set(currScope); + try { + this.getRegistryPublisher().remove(resStub); + } catch (Exception e) { + ScopeProvider.instance.set(currScope); + } } ScopeProvider.instance.set(currScope); } diff --git a/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/ManagementUtils.java b/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/ManagementUtils.java index a93913b..8edfe79 100644 --- a/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/ManagementUtils.java +++ b/src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/ManagementUtils.java @@ -116,7 +116,7 @@ public class ManagementUtils { } /** - * Applies the add to scope to multiple resources having the same type. + * Applies the remove from scope * @param type * @param resources * @param sourceScope @@ -129,9 +129,9 @@ public class ManagementUtils { ServerConsole.trace( LOG_PREFIX, "[REMOVE-FromExistingScope] Removing scope [" + - sourceScope.toString() + - "] to existing scope [" + targetScope.toString() + + "] from existing scope [" + + sourceScope.toString() + "] resources having type " + type.name()); // cannot remove a Scope if its the same if (targetScope.toString().compareTo(sourceScope.toString()) == 0) {