first refactoring for new Registry

git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/private/alessandro.pieve/resource-management@146324 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-03-24 13:20:55 +00:00
parent a700889be5
commit 2928749c1a
8 changed files with 122 additions and 114 deletions

View File

@ -1,16 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="resource-management-portlet">
<wb-module deploy-name="resource-management-evo-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="rmp-common-library-2.7.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/rmp-common-library/rmp-common-library">
<dependent-module archiveName="resource-registry-client-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resource-registry-client/resource-registry-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="ishealth-monitor-widget-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resource-ishealth-monitor/resource-ishealth-monitor">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="resource-sweeper-widget-2.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resource-sweeper/resource-sweeper">
<dependent-module archiveName="rmp-common-library-2.7.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/rmp-common-library-evo/rmp-common-library-evo">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>

25
pom.xml
View File

@ -51,6 +51,28 @@
</dependencies>
</dependencyManagement>
<dependencies>
<!-- new registry deps -->
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-client</artifactId>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>information-system-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>gcube-resources</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- endnew registry deps -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
@ -234,7 +256,8 @@
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<extraJvmArgs>-Xmx512M -DGLOBUS_LOCATION=${GLOBUS_LOCATION} -Dlog4j.configuration=clientlog4j.properties</extraJvmArgs>
<extraJvmArgs>-Xmx512M -DGLOBUS_LOCATION=${GLOBUS_LOCATION}
-Dlog4j.configuration=clientlog4j.properties</extraJvmArgs>
<runTarget>ResourceManagementPortlet.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<!-- <logLevel>DEBUG</logLevel> -->

View File

@ -180,10 +180,10 @@ public class ResourcesTreePanel {
if (StatusHandler.getStatus().isLoadGHNatStartup()) {
GWT.log(""+StatusHandler.getStatus().isLoadGHNatStartup());
Commands.doLoadResourceDetailsGrid(this,
StatusHandler.getStatus().getCurrentScope(),
"GHN");
// Commands.doLoadResourceDetailsGrid(this,
// StatusHandler.getStatus().getCurrentScope(),
// "GHN");
//
//select the GHN
for (ModelData md: store.getAllItems()) {
if (md.get("node").toString().compareTo("GHN") == 0)

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.admin.resourcemanagement.server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.entity.facet.NetworkingFacet;
import org.gcube.informationsystem.model.entity.resource.Service;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClientFactory;
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
import org.gcube.resourcemanagement.support.server.gcube.CacheManager;
public class RegistryClientRequester {
private static final String LOG_PREFIX = "[REGISTRY_CLIENT-REQS]";
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
/**
* For all the resource in the scope retrieves their
* (type, subtype) values.
* The result is a list of couples of that form.
* @return a list of string tuples (type, subtype)
* @throws Exception
*/
public static final HashMap<String, ArrayList<String>> getResourcesTree(final ScopeBean queryScope) throws Exception {
HashMap<String, ArrayList<String>> retval = new HashMap<String, ArrayList<String>>();
ScopeProvider.instance.set(queryScope.toString());
try {
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(Resource.class, true);
for (TypeDefinition td : typeDefinitions) {
retval.put(td.getName(), new ArrayList<String>());
}
// ArrayList<String> list = new ArrayList<>();
// list.add("ciao");
//
// retval.put("GHN", list);
// System.out.println("Instances ..");
// List<Service> eservices = (List<Service>) resourceRegistryClient.getInstances(Service.NAME, true);
// for (Service et : eservices) {
// List<? extends Facet> facets = et.getIdentificationFacets();
// for (Facet f : facets) {
// if(f instanceof NetworkingFacet){
// NetworkingFacet nf = (NetworkingFacet) f;
// System.out.println(nf.getHostName());
// }
//
// }
//// List<ConsistsOf<?, ?>> coList = et.getConsistsOf();
//// for (ConsistsOf<?, ?> co : coList) {
//// System.out.println(co);
//// }
//
//
//
// }
//
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return retval;
}
}

View File

@ -211,13 +211,13 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
AllowedResourceTypes type = AllowedResourceTypes.valueOf(resType);
ScopeBean targetScope = new ScopeBean(scope);
ScopeBean sourceScope = new ScopeBean(status.getCurrentScope());
String reportID = ManagementUtils.removeFromExistingScope(type,
resourceIDs.toArray(new String[]{}),
sourceScope,
targetScope);
RMReportingLibrary manager =
ResourceFactory.createResourceManager(type).getReportResourceManager(targetScope.toString());
@ -265,14 +265,14 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
Map<String, ScopeBean> 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;
}
@ -296,7 +296,17 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
public final HashMap<String, ArrayList<String>> getResourceTypeTree(final String scope) throws Exception {
try {
ScopeBean gscope = new ScopeBean(scope);
HashMap<String, ArrayList<String>> results = ISClientRequester.getResourcesTree(getCacheManager(this.getCurrentStatus()), gscope);
System.out.println("\n\n\n\n\n ***-");
//HashMap<String, ArrayList<String>> results = ISClientRequester.getResourcesTree(getCacheManager(this.getCurrentStatus()), gscope);
HashMap<String, ArrayList<String>> results = RegistryClientRequester.getResourcesTree(gscope);
for (String key : results.keySet()) {
System.out.println("***->"+key);
}
return results;
} catch (Exception e) {
ServerConsole.error(LOG_PREFIX, "applying resource get", e);
@ -354,12 +364,12 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
if (results != null && results.size() > 0) {
ResourceDescriptor retval = new ResourceDescriptor();
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 = helper.evaluate("/Resource/ID/text()");
if (currValue != null && currValue.size() > 0) {
retval.setID(currValue.get(0));
@ -529,6 +539,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
ServerConsole.info(LOG_PREFIX, "FAILED ATTEMPT SUPER USER MODE FROM IP: " + ipAddressCaller);
return matched;
}
}

View File

@ -1,52 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<infrastructures>
<infrastructure>
<name>d4science</name>
<vos>
<vo>
<name>d4science</name>
<src>ServiceMap_d4science.research-infrastructures.eu.xml</src>
<scope>/d4science.research-infrastructures.eu</scope>
</vo>
<vo>
<name>d4science/D4Research</name>
<src>ServiceMap_D4Research.xml</src>
<scope>/d4science.research-infrastructures.eu/D4Research</scope>
</vo>
<vo>
<name>d4science/Edison</name>
<src>ServiceMap_Edison.xml</src>
<scope>/d4science.research-infrastructures.eu/Edison</scope>
</vo>
<vo>
<name>d4science/FARM</name>
<src>ServiceMap_FARM.xml</src>
<scope>/d4science.research-infrastructures.eu/FARM</scope>
</vo>
<vo>
<name>d4science/gCubeApps</name>
<src>ServiceMap_gCubeApps.xml</src>
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
</vo>
<vo>
<name>d4science/OpenAIRE</name>
<src>ServiceMap_OpenAIRE.xml</src>
<scope>/d4science.research-infrastructures.eu/OpenAIRE</scope>
</vo>
<vo>
<name>d4science/SmartArea</name>
<src>ServiceMap_SmartArea.xml</src>
<scope>/d4science.research-infrastructures.eu/SmartArea</scope>
</vo>
<vo>
<name>d4science/SoBigData</name>
<src>ServiceMap_SoBigData.xml</src>
<scope>/d4science.research-infrastructures.eu/SoBigData</scope>
</vo>
</vos>
</infrastructure>
<infrastructure>
<name>gcube</name>
<vos>

View File

@ -1,52 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<infrastructures>
<infrastructure>
<name>d4science</name>
<vos>
<vo>
<name>d4science</name>
<src>ServiceMap_d4science.research-infrastructures.eu.xml</src>
<scope>/d4science.research-infrastructures.eu</scope>
</vo>
<vo>
<name>d4science/D4Research</name>
<src>ServiceMap_D4Research.xml</src>
<scope>/d4science.research-infrastructures.eu/D4Research</scope>
</vo>
<vo>
<name>d4science/Edison</name>
<src>ServiceMap_Edison.xml</src>
<scope>/d4science.research-infrastructures.eu/Edison</scope>
</vo>
<vo>
<name>d4science/FARM</name>
<src>ServiceMap_FARM.xml</src>
<scope>/d4science.research-infrastructures.eu/FARM</scope>
</vo>
<vo>
<name>d4science/gCubeApps</name>
<src>ServiceMap_gCubeApps.xml</src>
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
</vo>
<vo>
<name>d4science/OpenAIRE</name>
<src>ServiceMap_OpenAIRE.xml</src>
<scope>/d4science.research-infrastructures.eu/OpenAIRE</scope>
</vo>
<vo>
<name>d4science/SmartArea</name>
<src>ServiceMap_SmartArea.xml</src>
<scope>/d4science.research-infrastructures.eu/SmartArea</scope>
</vo>
<vo>
<name>d4science/SoBigData</name>
<src>ServiceMap_SoBigData.xml</src>
<scope>/d4science.research-infrastructures.eu/SoBigData</scope>
</vo>
</vos>
</infrastructure>
<infrastructure>
<name>gcube</name>
<vos>

View File

@ -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
DEFAULT_SCOPE =/gcube/devNext
# the target of update notification (if in singleton mode)
# mails MUST be separated by ;
USERMAIL_TO = m.assante@gmail.com