diff --git a/.classpath b/.classpath index 4035493..7f04816 100644 --- a/.classpath +++ b/.classpath @@ -35,5 +35,17 @@ + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java index f75bc39..5803001 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java @@ -127,7 +127,7 @@ public class ResourceDetailsPanel { }; groupButton.setId(btnGroupID); groupButton.setIconStyle("grid-icon"); - groupButton.setToolTip("Enables/Disables grouping by " + this.collapsibleColumn); + groupButton.setToolTip("Categorize"); this.toolBar.add(new SeparatorToolItem()); this.toolBar.add(groupButton); @@ -140,7 +140,7 @@ public class ResourceDetailsPanel { }; refreshButton.setId(btnRefreshID); refreshButton.setIconStyle("refresh-icon"); - refreshButton.setToolTip("Refresh grid"); + refreshButton.setToolTip("Refresh"); this.toolBar.add(refreshButton); this.rootPanel.setTopComponent(this.toolBar); diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java index aa82529..44e40e0 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java @@ -16,7 +16,10 @@ package org.gcube.portlets.admin.resourcemanagement.server; +import static org.gcube.resources.discovery.icclient.ICFactory.client; + import java.io.File; +import java.io.StringReader; import java.security.InvalidParameterException; import java.util.ArrayList; import java.util.HashMap; @@ -25,13 +28,11 @@ import java.util.Map; import java.util.Vector; import javax.servlet.http.HttpSession; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; -import org.gcube.common.core.contexts.GHNContext; -import org.gcube.common.core.informationsystem.client.ISClient; -import org.gcube.common.core.informationsystem.client.QueryParameter; -import org.gcube.common.core.informationsystem.client.XMLResult; -import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery; -import org.gcube.common.core.scope.GCUBEScope; +import org.gcube.common.resources.gcore.utils.XPathHelper; +import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy; import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler; @@ -56,8 +57,11 @@ import org.gcube.resourcemanagement.support.shared.types.UserGroup; import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile; import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; import org.gcube.resourcemanagement.support.shared.util.Assertion; +import org.gcube.resources.discovery.client.api.DiscoveryClient; +import org.gcube.resources.discovery.client.queries.impl.QueryTemplate; import org.gcube.vremanagement.resourcemanager.client.RMReportingLibrary; -import org.gcube.vremanagement.resourcemanager.stubs.reporting.ReportingPortType; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; import com.google.gwt.core.client.GWT; import com.google.gwt.user.server.rpc.RemoteServiceServlet; @@ -222,7 +226,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro public final Tuple checkDeployStatus(final String scope, final String deployID) throws Exception { if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(this.getCurrentStatus().getCredentials())) { - GCUBEScope sourceScope = ScopeManager.getScope(scope); + ScopeBean sourceScope = ScopeManager.getScope(scope); RMReportingLibrary manager = ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getReportResourceManager(sourceScope.toString()); String xmlReport = manager.getReport(deployID); @@ -236,34 +240,30 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro public final List getAvailableScopes() { ServerConsole.trace(LOG_PREFIX, "[GET-SCOPES] getting available scopes"); - GWT.log("The CONTEXT PATH is: " + this.getScopeDataPath()); Vector retval = new Vector(); - try { - Map scopes = ScopeManager.getAvailableScopes(); - for (GCUBEScope scope : scopes.values()) { - //if ((scope.getType().compareTo(Type.INFRASTRUCTURE) == 0) - // || (scope.getType().compareTo(Type.VO) == 0)) { + Map scopes = ScopeManager.getAvailableScopes(); + for (ScopeBean scope : scopes.values()) retval.add(scope.toString()); - //} - } + return retval; } catch (Exception e) { retval.add("/gcube"); retval.add("/gcube/devsec"); + e.printStackTrace(); } + return retval; } public final List getAvailableAddScopes() { List retval = new Vector(); try { - GCUBEScope currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()); + ScopeBean currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()); List scopes = this.getAvailableScopes(); for (String scope : scopes) { - GCUBEScope trgScope = ScopeManager.getScope(scope); - if (trgScope.isEnclosedIn(currScope)) { - retval.add(trgScope.toString()); + if (scope.contains(currScope.toString())) { + retval.add(scope); } } return retval; @@ -311,41 +311,45 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro } } - public final ResourceDescriptor getGenericResourceDescriptor(final String scope, final String resID) - throws Exception { + public final ResourceDescriptor getGenericResourceDescriptor(final String scope, final String resID) throws Exception { return this.getDescriptor(ScopeManager.getScope(scope), resID); } - private ResourceDescriptor getDescriptor(final GCUBEScope scope, final String resID) - throws Exception { - ISClient client = GHNContext.getImplementation(ISClient.class); - GCUBEGenericQuery isQuery = null; - isQuery = client.getQuery(GCUBEGenericQuery.class); + private ResourceDescriptor getDescriptor(final ScopeBean scope, final String resID) throws Exception { - isQuery.setExpression(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID)); - isQuery.addParameters( - new QueryParameter("RES_ID", resID), - new QueryParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name()) - ); - List results = client.execute(isQuery, scope); + //set the scope + String currScope = ScopeProvider.instance.get(); + ScopeProvider.instance.set(scope.toString()); + + QueryTemplate isQuery = null; + DiscoveryClient client = client(); + + isQuery = new QueryTemplate(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID)); + + isQuery.addParameter("RES_ID", resID); + isQuery.addParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name()); + + List results = client.submit(isQuery); if (results != null && results.size() > 0) { ResourceDescriptor retval = new ResourceDescriptor(); - XMLResult node = results.get(0); - + List currValue = null; - - currValue = node.evaluate("/Resource/ID/text()"); + DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Node node = docBuilder.parse(new InputSource(new StringReader(results.get(0)))).getDocumentElement(); + XPathHelper helper = new XPathHelper(node); + + currValue = helper.evaluate("/Resource/ID/text()"); if (currValue != null && currValue.size() > 0) { retval.setID(currValue.get(0)); } - currValue = node.evaluate("/Resource/Profile/Name/text()"); + currValue = helper.evaluate("/Resource/Profile/Name/text()"); if (currValue != null && currValue.size() > 0) { retval.setName(currValue.get(0)); } - currValue = node.evaluate("/Resource/Profile/Body/node()"); + currValue = helper.evaluate("/Resource/Profile/Body/node()"); if (currValue != null && currValue.size() > 0) { StringBuilder bodytext = new StringBuilder(); for (String line : currValue) { @@ -357,7 +361,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro } - currValue = node.evaluate("/Resource/Profile/Description/text()"); + currValue = helper.evaluate("/Resource/Profile/Description/text()"); if (currValue != null && currValue.size() > 0) { retval.set("Description", currValue.get(0)); } else { @@ -365,7 +369,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro } - currValue = node.evaluate("/Resource/Profile/SecondaryType/text()"); + currValue = helper.evaluate("/Resource/Profile/SecondaryType/text()"); if (currValue != null && currValue.size() > 0) { retval.set("SecondaryType", currValue.get(0)); } else { @@ -469,7 +473,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro private CurrentStatus getCurrentStatus() { return StatusHandler.getStatus(this.getHttpSession()); } - + private CacheManager getCacheManager(CurrentStatus status) { CacheManager cm = new CacheManager(); cm.setUseCache(status.useCache()); diff --git a/src/main/webapp/WEB-INF/xml/scopedata.xml b/src/main/webapp/WEB-INF/xml/scopedata.xml index 926cc04..7dfd3d2 100644 --- a/src/main/webapp/WEB-INF/xml/scopedata.xml +++ b/src/main/webapp/WEB-INF/xml/scopedata.xml @@ -18,12 +18,7 @@ d4science/gCubeApps ServiceMap_gCubeApps.xml /d4science.research-infrastructures.eu/gCubeApps - - - d4science/Ecosystem - ServiceMap_Ecosystem.xml - /d4science.research-infrastructures.eu/Ecosystem - + d4science/EUBrazilOpenBio ServiceMap_EUBrazilOpenBio.xml diff --git a/src/main/webapp/WEB-INF/xml/scopedata_admin.xml b/src/main/webapp/WEB-INF/xml/scopedata_admin.xml index 926cc04..fe2d6f7 100644 --- a/src/main/webapp/WEB-INF/xml/scopedata_admin.xml +++ b/src/main/webapp/WEB-INF/xml/scopedata_admin.xml @@ -19,11 +19,6 @@ ServiceMap_gCubeApps.xml /d4science.research-infrastructures.eu/gCubeApps - - d4science/Ecosystem - ServiceMap_Ecosystem.xml - /d4science.research-infrastructures.eu/Ecosystem - d4science/EUBrazilOpenBio ServiceMap_EUBrazilOpenBio.xml diff --git a/src/main/webapp/conf/resourcemanagement.properties b/src/main/webapp/conf/resourcemanagement.properties index 6e268cd..88eadbd 100644 --- a/src/main/webapp/conf/resourcemanagement.properties +++ b/src/main/webapp/conf/resourcemanagement.properties @@ -2,7 +2,7 @@ # The user and its credentials # Possible values for credentials: # [USER,ADMIN,DEBUG] -USER_CREDENTIALS = DEBUG +USER_CREDENTIALS = ADMIN # Defines the modality in which the portlet is running # possible values [STANDALONE,PORTAL,NOTDEFINED] @@ -11,7 +11,7 @@ RUNNING_MODE = STANDALONE DEFAULT_USER = massimiliano.assante # The scope that will be used as default -DEFAULT_SCOPE =/d4science.research-infrastructures.eu/gCubeApps +DEFAULT_SCOPE =/gcube/devsec # the target of update notification (if in singleton mode) # mails MUST be separated by ; USERMAIL_TO = m.assante@gmail.com diff --git a/src/main/webapp/images/icons/grid.png b/src/main/webapp/images/icons/grid.png index c4da495..2ea5dc4 100644 Binary files a/src/main/webapp/images/icons/grid.png and b/src/main/webapp/images/icons/grid.png differ diff --git a/src/main/webapp/images/icons/refresh.png b/src/main/webapp/images/icons/refresh.png index 328c1fd..85f47cd 100644 Binary files a/src/main/webapp/images/icons/refresh.png and b/src/main/webapp/images/icons/refresh.png differ