Implemented Feature #187, remove scope operation with Report

Implemented Feature #446 Show SmartGearsDistribution version instead of SmartGearsDistributionBundle version for Distro Version<

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@117656 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-08-04 13:16:16 +00:00
parent c5888c67b9
commit 9c995cabc4
6 changed files with 25 additions and 14 deletions

View File

@ -1,13 +1,20 @@
<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-4-0"
date="2015-08-04">
<Change>Implemented Feature #187, remove scope operation with Report</Change>
<Change>Implemented Feature #446 Show SmartGearsDistribution version instead of SmartGearsDistributionBundle version for Distro Version</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-3-0"
date="2014-06-09">
<Change>Fix for Incident #187, remove scope operation not passing through Resource Manager</Change>
date="2015-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-2-1"
date="2014-05-25">
<Change>Fix for Incident #148, Resource Sweeper does not sweep GHN
Resources</Change>
Resources
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-0"
date="2014-12-09">

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-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

@ -42,7 +42,8 @@ public enum ResourceTypeDecorator {
InstallableSoftware("InstallableSoftware", "empty-icon",""),
// In the taskbar for handlig the refresh of deployment reports
DeployReport("Deploy Report", "report-big-icon",""),
AddScopeReport("Add Scope Report", "report-big-icon",""),
AddScopeReport("Add to Scope Report", "report-big-icon",""),
RemoveScopeReport("Remove from Scope Report", "report-big-icon",""),
/****************************************

View File

@ -1,6 +1,6 @@
for $profiles in collection('/db/Profiles/GHN')//Resource
let $gcf-version := $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'gCF-version']/Value/text() | $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'SmartGears']/Value/text()
let $ghn-version := $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'GHN-distribution-version']/Value/text() | $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'SmartGearsDistributionBundle']/Value/text()
let $ghn-version := $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'GHN-distribution-version']/Value/text() | $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'SmartGearsDistribution']/Value/text()
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
let $subtype := $profiles//Resource/Profile/Site/Domain/text()
<RES_SUBTYPE ISdefault =''/>

View File

@ -542,7 +542,7 @@ public abstract class AbstractResourceManager {
* @param scope
* @throws ResourceOperationException
*/
public final void delete(final ScopeBean scope) throws AbstractResourceException {
public final String delete(final ScopeBean scope) throws AbstractResourceException {
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,20 +557,22 @@ public abstract class AbstractResourceManager {
ServerConsole.trace(LOG_PREFIX, "[DELETE] " + this.getType() + " " + this.getID() + " in scope [" + scope + "]");
ServerConsole.trace(LOG_PREFIX, "[DELETE] " + this.getType() + " " + this.getID() + " is bound to (" + boundedScopes.size() + ") scopes");
String toReturn = "";
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());
this.basicRemoveFromScope(scope);
toReturn = 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);
toReturn = "NO REPORT because with only one resource the RegistryPublisher().remove was called";
} catch (Exception e) {
ScopeProvider.instance.set(currScope);
}
}
ScopeProvider.instance.set(currScope);
ScopeProvider.instance.set(currScope);
return toReturn;
}
}

View File

@ -137,17 +137,18 @@ public class ManagementUtils {
if (targetScope.toString().compareTo(sourceScope.toString()) == 0) {
return "You are not allowed to remove this scope. Current and Target scope are the same.";
}
AbstractResourceManager resource = ResourceFactory.createResourceManager(type);
String toReturn = "";
AbstractResourceManager manager = ResourceFactory.createResourceManager(type);
for (String id : resourceIDs) {
try {
resource.setID(id);
resource.delete(targetScope);
manager.setID(id);
toReturn = manager.delete(targetScope);
} catch (AbstractResourceException e) {
ServerConsole.error(LOG_PREFIX, e);
}
}
return "ACK";
return toReturn;
}
/**