From 3a26651d3da72b5244a7e9806b5be638a0ef4a9f Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Thu, 12 Sep 2013 16:47:38 +0000 Subject: [PATCH] gCore almost removed git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/resource-management@81324 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 12 +++ .../resourcedetails/ResourceDetailsPanel.java | 4 +- .../server/ServiceProxyImpl.java | 88 +++++++++--------- src/main/webapp/WEB-INF/xml/scopedata.xml | 7 +- .../webapp/WEB-INF/xml/scopedata_admin.xml | 5 - .../webapp/conf/resourcemanagement.properties | 4 +- src/main/webapp/images/icons/grid.png | Bin 513 -> 398 bytes src/main/webapp/images/icons/refresh.png | Bin 507 -> 1783 bytes 8 files changed, 63 insertions(+), 57 deletions(-) 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 c4da495db39a9a876e89e67371fab75f3f7ae504..2ea5dc45ec0e027a8a435d900a80b172f3846d4a 100644 GIT binary patch delta 372 zcmV-)0gL{D1daocBYy!^NklKvheT^SXe3;TeT3u5Q0b$i!_!dod(fhaooB4joBqER@sfd{ym17Q6fTi z=c3{oGvgUU94xJ|wSH}E{7TyZzPwzRCX;sYgWXU{(R{HvxPQ7%0oa`;PBOu5T>zmw zim~BD;DiB#)7m|&IU+(F&XvMaPAd#NZcWYxvEFdmlt5x`kIVlagT_GA5K4j8@WbL6 z7zzTu{AXc>zGM>-6%i2L|7KV(?hl4L@SUgR9gWv&tO>HIiNFa1|9;ZiKCU`Oh=o>F zthN&dN^5*=iEXPLsgfK2?YZ8(coOFgP?o~7tum1Be4;x)wX_H$FR^w&JtN<6%h1jKLBAsw03<>JYdlqo&ZWj_zoY(YkvbY SY2m{F0000#` delta 488 zcmVt9vP*jK+QU@{I zevw`G5`|G9UAhK!5(Ei42tkL`K(N5bXoH1F$XnnsJb3k#yMOBL%rx`uCJ0^h(g(xG zn`Pg7-7fbK^9DEsd`3~VT8)oS z!M1Ifk>}t|*MIsrxV!>S<$GW}2f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