forked from gCubeSystem/rmp-common-library
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:
parent
c5888c67b9
commit
9c995cabc4
|
@ -1,13 +1,20 @@
|
||||||
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
|
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"
|
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-3-0"
|
||||||
date="2014-06-09">
|
date="2015-06-09">
|
||||||
<Change>Fix for Incident #187, remove scope operation not passing through Resource Manager</Change>
|
<Change>Fix for Incident #187, remove scope operation not passing
|
||||||
|
through Resource Manager</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-1"
|
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-1"
|
||||||
date="2014-05-25">
|
date="2014-05-25">
|
||||||
<Change>Fix for Incident #148, Resource Sweeper does not sweep GHN
|
<Change>Fix for Incident #148, Resource Sweeper does not sweep GHN
|
||||||
Resources</Change>
|
Resources
|
||||||
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-0"
|
<Changeset component="org.gcube.portlets-admin.rmp-common-library.2-2-0"
|
||||||
date="2014-12-09">
|
date="2014-12-09">
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.admin</groupId>
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
<artifactId>rmp-common-library</artifactId>
|
<artifactId>rmp-common-library</artifactId>
|
||||||
<version>2.3.0-SNAPSHOT</version>
|
<version>2.4.0-SNAPSHOT</version>
|
||||||
<name>Resource Management Library</name>
|
<name>Resource Management Library</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Resource Management Library is a common library containing shared code for Information System Operations
|
gCube Resource Management Library is a common library containing shared code for Information System Operations
|
||||||
|
|
|
@ -42,7 +42,8 @@ public enum ResourceTypeDecorator {
|
||||||
InstallableSoftware("InstallableSoftware", "empty-icon",""),
|
InstallableSoftware("InstallableSoftware", "empty-icon",""),
|
||||||
// In the taskbar for handlig the refresh of deployment reports
|
// In the taskbar for handlig the refresh of deployment reports
|
||||||
DeployReport("Deploy Report", "report-big-icon",""),
|
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",""),
|
||||||
|
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
for $profiles in collection('/db/Profiles/GHN')//Resource
|
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 $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 $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
||||||
let $subtype := $profiles//Resource/Profile/Site/Domain/text()
|
let $subtype := $profiles//Resource/Profile/Site/Domain/text()
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
<RES_SUBTYPE ISdefault =''/>
|
||||||
|
|
|
@ -542,7 +542,7 @@ public abstract class AbstractResourceManager {
|
||||||
* @param scope
|
* @param scope
|
||||||
* @throws ResourceOperationException
|
* @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>();
|
Assertion<AbstractResourceException> checker = new Assertion<AbstractResourceException>();
|
||||||
checker.validate(scope != null, new ResourceParameterException("Invalid parameter scope. null not allowed."));
|
checker.validate(scope != null, new ResourceParameterException("Invalid parameter scope. null not allowed."));
|
||||||
checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. 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() + " in scope [" + scope + "]");
|
||||||
|
|
||||||
ServerConsole.trace(LOG_PREFIX, "[DELETE] " + this.getType() + " " + this.getID() + " is bound to (" + boundedScopes.size() + ") scopes");
|
ServerConsole.trace(LOG_PREFIX, "[DELETE] " + this.getType() + " " + this.getID() + " is bound to (" + boundedScopes.size() + ") scopes");
|
||||||
|
String toReturn = "";
|
||||||
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());
|
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) {
|
else if (boundedScopes.size() == 1) {
|
||||||
ServerConsole.trace(LOG_PREFIX, "[DELETE] [DELETE-BRANCH] deleting resource since is bound to 1 scope only " + resStub.id());
|
ServerConsole.trace(LOG_PREFIX, "[DELETE] [DELETE-BRANCH] deleting resource since is bound to 1 scope only " + resStub.id());
|
||||||
try {
|
try {
|
||||||
this.getRegistryPublisher().remove(resStub);
|
this.getRegistryPublisher().remove(resStub);
|
||||||
|
toReturn = "NO REPORT because with only one resource the RegistryPublisher().remove was called";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ScopeProvider.instance.set(currScope);
|
ScopeProvider.instance.set(currScope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScopeProvider.instance.set(currScope);
|
ScopeProvider.instance.set(currScope);
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,17 +137,18 @@ public class ManagementUtils {
|
||||||
if (targetScope.toString().compareTo(sourceScope.toString()) == 0) {
|
if (targetScope.toString().compareTo(sourceScope.toString()) == 0) {
|
||||||
return "You are not allowed to remove this scope. Current and Target scope are the same.";
|
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) {
|
for (String id : resourceIDs) {
|
||||||
try {
|
try {
|
||||||
resource.setID(id);
|
manager.setID(id);
|
||||||
resource.delete(targetScope);
|
toReturn = manager.delete(targetScope);
|
||||||
} catch (AbstractResourceException e) {
|
} catch (AbstractResourceException e) {
|
||||||
ServerConsole.error(LOG_PREFIX, e);
|
ServerConsole.error(LOG_PREFIX, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "ACK";
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue