forked from gCubeSystem/rmp-common-library
force remove implemented, queries for the sweeper updated
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@82027 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
da7a38a6b4
commit
9bc49c8fc6
21
pom.xml
21
pom.xml
|
@ -34,12 +34,22 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Google Web Toolkit (GWT) -->
|
<!-- Google Web Toolkit (GWT) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt-user</artifactId>
|
<artifactId>gwt-user</artifactId>
|
||||||
<version>${gwtVersion}</version>
|
|
||||||
<!-- "provided" so that we don't deploy -->
|
<!-- "provided" so that we don't deploy -->
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -53,7 +63,11 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>ic-client</artifactId>
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resourcemanagement</groupId>
|
<groupId>org.gcube.resourcemanagement</groupId>
|
||||||
|
@ -73,18 +87,15 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resourcemanagement</groupId>
|
<groupId>org.gcube.resourcemanagement</groupId>
|
||||||
<artifactId>ghnmanager-stubs</artifactId>
|
<artifactId>ghnmanager-stubs</artifactId>
|
||||||
<version>[1.5.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- END FWS -->
|
<!-- END FWS -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.16</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.thoughtworks.xstream</groupId>
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
<artifactId>xstream</artifactId>
|
<artifactId>xstream</artifactId>
|
||||||
<version>1.3.1</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -55,11 +55,11 @@ public enum ResourceTypeDecorator {
|
||||||
/****************************************
|
/****************************************
|
||||||
* Models for SWEEPER
|
* Models for SWEEPER
|
||||||
***************************************/
|
***************************************/
|
||||||
Sweeper_GHN("gCube Hosting Node", "ghn-icon",""),
|
Sweeper_GHN("gCube Hosting Node", "ghn-icon","Hosting Node"),
|
||||||
Sweeper_RI("Running Instance", "runninginstance-icon",""),
|
Sweeper_RI("Running Instance", "runninginstance-icon", "GCore Endpoint"),
|
||||||
Sweeper_RI_Orphan("Orphan Running Instance", "orphan-runninginstance-icon",""),
|
Sweeper_RI_Orphan("Orphan Running Instance", "orphan-runninginstance-icon", "Orphan GCore Endpoint"),
|
||||||
Sweeper_GHN_Expired("Expired gHN", "expired-ghn-icon",""),
|
Sweeper_GHN_Expired("Expired gHN", "expired-ghn-icon", "Expired Nodes"),
|
||||||
Sweeper_GHN_Dead("Dead gHN", "dead-ghn-icon","");
|
Sweeper_GHN_Dead("Dead gHN", "dead-ghn-icon", "Unreachable Nodes");
|
||||||
|
|
||||||
|
|
||||||
private String fwsName = null;
|
private String fwsName = null;
|
||||||
|
|
|
@ -64,8 +64,13 @@ public enum QueryLocation {
|
||||||
|
|
||||||
// Queries for sweeper
|
// Queries for sweeper
|
||||||
SWEEPER_EXPIRED_GHN("sweeper/expiredGhns.xq"),
|
SWEEPER_EXPIRED_GHN("sweeper/expiredGhns.xq"),
|
||||||
|
RETURN_SWEEPER_EXPIRED_GHN("sweeper/RETURN_expiredGhns.xq"),
|
||||||
|
|
||||||
SWEEPER_DEAD_GHN("sweeper/deadGhns.xq"),
|
SWEEPER_DEAD_GHN("sweeper/deadGhns.xq"),
|
||||||
|
RETURN_SWEEPER_DEAD_GHN("sweeper/RETURN_deadGhns.xq"),
|
||||||
|
|
||||||
SWEEPER_ORPHAN_RI("sweeper/orphanRI.xq"),
|
SWEEPER_ORPHAN_RI("sweeper/orphanRI.xq"),
|
||||||
|
RETURN_SWEEPER_ORPHAN_RI("sweeper/RETURN_orphanRI.xq"),
|
||||||
|
|
||||||
// Used to build the gwt model representation inside dialogs.
|
// Used to build the gwt model representation inside dialogs.
|
||||||
// see getResourceModels inside ISClientRequester.
|
// see getResourceModels inside ISClientRequester.
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Resource>
|
||||||
|
{$GHNs/ID}
|
||||||
|
{$GHNs/Profile/GHNDescription/Name}
|
||||||
|
{$GHNs/Profile/GHNDescription/Status}
|
||||||
|
{$GHNs/Profile/GHNDescription/Type}
|
||||||
|
{$GHNs/Profile/Site/Location}
|
||||||
|
{$GHNs/Profile/Site/Domain}
|
||||||
|
<IPAddress>{$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()}</IPAddress>
|
||||||
|
<Scopes>{$scopes}</Scopes>
|
||||||
|
<AllocatedRI>{count($RIinstalled)}</AllocatedRI>
|
||||||
|
{$GHNs/Profile/GHNDescription/LastUpdate}
|
||||||
|
<UpdateMinutesElapsed>{$totalminutes}</UpdateMinutesElapsed>
|
||||||
|
<Actions>APPLY_GHN_DELETE</Actions>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<Resource>
|
||||||
|
{$GHNs/ID}
|
||||||
|
{$GHNs/Profile/GHNDescription/Name}
|
||||||
|
{$GHNs/Profile/GHNDescription/Status}
|
||||||
|
{$GHNs/Profile/GHNDescription/Type}
|
||||||
|
{$GHNs/Profile/Site/Location}
|
||||||
|
{$GHNs/Profile/Site/Domain}
|
||||||
|
<IPAddress>{$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()}</IPAddress>
|
||||||
|
<Scopes>{$scopes}</Scopes>
|
||||||
|
<AllocatedRI>{count($RIinstalled)}</AllocatedRI>
|
||||||
|
{$GHNs/Profile/GHNDescription/LastUpdate}
|
||||||
|
<Actions>APPLY_GHN_MOVE_TO_UNREACHABLE</Actions>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Resource>
|
||||||
|
<ID>{$ri//Resource/ID/string()}</ID>
|
||||||
|
<ServiceStatus>{$ri/Profile/DeploymentData/Status/string()}</ServiceStatus>
|
||||||
|
<ActivationTime>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</ActivationTime>
|
||||||
|
<ghnid>{$ri/Profile/GHN/@UniqueID/string()}</ghnid>
|
||||||
|
<ServiceClass>{$ri/Profile/ServiceClass/string()}</ServiceClass>
|
||||||
|
<ServiceName>{$ri/Profile/ServiceName/string()}</ServiceName>
|
||||||
|
<Actions>APPLY_RI_DELETE</Actions>
|
||||||
|
</Resource>
|
|
@ -10,20 +10,4 @@ let $RIinstalled := $RIs[Profile/GHN/string(@UniqueID)=$GHNs/ID]
|
||||||
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
||||||
where ($GHNs/Profile/GHNDescription/Status/string() eq 'down' or $GHNs/Profile/GHNDescription/Status/string() eq 'unreachable')
|
where ($GHNs/Profile/GHNDescription/Status/string() eq 'down' or $GHNs/Profile/GHNDescription/Status/string() eq 'unreachable')
|
||||||
return
|
return
|
||||||
<Resource>
|
<RESOURCE/>
|
||||||
{$GHNs/ID}
|
|
||||||
{$GHNs/Profile/GHNDescription/Name}
|
|
||||||
{$GHNs/Profile/GHNDescription/Status}
|
|
||||||
{$GHNs/Profile/GHNDescription/Type}
|
|
||||||
{$GHNs/Profile/Site/Location}
|
|
||||||
{$GHNs/Profile/Site/Domain}
|
|
||||||
<IPAddress>{$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()}</IPAddress>
|
|
||||||
<!--
|
|
||||||
Other info
|
|
||||||
-->
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<AllocatedRI>{count($RIinstalled)}</AllocatedRI>
|
|
||||||
{$GHNs/Profile/GHNDescription/LastUpdate}
|
|
||||||
<UpdateMinutesElapsed>{$totalminutes}</UpdateMinutesElapsed>
|
|
||||||
<Actions><ACTION ISdefault ='APPLY_GHN_DELETE'/></Actions>
|
|
||||||
</Resource>
|
|
|
@ -9,19 +9,4 @@ let $RIinstalled := $RIs[Profile/GHN/string(@UniqueID)=$GHNs/ID]
|
||||||
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
||||||
where $GHNs/Profile/GHNDescription/Status/string() != 'down' and $GHNs/Profile/GHNDescription/Status/string() != 'unreachable'
|
where $GHNs/Profile/GHNDescription/Status/string() != 'down' and $GHNs/Profile/GHNDescription/Status/string() != 'unreachable'
|
||||||
return
|
return
|
||||||
<Resource>
|
<RESOURCE/>
|
||||||
{$GHNs/ID}
|
|
||||||
{$GHNs/Profile/GHNDescription/Name}
|
|
||||||
{$GHNs/Profile/GHNDescription/Status}
|
|
||||||
{$GHNs/Profile/GHNDescription/Type}
|
|
||||||
{$GHNs/Profile/Site/Location}
|
|
||||||
{$GHNs/Profile/Site/Domain}
|
|
||||||
<IPAddress>{$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()}</IPAddress>
|
|
||||||
<!--
|
|
||||||
Other info
|
|
||||||
-->
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<AllocatedRI>{count($RIinstalled)}</AllocatedRI>
|
|
||||||
{$GHNs/Profile/GHNDescription/LastUpdate}
|
|
||||||
<Actions><ACTION ISdefault ='APPLY_GHN_MOVE_TO_UNREACHABLE'/></Actions>
|
|
||||||
</Resource>
|
|
|
@ -4,16 +4,4 @@ for $ri in $ris
|
||||||
let $counter := index-of(($ghns//ID/string()), $ri/Profile/GHN/@UniqueID/string())
|
let $counter := index-of(($ghns//ID/string()), $ri/Profile/GHN/@UniqueID/string())
|
||||||
where empty($counter)
|
where empty($counter)
|
||||||
return
|
return
|
||||||
<Resource>
|
<RESOURCE/>
|
||||||
<ID>{$ri//Resource/ID/string()}</ID>
|
|
||||||
<ServiceStatus>{$ri/Profile/DeploymentData/Status/string()}</ServiceStatus>
|
|
||||||
<ActivationTime>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</ActivationTime>
|
|
||||||
<ghnid>{$ri/Profile/GHN/@UniqueID/string()}</ghnid>
|
|
||||||
<ServiceClass>{$ri/Profile/ServiceClass/string()}</ServiceClass>
|
|
||||||
<ServiceName>{$ri/Profile/ServiceName/string()}</ServiceName>
|
|
||||||
<!-- <tmp>{$ghns//ID}</tmp> -->
|
|
||||||
<!--
|
|
||||||
The actions must be declared inside the SweeperAction enum declaration.
|
|
||||||
-->
|
|
||||||
<Actions><ACTION ISdefault ='APPLY_RI_DELETE'/></Actions>
|
|
||||||
</Resource>
|
|
|
@ -26,6 +26,7 @@ import org.gcube.common.resources.gcore.Resource;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
|
import org.gcube.informationsystem.publisher.AdvancedPublisher;
|
||||||
import org.gcube.informationsystem.publisher.RegistryPublisher;
|
import org.gcube.informationsystem.publisher.RegistryPublisher;
|
||||||
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
|
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
|
||||||
import org.gcube.resourcemanagement.support.server.exceptions.AbstractResourceException;
|
import org.gcube.resourcemanagement.support.server.exceptions.AbstractResourceException;
|
||||||
|
@ -503,14 +504,20 @@ public abstract class AbstractResourceManager {
|
||||||
* @param scope where the resource is bound
|
* @param scope where the resource is bound
|
||||||
* @throws AbstractResourceException
|
* @throws AbstractResourceException
|
||||||
*/
|
*/
|
||||||
public final void forceDelete(final ScopeBean scope) throws AbstractResourceException {
|
public final void forceDelete(ScopeBean scope) throws AbstractResourceException {
|
||||||
ServerConsole.trace(LOG_PREFIX, "[DELETE] [DELETE-BRANCH] deleting resource since no more scopes remained");
|
ServerConsole.trace(LOG_PREFIX, "[FORCE DELETE] [DELETE-BRANCH] deleting resource from scope " + scope);
|
||||||
Resource resStub = this.getResource(scope);
|
String currScope = ScopeProvider.instance.get();
|
||||||
try {
|
|
||||||
this.getRegistryPublisher().remove(resStub);
|
Resource toDelete = this.getResource(scope);
|
||||||
} catch (Exception e) {
|
|
||||||
ServerConsole.error(LOG_PREFIX, e);
|
while (scope.enclosingScope() != null)
|
||||||
}
|
scope = scope.enclosingScope();
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scope.toString());
|
||||||
|
AdvancedPublisher advancedPublisher = new AdvancedPublisher(this.getRegistryPublisher());
|
||||||
|
advancedPublisher.forceRemove(toDelete);
|
||||||
|
ServerConsole.trace(LOG_PREFIX, "[FORCE DELETE] [DELETE-BRANCH] deleted resource from scope " + scope);
|
||||||
|
ScopeProvider.instance.set(currScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -528,8 +535,8 @@ public abstract class AbstractResourceManager {
|
||||||
checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. null not allowed."));
|
checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. null not allowed."));
|
||||||
|
|
||||||
System.out.println("DELETING TYPE: "+ this.getType());
|
System.out.println("DELETING TYPE: "+ this.getType());
|
||||||
|
String currScope = ScopeProvider.instance.get();
|
||||||
ScopeProvider.instance.set(scope.toString());
|
ScopeProvider.instance.set(scope.toString());
|
||||||
|
|
||||||
Resource resStub = this.getResource(scope);
|
Resource resStub = this.getResource(scope);
|
||||||
|
|
||||||
List<ScopeBean> boundedScopes = this.validateScopes(resStub.scopes().toArray(new String[0]));
|
List<ScopeBean> boundedScopes = this.validateScopes(resStub.scopes().toArray(new String[0]));
|
||||||
|
@ -545,8 +552,9 @@ public abstract class AbstractResourceManager {
|
||||||
try {
|
try {
|
||||||
this.getRegistryPublisher().remove(resStub);
|
this.getRegistryPublisher().remove(resStub);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
ScopeProvider.instance.set(currScope);
|
||||||
}
|
}
|
||||||
|
ScopeProvider.instance.set(currScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ implements PersistenceHandler<T> {
|
||||||
while ((currLine = reader.readLine()) != null) {
|
while ((currLine = reader.readLine()) != null) {
|
||||||
xml.append(currLine);
|
xml.append(currLine);
|
||||||
}
|
}
|
||||||
|
reader.close();
|
||||||
return (T) this.getSerializer().fromXML(xml.toString());
|
return (T) this.getSerializer().fromXML(xml.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ServerConsole.error(LOG_PREFIX, e);
|
ServerConsole.error(LOG_PREFIX, e);
|
||||||
|
|
Loading…
Reference in New Issue