Roberto Cirillo 9 years ago
commit
977cf482b5
  1. 10
      .classpath
  2. 23
      .project
  3. 7
      .settings/org.eclipse.core.resources.prefs
  4. 6
      .settings/org.eclipse.jdt.core.prefs
  5. 5
      .settings/org.eclipse.m2e.core.prefs
  6. 0
      distro/INSTALL
  7. 6
      distro/LICENSE
  8. 3
      distro/MAINTAINERS
  9. 44
      distro/README
  10. 5
      distro/changelog.xml
  11. 47
      distro/descriptor.xml
  12. 39
      distro/profile.xml
  13. 1
      distro/svnpath.txt
  14. 80
      pom.xml
  15. 74
      src/main/java/org/gcube/vremanagement/resourcemanager/client/Constants.java
  16. 56
      src/main/java/org/gcube/vremanagement/resourcemanager/client/RMAdminLibrary.java
  17. 80
      src/main/java/org/gcube/vremanagement/resourcemanager/client/RMBinderLibrary.java
  18. 96
      src/main/java/org/gcube/vremanagement/resourcemanager/client/RMControllerLibrary.java
  19. 75
      src/main/java/org/gcube/vremanagement/resourcemanager/client/RMReportingLibrary.java
  20. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/InvalidOptionsException.java
  21. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/InvalidScopeException.java
  22. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/NoSuchReportException.java
  23. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/ResourcesCreationException.java
  24. 39
      src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/ResourcesRemovalException.java
  25. 23
      src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMAdminServiceJAXWSStubs.java
  26. 27
      src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMBinderServiceJAXWSStubs.java
  27. 33
      src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMControllerServiceJAXWSStubs.java
  28. 29
      src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMReportingServiceJAXWSStubs.java
  29. 262
      src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/Types.java
  30. 15
      src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMAdminInterface.java
  31. 19
      src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMBinderInterface.java
  32. 23
      src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMControllerInterface.java
  33. 19
      src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMReportingInterface.java
  34. 64
      src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/AbstractPlugin.java
  35. 39
      src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/AdminPlugin.java
  36. 39
      src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/BinderPlugin.java
  37. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/ControllerPlugin.java
  38. 38
      src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/ReportingPlugin.java
  39. 48
      src/main/java/org/gcube/vremanagement/resourcemanager/client/proxies/Proxies.java
  40. 30
      src/test/java/org/gcube/vremanagement/resourcemanager/client/test/RMAdminLibraryTest.java
  41. 90
      src/test/java/org/gcube/vremanagement/resourcemanager/client/test/RMBinderLibraryTest.java
  42. 84
      src/test/java/org/gcube/vremanagement/resourcemanager/client/test/RMControllerLibraryTest.java
  43. 52
      src/test/java/org/gcube/vremanagement/resourcemanager/client/test/RMReportingLibraryTest.java
  44. 1
      src/test/resources/report.xml

10
.classpath

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
.project

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>resourcemanager-client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

7
.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,7 @@
#Tue Apr 23 11:22:06 CEST 2013
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

6
.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,6 @@
#Tue Apr 23 11:22:07 CEST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

5
.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,5 @@
#Tue Apr 23 11:22:04 CEST 2013
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

0
distro/INSTALL

6
distro/LICENSE

@ -0,0 +1,6 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

3
distro/MAINTAINERS

@ -0,0 +1,3 @@
* Andrea Manzi (andrea.manzi@cern.ch), CERN

44
distro/README

@ -0,0 +1,44 @@
The gCube System - GHNManager Service Client
------------------------------------------------------------
This work has been partially supported by the following European projects:
DILIGENT (FP6-2003-IST-2),
D4Science (FP7-INFRA-2007-1.2.2),
D4Science-II (FP7-INFRA-2008-1.2.2), i
Marine (FP7-INFRASTRUCTURES-2011-2), and
EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Andrea Manzi (andrea.manzi@cern.ch), CERN
Version and Release Date
------------------------
v. 1.0, 04/05/2012
Description
-----------
Download information
--------------------
Source code is available from SVN:
http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/GHNManager
Binaries can be downloaded from:
http://www.gcube-system.org/
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/GHN_Manager
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

5
distro/changelog.xml

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="org.gcube.common.vre-management.resourcemanager-client.1-0-0" date="2012-xx-xx">
<Change>ported to maven</Change>
</Changeset>
</ReleaseNotes>

47
distro/descriptor.xml

@ -0,0 +1,47 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>./</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.jar</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

39
distro/profile.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:p1="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID/>
<Type>Service</Type>
<Profile>
<Description>The Resource Manager Service Client Library</Description>
<Class>VREManagement</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Description>The Resource Manager Service Client Library</Description>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<MultiVersion value="true"/>
<Mandatory level="GHN"/>
<Shareable level="VO"/>
<GHNRequirements>
<Requirement category="Site" operator="ge" requirement="string" value="java1.5"/>
</GHNRequirements>
<SpecificData>text</SpecificData>
<Type>library</Type>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

1
distro/svnpath.txt

@ -0,0 +1 @@
${scm.url}

80
pom.xml

@ -0,0 +1,80 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>resourcemanager-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Resource Manager CL</name>
<dependencies>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-fw-clients</artifactId>
<version>[1.0.0-SNAPSHOT,)</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<distroDirectory>distro</distroDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

74
src/main/java/org/gcube/vremanagement/resourcemanager/client/Constants.java

@ -0,0 +1,74 @@
package org.gcube.vremanagement.resourcemanager.client;
import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.service;
import javax.xml.namespace.QName;
import org.gcube.common.clients.stubs.jaxws.GCoreService;
import org.gcube.vremanagement.resourcemanager.client.fws.*;
/**
*
* @author andrea
*
*/
public class Constants {
public static final String SERVICE_CLASS = "VREManagement";
public static final String SERVICE_NAME = "ResourceManager";
public static final String NAMESPACE_ADMIN = "http://gcube-system.org/namespaces/vremanagement/resourcemanager/administration";
public static final String PORT_TYPE_NAME_ADMIN = "gcube/vremanagement/resourcemanager/administration";
public static final String NAMESPACE_REPORTING = "http://gcube-system.org/namespaces/vremanagement/resourcemanager/reporting";
public static final String PORT_TYPE_NAME_REPORTING = "gcube/vremanagement/resourcemanager/reporting";
public static final String NAMESPACE_BINDER = "http://gcube-system.org/namespaces/vremanagement/resourcemanager/binder";
public static final String PORT_TYPE_NAME_BINDER = "gcube/vremanagement/resourcemanager/binder";
public static final String NAMESPACE_CONTROLLER = "http://gcube-system.org/namespaces/vremanagement/resourcemanager/controller";
public static final String PORT_TYPE_NAME_CONTROLLER = "gcube/vremanagement/resourcemanager/scopecontroller";
public static final String serviceAdminNS = NAMESPACE_ADMIN+"/service";
public static final String serviceAdminLocalName = "ReportingService";
public static final QName serviceAdminName = new QName(serviceAdminNS,serviceAdminLocalName);
public static final String serviceReportingNS = NAMESPACE_REPORTING+"/service";
public static final String serviceReportingLocalName = "ReportingService";
public static final QName serviceReportingName = new QName(serviceReportingNS,serviceReportingLocalName);
public static final String serviceBinderNS = NAMESPACE_BINDER+"/service";
public static final String serviceBinderLocalName = "ResourceBinderService";
public static final QName serviceBinderName = new QName(serviceBinderNS,serviceBinderLocalName);
public static final String serviceControllerNS = NAMESPACE_CONTROLLER+"/service";
public static final String serviceControllerLocalName = "ScopeControllerService";
public static final QName serviceControllerName = new QName(serviceControllerNS,serviceControllerLocalName);
public static final String porttypeAdminLocalName = "AdministrationPortType";
public static final String porttypeReportingLocalName = "ReportingPortType";
public static final String porttypeBinderLocalName = "ResourceBinderPortType";
public static final String porttypeControllerLocalName = "ScopeControllerPortType";
public static final GCoreService<RMAdminServiceJAXWSStubs> rm_admin = service().withName(serviceAdminName)
.coordinates(SERVICE_CLASS,SERVICE_NAME)
.andInterface(RMAdminServiceJAXWSStubs.class);
public static final GCoreService<RMReportingServiceJAXWSStubs> rm_reporting = service().withName(serviceReportingName)
.coordinates(SERVICE_CLASS,SERVICE_NAME)
.andInterface(RMReportingServiceJAXWSStubs.class);
public static final GCoreService<RMBinderServiceJAXWSStubs> rm_binder = service().withName(serviceBinderName)
.coordinates(SERVICE_CLASS,SERVICE_NAME)
.andInterface(RMBinderServiceJAXWSStubs.class);
public static final GCoreService<RMControllerServiceJAXWSStubs> rm_controller = service().withName(serviceControllerName)
.coordinates(SERVICE_CLASS,SERVICE_NAME)
.andInterface(RMControllerServiceJAXWSStubs.class);
}

56
src/main/java/org/gcube/vremanagement/resourcemanager/client/RMAdminLibrary.java

@ -0,0 +1,56 @@
package org.gcube.vremanagement.resourcemanager.client;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.exceptions.ServiceException;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.fws.RMAdminServiceJAXWSStubs;
import org.gcube.vremanagement.resourcemanager.client.interfaces.RMAdminInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class RMAdminLibrary implements RMAdminInterface {
private final ProxyDelegate<RMAdminServiceJAXWSStubs> delegate;
Logger logger = LoggerFactory.getLogger(this.getClass().toString());
public RMAdminLibrary(ProxyDelegate<RMAdminServiceJAXWSStubs> delegate) {
this.delegate=delegate;
}
@Override
public Empty cleanSoftwareState() throws InvalidScopeException {
Call<RMAdminServiceJAXWSStubs,Empty> call = new Call<RMAdminServiceJAXWSStubs,Empty>() {
@Override
public Empty call(RMAdminServiceJAXWSStubs endpoint) throws Exception {
return endpoint.CleanSoftwareState();
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw new ServiceException (e);
}
}
}

80
src/main/java/org/gcube/vremanagement/resourcemanager/client/RMBinderLibrary.java

@ -0,0 +1,80 @@
package org.gcube.vremanagement.resourcemanager.client;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesCreationException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesRemovalException;
import org.gcube.vremanagement.resourcemanager.client.fws.*;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.AddResourcesParameters;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.RemoveResourcesParameters;
import org.gcube.vremanagement.resourcemanager.client.interfaces.RMBinderInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.gcube.common.clients.exceptions.FaultDSL.*;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class RMBinderLibrary implements RMBinderInterface{
private final ProxyDelegate<RMBinderServiceJAXWSStubs> delegate;
Logger logger = LoggerFactory.getLogger(this.getClass().toString());
public RMBinderLibrary(ProxyDelegate<RMBinderServiceJAXWSStubs> delegate) {
this.delegate=delegate;
}
@Override
public String addResources(final AddResourcesParameters params)
throws ResourcesCreationException, InvalidScopeException {
Call<RMBinderServiceJAXWSStubs,String> call = new Call<RMBinderServiceJAXWSStubs,String>() {
@Override
public String call(RMBinderServiceJAXWSStubs endpoint) throws Exception {
return endpoint.AddResources(params);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(ResourcesCreationException.class,InvalidScopeException.class);
}
}
@Override
public String removeResources(final RemoveResourcesParameters params)
throws ResourcesRemovalException, InvalidScopeException {
Call<RMBinderServiceJAXWSStubs,String> call = new Call<RMBinderServiceJAXWSStubs,String>() {
@Override
public String call(RMBinderServiceJAXWSStubs endpoint) throws Exception {
return endpoint.RemoveResources(params);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(ResourcesRemovalException.class,InvalidScopeException.class);
}
}
}

96
src/main/java/org/gcube/vremanagement/resourcemanager/client/RMControllerLibrary.java

@ -0,0 +1,96 @@
package org.gcube.vremanagement.resourcemanager.client;
import static org.gcube.common.clients.exceptions.FaultDSL.again;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidOptionsException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.fws.RMControllerServiceJAXWSStubs;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.CreateScopeParameters;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.OptionsParameters;
import org.gcube.vremanagement.resourcemanager.client.interfaces.RMControllerInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class RMControllerLibrary implements RMControllerInterface{
private final ProxyDelegate<RMControllerServiceJAXWSStubs> delegate;
Logger logger = LoggerFactory.getLogger(this.getClass().toString());
public RMControllerLibrary(ProxyDelegate<RMControllerServiceJAXWSStubs> delegate) {
this.delegate=delegate;
}
@Override
public Empty changeScopeOptions(final OptionsParameters options)
throws InvalidScopeException, InvalidOptionsException {
Call<RMControllerServiceJAXWSStubs,Empty> call = new Call<RMControllerServiceJAXWSStubs,Empty>() {
@Override
public Empty call(RMControllerServiceJAXWSStubs endpoint) throws Exception {
return endpoint.ChangeScopeOptions(options);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(InvalidOptionsException.class,InvalidScopeException.class);
}
}
@Override
public String disposeScope(final String scope) throws InvalidScopeException {
Call<RMControllerServiceJAXWSStubs,String> call = new Call<RMControllerServiceJAXWSStubs,String>() {
@Override
public String call(RMControllerServiceJAXWSStubs endpoint) throws Exception {
return endpoint.DisposeScope(scope);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(InvalidScopeException.class);
}
}
@Override
public Empty createScope(final CreateScopeParameters params)
throws InvalidScopeException, InvalidOptionsException {
Call<RMControllerServiceJAXWSStubs,Empty> call = new Call<RMControllerServiceJAXWSStubs,Empty>() {
@Override
public Empty call(RMControllerServiceJAXWSStubs endpoint) throws Exception {
return endpoint.CreateScope(params);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(InvalidScopeException.class,InvalidOptionsException.class);
}
}
}

75
src/main/java/org/gcube/vremanagement/resourcemanager/client/RMReportingLibrary.java

@ -0,0 +1,75 @@
package org.gcube.vremanagement.resourcemanager.client;
import static org.gcube.common.clients.exceptions.FaultDSL.again;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.NoSuchReportException;
import org.gcube.vremanagement.resourcemanager.client.fws.RMReportingServiceJAXWSStubs;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.SendReportParameters;
import org.gcube.vremanagement.resourcemanager.client.interfaces.RMReportingInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class RMReportingLibrary implements RMReportingInterface{
private final ProxyDelegate<RMReportingServiceJAXWSStubs> delegate;
Logger logger = LoggerFactory.getLogger(this.getClass().toString());
public RMReportingLibrary(ProxyDelegate<RMReportingServiceJAXWSStubs> delegate) {
this.delegate=delegate;
}
@Override
public Empty sendReport(final SendReportParameters params)
throws InvalidScopeException {
Call<RMReportingServiceJAXWSStubs,Empty> call = new Call<RMReportingServiceJAXWSStubs,Empty>() {
@Override
public Empty call(RMReportingServiceJAXWSStubs endpoint) throws Exception {
return endpoint.SendReport(params);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(InvalidScopeException.class);
}
}
@Override
public String getReport(final String reportId) throws InvalidScopeException,
NoSuchReportException {
Call<RMReportingServiceJAXWSStubs,String> call = new Call<RMReportingServiceJAXWSStubs,String>() {
@Override
public String call(RMReportingServiceJAXWSStubs endpoint) throws Exception {
return endpoint.GetReport(reportId);
}
};
try {
return delegate.make(call);
}
catch(Exception e) {
throw again(e).as(InvalidScopeException.class, NoSuchReportException.class);
}
}
}

38
src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/InvalidOptionsException.java

@ -0,0 +1,38 @@
package org.gcube.vremanagement.resourcemanager.client.exceptions;
import javax.xml.ws.WebFault;
import org.gcube.common.clients.delegates.Unrecoverable;
@Unrecoverable
@WebFault(name="InvalidOptionsFaultType")
public class InvalidOptionsException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Creates an instance.
*/
public InvalidOptionsException() {
super();
}
/**
* Creates an instance with given message.
* @param msg the message
*/
public InvalidOptionsException(String msg) {
super(msg);
}
/**
* Creates an instance with a given message and cause.
* @param msg the message
* @param cause the cause
*/
public InvalidOptionsException(String msg,Throwable cause) {super(msg,cause);}
public InvalidOptionsException(Throwable cause) {
super(cause);
}
}

38
src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/InvalidScopeException.java

@ -0,0 +1,38 @@
package org.gcube.vremanagement.resourcemanager.client.exceptions;
import javax.xml.ws.WebFault;
import org.gcube.common.clients.delegates.Unrecoverable;
@Unrecoverable
@WebFault(name="InvalidScopeFaultType")
public class InvalidScopeException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Creates an instance.
*/
public InvalidScopeException() {
super();
}
/**
* Creates an instance with given message.
* @param msg the message
*/
public InvalidScopeException(String msg) {
super(msg);
}
/**
* Creates an instance with a given message and cause.
* @param msg the message
* @param cause the cause
*/
public InvalidScopeException(String msg,Throwable cause) {super(msg,cause);}
public InvalidScopeException(Throwable cause) {
super(cause);
}
}

38
src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/NoSuchReportException.java

@ -0,0 +1,38 @@
package org.gcube.vremanagement.resourcemanager.client.exceptions;
import javax.xml.ws.WebFault;
import org.gcube.common.clients.delegates.Unrecoverable;
@Unrecoverable
@WebFault(name="NoSuchReportFaultType")
public class NoSuchReportException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Creates an instance.
*/
public NoSuchReportException() {
super();
}
/**
* Creates an instance with given message.
* @param msg the message
*/
public NoSuchReportException(String msg) {
super(msg);
}
/**
* Creates an instance with a given message and cause.
* @param msg the message
* @param cause the cause
*/
public NoSuchReportException(String msg,Throwable cause) {super(msg,cause);}
public NoSuchReportException(Throwable cause) {
super(cause);
}
}

38
src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/ResourcesCreationException.java

@ -0,0 +1,38 @@
package org.gcube.vremanagement.resourcemanager.client.exceptions;
import javax.xml.ws.WebFault;
import org.gcube.common.clients.delegates.Unrecoverable;
@Unrecoverable
@WebFault(name="ResourcesCreationFaultType")
public class ResourcesCreationException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Creates an instance.
*/
public ResourcesCreationException() {
super();
}
/**
* Creates an instance with given message.
* @param msg the message
*/
public ResourcesCreationException(String msg) {
super(msg);
}
/**
* Creates an instance with a given message and cause.
* @param msg the message
* @param cause the cause
*/
public ResourcesCreationException(String msg,Throwable cause) {super(msg,cause);}
public ResourcesCreationException(Throwable cause) {
super(cause);
}
}

39
src/main/java/org/gcube/vremanagement/resourcemanager/client/exceptions/ResourcesRemovalException.java

@ -0,0 +1,39 @@
package org.gcube.vremanagement.resourcemanager.client.exceptions;
import javax.xml.ws.WebFault;
import org.gcube.common.clients.delegates.Unrecoverable;
@Unrecoverable
@WebFault(name="ResourcesRemovalFaultType")
public class ResourcesRemovalException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Creates an instance.
*/
public ResourcesRemovalException() {
super();
}
/**
* Creates an instance with given message.
* @param msg the message
*/
public ResourcesRemovalException(String msg) {
super(msg);
}
/**
* Creates an instance with a given message and cause.
* @param msg the message
* @param cause the cause
*/
public ResourcesRemovalException(String msg,Throwable cause) {super(msg,cause);}
public ResourcesRemovalException(Throwable cause) {
super(cause);
}
}

23
src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMAdminServiceJAXWSStubs.java

@ -0,0 +1,23 @@
package org.gcube.vremanagement.resourcemanager.client.fws;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import static org.gcube.vremanagement.resourcemanager.client.Constants.*;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
/**
*
* @author Andrea Manzi(CERN)
*
*/
@WebService(name=porttypeAdminLocalName,targetNamespace=NAMESPACE_ADMIN)
public interface RMAdminServiceJAXWSStubs {
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public Empty CleanSoftwareState();
}

27
src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMBinderServiceJAXWSStubs.java

@ -0,0 +1,27 @@
package org.gcube.vremanagement.resourcemanager.client.fws;
import static org.gcube.vremanagement.resourcemanager.client.Constants.*;
import static org.gcube.vremanagement.resourcemanager.client.fws.Types.*;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
/**
*
* @author Andrea Manzi(CERN)
*
*/
@WebService(name=porttypeBinderLocalName,targetNamespace=NAMESPACE_BINDER)
public interface RMBinderServiceJAXWSStubs {
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public String AddResources(AddResourcesParameters params);
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public String RemoveResources(RemoveResourcesParameters params);
}

33
src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMControllerServiceJAXWSStubs.java

@ -0,0 +1,33 @@
package org.gcube.vremanagement.resourcemanager.client.fws;
import static org.gcube.vremanagement.resourcemanager.client.Constants.*;
import static org.gcube.vremanagement.resourcemanager.client.fws.Types.*;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
/**
*
* @author Andrea Manzi(CERN)
*
*/
@WebService(name=porttypeControllerLocalName,targetNamespace=NAMESPACE_CONTROLLER)
public interface RMControllerServiceJAXWSStubs {
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public Empty ChangeScopeOptions(OptionsParameters options);
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public String DisposeScope(String scope);
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public Empty CreateScope(CreateScopeParameters params);
}

29
src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/RMReportingServiceJAXWSStubs.java

@ -0,0 +1,29 @@
package org.gcube.vremanagement.resourcemanager.client.fws;
import static org.gcube.vremanagement.resourcemanager.client.Constants.*;
import static org.gcube.vremanagement.resourcemanager.client.fws.Types.*;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
/**
*
* @author Andrea Manzi(CERN)
*
*/
@WebService(name=porttypeReportingLocalName,targetNamespace=NAMESPACE_REPORTING)
public interface RMReportingServiceJAXWSStubs {
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public Empty SendReport(SendReportParameters params);
@SOAPBinding(parameterStyle=ParameterStyle.BARE)
public String GetReport(String reportId);
}

262
src/main/java/org/gcube/vremanagement/resourcemanager/client/fws/Types.java

@ -0,0 +1,262 @@
package org.gcube.vremanagement.resourcemanager.client.fws;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.ws.WebFault;
import org.gcube.common.resources.gcore.common.Identity;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class Types {
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class AddResourcesParameters{
@XmlElement(name = "software")
public SoftwareList softwareList;
@XmlElement (name= "resources")
public ResourceList resources;
@XmlElement (name= "targetScope")
public String targetScope;
public SoftwareList getSoftwareList() {
return softwareList;
}
public void setSoftwareList(SoftwareList softwareList) {
this.softwareList = softwareList;
}
public ResourceList getResources() {
return resources;
}
public void setResources(ResourceList resources) {
this.resources = resources;
}
public String getTargetScope() {
return targetScope;
}
public void setTargetScope(String targetScope) {
this.targetScope = targetScope;
}
@Override
public String toString() {
return "AddResourcesParameters [scope=" + softwareList + ", resources="
+ resources + ", targetScope=" + targetScope + "]";
}
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class RemoveResourcesParameters{
@XmlElement(name = "software")
public SoftwareList softwareList;
@XmlElement (name= "resources")
public ResourceList resources;
@XmlElement (name= "targetScope")
public String targetScope;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class SoftwareList{
@XmlElement(name="suggestedTargetGHNNames")
public ArrayList<String> suggestedTargetGHNNames;
@XmlElement(name="software")
public ArrayList<PackageItem> software;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class ResourceList{
@XmlElement(name="resource")
public ArrayList<ResourceItem> resource;
public ArrayList<ResourceItem> getResource() {
return resource;
}
public void setResource(ArrayList<ResourceItem> resource) {
this.resource = resource;
}
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class PackageItem{
@XmlElement(name="ServiceClass")
public String serviceClass;
@XmlElement(name="ServiceName")
public String serviceName;
@XmlElement(name="ServiceVersion")
public String serviceVersion;
@XmlElement(name="PackageName")
public String packageName;
@XmlElement(name="PackageVersion")
public String packageVersion;
@XmlElement(name="TargetGHNName")
public String targetGHNName;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class ResourceItem{
@XmlElement(name="ID")
public String id;
@XmlElement(name="Type")
public String type;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class OptionsParameters{
@XmlElement(name="targetScope")
public String targetScope;
@XmlElement(name="scopeOptionList")
public ArrayList<ScopeOption> scopeOptionList;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class ScopeOption{
@XmlElement
public String name;
@XmlElement
public String value;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class CreateScopeParameters{
@XmlElement
public String targetScope;
@XmlElement
public String serviceMap;
// @XmlElement(name="optionParameters")
@XmlElementRef
public OptionsParameters optionParameters;
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class SendReportParameters{
@XmlElement
public String callbackID;
@XmlElement
public String report;
@XmlElement
public String targetScope;
}
@WebFault(name="InvalidOptionsFault")
public static class InvalidOptionsFault extends RuntimeException {
public InvalidOptionsFault(String s) {
super(s);
}
}
@WebFault(name="InvalidScopeFault")
public static class InvalidScopeFault extends RuntimeException {
public InvalidScopeFault(String s) {
super(s);
}
}
@WebFault(name="NoSuchReportFault")
public static class NoSuchReportFault extends RuntimeException {
public NoSuchReportFault(String s) {
super(s);
}
}
@WebFault(name="ResourcesCreationFault")
public static class ResourcesCreationFault extends RuntimeException {
public ResourcesCreationFault(String s) {
super(s);
}
}
@WebFault(name="ResourcesRemovalFault")
public static class ResourcesRemovalFault extends RuntimeException {
public ResourcesRemovalFault(String s) {
super(s);
}
}
}

15
src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMAdminInterface.java

@ -0,0 +1,15 @@
package org.gcube.vremanagement.resourcemanager.client.interfaces;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public interface RMAdminInterface {
public Empty cleanSoftwareState() throws InvalidScopeException;
}

19
src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMBinderInterface.java

@ -0,0 +1,19 @@
package org.gcube.vremanagement.resourcemanager.client.interfaces;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesCreationException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesRemovalException;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.AddResourcesParameters;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.RemoveResourcesParameters;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public interface RMBinderInterface {
public String addResources(AddResourcesParameters params) throws ResourcesCreationException, InvalidScopeException;
public String removeResources(RemoveResourcesParameters params) throws ResourcesRemovalException, InvalidScopeException;
}

23
src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMControllerInterface.java

@ -0,0 +1,23 @@
package org.gcube.vremanagement.resourcemanager.client.interfaces;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidOptionsException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.CreateScopeParameters;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.OptionsParameters;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public interface RMControllerInterface {
public Empty changeScopeOptions(OptionsParameters options) throws InvalidScopeException, InvalidOptionsException;
public String disposeScope(String scope) throws InvalidScopeException;
public Empty createScope(CreateScopeParameters params) throws InvalidScopeException, InvalidOptionsException;
}

19
src/main/java/org/gcube/vremanagement/resourcemanager/client/interfaces/RMReportingInterface.java

@ -0,0 +1,19 @@
package org.gcube.vremanagement.resourcemanager.client.interfaces;
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils.Empty;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.NoSuchReportException;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.SendReportParameters;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public interface RMReportingInterface {
public Empty sendReport(SendReportParameters params) throws InvalidScopeException;
public String getReport(String reportId) throws InvalidScopeException, NoSuchReportException;
}

64
src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/AbstractPlugin.java

@ -0,0 +1,64 @@
package org.gcube.vremanagement.resourcemanager.client.plugins;
import org.gcube.common.clients.config.ProxyConfig;
import org.gcube.common.clients.fw.plugin.Plugin;
import org.gcube.vremanagement.resourcemanager.client.Constants;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidOptionsException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.InvalidScopeException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.NoSuchReportException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesCreationException;
import org.gcube.vremanagement.resourcemanager.client.exceptions.ResourcesRemovalException;
import org.gcube.vremanagement.resourcemanager.client.fws.Types.*;
/**
*
* @author Andrea Manzi(CERN)
*
* @param <S>
* @param <P>
*/
public abstract class AbstractPlugin<S,P> implements Plugin<S,P> {
public final String name;
AbstractPlugin(String name) {
this.name=name;
}
@Override
public String serviceClass() {
return Constants.SERVICE_CLASS;
}
@Override
public String serviceName() {
return Constants.SERVICE_NAME;
}
@Override
public String name() {
return name;
}
@Override
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
if (fault instanceof InvalidScopeFault)
return new InvalidScopeException(fault);
if (fault instanceof InvalidOptionsFault)
return new InvalidOptionsException(fault);
if (fault instanceof NoSuchReportFault)
return new NoSuchReportException(fault);
if (fault instanceof ResourcesCreationFault)
return new ResourcesCreationException(fault);
if (fault instanceof ResourcesRemovalFault)
return new ResourcesRemovalException(fault);
return fault;
}
}

39
src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/AdminPlugin.java

@ -0,0 +1,39 @@
package org.gcube.vremanagement.resourcemanager.client.plugins;
import javax.xml.ws.EndpointReference;
import org.gcube.common.clients.config.ProxyConfig;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.vremanagement.resourcemanager.client.Constants;
import org.gcube.vremanagement.resourcemanager.client.RMAdminLibrary;
import org.gcube.vremanagement.resourcemanager.client.fws.RMAdminServiceJAXWSStubs;
import static org.gcube.vremanagement.resourcemanager.client.Constants.*;
import static org.gcube.common.clients.stubs.jaxws.StubFactory.*;
/**
*
* @author Andrea Manzi(CERN)
*
*/
public class AdminPlugin extends AbstractPlugin<RMAdminServiceJAXWSStubs,RMAdminLibrary> {
public AdminPlugin() {
super(PORT_TYPE_NAME_ADMIN);
}
public RMAdminServiceJAXWSStubs resolve(EndpointReference reference,ProxyConfig<?,?> config) throws Exception {
return stubFor(Constants.rm_admin).at(reference);
}
public RMAdminLibrary newProxy(ProxyDelegate<RMAdminServiceJAXWSStubs> delegate) {
return new RMAdminLibrary(delegate);
}
@Override
public String namespace() {
return NAMESPACE_ADMIN;
}
}

39
src/main/java/org/gcube/vremanagement/resourcemanager/client/plugins/BinderPlugin.java