gCore dep removed except for logging

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/rmp-common-library@81325 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-09-12 16:47:59 +00:00
parent 878cc7ffc5
commit 756f7a96d7
21 changed files with 260 additions and 293 deletions

View File

@ -12,7 +12,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT (5)"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>

23
pom.xml
View File

@ -35,6 +35,12 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- Google Web Toolkit (GWT) -->
<dependency>
<groupId>com.google.gwt</groupId>
@ -49,23 +55,6 @@
<version>2.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>ghn-client-runtime</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.resourcemanagement</groupId> -->
<!-- <artifactId>resource-manager-stubs</artifactId> -->
<!-- <version>[2.0.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version> -->
<!-- </dependency> -->
<!-- FWS DEPS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>

View File

@ -42,12 +42,6 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.ISClient;
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.core.utils.logging.GCUBEClientLog;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
@ -79,7 +73,6 @@ import org.xml.sax.SAXException;
* @author Daniele Strollo
*/
public class ISClientRequester {
static GCUBEClientLog _log = new GCUBEClientLog(ISClientRequester.class);
private static final ISQueryCache CACHE = new ISQueryCache();
private static final String LOG_PREFIX = "[ISCLIENT-REQS]";
@ -254,7 +247,7 @@ public class ISClientRequester {
retval.put(type, subtypes);
}
} catch (Exception e) {
_log.error(LOG_PREFIX, e);
ServerConsole.error(LOG_PREFIX, e);
}
}
@ -301,8 +294,8 @@ public class ISClientRequester {
DiscoveryClient<String> client = client();
isQuery.addParameter("RES_ID", id.trim());
//add the return statement
isQuery.addParameter("RESOURCE", QueryLoader.getQuery(QueryLocation.valueOf("LIST_RELATED_RETURN_" + type)));
ISQueryCacheKeyT cacheKey = new ISQueryCacheKeyT(queryScope.toString(), isQuery.expression(), "getResourceRelated");
@ -317,6 +310,7 @@ public class ISClientRequester {
}
}
if (resultz == null || resultz.size() == 0) {
ServerConsole.debug(LOG_PREFIX, "[getResourcesRelated] Got No Results");
return null;
}
// ENDOF Handle cache
@ -583,32 +577,36 @@ public class ISClientRequester {
return null;
}
public static Map<String, GenericResourcePlugin> getGenericResourcePlugins(final GCUBEScope scope) throws Exception {
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBEGenericQuery isQuery = null;
isQuery = client.getQuery(GCUBEGenericQuery.class);
isQuery.setExpression(QueryLoader.getQuery(QueryLocation.GET_GENERIC_RESOURCE_PLUGINS));
List<XMLResult> results = client.execute(isQuery, scope);
public static Map<String, GenericResourcePlugin> getGenericResourcePlugins(final ScopeBean scope) throws Exception {
//set the scope
ScopeProvider.instance.set(scope.toString());
Query isQuery = new QueryBox(QueryLoader.getQuery(QueryLocation.GET_GENERIC_RESOURCE_PLUGINS));
DiscoveryClient<String> client = client();
List<String> resultz= client.submit(isQuery);
Map<String, GenericResourcePlugin> retval = new HashMap<String, GenericResourcePlugin>();
gonext: for (XMLResult plugin : results) {
gonext: for (String plugin : resultz) {
try {
for (String entry : plugin.evaluate("/CMPlugins/Plugin/Entry")) {
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(plugin))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
for (String entry : helper.evaluate("/CMPlugins/Plugin/Entry")) {
Document doc = ScopeManager.getDocumentGivenXML(entry);
String name = doc.getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-PLUGIN] found: *** name " + name);
ServerConsole.trace("[LOAD-PLUGIN] found: *** name " + name);
String pluginType = doc.getElementsByTagName("Type").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-PLUGIN] found: *** type " + pluginType);
ServerConsole.trace("[LOAD-PLUGIN] found: *** type " + pluginType);
String description = doc.getElementsByTagName("description").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-PLUGIN] found: *** description " + description);
ServerConsole.trace("[LOAD-PLUGIN] found: *** description " + description);
String namespace = null;
try {
namespace = doc.getElementsByTagName("namespace").item(0).getFirstChild().getNodeValue();
_log.debug("[LOAD-PLUGIN] found: *** namespace " + namespace);
ServerConsole.debug("[LOAD-PLUGIN] found: *** namespace " + namespace);
} catch (Exception e) {
_log.warn("[LOAD-PLUGIN] namespace not found");
ServerConsole.warn("[LOAD-PLUGIN] namespace not found");
}
GenericResourcePlugin toAdd = new GenericResourcePlugin(name, namespace, description, pluginType);
@ -629,7 +627,7 @@ public class ISClientRequester {
}
}
_log.trace("[LOAD-PLUGIN] found: param " + paramName);
ServerConsole.trace("[LOAD-PLUGIN] found: param " + paramName);
GenericResourcePlugin.Field paramField = new GenericResourcePlugin.Field(paramName, GenericResourcePlugin.FieldType.string);
if (paramDefinition != null) {
@ -688,32 +686,36 @@ public class ISClientRequester {
* @return a map containing the plugin name as key and a List of formfield
* @throws Exception
*/
public static HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeManagerPlugins(final GCUBEScope scope) throws Exception {
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBEGenericQuery isQuery = null;
isQuery = client.getQuery(GCUBEGenericQuery.class);
isQuery.setExpression(QueryLoader.getQuery(QueryLocation.GET_GENERIC_RESOURCE_TREE_MANAGER_PLUGINS));
List<XMLResult> results = client.execute(isQuery, scope);
public static HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeManagerPlugins(final ScopeBean scope) throws Exception {
ScopeProvider.instance.set(scope.toString());
Query isQuery = new QueryBox(QueryLoader.getQuery(QueryLocation.GET_GENERIC_RESOURCE_TREE_MANAGER_PLUGINS));
DiscoveryClient<String> client = client();
List<String> resultz= client.submit(isQuery);
HashMap<String, ArrayList<TMPluginFormField>> retval = new HashMap<String, ArrayList<TMPluginFormField>>();
gonext: for (XMLResult plugin : results) {
gonext: for (String plugin : resultz) {
try {
for (String entry : plugin.evaluate("/TMPlugins/Plugin/Entry")) {
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(plugin))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
for (String entry : helper.evaluate("/TMPlugins/Plugin/Entry")) {
String requestName = null;
boolean foundRequest = false;
Document doc = ScopeManager.getDocumentGivenXML(entry);
String name = doc.getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-TMPLUGIN] found: *** name " + name);
ServerConsole.trace("[LOAD-TMPLUGIN] found: *** name " + name);
String pluginType = doc.getElementsByTagName("Type").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-TMPLUGIN] found: *** type " + pluginType);
ServerConsole.trace("[LOAD-TMPLUGIN] found: *** type " + pluginType);
String description = doc.getElementsByTagName("description").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-TMPLUGIN] found: *** description " + description);
ServerConsole.trace("[LOAD-TMPLUGIN] found: *** description " + description);
String namespace = null;
try {
namespace = doc.getElementsByTagName("namespace").item(0).getFirstChild().getNodeValue();
_log.trace("[LOAD-TMPLUGIN] found: *** namespace " + namespace);
ServerConsole.trace("[LOAD-TMPLUGIN] found: *** namespace " + namespace);
} catch (Exception e) {
_log.warn("[LOAD-TMPLUGIN] namespace not found");
ServerConsole.warn("[LOAD-TMPLUGIN] namespace not found");
}
NodeList params = doc.getElementsByTagName("param");

View File

@ -20,8 +20,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.common.core.informationsystem.client.XMLResult;
class ISQueryCacheKeyT {
String keyValue = null;
String queryExpression = null;

View File

@ -49,14 +49,18 @@ public enum QueryLocation {
// To retrieve the list of generic resources publishing plugins
// to deploy activation records
GET_GENERIC_RESOURCE_PLUGINS("getPlugins.xq"),
RETURN_GET_GENERIC_RESOURCE_PLUGINS("RETURN_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_RETURN_GHN("related/RETURN_GHN.xq"),
LIST_RELATED_RunningInstance("related/RunningInstance.xq"),
LIST_RELATED_RETURN_RunningInstance("related/RETURN_RunningInstance.xq"),
LIST_RELATED_Service("related/Service.xq"),
LIST_RELATED_RETURN_Service("related/RETURN_Service.xq"),
// Queries for sweeper
SWEEPER_EXPIRED_GHN("sweeper/expiredGhns.xq"),

View File

@ -1,4 +1,3 @@
for $_outer in collection("/db/Properties")//Document
where ($_outer//Document/Data/child::*[local-name()='ServiceClass']/text() = 'ContentManagement'
and exists($_outer/Data/child::*[local-name()='Plugin']/name))

View File

@ -15,11 +15,4 @@
for $ris in collection('/db/Profiles/RunningInstance')//Resource
where $ris//Resource/Profile/GHN/@UniqueID/string() eq '<RES_ID/>'
return
<Resource>
{$ris/ID}
{$ris/Profile/ServiceName}
{$ris/Profile/ServiceClass}
<ServiceVersion>{$ris//Resource/@version/string()}</ServiceVersion>
<MainVersion>{$ris/Profile/Version/text()}</MainVersion>
<Status>{$ris/Profile/DeploymentData/Status/text()}</Status>
</Resource>
<RESOURCE/>

View File

@ -0,0 +1,8 @@
<Resource>
{$ris/ID}
{$ris/Profile/ServiceName}
{$ris/Profile/ServiceClass}
<ServiceVersion>{$ris//Resource/@version/string()}</ServiceVersion>
<MainVersion>{$ris/Profile/Version/text()}</MainVersion>
<Status>{$ris/Profile/DeploymentData/Status/text()}</Status>
</Resource>

View File

@ -0,0 +1,45 @@
<Resources>
<Resource>
<Key>ID</Key>
<Value>{$ri//Resource/ID/string()}</Value>
</Resource>
<Resource>
<Key>ServiceStatus</Key>
<Value>{$ri/Profile/DeploymentData/Status/string()}</Value>
</Resource>
<Resource>
<Key>ActivationTime</Key>
<Value>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</Value>
</Resource>
<Resource>
<Key>GHNName</Key>
<Value>{$ghn-name}</Value>
</Resource>
<Resource>
<Key>GHNSite</Key>
<Value>{$relatedghn/Profile/Site/Domain/string()}</Value>
</Resource>
<Resource>
<Key>GHNStatus</Key>
<Value>{$relatedghn/Profile/GHNDescription/Status/string()}</Value>
</Resource>
<Resource>
<Key>GHNActivationTime</Key>
<Value>{$relatedghn/Profile/GHNDescription/ActivationTime/string()}</Value>
</Resource>
<Resource>
<Key>GHNLastUpdate</Key>
<Value>{$relatedghn/Profile/GHNDescription/LastUpdate/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad15Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last15Min/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad5Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last5Min/string()}</Value>
</Resource><Resource>
<Key>GHNLoad1Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last1Min/string()}</Value>
</Resource>
</Resources>

View File

@ -0,0 +1,21 @@
<Resource>
<!-- INFORMATION ABOUT THE RI -->
<RIID>{$ri/ID/string()}</RIID>
<ServiceStatus>{$ri/Profile/DeploymentData/Status/string()}</ServiceStatus>
<ActivationTime>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</ActivationTime>
<RIVersion>{$ri/Profile/Version/string()}</RIVersion>
<!-- INFORMATION about GHN -->
<GHNID>{$ghn-id}</GHNID>
<GHNName>{$ghn/Profile/GHNDescription/Name/string()}</GHNName>
<GHNSite>{$ghn/Profile/Site/Domain/string()}</GHNSite>
<GHNStatus>{$ghn/Profile/GHNDescription/Status/string()}</GHNStatus>
<GHNLoad15Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad15Min>
<GHNLoad5Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad5Min>
<GHNLoad1Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad1Min>
<GHNActivationTime>{$ghn/Profile/GHNDescription/ActivationTime/string()}</GHNActivationTime>
<GHNLastUpdate>{$ghn/Profile/GHNDescription/LastUpdate/string()}</GHNLastUpdate>
</Resource>
return
<Resources>
{$relatedris}
</Resources>

View File

@ -1,55 +1,11 @@
<!--
Notice: the <Resources> node must be removed in using the resource grid factory.
-->
let $profiles := collection('/db/Profiles/<RES_TYPE ISdefault ='RunningInstance'>')//Resource[ID/string() eq '<RES_ID/>']
let $profiles := collection('/db/Profiles/<RES_TYPE ISdefault ='RunningInstance'/>')//Resource[ID/string() eq '<RES_ID/>']
let $relatedghn := collection('/db/Profiles/GHN')//Resource[ID/string() eq $profiles/Profile/GHN/@UniqueID/string()]
let $ghn-name := if (empty($relatedghn/Profile/GHNDescription/Name/string()))
then $profiles/Profile/GHN/@UniqueID/string()
else $relatedghn/Profile/GHNDescription/Name/string()
for $ri in $profiles
return
<Resources>
<Resource>
<Key>ID</Key>
<Value>{$ri//Resource/ID/string()}</Value>
</Resource>
<Resource>
<Key>ServiceStatus</Key>
<Value>{$ri/Profile/DeploymentData/Status/string()}</Value>
</Resource>
<Resource>
<Key>ActivationTime</Key>
<Value>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</Value>
</Resource>
<Resource>
<Key>GHNName</Key>
<Value>{$ghn-name}</Value>
</Resource>
<Resource>
<Key>GHNSite</Key>
<Value>{$relatedghn/Profile/Site/Domain/string()}</Value>
</Resource>
<Resource>
<Key>GHNStatus</Key>
<Value>{$relatedghn/Profile/GHNDescription/Status/string()}</Value>
</Resource>
<Resource>
<Key>GHNActivationTime</Key>
<Value>{$relatedghn/Profile/GHNDescription/ActivationTime/string()}</Value>
</Resource>
<Resource>
<Key>GHNLastUpdate</Key>
<Value>{$relatedghn/Profile/GHNDescription/LastUpdate/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad15Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last15Min/string()}</Value>
</Resource>
<Resource>
<Key>GHNLoad5Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last5Min/string()}</Value>
</Resource><Resource>
<Key>GHNLoad1Min</Key>
<Value>{$relatedghn/Profile/GHNDescription/Load/@Last1Min/string()}</Value>
</Resource>
</Resources>
<RESOURCE/>

View File

@ -13,24 +13,4 @@ let $relatedris :=
let $ghn := collection('/db/Profiles/GHN')//Resource[ID/string() eq $ghn-id]
<!-- and $ri//Profile/Version/string() eq $ServiceVersion -->
return
<Resource>
<!-- INFORMATION ABOUT THE RI -->
<RIID>{$ri/ID/string()}</RIID>
<ServiceStatus>{$ri/Profile/DeploymentData/Status/string()}</ServiceStatus>
<ActivationTime>{$ri/Profile/DeploymentData/ActivationTime/@value/string()}</ActivationTime>
<RIVersion>{$ri/Profile/Version/string()}</RIVersion>
<!-- INFORMATION about GHN -->
<GHNID>{$ghn-id}</GHNID>
<GHNName>{$ghn/Profile/GHNDescription/Name/string()}</GHNName>
<GHNSite>{$ghn/Profile/Site/Domain/string()}</GHNSite>
<GHNStatus>{$ghn/Profile/GHNDescription/Status/string()}</GHNStatus>
<GHNLoad15Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad15Min>
<GHNLoad5Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad5Min>
<GHNLoad1Min>{$ghn/Profile/GHNDescription/Load/@Last15Min/string()}</GHNLoad1Min>
<GHNActivationTime>{$ghn/Profile/GHNDescription/ActivationTime/string()}</GHNActivationTime>
<GHNLastUpdate>{$ghn/Profile/GHNDescription/LastUpdate/string()}</GHNLastUpdate>
</Resource>
return
<Resources>
{$relatedris}
</Resources>
<RESOURCE/>

View File

@ -22,9 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
import org.gcube.common.resources.gcore.Resource;
import org.gcube.common.resources.gcore.ScopeGroup;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
@ -63,7 +61,6 @@ public abstract class AbstractResourceManager {
private String name = null;
private AllowedResourceTypes type = null;
private String subType = null;
private GCUBESecurityManagerImpl managerSec = null;
private RegistryPublisher publisher = null;
private static final String LOG_PREFIX = "[AbstractResMgr]";
@ -77,15 +74,6 @@ public abstract class AbstractResourceManager {
this.type = type;
/**
* Initially the security management is disabled.
*/
this.managerSec = new GCUBESecurityManagerImpl() {
public boolean isSecurityEnabled() {
return false;
}
};
try {
this.publisher = RegistryPublisherFactory.create();
} catch (Exception e) {
@ -135,20 +123,6 @@ public abstract class AbstractResourceManager {
return publisher;
}
public final void setSecurityManager(final GCUBESecurityManagerImpl securityManager) {
this.managerSec = securityManager;
}
/**
* The security manager is initially instantiated with empty permissions.
* The {@link AbstractResourceManager#setSecurityManager} can be used to
* change it.
* @return
*/
public final GCUBESecurityManagerImpl getSecurityManager() {
return this.managerSec;
}
/**
* All resources must be identifiable through an unique ID.
* <br/>
@ -201,7 +175,7 @@ public abstract class AbstractResourceManager {
* @throws ResourceParameterException if the parameters are invalid
*/
public final RMBinderLibrary getResourceManager(String scope) throws AbstractResourceException {
String currScope = ScopeProvider.instance.get();
ScopeBean bscope = new ScopeBean(scope);
if (bscope.is(Type.VRE)) {
scope = bscope.enclosingScope().toString();
@ -212,7 +186,6 @@ public abstract class AbstractResourceManager {
if (rml == null) { // no managers found
throw new ResourceAccessException("Unable to find ResourceManagers for resource " + this.getType() + " in scope: " + scope.toString());
}
ScopeProvider.instance.set(currScope);
return rml;
}
@ -224,7 +197,6 @@ public abstract class AbstractResourceManager {
* @throws ResourceParameterException if the parameters are invalid
*/
public final RMReportingLibrary getReportResourceManager(String scope) throws AbstractResourceException {
String currScope = ScopeProvider.instance.get();
ScopeBean bscope = new ScopeBean(scope);
if (bscope.is(Type.VRE)) {
scope = bscope.enclosingScope().toString();
@ -236,7 +208,6 @@ public abstract class AbstractResourceManager {
if (rml == null) { // no managers found
throw new ResourceAccessException("Unable to find ResourceManagers for resource " + this.getType() + " in scope: " + scope.toString());
}
ScopeProvider.instance.set(currScope);
return rml;
}
@ -259,6 +230,8 @@ public abstract class AbstractResourceManager {
LOG_PREFIX,
"[BIND-SCOPE-ENTER] Adding " + this.getType() + " " + this.getID() + " to scope [" +
targetScope.toString() + "]");
String curr = ScopeProvider.instance.get();
ScopeProvider.instance.set(targetScope.toString());
AddResourcesParameters addParam = new AddResourcesParameters();
ResourceItem toAdd = new ResourceItem();
@ -275,7 +248,6 @@ public abstract class AbstractResourceManager {
RMBinderLibrary manager = this.getResourceManager(targetScope);
try {
String curr = ScopeProvider.instance.get();
ScopeBean scope = new ScopeBean(targetScope);
if (scope.is(Type.VRE)) {
ScopeProvider.instance.set(scope.enclosingScope().toString());
@ -305,7 +277,7 @@ public abstract class AbstractResourceManager {
/**
* Add a scope to a gHN and the related Service Map is already available on the gHN.
* Add a scope to a Resource
* @param nestingPublication true for resources different from gHN and RI.
* @return the reportID generated
*/
@ -315,6 +287,8 @@ public abstract class AbstractResourceManager {
checker.validate(targetScope != null, new ResourceParameterException("Invalid parameter targetScope. null not allowed."));
checker.validate(this.getID() != null, new ResourceOperationException("Invalid resource ID. null not allowed."));
String curr = ScopeProvider.instance.get();
ScopeProvider.instance.set(sourceScope.toString());
ReportBuilder report = new ReportBuilder();
ServerConsole.trace(
@ -345,7 +319,10 @@ public abstract class AbstractResourceManager {
targetScope.toString() + " the remote report ID is: " +
this.bindToScope(targetScope.toString()), true));
return report.getXML();
String toReturn = report.getXML();
ScopeProvider.instance.set(curr);
return toReturn;
}
@ -431,7 +408,6 @@ public abstract class AbstractResourceManager {
Assertion<AbstractResourceException> checker = new Assertion<AbstractResourceException>();
checker.validate(this.getID() != null, new ResourceAccessException("Cannot execute on resources with no ID."));
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
// Phase 1. retrieve the resource to copy
@ -447,7 +423,6 @@ public abstract class AbstractResourceManager {
if (results == null || results.isEmpty())
throw new ResourceAccessException("Cannot retrieve the IS profile for resource: " + this.getID() +
" in scope: " + scope.toString());
ScopeProvider.instance.set(currScope);
return results.get(0).toString();
}
@ -482,10 +457,8 @@ public abstract class AbstractResourceManager {
ServerConsole.trace(LOG_PREFIX, "[REMOVE-FROM-SCOPE] Sending the Remove Resource request....");
try {
RMBinderLibrary manager = this.getResourceManager(scope.toString());
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
retval = manager.removeResources(params);
ScopeProvider.instance.set(currScope);
} catch (Exception e) {
throw new ResourceOperationException("During removeFrom scope of "
+ this.getType()
@ -503,12 +476,9 @@ public abstract class AbstractResourceManager {
checker.validate(scope != null, new ResourceParameterException("Invalid parameter scope. null not allowed."));
checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. null not allowed."));
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
String retval = this.basicRemoveFromScope(scope);
ScopeProvider.instance.set(currScope);
return retval;
}
@ -558,7 +528,6 @@ public abstract class AbstractResourceManager {
checker.validate(this.getID() != null, new ResourceOperationException("Invalid ID. null not allowed."));
System.out.println("DELETING TYPE: "+ this.getType());
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
Resource resStub = this.getResource(scope);
@ -578,7 +547,6 @@ public abstract class AbstractResourceManager {
} catch (Exception e) {
}
ScopeProvider.instance.set(currScope);
}
}

View File

@ -16,11 +16,6 @@
package org.gcube.resourcemanagement.support.server.managers.resources;
import java.io.StringReader;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.resources.GCUBECollection;
import org.gcube.common.core.resources.GCUBEResource;
import org.gcube.common.resources.gcore.Resource;
import org.gcube.resourcemanagement.support.server.exceptions.AbstractResourceException;
import org.gcube.resourcemanagement.support.server.exceptions.ResourceAccessException;

View File

@ -44,6 +44,7 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -139,7 +140,6 @@ public class GenericResourceManager extends AbstractResourceManager {
if (subType != null)
resource.profile().type(subType.trim());
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
RegistryPublisher publisher = getRegistryPublisher();
String id = publisher.update(resource).id();
@ -147,13 +147,11 @@ public class GenericResourceManager extends AbstractResourceManager {
if (id == null || id.length() == 0) {
throw new Exception("The GenericResource has not been updated");
}
ScopeProvider.instance.set(currScope);
ServerConsole.info(LOG_PREFIX, "Resource Updated with ID: " + id);
}
private GenericResource getResourceToEditById(String id, ScopeBean scope) throws Exception {
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
SimpleQuery query = queryFor(GenericResource.class);
@ -163,7 +161,6 @@ public class GenericResourceManager extends AbstractResourceManager {
List<GenericResource> r = client.submit(query);
ScopeProvider.instance.set(currScope);
if (r == null || r.isEmpty())
throw new Exception("Could not retrieve GenericResource profile with id " + id + " in scope + " +scope);
else
@ -194,7 +191,7 @@ public class GenericResourceManager extends AbstractResourceManager {
GenericResourceManager gm = new GenericResourceManager();
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
RegistryPublisher publisher = gm.getRegistryPublisher();
String id = publisher.create(resource).id();
@ -202,7 +199,6 @@ public class GenericResourceManager extends AbstractResourceManager {
if (id == null || id.length() == 0) {
throw new Exception("The GenericResource has not been created");
}
ScopeProvider.instance.set(currScope);
ServerConsole.info(LOG_PREFIX, "Resource Created with ID: " + id);
return id;
}
@ -227,12 +223,21 @@ public class GenericResourceManager extends AbstractResourceManager {
* @throws SAXException
* @throws ParserConfigurationException
*/
public static void appendXmlFragment(Node parent, String fragment) throws IOException, SAXException, ParserConfigurationException {
public static void appendXmlFragment(Node parent, String fragment) throws IOException, ParserConfigurationException {
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = parent.getOwnerDocument();
Node fragmentNode = docBuilder.parse(new InputSource(new StringReader(fragment))).getDocumentElement();
fragmentNode = doc.importNode(fragmentNode, true);
parent.appendChild(fragmentNode);
Node fragmentNode;
try {
fragmentNode = docBuilder.parse(new InputSource(new StringReader(fragment))).getDocumentElement();
fragmentNode = doc.importNode(fragmentNode, true);
parent.appendChild(fragmentNode);
} catch (SAXException e) {
//in case no xml is entered, just text
System.out.println("to append: " + fragment);
Text text = doc.createTextNode(fragment);
doc.importNode(text, true);
}
}
}

View File

@ -66,12 +66,7 @@ public class ManagementUtils {
* @param targetScope
* @return the generated report ID
*/
public static final synchronized String addToExistingScope(
final AllowedResourceTypes type,
final String[] resourceIDs,
final ScopeBean sourceScope,
final ScopeBean targetScope)
throws Exception {
public static final synchronized String addToExistingScope(AllowedResourceTypes type, String[] resourceIDs, ScopeBean sourceScope, ScopeBean targetScope) throws Exception {
ServerConsole.trace(
LOG_PREFIX,
"[ADD-ToExistingScope] Adding from scope [" +
@ -97,10 +92,10 @@ public class ManagementUtils {
for (String id : resourceIDs) {
AbstractResourceManager res = ResourceFactory.createResourceManager(type, id);
Resource resStub = res.getResource(sourceScope);
String curr = ScopeProvider.instance.get();
ScopeProvider.instance.set(targetScope.toString());
res.getRegistryPublisher().update(resStub);
ScopeProvider.instance.set(curr);
}
} catch (Exception e) {
throw new ResourceAccessException(e.getMessage());

View File

@ -16,32 +16,37 @@
package org.gcube.resourcemanagement.support.server.managers.scope;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.ISException;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericResourceQuery;
import org.gcube.common.core.resources.GCUBEGenericResource;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.scope.ServiceMap;
import org.gcube.common.core.scope.VO;
import org.gcube.common.core.scope.VRE;
import org.gcube.common.resources.gcore.GenericResource;
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.resourcemanagement.support.server.gcube.CacheManager;
import org.gcube.resourcemanagement.support.server.gcube.ISClientRequester;
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
@ -52,18 +57,18 @@ import org.xml.sax.SAXException;
*
*/
public class ScopeManager {
private static final Map<String, GCUBEScope> SCOPES = new LinkedHashMap<String, GCUBEScope>();
private static final Map<String, ScopeBean> SCOPES = new LinkedHashMap<String, ScopeBean>();
private static String confFile = null;
private static final String LOG_PREFIX = "[SCOPE-MGR]";
public static GCUBEScope getScope(final String scope) throws Exception {
public static ScopeBean getScope(final String scope) throws Exception {
synchronized (SCOPES) {
if (getAvailableScopes().containsKey(scope)) {
return getAvailableScopes().get(scope);
}
}
ServerConsole.warn(LOG_PREFIX, "Using DEFAULT scope manager");
return GCUBEScope.getScope(scope);
return new ScopeBean(scope);
}
public static void setScopeConfigFile(final String file) {
@ -74,7 +79,7 @@ public class ScopeManager {
* Refreshes the list of scopes and associated maps.
*/
public static Map<String, GCUBEScope> getAvailableScopes()
public static Map<String, ScopeBean> getAvailableScopes()
throws Exception {
if (SCOPES.size() == 0) {
update();
@ -100,25 +105,24 @@ public class ScopeManager {
String voString = voDetails.item(5).getFirstChild().getNodeValue();
String fileName = voDetails.item(3).getFirstChild().getNodeValue();
// String voName = voDetails.item(1).getFirstChild().getNodeValue();
GCUBEScope vo = GCUBEScope.getScope(voString);
ScopeBean vo = new ScopeBean(voString);
try {
vo.setServiceMap(loadServiceMap((VO) vo, fileName));
//vo.setServiceMap(loadServiceMap((VO) vo, fileName));
SCOPES.put(vo.toString(), vo);
ServerConsole.info(LOG_PREFIX, " Scopes in VO " + vo.toString());
try {
for (VRE vre : getVREFromVO((VO) vo)) {
for (String vre : getVREFromVO(vo)) {
// This operation overrides the vo map
vre.getEnclosingScope().setServiceMap(vo.getServiceMap());
SCOPES.put(vre.toString(), vre);
SCOPES.put(vre.toString(), new ScopeBean(vo.toString()+"/"+vre));
}
} catch (ISException e) {
} catch (Exception e) {
ServerConsole.error(LOG_PREFIX, "Exception raised while loading VREs for VO : " + vo, e);
}
}
catch (FileNotFoundException e) {
catch (Exception e) {
ServerConsole.warn(LOG_PREFIX, "skipping... map not found for VO : " + vo, e);
}
@ -127,36 +131,23 @@ public class ScopeManager {
ServerConsole.info(LOG_PREFIX, "*** found scopes : " + SCOPES.keySet());
}
protected static List<VRE> getVREFromVO(final VO vo)
throws Exception {
ServerConsole.info(LOG_PREFIX, "*******************\n\n********************\nStarting Retrieving VREs for VO : " + vo);
List<VRE> toReturn = new ArrayList<VRE>();
protected static List<String> getVREFromVO(final ScopeBean vo) throws Exception {
ServerConsole.info(LOG_PREFIX, "Starting Retrieving VREs for VO : " + vo);
List<String> toReturn = new ArrayList<String>();
ISClient client = GHNContext.getImplementation(ISClient.class);
ScopeProvider.instance.set(vo.toString());
SimpleQuery query = queryFor(GenericResource.class);
query.addCondition("$resource/Profile/SecondaryType/text() eq 'VRE'");
// FIXME query to get VREs
try {
GCUBEGenericResourceQuery query = client.getQuery(GCUBEGenericResourceQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/SecondaryType", "VRE"));
//query.addGenericCondition("not($result/Scopes/Scope/string() eq '" + vo.toString() + "')");
System.out.println( "************** \n\n\n *****************\nready to query : " + query.getExpression());
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
for (GCUBEGenericResource resource : client.execute(query, vo)) {
ServerConsole.info(LOG_PREFIX, "Found: " + resource.getName());
for (String vreName : resource.getScopes().keySet()) {
GCUBEScope vre = resource.getScopes().get(vreName);
if (vre.getType().equals(GCUBEScope.Type.VRE)) {
toReturn.add((VRE) vre);
}
}
List<GenericResource> gRes = client.submit(query);
}
} catch (Exception e) {
ServerConsole.error(LOG_PREFIX, e);
for (GenericResource res : gRes) {
ServerConsole.info(LOG_PREFIX, "Found: " + res.profile().name());
toReturn.add(res.profile().name());
}
return toReturn;
}
/**
@ -167,7 +158,7 @@ public class ScopeManager {
* @return
* @throws Exception
*/
public static String getMapXML(final GCUBEScope searchvo) throws Exception {
public static String getMapXML(final ScopeBean searchvo) throws Exception {
if (confFile == null) {
throw new NullPointerException("the scope file has not been defined");
}
@ -180,7 +171,7 @@ public class ScopeManager {
String voString = voDetails.item(5).getFirstChild().getNodeValue();
String fileName = voDetails.item(3).getFirstChild().getNodeValue();
// String voName = voDetails.item(1).getFirstChild().getNodeValue();
GCUBEScope vo = GCUBEScope.getScope(voString);
ScopeBean vo = new ScopeBean(voString);
if (vo.equals(searchvo)) {
return fileToString(System.getenv("GLOBUS_LOCATION") + File.separator + "config" + File.separator + fileName);
@ -190,13 +181,13 @@ public class ScopeManager {
return null;
}
private static ServiceMap loadServiceMap(final VO vo, final String fileName) throws Exception {
ServiceMap map = new ServiceMap();
String filePath = System.getenv("GLOBUS_LOCATION") + File.separator + "config" + File.separator + fileName;
ServerConsole.info(LOG_PREFIX, "--- Loading " + vo.getName() + " from: " + filePath);
map.load(new FileReader(filePath));
return map;
}
// private static ServiceMap loadServiceMap(final VO vo, final String fileName) throws Exception {
// ServiceMap map = new ServiceMap();
// String filePath = System.getenv("GLOBUS_LOCATION") + File.separator + "config" + File.separator + fileName;
// ServerConsole.info(LOG_PREFIX, "--- Loading " + vo.getName() + " from: " + filePath);
// map.load(new FileReader(filePath));
// return map;
// }
public static String fileToString(final String path) throws IOException {
BufferedReader filebuf = null;

View File

@ -22,30 +22,31 @@
package org.gcube.resourcemanagement.support.server.tests;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.File;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.gcube.common.core.scope.GCUBEScope;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.gcube.common.resources.gcore.HostingNode;
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.resourcemanagement.support.client.utils.StatusHandler;
import org.gcube.resourcemanagement.support.server.gcube.CacheManager;
import org.gcube.resourcemanagement.support.server.gcube.ISClientRequester;
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.GenericResourceManager;
import org.gcube.resourcemanagement.support.server.managers.resources.ManagementUtils;
import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager;
import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes;
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/**
* @author Daniele Strollo (ISTI-CNR)
@ -63,9 +64,9 @@ public class GenericTest {
resID = GenericResourceManager.create(
null,
new ScopeBean("/gcube/devsec"),
"RMP Test",
"RMP Test " + new Date(),
"RMP Test Description",
"<TestBody>Hello</TestBody>",
"Hello",
"test");
ServerConsole.trace(null, "Generic Resource Created with ID: " + resID);
} catch (Exception e) {
@ -79,10 +80,12 @@ public class GenericTest {
public static void testScopeCopy(final String resID, final String fromScope, final String toScope) {
System.out.println("\n\n\n******************** TEST SCOPE COPY ***************");
try {
GenericResourceManager res = new GenericResourceManager(resID);
ServerConsole.trace(null,
res.addToExistingScope(new ScopeBean(fromScope), new ScopeBean(toScope))
);
// GenericResourceManager res = new GenericResourceManager(resID);
// ServerConsole.trace(null,
// res.addToExistingScope(new ScopeBean(fromScope), new ScopeBean(toScope))
// );
String[] ids = {resID};
ManagementUtils.addToExistingScope(AllowedResourceTypes.GenericResource, ids, new ScopeBean(fromScope), new ScopeBean(toScope));
} catch (Exception e) {
ServerConsole.error(LOG_PREFIX, e);
} finally {
@ -161,9 +164,12 @@ public class GenericTest {
}
}
List<ResourceDescriptor> descs = ISClientRequester.getResourceModels(scope, "GenericResource", null, null);
for (ResourceDescriptor resourceDescriptor : descs) {
System.out.println(resourceDescriptor);
List<String> descs = ISClientRequester.getResourcesByType(cm, scope, "GenericResource", "VRE");
for (String resourceDescriptor : descs) {
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(resourceDescriptor))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
System.out.println(helper.evaluate("/Resource/Name/text()").get(0));
}
}
@ -174,21 +180,21 @@ public class GenericTest {
ScopeProvider.instance.set("/gcube/devsec");
//testTree( new ScopeBean("/gcube"));
testTree( new ScopeBean("/gcube/devsec"));
// boolean deepTest = true;
//
// // testGHN();
// if (deepTest) {
String resID = testCreation();
testScopeCopy(resID, "/gcube/devsec", "/gcube/devsec/devVRE");
// String resID = testCreation();
// testScopeCopy(resID, "/gcube/devsec", "/gcube/devsec/devVRE");
//////
// System.out.println("\n\nWaiting for resource refresh 20secs.\n\n\n");
// Thread.sleep(20000);
//
//
// //testResourceEdit(resID, new ScopeBean("/gcube/devsec"));
// //testDelete(resID, new ScopeBean("/gcube/devsec"));
//testDelete(resID, new ScopeBean("/gcube/devsec"));
//
// testRemoveFromScope(resID, new ScopeBean("/gcube/devsec/devVRE"));
// } else {

View File

@ -18,13 +18,17 @@ package org.gcube.resourcemanagement.support.server.utils;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.resourcemanagement.support.server.managers.resources.AbstractResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Daniele Strollo (ISTI-CNR)
*
*/
public class ServerConsole {
//private static final Logger LOGGER = LoggerFactory.getLogger(AbstractResourceManager.class);
private static final GCUBEClientLog LOGGER = new GCUBEClientLog(AbstractResourceManager.class);
private static final String LOG_PREFIX = "*** [RMP] ";
public static void error(final String prefix, final String msg) {
@ -48,13 +52,16 @@ public class ServerConsole {
public static void trace(final String prefix, final String msg) {
LOGGER.trace(LOG_PREFIX + ((prefix != null) ? prefix + " " : "") + msg);
}
public static void trace(final String msg) {
LOGGER.trace(msg);
}
public static void debug(final String msg) {
LOGGER.debug(msg);
}
public static void warn(final String msg) {
LOGGER.warn(msg);
}
public static void debug(final String prefix, final String msg) {
LOGGER.debug(LOG_PREFIX + ((prefix != null) ? prefix + " " : "") + msg);
}
public static void fatal(final String prefix, final String msg) {
LOGGER.fatal(LOG_PREFIX + ((prefix != null) ? prefix + " " : "") + msg);
}
public static void fatal(final String prefix, final String msg, final Throwable exc) {
LOGGER.fatal(LOG_PREFIX + ((prefix != null) ? prefix + " " : "") + msg, exc);
}
}

View File

@ -2,7 +2,7 @@ package org.gcube.resourcemanagement.support.server.utils.persistence;
import java.io.File;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager;
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
@ -12,12 +12,12 @@ public class TestPersistence {
* @param args
*/
public static void main(final String[] args) {
PersistentItem<GCUBEScope[]> persistentScopes = new PersistentItem<GCUBEScope[]>("data.xml", 10000) {
PersistentItem<ScopeBean[]> persistentScopes = new PersistentItem<ScopeBean[]>("data.xml", 10000) {
// Builds the data to persist
private void refreshData() {
try {
GCUBEScope[] toStore =
ScopeManager.getAvailableScopes().values().toArray(new GCUBEScope[]{});
ScopeBean[] toStore =
ScopeManager.getAvailableScopes().values().toArray(new ScopeBean[]{});
this.setData(toStore);
} catch (Exception e) {
ServerConsole.error(LOG_PREFIX, e);
@ -32,7 +32,7 @@ public class TestPersistence {
public void onRefresh() {
this.refreshData();
GCUBEScope[] scopes = this.getData();
ScopeBean[] scopes = this.getData();
System.out.println(scopes);
}
public void onDestroy() {

View File

@ -128,7 +128,12 @@ public class ResourceDetailModel {
@Override
public String render(BaseModelData model, String property, ColumnData config,
int rowIndex, int colIndex, ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
int val = Integer.parseInt((String)model.get(property));
int val = 0;
try {
val = Integer.parseInt((String)model.get(property));
} catch (NumberFormatException e) {
val = 0;
}
String style = val < 1000000 ? "red" : "green";
String toDisplay = number.format(val);
if (toDisplay.length() > 4)