ready for release
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/resource-sweeper@65421 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f12951c7c1
commit
ac8d85eedc
13
pom.xml
13
pom.xml
|
@ -21,7 +21,6 @@
|
||||||
<maven.compiler.source>1.6</maven.compiler.source>
|
<maven.compiler.source>1.6</maven.compiler.source>
|
||||||
<maven.compiler.target>1.6</maven.compiler.target>
|
<maven.compiler.target>1.6</maven.compiler.target>
|
||||||
|
|
||||||
<!-- Don't let your Mac use a crazy non-standard encoding -->
|
|
||||||
<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>
|
||||||
|
@ -48,12 +47,7 @@
|
||||||
<version>2.2.5</version>
|
<version>2.2.5</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.portlets.admin</groupId>
|
|
||||||
<artifactId>rmp-common-library</artifactId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>gcf</artifactId>
|
<artifactId>gcf</artifactId>
|
||||||
|
@ -66,6 +60,11 @@
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
|
<artifactId>rmp-common-library</artifactId>
|
||||||
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||||
<inherits name='com.extjs.gxt.themes.Themes' />
|
<inherits name='com.extjs.gxt.themes.Themes' />
|
||||||
|
|
||||||
<inherits name='org.gcube.resourcemanagement.support.Resource_support' />
|
<set-property name="user.agent" value="gecko1_8" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <inherits name='org.gcube.resourcemanagement.support.Resource_support' /> -->
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
class='org.gcube.portlets.admin.resourcesweeper.client.Resource_sweeper' />
|
class='org.gcube.portlets.admin.resourcesweeper.client.Resource_sweeper' />
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.admin.resourcesweeper.client;
|
package org.gcube.portlets.admin.resourcesweeper.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.resourcesweeper.client.dialog.SweeperDialog;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +14,6 @@ public class Resource_sweeper implements EntryPoint {
|
||||||
*/
|
*/
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
//### Just for testing leave commented
|
//### Just for testing leave commented
|
||||||
//snew SweeperDialog("/gcube/devNext");
|
new SweeperDialog("/gcube/devNext");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.gcube.portlets.admin.resourcesweeper.server;
|
package org.gcube.portlets.admin.resourcesweeper.server;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
@ -28,9 +29,9 @@ import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
|
||||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||||
import org.gcube.portlets.admin.resourcesweeper.server.queries.QueryLoader;
|
|
||||||
import org.gcube.portlets.admin.resourcesweeper.server.queries.QueryLocation;
|
|
||||||
import org.gcube.portlets.admin.resourcesweeper.shared.SweeperActions;
|
import org.gcube.portlets.admin.resourcesweeper.shared.SweeperActions;
|
||||||
|
import org.gcube.resourcemanagement.support.server.gcube.queries.QueryLoader;
|
||||||
|
import org.gcube.resourcemanagement.support.server.gcube.queries.QueryLocation;
|
||||||
import org.gcube.resourcemanagement.support.server.managers.resources.GHNManager;
|
import org.gcube.resourcemanagement.support.server.managers.resources.GHNManager;
|
||||||
import org.gcube.resourcemanagement.support.server.managers.resources.RunningInstanceManager;
|
import org.gcube.resourcemanagement.support.server.managers.resources.RunningInstanceManager;
|
||||||
|
|
||||||
|
@ -46,11 +47,8 @@ public class Sweeper {
|
||||||
|
|
||||||
static GCUBEClientLog _log = new GCUBEClientLog(Sweeper.class);
|
static GCUBEClientLog _log = new GCUBEClientLog(Sweeper.class);
|
||||||
|
|
||||||
protected static final List<String> applyQuery(
|
|
||||||
final GCUBEScope queryScope,
|
protected ArrayList<String> applyQuery(GCUBEScope queryScope, QueryLocation queryPath, QueryParameter... params) throws Exception {
|
||||||
final QueryLocation queryPath,
|
|
||||||
final QueryParameter... params
|
|
||||||
) throws Exception {
|
|
||||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||||
GCUBEGenericQuery isQuery = null;
|
GCUBEGenericQuery isQuery = null;
|
||||||
isQuery = client.getQuery(GCUBEGenericQuery.class);
|
isQuery = client.getQuery(GCUBEGenericQuery.class);
|
||||||
|
@ -59,7 +57,7 @@ public class Sweeper {
|
||||||
isQuery.addParameters(params);
|
isQuery.addParameters(params);
|
||||||
}
|
}
|
||||||
List<XMLResult> results = client.execute(isQuery, queryScope);
|
List<XMLResult> results = client.execute(isQuery, queryScope);
|
||||||
List<String> retval = new Vector<String>();
|
ArrayList<String> retval = new ArrayList<String>();
|
||||||
|
|
||||||
for (XMLResult elem : results) {
|
for (XMLResult elem : results) {
|
||||||
// Removes the resources with no ID or empty
|
// Removes the resources with no ID or empty
|
||||||
|
@ -81,7 +79,7 @@ public class Sweeper {
|
||||||
* @param queryScope
|
* @param queryScope
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static final List<String> getExpiredGHNs(final GCUBEScope queryScope) {
|
public ArrayList<String> getExpiredGHNs(final GCUBEScope queryScope) {
|
||||||
try {
|
try {
|
||||||
return applyQuery(
|
return applyQuery(
|
||||||
queryScope,
|
queryScope,
|
||||||
|
@ -92,7 +90,7 @@ public class Sweeper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static final List<String> getDeadGHNs(final GCUBEScope queryScope) {
|
public ArrayList<String> getDeadGHNs(GCUBEScope queryScope) {
|
||||||
try {
|
try {
|
||||||
return applyQuery(
|
return applyQuery(
|
||||||
queryScope,
|
queryScope,
|
||||||
|
@ -103,7 +101,7 @@ public class Sweeper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final List<String> getOrphanRI(final GCUBEScope queryScope) {
|
public ArrayList<String> getOrphanRI(GCUBEScope queryScope) {
|
||||||
try {
|
try {
|
||||||
return applyQuery(
|
return applyQuery(
|
||||||
queryScope,
|
queryScope,
|
||||||
|
@ -115,7 +113,7 @@ public class Sweeper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static final void applySweep(final GCUBEScope queryScope, final List<ModelData> elems) {
|
public void applySweep(GCUBEScope queryScope, List<ModelData> elems) {
|
||||||
for (ModelData entry : elems) {
|
for (ModelData entry : elems) {
|
||||||
try {
|
try {
|
||||||
SweeperActions action = SweeperActions.valueOf(((Object) entry.get("Actions")).toString());
|
SweeperActions action = SweeperActions.valueOf(((Object) entry.get("Actions")).toString());
|
||||||
|
|
|
@ -46,16 +46,17 @@ public class SweeperServiceImpl extends RemoteServiceServlet implements SweeperS
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> getSweepElems(String scope, SweeperActions action) {
|
public List<String> getSweepElems(String scope, SweeperActions action) {
|
||||||
|
Sweeper sweeper = new Sweeper();
|
||||||
try {
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case GET_GHN_MOVE_TO_UNREACHABLE: {
|
case GET_GHN_MOVE_TO_UNREACHABLE: {
|
||||||
List<String> ghnList = Sweeper.getExpiredGHNs(GCUBEScope.getScope(scope));
|
List<String> ghnList = sweeper.getExpiredGHNs(GCUBEScope.getScope(scope));
|
||||||
return filterExpiredGHNs(ghnList);
|
return filterExpiredGHNs(ghnList);
|
||||||
}
|
}
|
||||||
case GET_GHN_DELETE:
|
case GET_GHN_DELETE:
|
||||||
return Sweeper.getDeadGHNs(GCUBEScope.getScope(scope));
|
return sweeper.getDeadGHNs(GCUBEScope.getScope(scope));
|
||||||
case GET_RI_DELETE:
|
case GET_RI_DELETE:
|
||||||
return Sweeper.getOrphanRI(GCUBEScope.getScope(scope));
|
return sweeper.getOrphanRI(GCUBEScope.getScope(scope));
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -70,8 +71,9 @@ public class SweeperServiceImpl extends RemoteServiceServlet implements SweeperS
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void applySweep(String scope, List<ModelData> elems) {
|
public void applySweep(String scope, List<ModelData> elems) {
|
||||||
|
Sweeper sweeper = new Sweeper();
|
||||||
try {
|
try {
|
||||||
Sweeper.applySweep(GCUBEScope.getScope(scope), elems);
|
sweeper.applySweep(GCUBEScope.getScope(scope), elems);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error(e.getMessage());
|
_log.error(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* This software is part of the gCube Project.
|
|
||||||
* Site: http://www.gcube-system.org/
|
|
||||||
****************************************************************************
|
|
||||||
* The gCube/gCore software is licensed as Free Open Source software
|
|
||||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
|
||||||
* The software and documentation is provided by its authors/distributors
|
|
||||||
* "as is" and no expressed or
|
|
||||||
* implied warranty is given for its use, quality or fitness for a
|
|
||||||
* particular case.
|
|
||||||
****************************************************************************
|
|
||||||
* Filename: QueryLoader.java
|
|
||||||
****************************************************************************
|
|
||||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
package org.gcube.portlets.admin.resourcesweeper.server.queries;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resource_support utility to load at runtime the customized queries to submit to
|
|
||||||
* the IS.
|
|
||||||
* @author Daniele Strollo (ISTI-CNR)
|
|
||||||
*/
|
|
||||||
public class QueryLoader {
|
|
||||||
private static final HashMap<QueryLocation, String> cachedQueries = new HashMap<QueryLocation, String>();
|
|
||||||
private static GCUBEClientLog _log = new GCUBEClientLog(QueryLoader.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param query the location of query file to load
|
|
||||||
* @return the string consisting of the xquery to submit to the server
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String getQuery(final QueryLocation query) throws Exception {
|
|
||||||
if (query == null) {
|
|
||||||
throw new Exception("Invalid query parameter. Null not allowed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
_log.trace("loading " + query.name());
|
|
||||||
|
|
||||||
if (query != null && cachedQueries.containsKey(query)) {
|
|
||||||
return cachedQueries.get(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(query.getFileName()));
|
|
||||||
StringBuilder retval = new StringBuilder();
|
|
||||||
String currLine = null;
|
|
||||||
|
|
||||||
while ((currLine = in.readLine()) != null) {
|
|
||||||
// a comment
|
|
||||||
if (currLine.trim().length() > 0 && currLine.trim().startsWith("#")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (currLine.trim().length() == 0) { continue; }
|
|
||||||
retval.append(currLine + System.getProperty("line.separator"));
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
String tmp = retval.toString();
|
|
||||||
if (cachedQueries != null) {
|
|
||||||
cachedQueries.put(query, tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* This software is part of the gCube Project.
|
|
||||||
* Site: http://www.gcube-system.org/
|
|
||||||
****************************************************************************
|
|
||||||
* The gCube/gCore software is licensed as Free Open Source software
|
|
||||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
|
||||||
* The software and documentation is provided by its authors/distributors
|
|
||||||
* "as is" and no expressed or
|
|
||||||
* implied warranty is given for its use, quality or fitness for a
|
|
||||||
* particular case.
|
|
||||||
****************************************************************************
|
|
||||||
* Filename: QueryLocator.java
|
|
||||||
****************************************************************************
|
|
||||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
package org.gcube.portlets.admin.resourcesweeper.server.queries;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Keeps the association between an xquery and the path
|
|
||||||
* on which it can be retrieved.
|
|
||||||
* @author Daniele Strollo
|
|
||||||
* @author Massimiliano Assante (ISTI-CNR)
|
|
||||||
*/
|
|
||||||
public enum QueryLocation {
|
|
||||||
// These two queries are needed to build the tree of resource types and subtypes
|
|
||||||
// for resources different from wsresources.
|
|
||||||
GET_TREE_TYPES("getTypes.xq"),
|
|
||||||
GET_TREE_SUBTYPES("getSubTypes.xq"),
|
|
||||||
|
|
||||||
// Customized queries to retrieve the relevant data from resources
|
|
||||||
// according to their type
|
|
||||||
LIST_GHN("resources/GHN.xq"),
|
|
||||||
LIST_Collection("resources/Collection.xq"),
|
|
||||||
LIST_VIEW("resources/VIEW.xq"),
|
|
||||||
LIST_Service("resources/Service.xq"),
|
|
||||||
LIST_GenericResource("resources/GenericResource.xq"),
|
|
||||||
LIST_RunningInstance("resources/RunningInstance.xq"),
|
|
||||||
LIST_RuntimeResource("resources/RuntimeResource.xq"),
|
|
||||||
|
|
||||||
// To retrieve the list of generic resources publishing plugins
|
|
||||||
// to deploy activation records
|
|
||||||
GET_GENERIC_RESOURCE_PLUGINS("getPlugins.xq"),
|
|
||||||
|
|
||||||
// to deploy activation records for Tree manager
|
|
||||||
GET_GENERIC_RESOURCE_TREE_MANAGER_PLUGINS("getTreeManagerPlugins.xq"),
|
|
||||||
|
|
||||||
// Related resources
|
|
||||||
LIST_RELATED_GHN("related/GHN.xq"),
|
|
||||||
LIST_RELATED_RunningInstance("related/RunningInstance.xq"),
|
|
||||||
LIST_RELATED_Service("related/Service.xq"),
|
|
||||||
|
|
||||||
// Queries for sweeper
|
|
||||||
SWEEPER_EXPIRED_GHN("sweeper/expiredGhns.xq"),
|
|
||||||
SWEEPER_DEAD_GHN("sweeper/deadGhns.xq"),
|
|
||||||
SWEEPER_ORPHAN_RI("sweeper/orphanRI.xq"),
|
|
||||||
|
|
||||||
// Used to build the gwt model representation inside dialogs.
|
|
||||||
// see getResourceModels inside ISClientRequester.
|
|
||||||
GET_RES_DETAILS_BYTYPE("getResourcesDetails.xq"),
|
|
||||||
GET_RES_DETAILS_BYSUBTYPE("getResourcesDetailsSubtype.xq"),
|
|
||||||
|
|
||||||
GET_RESOURCE_BYID("getResourceByID.xq"),
|
|
||||||
GET_WSRES_TYPES("getWSResourcesTypes.xq"),
|
|
||||||
GET_WSRES_DETAILS_BYTYPE("getWSResourcesDetails.xq"),
|
|
||||||
GET_WSRES_DETAILS_BYSUBTYPE("getWSResourcesDetailsSubType.xq"),
|
|
||||||
GET_WSRESOURCE_BYID("getWSResourceByID.xq");
|
|
||||||
|
|
||||||
private final String path = "org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/";
|
|
||||||
private String filename = null;
|
|
||||||
QueryLocation(final String filename) {
|
|
||||||
this.filename = filename;
|
|
||||||
}
|
|
||||||
public InputStream getFileName() {
|
|
||||||
return this.getClass().getClassLoader().getResourceAsStream(this.path + this.filename);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
#
|
|
||||||
# Params: RES_ID the ID of looked up resource
|
|
||||||
# RES_TYPE (option) the type of searched resource
|
|
||||||
|
|
||||||
|
|
||||||
for $resource in collection('/db/Profiles/<RES_TYPE ISdefault =''>')//Resource
|
|
||||||
where $resource/ID/string() eq '<RES_ID/>'
|
|
||||||
return $resource
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
for $resource in collection("/db/Properties")//Document
|
|
||||||
where $resource/ID/string() eq '<RES_ID/>'
|
|
||||||
return $resource
|
|
|
@ -1,22 +0,0 @@
|
||||||
<!--
|
|
||||||
RES_SUBTYPE subtype parameters can be passed by expressing:
|
|
||||||
|
|
||||||
where $subtype = "TheSubType" and $wsresource/Data//child::*[local-name()='Type'][0]/string() eq 'gDocRead'
|
|
||||||
-->
|
|
||||||
|
|
||||||
for $profiles in collection('/db/Profiles/GenericResource')//Resource, $wsresource in collection('/db/Properties')//Document
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles//Resource/Profile/SecondaryType/text()
|
|
||||||
where $subtype = "GCUBECollection" and $profiles//Resource/ID eq $wsresource/SourceKey and $wsresource/Data//child::*[local-name()='Type']/string() eq 'gDocRead'
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles//Resource/ID}
|
|
||||||
<Type>{$profiles//Resource/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<Name>{$profiles//Resource/Profile/Name/text()}</Name>
|
|
||||||
<CreationTime>{$profiles//Resource/Profile/Body/CollectionInfo/creationTime/text()}</CreationTime>
|
|
||||||
<LastUpdateTime>{$wsresource/LastUpdateHuman/text()}</LastUpdateTime>
|
|
||||||
<NumberOfMembers>{$wsresource//child::*[local-name()='Cardinality']/text()}</NumberOfMembers>
|
|
||||||
</Resource>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<!--
|
|
||||||
gets the compressed description of all GHNs published in a scope
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
for $profiles in collection('/db/Profiles/GHN')//Resource
|
|
||||||
let $gcf-version := $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'gCF-version']/Value/text()
|
|
||||||
let $ghn-version := $profiles//Resource/Profile/GHNDescription/RunTimeEnv/Variable[Key/text() = 'GHN-distribution-version']/Value/text()
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles//Resource/Profile/Site/Domain/text()
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles//Resource/ID}
|
|
||||||
<Type>{$profiles//Resource/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Status>{$profiles//Resource/Profile/GHNDescription/Status/text()}</Status>
|
|
||||||
<Name>{$profiles//Resource/Profile/GHNDescription/Name/text()}</Name>
|
|
||||||
<Uptime>{$profiles//Resource/Profile/GHNDescription/Uptime/text()}</Uptime>
|
|
||||||
<LastUpdate>{$profiles//Resource/Profile/GHNDescription/LastUpdate/text()}</LastUpdate>
|
|
||||||
<LocalAvailableSpace>{$profiles//Resource/Profile/GHNDescription/LocalAvailableSpace/text()}</LocalAvailableSpace>
|
|
||||||
<VirtualSize>{$profiles//Resource/Profile/GHNDescription/MainMemory/string(@VirtualSize)}</VirtualSize>
|
|
||||||
<VirtualAvailable>{$profiles//Resource/Profile/GHNDescription/MainMemory/string(@VirtualAvailable)}</VirtualAvailable>
|
|
||||||
<LoadLast1Min>{$profiles//Resource/Profile/GHNDescription/Load/string(@Last1Min)}</LoadLast1Min>
|
|
||||||
<LoadLast5Min>{$profiles//Resource/Profile/GHNDescription/Load/string(@Last5Min)}</LoadLast5Min>
|
|
||||||
<LoadLast15Min>{$profiles//Resource/Profile/GHNDescription/Load/string(@Last15Min)}</LoadLast15Min>
|
|
||||||
<gcf-version>{$gcf-version}</gcf-version>
|
|
||||||
<ghn-version>{$ghn-version}</ghn-version>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
</Resource>
|
|
|
@ -1,15 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for $profiles in collection('/db/Profiles/GenericResource')//Resource
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles//Resource/Profile/SecondaryType/text()
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles//Resource/ID}
|
|
||||||
<Type>{$profiles//Resource/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<Name>{$profiles//Resource/Profile/Name/text()}</Name>
|
|
||||||
</Resource>
|
|
|
@ -1,26 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
for $profiles in collection('/db/Profiles/RunningInstance')//Resource
|
|
||||||
<!--
|
|
||||||
let $ghn-name := $profiles/Profile/GHN/@UniqueID/string()
|
|
||||||
-->
|
|
||||||
let $ghns := collection('/db/Profiles/GHN')//Resource
|
|
||||||
let $_ghn-name := for $ghn in $ghns
|
|
||||||
where $ghn/ID/string() eq $profiles/Profile/GHN/@UniqueID/string()
|
|
||||||
return $ghn/Profile/GHNDescription/Name/string()
|
|
||||||
let $ghn-name := if (empty($_ghn-name)) then $profiles/Profile/GHN/@UniqueID/string() else $_ghn-name
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles/Profile/ServiceClass/text()
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles/ID}
|
|
||||||
<Type>{$profiles/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<ServiceClass>{$profiles/Profile/ServiceClass/text()}</ServiceClass>
|
|
||||||
<ServiceName>{$profiles/Profile/ServiceName/text()}</ServiceName>
|
|
||||||
<Version>{$profiles/Profile/Version/text()}</Version>
|
|
||||||
<Status>{$profiles/Profile/DeploymentData/Status/text()}</Status>
|
|
||||||
<ghn-name>{$ghn-name}</ghn-name>
|
|
||||||
</Resource>
|
|
|
@ -1,12 +0,0 @@
|
||||||
for $profiles in collection('/db/Profiles/RuntimeResource')//Resource
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles//Resource/Profile/Category/text()
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles//Resource/ID}
|
|
||||||
<Type>{$profiles//Resource/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<Name>{$profiles//Resource/Profile/Name/text()}</Name>
|
|
||||||
</Resource>
|
|
|
@ -1,18 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
for $profiles in collection('/db/Profiles/Service')//Resource
|
|
||||||
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
|
|
||||||
let $subtype := $profiles//Resource/Profile/Class/text()
|
|
||||||
<RES_SUBTYPE ISdefault =''/>
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$profiles//Resource/ID}
|
|
||||||
<Type>{$profiles//Resource/Type/text()}</Type>
|
|
||||||
<SubType>{$subtype}</SubType>
|
|
||||||
<Scopes>{$scopes}</Scopes>
|
|
||||||
<ServiceClass>{$profiles//Resource/Profile/Class/text()}</ServiceClass>
|
|
||||||
<ServiceName>{$profiles//Resource/Profile/Name/text()}</ServiceName>
|
|
||||||
<!-- if many software defined takes the version of the first one -->
|
|
||||||
<Version>{$profiles//Resource/Profile/Packages/Software[1]/Version/text()}</Version>
|
|
||||||
<Shareable>{$profiles//Resource/Profile/Packages/Software/Shareable/string(@level)}</Shareable>
|
|
||||||
</Resource>
|
|
|
@ -1,21 +0,0 @@
|
||||||
declare namespace gc = 'http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider';
|
|
||||||
declare namespace wmns= 'http://gcube-system.org/namespaces/contentmanagement/viewmanager';
|
|
||||||
for $outer in collection("/db/Properties")//Document, $res in $outer/Data where $res/gc:ServiceClass/string() eq 'ContentManagement'
|
|
||||||
and count($res//wmns:View)>0 and $res/gc:ServiceName/string() eq 'ViewManager'
|
|
||||||
return
|
|
||||||
<Resource>
|
|
||||||
{$outer//Document/ID}
|
|
||||||
{$outer//Document/Source}
|
|
||||||
{$outer//Document/SourceKey}
|
|
||||||
<ViewName>{$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='property']/child::*[local-name()='name' and text()='name']/../child::*[local-name()='value']/text()}</ViewName>
|
|
||||||
<Cardinality>{$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='cardinality']/text()}</Cardinality>
|
|
||||||
<ViewType>{$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='type']/text()}</ViewType>
|
|
||||||
<RelatedCollectionId>{$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='collectionID']/text()}</RelatedCollectionId>
|
|
||||||
<ServiceClass>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</ServiceClass>
|
|
||||||
<ServiceName>{$outer//Document/Data/child::*[local-name()='ServiceName']/text()}</ServiceName>
|
|
||||||
<SubType>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</SubType>
|
|
||||||
{$outer//Document/TerminationTimeHuman} {$outer//Document/LastUpdateHuman}
|
|
||||||
<RI>{$outer//Document/Data/child::*[local-name()='RI']/text()}</RI>
|
|
||||||
<Type>WSResource</Type>
|
|
||||||
<scopes>{$outer//Document/Data/child::*[local-name()='Scope']/text()}</scopes>
|
|
||||||
</Resource>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<!--
|
|
||||||
These are the GHNs that are declared certified and must be passed to
|
|
||||||
down status.
|
|
||||||
The choice is done by minutes elapsed from last update.
|
|
||||||
-->
|
|
||||||
let $RIs := collection("/db/Profiles/RunningInstance")//Document/Data/child::*[local-name()='Profile']/Resource
|
|
||||||
for $GHNs in collection("/db/Profiles/GHN")//Document/Data/child::*[local-name()='Profile']/Resource
|
|
||||||
let $totalminutes := hours-from-dateTime($GHNs/Profile/GHNDescription/LastUpdate/text())
|
|
||||||
let $RIinstalled := $RIs[Profile/GHN/string(@UniqueID)=$GHNs/ID]
|
|
||||||
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
|
||||||
where ($GHNs/Profile/GHNDescription/Status/string() eq 'down' or $GHNs/Profile/GHNDescription/Status/string() eq 'unreachable')
|
|
||||||
return
|
|
||||||
<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>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<!--
|
|
||||||
These are the GHNs that are declared certified and must be passed to
|
|
||||||
down status.
|
|
||||||
The choice is done by minutes elapsed from last update.
|
|
||||||
-->
|
|
||||||
let $RIs := collection("/db/Profiles/RunningInstance")//Document/Data/child::*[local-name()='Profile']/Resource
|
|
||||||
for $GHNs in collection("/db/Profiles/GHN")//Document/Data/child::*[local-name()='Profile']/Resource
|
|
||||||
let $RIinstalled := $RIs[Profile/GHN/string(@UniqueID)=$GHNs/ID]
|
|
||||||
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
|
|
||||||
where $GHNs/Profile/GHNDescription/Status/string() != 'down' and $GHNs/Profile/GHNDescription/Status/string() != 'unreachable'
|
|
||||||
return
|
|
||||||
<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>
|
|
|
@ -1,19 +0,0 @@
|
||||||
let $ghns := collection('/db/Profiles/GHN')//Resource/ID
|
|
||||||
let $ris := collection('/db/Profiles/RunningInstance')//Resource
|
|
||||||
for $ri in $ris
|
|
||||||
let $counter := index-of(($ghns//ID/string()), $ri/Profile/GHN/@UniqueID/string())
|
|
||||||
where empty($counter)
|
|
||||||
return
|
|
||||||
<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>
|
|
Loading…
Reference in New Issue