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
This commit is contained in:
Massimiliano Assante 2015-06-09 15:51:59 +00:00
parent fdab0b5f2e
commit 5b44e9ad0c
4 changed files with 33 additions and 21 deletions

View File

@ -1,13 +1,19 @@
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-1-2"
date="2014-06-09">
<Change>Fix for Incident #187, remove scope operation not passing through Resource Manager</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-1-1"
date="2014-05-25">
<Change>Fix for Incident #148, Resource Sweeper does not sweep GHN Resources</Change>
<Change>Fix for Incident #148, Resource Sweeper does not sweep GHN
Resources</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-0"
date="2014-12-09">
<Change>Modified xqueries for showing SmartGears and SmarGearsBundle
version</Change>
version
</Change>
<Change>Updated label names for the gHN grid columns</Change>
<Change>Modified xquery to fix bug about wrong scoped generic resource
</Change>
@ -15,9 +21,11 @@
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-1-0"
date="2014-12-09">
<Change>Modified xquery to get also the hostname info about service
endpoints in a given scope</Change>
endpoints in a given scope
</Change>
<Change>Modified the Resource detail model class to in shared package
to support the change explained above</Change>
to support the change explained above
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-0-0"
date="2013-10-21">

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>2.2.1-SNAPSHOT</version>
<version>2.2.2-SNAPSHOT</version>
<name>Resource Management Library</name>
<description>
gCube Resource Management Library is a common library containing shared code for Information System Operations

View File

@ -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<AbstractResourceException> checker = new Assertion<AbstractResourceException>();
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,15 +558,18 @@ 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);
}
}
ScopeProvider.instance.set(currScope);
}

View File

@ -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) {