Massimiliano Assante 9 years ago
parent
commit
e3557d0200
  1. 2
      .project
  2. 2
      distro/profile.xml
  3. 14
      pom.xml
  4. 2
      src/main/java/org/gcube/resourcemanagement/support/server/exceptions/ResourceAccessException.java
  5. 12
      src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java

2
.project

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ResourceManagementSupport</name>
<name>rmp-common-library</name>
<comment></comment>
<projects>
</projects>

2
distro/profile.xml

@ -3,7 +3,7 @@
<ID></ID>
<Type>Library</Type>
<Profile>
<Description>Resource Management Portlet Common IS Operations Support Library</Description>
<Description>${description}</Description>
<Class>PortletsAdmin</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>

14
pom.xml

@ -12,8 +12,16 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>1.1.0-SNAPSHOT</version>
<name>Resource Management Portlet Common IS Operations Support Library</name>
<name>Resource Management Library</name>
<description>
gCube Resource Management Library is a common library containing shared code for Information System Operations
used by all the Portlets and Widgets partaking into the Monitoring and Management of the Infrasturcture.
</description>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
@ -63,7 +71,7 @@
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
</dependency>
<dependency>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>resource-manager-stubs</artifactId>

2
src/main/java/org/gcube/resourcemanagement/support/server/exceptions/ResourceAccessException.java

@ -21,8 +21,8 @@ package org.gcube.resourcemanagement.support.server.exceptions;
*
* @author Daniele Strollo (ISTI-CNR)
*/
@SuppressWarnings("serial")
public class ResourceAccessException extends AbstractResourceException {
private static final long serialVersionUID = -4491094127600507185L;
public ResourceAccessException() {
super();

12
src/main/java/org/gcube/resourcemanagement/support/server/managers/resources/AbstractResourceManager.java

@ -129,8 +129,7 @@ public abstract class AbstractResourceManager {
public AbstractResourceManager(
final String id,
final String name,
final AllowedResourceTypes type)
throws ResourceParameterException, ResourceAccessException {
final AllowedResourceTypes type) throws ResourceParameterException, ResourceAccessException {
this(id, type);
Assertion<ResourceParameterException> checker = new Assertion<ResourceParameterException>();
checker.validate(name != null && name.trim().length() > 0, new ResourceParameterException("Invalid Parameter name"));
@ -233,8 +232,8 @@ public abstract class AbstractResourceManager {
* @return a raw list of resource manager descriptors.
* @throws Exception
*/
private List<GCUBERunningInstance> getResourceManagerFromScope(final GCUBEScope scope)
throws Exception {
private List<GCUBERunningInstance> getResourceManagerFromScope(final GCUBEScope scope) throws Exception {
System.out.println("Looking for ResourceManager in scope: " + scope);
GCUBERIQuery query = this.client.getQuery(GCUBERIQuery.class);
query.addAtomicConditions(new AtomicCondition("//Profile/ServiceClass", "VREManagement"));
query.addAtomicConditions(new AtomicCondition("//Profile/ServiceName", "ResourceManager"));
@ -246,6 +245,7 @@ public abstract class AbstractResourceManager {
toReturn.add(ri);
}
}
System.out.println("Found " + toReturn.size() +" ResourceManager in scope: " + scope);
return toReturn;
}
@ -260,6 +260,7 @@ public abstract class AbstractResourceManager {
Assertion<ResourceParameterException> checker = new Assertion<ResourceParameterException>();
checker.validate(scope != null, new ResourceParameterException("Invalid scope"));
List<GCUBERunningInstance> resourceManagerList = null;
try {
resourceManagerList = this.getResourceManagerFromScope(scope);
@ -269,7 +270,8 @@ public abstract class AbstractResourceManager {
}
List<ResourceBinderPortType> retval = new Vector<ResourceBinderPortType>();
if (resourceManagerList.isEmpty()) {
if (resourceManagerList.isEmpty()) {
System.out.println("\n\n\n\n\n****** Schianta qui size: " + resourceManagerList.size() + " scope: " + scope);
throw new ResourceAccessException("Unable to find ResourceManagers for resource " + this.getType() + " in scope: " + scope.toString());
}

Loading…
Cancel
Save