From ac8d85eedc1f681cd39aa95416a5b5a97dc605a4 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 28 Dec 2012 17:53:49 +0000 Subject: [PATCH] ready for release git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/resource-sweeper@65421 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 13 ++- .../resourcesweeper/Resource_sweeper.gwt.xml | 5 +- .../client/Resource_sweeper.java | 4 +- .../admin/resourcesweeper/server/Sweeper.java | 22 +++--- .../server/SweeperServiceImpl.java | 10 ++- .../server/queries/QueryLoader.java | 72 ----------------- .../server/queries/QueryLocation.java | 79 ------------------- .../server/queries/xquery/getResourceByID.xq | 8 -- .../queries/xquery/getWSResourceByID.xq | 4 - .../queries/xquery/resources/Collection.xq | 22 ------ .../server/queries/xquery/resources/GHN.xq | 30 ------- .../xquery/resources/GenericResource.xq | 15 ---- .../xquery/resources/RunningInstance.xq | 26 ------ .../xquery/resources/RuntimeResource.xq | 12 --- .../queries/xquery/resources/Service.xq | 18 ----- .../server/queries/xquery/resources/VIEW.xq | 21 ----- .../server/queries/xquery/sweeper/deadGhns.xq | 29 ------- .../queries/xquery/sweeper/expiredGhns.xq | 27 ------- .../server/queries/xquery/sweeper/orphanRI.xq | 19 ----- 19 files changed, 29 insertions(+), 407 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLoader.java delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLocation.java delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getResourceByID.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getWSResourceByID.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Collection.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GHN.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GenericResource.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RunningInstance.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RuntimeResource.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Service.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/VIEW.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/deadGhns.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/expiredGhns.xq delete mode 100644 src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/orphanRI.xq diff --git a/pom.xml b/pom.xml index ab43154..f372f25 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,6 @@ 1.6 1.6 - UTF-8 UTF-8 @@ -48,12 +47,7 @@ 2.2.5 provided - - org.gcube.portlets.admin - rmp-common-library - 1.0.0-SNAPSHOT - provided - + org.gcube.core gcf @@ -66,6 +60,11 @@ 2.0.0 provided + + org.gcube.portlets.admin + rmp-common-library + 1.1.0-SNAPSHOT + diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/Resource_sweeper.gwt.xml b/src/main/java/org/gcube/portlets/admin/resourcesweeper/Resource_sweeper.gwt.xml index aeb30aa..f4f9bc4 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/Resource_sweeper.gwt.xml +++ b/src/main/java/org/gcube/portlets/admin/resourcesweeper/Resource_sweeper.gwt.xml @@ -6,7 +6,10 @@ - + + + + diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/client/Resource_sweeper.java b/src/main/java/org/gcube/portlets/admin/resourcesweeper/client/Resource_sweeper.java index 670e841..c34beea 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/client/Resource_sweeper.java +++ b/src/main/java/org/gcube/portlets/admin/resourcesweeper/client/Resource_sweeper.java @@ -1,5 +1,7 @@ package org.gcube.portlets.admin.resourcesweeper.client; +import org.gcube.portlets.admin.resourcesweeper.client.dialog.SweeperDialog; + import com.google.gwt.core.client.EntryPoint; /** @@ -12,6 +14,6 @@ public class Resource_sweeper implements EntryPoint { */ public void onModuleLoad() { //### Just for testing leave commented - //snew SweeperDialog("/gcube/devNext"); + new SweeperDialog("/gcube/devNext"); } } diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/Sweeper.java b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/Sweeper.java index ee9f606..e8eed9b 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/Sweeper.java +++ b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/Sweeper.java @@ -16,6 +16,7 @@ package org.gcube.portlets.admin.resourcesweeper.server; +import java.util.ArrayList; import java.util.List; 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.scope.GCUBEScope; 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.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.RunningInstanceManager; @@ -46,11 +47,8 @@ public class Sweeper { static GCUBEClientLog _log = new GCUBEClientLog(Sweeper.class); - protected static final List applyQuery( - final GCUBEScope queryScope, - final QueryLocation queryPath, - final QueryParameter... params - ) throws Exception { + + protected ArrayList applyQuery(GCUBEScope queryScope, QueryLocation queryPath, QueryParameter... params) throws Exception { ISClient client = GHNContext.getImplementation(ISClient.class); GCUBEGenericQuery isQuery = null; isQuery = client.getQuery(GCUBEGenericQuery.class); @@ -59,7 +57,7 @@ public class Sweeper { isQuery.addParameters(params); } List results = client.execute(isQuery, queryScope); - List retval = new Vector(); + ArrayList retval = new ArrayList(); for (XMLResult elem : results) { // Removes the resources with no ID or empty @@ -81,7 +79,7 @@ public class Sweeper { * @param queryScope * @return */ - public static final List getExpiredGHNs(final GCUBEScope queryScope) { + public ArrayList getExpiredGHNs(final GCUBEScope queryScope) { try { return applyQuery( queryScope, @@ -92,7 +90,7 @@ public class Sweeper { return null; } } - public static final List getDeadGHNs(final GCUBEScope queryScope) { + public ArrayList getDeadGHNs(GCUBEScope queryScope) { try { return applyQuery( queryScope, @@ -103,7 +101,7 @@ public class Sweeper { } } - public static final List getOrphanRI(final GCUBEScope queryScope) { + public ArrayList getOrphanRI(GCUBEScope queryScope) { try { return applyQuery( queryScope, @@ -115,7 +113,7 @@ public class Sweeper { } @SuppressWarnings("deprecation") - public static final void applySweep(final GCUBEScope queryScope, final List elems) { + public void applySweep(GCUBEScope queryScope, List elems) { for (ModelData entry : elems) { try { SweeperActions action = SweeperActions.valueOf(((Object) entry.get("Actions")).toString()); diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/SweeperServiceImpl.java b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/SweeperServiceImpl.java index 5bd79ed..a656ba4 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/SweeperServiceImpl.java +++ b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/SweeperServiceImpl.java @@ -46,16 +46,17 @@ public class SweeperServiceImpl extends RemoteServiceServlet implements SweeperS */ @Override public List getSweepElems(String scope, SweeperActions action) { + Sweeper sweeper = new Sweeper(); try { switch (action) { case GET_GHN_MOVE_TO_UNREACHABLE: { - List ghnList = Sweeper.getExpiredGHNs(GCUBEScope.getScope(scope)); + List ghnList = sweeper.getExpiredGHNs(GCUBEScope.getScope(scope)); return filterExpiredGHNs(ghnList); } case GET_GHN_DELETE: - return Sweeper.getDeadGHNs(GCUBEScope.getScope(scope)); + return sweeper.getDeadGHNs(GCUBEScope.getScope(scope)); case GET_RI_DELETE: - return Sweeper.getOrphanRI(GCUBEScope.getScope(scope)); + return sweeper.getOrphanRI(GCUBEScope.getScope(scope)); default: return null; } @@ -70,8 +71,9 @@ public class SweeperServiceImpl extends RemoteServiceServlet implements SweeperS */ @Override public void applySweep(String scope, List elems) { + Sweeper sweeper = new Sweeper(); try { - Sweeper.applySweep(GCUBEScope.getScope(scope), elems); + sweeper.applySweep(GCUBEScope.getScope(scope), elems); } catch (Exception e) { _log.error(e.getMessage()); e.printStackTrace(); diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLoader.java b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLoader.java deleted file mode 100644 index 65d3909..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLoader.java +++ /dev/null @@ -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 Daniele Strollo - ***************************************************************************/ - -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 cachedQueries = new HashMap(); - 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; - } -} - diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLocation.java b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLocation.java deleted file mode 100644 index 7e6638e..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/QueryLocation.java +++ /dev/null @@ -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 Daniele Strollo - ***************************************************************************/ - -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); - } -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getResourceByID.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getResourceByID.xq deleted file mode 100644 index ed81f47..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getResourceByID.xq +++ /dev/null @@ -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/')//Resource -where $resource/ID/string() eq '' -return $resource \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getWSResourceByID.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getWSResourceByID.xq deleted file mode 100644 index fe85999..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/getWSResourceByID.xq +++ /dev/null @@ -1,4 +0,0 @@ - -for $resource in collection("/db/Properties")//Document -where $resource/ID/string() eq '' -return $resource \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Collection.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Collection.xq deleted file mode 100644 index 2c9b328..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Collection.xq +++ /dev/null @@ -1,22 +0,0 @@ - - -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' - - return - - {$profiles//Resource/ID} - {$profiles//Resource/Type/text()} - {$subtype} - {$scopes} - {$profiles//Resource/Profile/Name/text()} - {$profiles//Resource/Profile/Body/CollectionInfo/creationTime/text()} - {$wsresource/LastUpdateHuman/text()} - {$wsresource//child::*[local-name()='Cardinality']/text()} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GHN.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GHN.xq deleted file mode 100644 index 675a2d8..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GHN.xq +++ /dev/null @@ -1,30 +0,0 @@ - - - -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() - - return - - {$profiles//Resource/ID} - {$profiles//Resource/Type/text()} - {$subtype} - {$profiles//Resource/Profile/GHNDescription/Status/text()} - {$profiles//Resource/Profile/GHNDescription/Name/text()} - {$profiles//Resource/Profile/GHNDescription/Uptime/text()} - {$profiles//Resource/Profile/GHNDescription/LastUpdate/text()} - {$profiles//Resource/Profile/GHNDescription/LocalAvailableSpace/text()} - {$profiles//Resource/Profile/GHNDescription/MainMemory/string(@VirtualSize)} - {$profiles//Resource/Profile/GHNDescription/MainMemory/string(@VirtualAvailable)} - {$profiles//Resource/Profile/GHNDescription/Load/string(@Last1Min)} - {$profiles//Resource/Profile/GHNDescription/Load/string(@Last5Min)} - {$profiles//Resource/Profile/GHNDescription/Load/string(@Last15Min)} - {$gcf-version} - {$ghn-version} - {$scopes} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GenericResource.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GenericResource.xq deleted file mode 100644 index 472a7d6..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/GenericResource.xq +++ /dev/null @@ -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() - - return - - {$profiles//Resource/ID} - {$profiles//Resource/Type/text()} - {$subtype} - {$scopes} - {$profiles//Resource/Profile/Name/text()} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RunningInstance.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RunningInstance.xq deleted file mode 100644 index ac8dd3a..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RunningInstance.xq +++ /dev/null @@ -1,26 +0,0 @@ - - -for $profiles in collection('/db/Profiles/RunningInstance')//Resource - -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() - - return - - {$profiles/ID} - {$profiles/Type/text()} - {$subtype} - {$scopes} - {$profiles/Profile/ServiceClass/text()} - {$profiles/Profile/ServiceName/text()} - {$profiles/Profile/Version/text()} - {$profiles/Profile/DeploymentData/Status/text()} - {$ghn-name} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RuntimeResource.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RuntimeResource.xq deleted file mode 100644 index 7e36fe7..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/RuntimeResource.xq +++ /dev/null @@ -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() - - return - - {$profiles//Resource/ID} - {$profiles//Resource/Type/text()} - {$subtype} - {$scopes} - {$profiles//Resource/Profile/Name/text()} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Service.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Service.xq deleted file mode 100644 index 215ea0d..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/Service.xq +++ /dev/null @@ -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() - - return - - {$profiles//Resource/ID} - {$profiles//Resource/Type/text()} - {$subtype} - {$scopes} - {$profiles//Resource/Profile/Class/text()} - {$profiles//Resource/Profile/Name/text()} - - {$profiles//Resource/Profile/Packages/Software[1]/Version/text()} - {$profiles//Resource/Profile/Packages/Software/Shareable/string(@level)} - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/VIEW.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/VIEW.xq deleted file mode 100644 index 641e7d8..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/resources/VIEW.xq +++ /dev/null @@ -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 - - {$outer//Document/ID} - {$outer//Document/Source} - {$outer//Document/SourceKey} - {$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='property']/child::*[local-name()='name' and text()='name']/../child::*[local-name()='value']/text()} - {$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='cardinality']/text()} - {$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='type']/text()} - {$outer//Document/Data/child::*[local-name()='View']/child::*[local-name()='collectionID']/text()} - {$outer//Document/Data/child::*[local-name()='ServiceClass']/text()} - {$outer//Document/Data/child::*[local-name()='ServiceName']/text()} - {$outer//Document/Data/child::*[local-name()='ServiceClass']/text()} - {$outer//Document/TerminationTimeHuman} {$outer//Document/LastUpdateHuman} - {$outer//Document/Data/child::*[local-name()='RI']/text()} - WSResource - {$outer//Document/Data/child::*[local-name()='Scope']/text()} - diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/deadGhns.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/deadGhns.xq deleted file mode 100644 index 86d266e..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/deadGhns.xq +++ /dev/null @@ -1,29 +0,0 @@ - -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 - - {$GHNs/ID} - {$GHNs/Profile/GHNDescription/Name} - {$GHNs/Profile/GHNDescription/Status} - {$GHNs/Profile/GHNDescription/Type} - {$GHNs/Profile/Site/Location} - {$GHNs/Profile/Site/Domain} - {$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()} - - {$scopes} - {count($RIinstalled)} - {$GHNs/Profile/GHNDescription/LastUpdate} - {$totalminutes} - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/expiredGhns.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/expiredGhns.xq deleted file mode 100644 index 327987b..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/expiredGhns.xq +++ /dev/null @@ -1,27 +0,0 @@ - -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 - - {$GHNs/ID} - {$GHNs/Profile/GHNDescription/Name} - {$GHNs/Profile/GHNDescription/Status} - {$GHNs/Profile/GHNDescription/Type} - {$GHNs/Profile/Site/Location} - {$GHNs/Profile/Site/Domain} - {$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()} - - {$scopes} - {count($RIinstalled)} - {$GHNs/Profile/GHNDescription/LastUpdate} - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/orphanRI.xq b/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/orphanRI.xq deleted file mode 100644 index ebac355..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcesweeper/server/queries/xquery/sweeper/orphanRI.xq +++ /dev/null @@ -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 - - {$ri//Resource/ID/string()} - {$ri/Profile/DeploymentData/Status/string()} - {$ri/Profile/DeploymentData/ActivationTime/@value/string()} - {$ri/Profile/GHN/@UniqueID/string()} - {$ri/Profile/ServiceClass/string()} - {$ri/Profile/ServiceName/string()} - - - - \ No newline at end of file