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
This commit is contained in:
Massimiliano Assante 2013-09-12 16:47:38 +00:00
parent c099f1f4e8
commit 3a26651d3d
8 changed files with 63 additions and 57 deletions

View File

@ -35,5 +35,17 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="lib" path="/Applications/eclipse 4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-user.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Applications/eclipse%204.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Applications/eclipse 4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-dev.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Applications/eclipse%204.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Applications/eclipse 4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="lib" path="/Applications/eclipse 4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA.jar" sourcepath="/Applications/eclipse 4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="output" path="target/resource-management-4.1.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/resource-management-4.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -127,7 +127,7 @@ public class ResourceDetailsPanel {
}; };
groupButton.setId(btnGroupID); groupButton.setId(btnGroupID);
groupButton.setIconStyle("grid-icon"); groupButton.setIconStyle("grid-icon");
groupButton.setToolTip("Enables/Disables grouping by " + this.collapsibleColumn); groupButton.setToolTip("Categorize");
this.toolBar.add(new SeparatorToolItem()); this.toolBar.add(new SeparatorToolItem());
this.toolBar.add(groupButton); this.toolBar.add(groupButton);
@ -140,7 +140,7 @@ public class ResourceDetailsPanel {
}; };
refreshButton.setId(btnRefreshID); refreshButton.setId(btnRefreshID);
refreshButton.setIconStyle("refresh-icon"); refreshButton.setIconStyle("refresh-icon");
refreshButton.setToolTip("Refresh grid"); refreshButton.setToolTip("Refresh");
this.toolBar.add(refreshButton); this.toolBar.add(refreshButton);
this.rootPanel.setTopComponent(this.toolBar); this.rootPanel.setTopComponent(this.toolBar);

View File

@ -16,7 +16,10 @@
package org.gcube.portlets.admin.resourcemanagement.server; package org.gcube.portlets.admin.resourcemanagement.server;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.File; import java.io.File;
import java.io.StringReader;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -25,13 +28,11 @@ import java.util.Map;
import java.util.Vector; import java.util.Vector;
import javax.servlet.http.HttpSession; 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.resources.gcore.utils.XPathHelper;
import org.gcube.common.core.informationsystem.client.ISClient; import org.gcube.common.scope.api.ScopeProvider;
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.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy; import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy;
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler; 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.CompleteResourceProfile;
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
import org.gcube.resourcemanagement.support.shared.util.Assertion; 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.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.core.client.GWT;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@ -222,7 +226,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
public final Tuple<String> checkDeployStatus(final String scope, final String deployID) throws Exception { public final Tuple<String> checkDeployStatus(final String scope, final String deployID) throws Exception {
if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(this.getCurrentStatus().getCredentials())) { if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(this.getCurrentStatus().getCredentials())) {
GCUBEScope sourceScope = ScopeManager.getScope(scope); ScopeBean sourceScope = ScopeManager.getScope(scope);
RMReportingLibrary manager = RMReportingLibrary manager =
ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getReportResourceManager(sourceScope.toString()); ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getReportResourceManager(sourceScope.toString());
String xmlReport = manager.getReport(deployID); String xmlReport = manager.getReport(deployID);
@ -236,34 +240,30 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
public final List<String> getAvailableScopes() { public final List<String> getAvailableScopes() {
ServerConsole.trace(LOG_PREFIX, "[GET-SCOPES] getting available scopes"); ServerConsole.trace(LOG_PREFIX, "[GET-SCOPES] getting available scopes");
GWT.log("The CONTEXT PATH is: " + this.getScopeDataPath());
Vector<String> retval = new Vector<String>(); Vector<String> retval = new Vector<String>();
try { try {
Map<String, GCUBEScope> scopes = ScopeManager.getAvailableScopes(); Map<String, ScopeBean> scopes = ScopeManager.getAvailableScopes();
for (GCUBEScope scope : scopes.values()) { for (ScopeBean scope : scopes.values())
//if ((scope.getType().compareTo(Type.INFRASTRUCTURE) == 0)
// || (scope.getType().compareTo(Type.VO) == 0)) {
retval.add(scope.toString()); retval.add(scope.toString());
//}
}
return retval; return retval;
} catch (Exception e) { } catch (Exception e) {
retval.add("/gcube"); retval.add("/gcube");
retval.add("/gcube/devsec"); retval.add("/gcube/devsec");
e.printStackTrace();
} }
return retval; return retval;
} }
public final List<String> getAvailableAddScopes() { public final List<String> getAvailableAddScopes() {
List<String> retval = new Vector<String>(); List<String> retval = new Vector<String>();
try { try {
GCUBEScope currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()); ScopeBean currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope());
List<String> scopes = this.getAvailableScopes(); List<String> scopes = this.getAvailableScopes();
for (String scope : scopes) { for (String scope : scopes) {
GCUBEScope trgScope = ScopeManager.getScope(scope); if (scope.contains(currScope.toString())) {
if (trgScope.isEnclosedIn(currScope)) { retval.add(scope);
retval.add(trgScope.toString());
} }
} }
return retval; return retval;
@ -311,41 +311,45 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
} }
} }
public final ResourceDescriptor getGenericResourceDescriptor(final String scope, final String resID) public final ResourceDescriptor getGenericResourceDescriptor(final String scope, final String resID) throws Exception {
throws Exception {
return this.getDescriptor(ScopeManager.getScope(scope), resID); return this.getDescriptor(ScopeManager.getScope(scope), resID);
} }
private ResourceDescriptor getDescriptor(final GCUBEScope scope, final String resID) private ResourceDescriptor getDescriptor(final ScopeBean scope, final String resID) throws Exception {
throws Exception {
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBEGenericQuery isQuery = null;
isQuery = client.getQuery(GCUBEGenericQuery.class);
isQuery.setExpression(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID));
isQuery.addParameters(
new QueryParameter("RES_ID", resID),
new QueryParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name())
);
List<XMLResult> results = client.execute(isQuery, scope); //set the scope
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
QueryTemplate isQuery = null;
DiscoveryClient<String> client = client();
isQuery = new QueryTemplate(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID));
isQuery.addParameter("RES_ID", resID);
isQuery.addParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name());
List<String> results = client.submit(isQuery);
if (results != null && results.size() > 0) { if (results != null && results.size() > 0) {
ResourceDescriptor retval = new ResourceDescriptor(); ResourceDescriptor retval = new ResourceDescriptor();
XMLResult node = results.get(0);
List<String> currValue = null; List<String> currValue = null;
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(results.get(0)))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
currValue = node.evaluate("/Resource/ID/text()"); currValue = helper.evaluate("/Resource/ID/text()");
if (currValue != null && currValue.size() > 0) { if (currValue != null && currValue.size() > 0) {
retval.setID(currValue.get(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) { if (currValue != null && currValue.size() > 0) {
retval.setName(currValue.get(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) { if (currValue != null && currValue.size() > 0) {
StringBuilder bodytext = new StringBuilder(); StringBuilder bodytext = new StringBuilder();
for (String line : currValue) { 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) { if (currValue != null && currValue.size() > 0) {
retval.set("Description", currValue.get(0)); retval.set("Description", currValue.get(0));
} else { } 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) { if (currValue != null && currValue.size() > 0) {
retval.set("SecondaryType", currValue.get(0)); retval.set("SecondaryType", currValue.get(0));
} else { } else {

View File

@ -19,11 +19,6 @@
<src>ServiceMap_gCubeApps.xml</src> <src>ServiceMap_gCubeApps.xml</src>
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope> <scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
</vo> </vo>
<vo>
<name>d4science/Ecosystem</name>
<src>ServiceMap_Ecosystem.xml</src>
<scope>/d4science.research-infrastructures.eu/Ecosystem</scope>
</vo>
<vo> <vo>
<name>d4science/EUBrazilOpenBio</name> <name>d4science/EUBrazilOpenBio</name>
<src>ServiceMap_EUBrazilOpenBio.xml</src> <src>ServiceMap_EUBrazilOpenBio.xml</src>

View File

@ -19,11 +19,6 @@
<src>ServiceMap_gCubeApps.xml</src> <src>ServiceMap_gCubeApps.xml</src>
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope> <scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
</vo> </vo>
<vo>
<name>d4science/Ecosystem</name>
<src>ServiceMap_Ecosystem.xml</src>
<scope>/d4science.research-infrastructures.eu/Ecosystem</scope>
</vo>
<vo> <vo>
<name>d4science/EUBrazilOpenBio</name> <name>d4science/EUBrazilOpenBio</name>
<src>ServiceMap_EUBrazilOpenBio.xml</src> <src>ServiceMap_EUBrazilOpenBio.xml</src>

View File

@ -2,7 +2,7 @@
# The user and its credentials # The user and its credentials
# Possible values for credentials: # Possible values for credentials:
# [USER,ADMIN,DEBUG] # [USER,ADMIN,DEBUG]
USER_CREDENTIALS = DEBUG USER_CREDENTIALS = ADMIN
# Defines the modality in which the portlet is running # Defines the modality in which the portlet is running
# possible values [STANDALONE,PORTAL,NOTDEFINED] # possible values [STANDALONE,PORTAL,NOTDEFINED]
@ -11,7 +11,7 @@ RUNNING_MODE = STANDALONE
DEFAULT_USER = massimiliano.assante DEFAULT_USER = massimiliano.assante
# The scope that will be used as default # 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) # the target of update notification (if in singleton mode)
# mails MUST be separated by ; # mails MUST be separated by ;
USERMAIL_TO = m.assante@gmail.com USERMAIL_TO = m.assante@gmail.com

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 1.7 KiB