Branched to release version 1.3

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-gcore-resources/1.3@114431 82a268e6-3cf1-43bd-a215-b396298e98cf
feature/24727
Luca Frosini 9 years ago
commit 54d9fcf300

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>common-gcore-resources</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

@ -0,0 +1,7 @@
#Mon Dec 03 17:40:30 CET 2012
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

@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

@ -0,0 +1,5 @@
#Mon Dec 03 17:40:29 CET 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="common-gcore-resources">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
</wb-module>
</project-modules>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

@ -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.

@ -0,0 +1,4 @@
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
* Roberto Cirillo (roberto.cirillo@isti.cnr.it), CNR, Italy
* Luigi Fortunati (luigi.fortunati@isti.cnr.it), CNR, Italy
* Luca Frosini (luca.frosini@isti.cnr.it), CNR, Italy

@ -0,0 +1,41 @@
The gCube System - ${name}
----------------------
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), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
* Roberto Cirillo (roberto.cirillo@isti.cnr.it), CNR, Italy
* Luigi Fortunati (luigi.fortunati@isti.cnr.it), CNR, Italy
* Luca Frosini (luca.frosini@isti.cnr.it), CNR, Italy
Version and Release Date
------------------------
${version}
Description
-----------
${description}
Download information
--------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from:
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/Common-gcore-resources
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

@ -0,0 +1,22 @@
<ReleaseNotes>
<Changeset component="common-gcore-resources-1.0.0" date="2013-11-01">
<Change>First Release</Change>
</Changeset>
<Changeset component="common-gcore-resources-1.1.0" date="2013-13-09">
<Change>readonly groups are iterables and can be converted in collections</Change>
<Change>hosting node's load work with doubles instead of integers</Change>
<Change>resources with no scopes (e.g. just created) now pass validation</Change>
<Change>hosting node's load work with doubles instead of integers</Change>
<Change>more robust serialisation to contain a JAXB bug</Change>
<Change>date serialisation now retro-compatible with legacy processor</Change>
<Change>GenericResource now takes mixed content in its body. #newBody(String) and #bodyAsString() as helpers to work with plain string bodies</Change>
<Change>Software now takes mixed content in its body. #newSpecificData(String) and #specificDataAsString() as helpers to work with plain string data</Change>
</Changeset>
<Changeset component="common-gcore-resources-1.2.0" date="2013-02-10">
<Change>better string vs. DOM handling of Any content</Change>
<Change>Fixed visibility of Software inner class LevelWrapper to be public</Change>
</Changeset>
<Changeset component="common-gcore-resources-1.3.0" date="2015-04-27">
<Change>Deprecated localAvailableStorage() methods and added replacements localAvailableSpace()</Change>
</Changeset>
</ReleaseNotes>

@ -0,0 +1,38 @@
<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>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<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>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID />
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>Common</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

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

@ -0,0 +1,84 @@
<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>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.resources</groupId>
<artifactId>common-gcore-resources</artifactId>
<version>1.3.0-SNAPSHOT</version>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/${project.artifactId}</connection>
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/${project.artifactId}</url>
</scm>
<properties>
<distroDirectory>distro</distroDirectory>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<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>

@ -0,0 +1,166 @@
package org.gcube.common.resources.gcore;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.gcube.common.resources.gcore.common.AnyMixedWrapper;
import org.w3c.dom.Element;
/**
* A resource with custom semantics.
*
*/
@XmlRootElement(name="Resource")
@XmlType(propOrder={"profile"})
public class GenericResource extends Resource {
public GenericResource() {
this.type(Type.GENERIC);
}
@XmlElementRef
private Profile profile;
public Profile profile() {
return profile;
};
public Profile newProfile() {
return profile = new Profile();
}
@XmlRootElement(name="Profile")
@XmlType(propOrder={"secondaryType","name","description","body"})
public static class Profile {
@XmlElement(name="SecondaryType")
private String secondaryType;
@XmlElement(name="Name")
private String name;
@XmlElement(name="Description")
private String description;
@XmlElementRef
private Body body;
public String type() {
return secondaryType;
}
public Profile type(String secondaryType) {
this.secondaryType = secondaryType;
return this;
}
public String name() {
return name;
}
public Profile name(String name) {
this.name = name;
return this;
}
public String description() {
return description;
}
public Profile description(String description) {
this.description = description;
return this;
}
/**
* Returns the body as a DOM document.
* @return the body
*/
public Element body() {
return body==null?null:body.root();
}
/**
* Returns the body as a string.
* @return the body
*/
public String bodyAsString() {
return body==null?null:body.asString();
}
public Element newBody() {
body = new Body();
return body();
}
public Profile newBody(String text) {
body = new Body();
body.setString(text);
return this;
}
@Override
public String toString() {
return "[secondaryType=" + secondaryType + ", name=" + name + ", description=" + description
+ ", body=" + body + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((body == null) ? 0 : body.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((secondaryType == null) ? 0 : secondaryType.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Profile other = (Profile) obj;
if (body == null) {
if (other.body != null)
return false;
} else if (!body.equals(other.body))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (secondaryType == null) {
if (other.secondaryType != null)
return false;
} else if (!secondaryType.equals(other.secondaryType))
return false;
return true;
}
}
@XmlRootElement(name="Body")
public static class Body extends AnyMixedWrapper{}
@Override
public String toString() {
return super.toString()+profile;
}
}

@ -0,0 +1,175 @@
package org.gcube.common.resources.gcore;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
/**
* Partial implementation for resource classes.
*
*/
@XmlType(propOrder={"id","type","scopes"})
public abstract class Resource {
//default resource type version
private static String CURRENT_VERSION = "0.4.x";
/**
* The type of the resource
*/
public static enum Type {
GENERIC{public String toString() {return "GenericResource"; }},
ENDPOINT{public String toString() {return "RuntimeResource"; }},
GCOREENDPOINT{public String toString() {return "RunningInstance"; }},
SOFTWARE{public String toString() {return "Service"; }},
NODE{public String toString() {return "GHN"; }};
}
//type string values -> enum values
private static Map<String,Type> types = new HashMap<String, Resource.Type>();
//populates type map
static {
for (Type t : Type.values())
types.put(t.toString(),t);
}
@XmlElement(name="ID")
private String id = UUID.randomUUID().toString();
@XmlElementWrapper(name = "Scopes")
@XmlElement(name = "Scope")
private Set<String> scopes = new LinkedHashSet<String>(); //order preserving
@XmlElement(name="Type")
private String type;
@XmlAttribute
private String version = CURRENT_VERSION;
public ScopeGroup<String> scopes() {
return new ScopeGroup<String>(scopes,String.class);
}
protected String addScope(String scope){
scopes.add(scope);
return scope;
}
protected String removeScope(String scope){
scopes.remove(scope);
return scope;
}
public Type type() {
return typeOf(type);
}
protected void type(Type t) {
this.type=t.toString();
}
public String version() {
return version;
}
protected void version(String version) {
this.version = version;
}
public String id() {
return id;
}
void setId(String id){
this.id=id;
}
abstract protected Object profile();
@Override
public String toString() {
return getClass().getSimpleName()+" [id=" + id + ", scopes=" + scopes + ", type=" + type + ", version=" + version
+ ", profile=" + profile() + "]";
}
//helper
private static Type typeOf(String type) {
return types.get(type);
}
//before serialisation, we null the optional fields
void beforeMarshal(Marshaller marshaller) {
if (scopes!=null && scopes.isEmpty())
scopes=null;
}
//after serialisation, we reinitialise them
void afterMarshal(Marshaller marshaller) {
if (scopes==null)
scopes=new LinkedHashSet<String>();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((scopes == null) ? 0 : scopes.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
result = prime * result + ((profile() == null) ? 0 : profile().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Resource other = (Resource) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (scopes == null) {
if (other.scopes != null)
return false;
} else if (!scopes.equals(other.scopes))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
if (profile() == null) {
if (other.profile() != null)
return false;
} else if (!profile().equals(other.profile())){
return false;
}
return true;
}
}

@ -0,0 +1,222 @@
package org.gcube.common.resources.gcore;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
/**
* Utility methods over resources.
*
* @author Fabio Simeoni
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*/
public class Resources {
private static SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
//known schema files embedded as classpath resources
private static Map<Class<?>, String> schemaResources = new HashMap<Class<?>, String>();
//cached schemas
private static Map<Class<?>,Schema> schemas = new HashMap<Class<?>, Schema>();
private static Map<Class<?>, JAXBContext> contexts = new HashMap<Class<?>, JAXBContext>();
static {
schemaFactory.setResourceResolver(new SchemaResolver());
//populates schema map
schemaResources.put(GenericResource.class, "schema/generic.xsd");
schemaResources.put(ServiceEndpoint.class, "schema/endpoint.xsd");
schemaResources.put(Software.class, "schema/service.xsd");
schemaResources.put(GCoreEndpoint.class, "schema/gcoreendpoint.xsd");
schemaResources.put(HostingNode.class, "schema/node.xsd");
//note: service instances have no schema so far
}
// helper: resolves common type declarations in schemas
private static class SchemaResolver implements LSResourceResolver {
private static LSInput input;
static {
try {
input = ((DOMImplementationLS) DOMImplementationRegistry.newInstance().getDOMImplementation("LS"))
.createLSInput();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId,
String baseURI) {
if (systemId.equals("CommonTypeDefinitions.xsd")) {
input.setByteStream(Resources.class.getResourceAsStream("/schema/CommonTypeDefinitions.xsd"));
}
return input;
}
};
/**
* Validates a resource against its own schema, if one exists.
* @param resource the resource
* @throws IllegalArgumentException if the resource has no associated scheme
* @throws Exception if the resource is not valid with respect to its own schema
*/
public static void validate(Resource resource) throws IllegalArgumentException, Exception {
Schema schema = schema(resource.getClass());
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayInputStream in = new ByteArrayInputStream(marshal(resource,out).toByteArray());
schema.newValidator().validate(new StreamSource(in));
}
//helper
private static synchronized Schema schema(Class<?> resourceClass) throws Exception {
String schemaResource = schemaResources.get(resourceClass);
if (schemaResource==null)
throw new IllegalArgumentException("no known schema for:\n "+resourceClass);
Schema schema = schemas.get(resourceClass);
if (schema==null) {
InputStream stream = Resources.class.getClassLoader().getResourceAsStream(schemaResource);
schema = schemaFactory.newSchema(new StreamSource(stream));
schemas.put(resourceClass,schema);
}
return schema;
}
/**
* Write the serialisation of a given resource to a given stream.
* @param resource the resource
* @param stream the stream in input
*/
public static <T extends OutputStream> T marshal(Object resource,T stream) {
marshal(resource, new StreamResult(stream));
return stream;
}
/**
* Write the serialisation of a given resource to a given character stream.
* @param resource the resource
* @param stream the stream in input
*/
public static <T extends Writer> T marshal(Object resource,T stream) {
marshal(resource,new StreamResult(stream));
return stream;
}
/**
* Write the serialisation of a given resource to a {@link Result}.
* @param resource the resource
* @param stream the result
* @return the result in input
*/
public static <T extends Result> T marshal(Object resource,T result) {
try {
JAXBContext context = context(resource.getClass());
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.marshal(resource,result);
return result;
}
catch(Exception e) {
throw new RuntimeException("serialisation error",e);
}
}
/**
* Prints the serialisation of a given resource to {@link System#out}
* @param resource the resource
*/
public static void print(Object resource) {
marshal(resource,new OutputStreamWriter(System.out));
}
/**
* Creates a resource of given class from its serialisation in a given {@link Reader}.
* @param resourceClass the class of the resource
* @param reader the reader
* @return the resource
*/
public static <T> T unmarshal(Class<T> resourceClass, Reader reader) {
return unmarshal(resourceClass,new StreamSource(reader));
}
/**
* Creates a resource of given class from its serialisation in a given {@link InputStream}.
* @param resourceClass the class of the resource
* @param stream the stream
* @return the resource
*/
public static <T> T unmarshal(Class<T> resourceClass, InputStream stream) {
return unmarshal(resourceClass,new StreamSource(stream));
}
/**
* Creates a resource of given class from its serialisation in a given {@link Source}.
* @param resourceClass the class of the resource
* @param source the source
* @return the resource
*/
public static <T> T unmarshal(Class<T> resourceClass,Source source) {
try {
JAXBContext ctx = context(resourceClass);
Unmarshaller um = ctx.createUnmarshaller();
return resourceClass.cast(um.unmarshal(source));
}
catch(Exception e) {
throw new RuntimeException("deserialisation error",e);
}
}
//helper
private static synchronized JAXBContext context(Class<?> resourceClass) throws Exception {
JAXBContext ctx = contexts.get(resourceClass);
if (ctx==null) {
ctx = JAXBContext.newInstance(resourceClass);
contexts.put(resourceClass,ctx);
}
return ctx;
}
}

@ -0,0 +1,21 @@
package org.gcube.common.resources.gcore;
import java.util.Collection;
import org.gcube.common.resources.gcore.utils.ReadOnlyGroup;
public class ScopeGroup<T> extends ReadOnlyGroup<T> {
public ScopeGroup(Collection<T> values, Class<? extends T> clazz) {
super(values, clazz);
}
protected boolean add(T element) {
return base.add(element);
}
protected boolean remove(T element) {
return base.remove(element);
}
}

@ -0,0 +1,710 @@
package org.gcube.common.resources.gcore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import org.gcube.common.resources.gcore.common.GHNReference;
import org.gcube.common.resources.gcore.common.Platform;
import org.gcube.common.resources.gcore.utils.Group;
/**
* Describes endpoints of arbitrary services.
*/
@XmlRootElement(name = "Resource")
@XmlType(propOrder={"profile"})
public class ServiceEndpoint extends Resource {
public ServiceEndpoint() {
this.type(Type.ENDPOINT);
}
@XmlElementRef
private Profile profile;
public Profile profile() {
return profile;
};
public Profile newProfile() {
return profile = new Profile();
};
@XmlRootElement(name="Profile")
@XmlType(propOrder={"category","name","version","description","platform","runtime","accessPoints"})
public static class Profile {
@XmlElement(name = "Category")
private String category;
@XmlElement(name = "Name")
private String name;
@XmlElement(name = "Version")
private String version;
@XmlElement(name = "Description")
private String description;
@XmlElementRef
private Platform platform;
@XmlElementRef
private Runtime runtime;
@XmlElementRef
private List<AccessPoint> accessPoints = new ArrayList<AccessPoint>();
public String name() {
return name;
}
public Profile name(String name) {
this.name = name;
return this;
}
public String description() {
return description;
}
public Profile description(String description) {
this.description = description;
return this;
}
public String version() {
return version;
}
public Profile version(String version) {
this.version = version;
return this;
}
public String category() {
return category;
}
public Profile category(String category) {
this.category = category;
return this;
}
public Runtime runtime() {
return runtime;
}
public Runtime newRuntime() {
return runtime=new Runtime();
}
public Platform platform() {
return platform;
}
public Platform newPlatform() {
return platform = new Platform();
}
public Group<AccessPoint> accessPoints() {
return new Group<AccessPoint>(accessPoints,AccessPoint.class);
}
@Override
public String toString() {
return "[name=" + name + ", description=" + description + ", version=" + version + ", category="
+ category + ", runtime=" + runtime + ", platform=" + platform + ", accessPoints=" + accessPoints
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((accessPoints == null) ? 0 : accessPoints.hashCode());
result = prime * result + ((category == null) ? 0 : category.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
result = prime * result + ((runtime == null) ? 0 : runtime.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Profile other = (Profile) obj;
if (accessPoints == null) {
if (other.accessPoints != null)
return false;
} else if (!accessPoints.equals(other.accessPoints))
return false;
if (category == null) {
if (other.category != null)
return false;
} else if (!category.equals(other.category))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (platform == null) {
if (other.platform != null)
return false;
} else if (!platform.equals(other.platform))
return false;
if (runtime == null) {
if (other.runtime != null)
return false;
} else if (!runtime.equals(other.runtime))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}
@XmlRootElement(name = "RunTime")
@XmlType(propOrder={"hostedOn","ghn","status"})
public static class Runtime {
@XmlElement(name = "HostedOn")
private String hostedOn;
@XmlElement(name = "GHN")
private GHNReference ghn = new GHNReference();
@XmlElement(name = "Status")
private String status;
public String hostedOn() {
return hostedOn;
}
public Runtime hostedOn(String hostedOn) {
this.hostedOn = hostedOn;
return this;
}
public String status() {
return status;
}
public Runtime status(String status) {
this.status = status;
return this;
}
public String ghnId() {
return ghn.id;
}
public Runtime ghnId(String id) {
this.ghn.id=id;
return this;
}
//before serialisation, we null the optional fields
void beforeMarshal(Marshaller marshaller) {
if (ghn!=null && ghn.id==null)
ghn=null;
}
//after serialisation, we reinitialise them
void afterMarshal(Marshaller marshaller) {
if (ghn==null)
ghn = new GHNReference();
}
@Override
public String toString() {
return "[hostedOn=" + hostedOn + ", status=" + status + ", ghn=" + ghn + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((ghn == null) ? 0 : ghn.hashCode());
result = prime * result + ((hostedOn == null) ? 0 : hostedOn.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Runtime other = (Runtime) obj;
if (ghn == null) {
if (other.ghn != null)
return false;
} else if (!ghn.equals(other.ghn))
return false;
if (hostedOn == null) {
if (other.hostedOn != null)
return false;
} else if (!hostedOn.equals(other.hostedOn))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
return true;
}
}
@XmlRootElement(name = "AccessData")
@XmlType(propOrder={"username","password"})
static class AccessData {
@XmlElement(name = "Username")
private String username;
@XmlElement(name = "Password")
private String password;
public void set(String password,String username) {
this.password = password;
this.username=username;
}
@Override
public String toString() {
return "[username=" + username + ", password=" + password + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + ((username == null) ? 0 : username.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AccessData other = (AccessData) obj;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
return false;
return true;
}
}
@XmlRootElement(name = "Endpoint")
public static class Endpoint {
@XmlAttribute(name = "EntryName")
private String name;
@XmlValue
private String address;
public String name() {
return name;
}
public String address() {
return address;
}
public void name(String name) {
this.name = name;
}
public void address(String address) {
this.address = address;
}
@Override
public String toString() {
return "[name=" + name + ", address=" + address + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Endpoint other = (Endpoint) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
@XmlRootElement(name = "Interface")
public static class Interface {
@XmlElementRef
private Endpoint endpoint = new Endpoint();
public Endpoint endpoint() {
return endpoint;
}
@Override
public String toString() {
return "[endpoints=" + endpoint + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Interface other = (Interface) obj;
if (endpoint == null) {
if (other.endpoint != null)
return false;
} else if (!endpoint.equals(other.endpoint))
return false;
return true;
}
}
@XmlRootElement(name = "AccessPoint")
@XmlType(propOrder={"description","itfce","accessData","properties"})
public static class AccessPoint {
@XmlElement(name = "Description")
private String description;
@XmlElementRef
private Interface itfce = new Interface();
@XmlElementRef
private AccessData accessData;
@XmlElementWrapper(name = "Properties")
@XmlElementRef
private List<Property> properties = new ArrayList<Property>();
//before serialisation, we null the optional fields
void beforeMarshal(Marshaller marshaller) {
if (properties!=null && properties.isEmpty())
properties=null;
}
//after serialisation, we reinitialise them
void afterMarshal(Marshaller marshaller) {
if (properties==null)
properties = new ArrayList<Property>();
}
public String description() {
return description;
}
public AccessPoint description(String description) {
this.description = description;
return this;
}
public String username() {
return accessData.username;
}
public String password() {
return accessData.password;
}
public AccessPoint credentials(String password,String username) {
accessData = new AccessData();
accessData.password=password;
accessData.username=username;
return this;
}
public String name() {
return itfce.endpoint().name();
}
public AccessPoint name(String address) {
itfce.endpoint().name(address);
return this;
}
public String address() {
return itfce.endpoint().address();
}
public AccessPoint address(String address) {
itfce.endpoint().address(address);
return this;
}
public Group<Property> properties() {
return new Group<Property>(properties,Property.class);
}
public Map<String, Property> propertyMap(){
Map<String, Property> map=new HashMap<String, Property>();
for (Property p: properties){
if(p.name()!=null)
map.put(p.name(),p);
}
return map;
}
@Override
public String toString() {
return "AccessPoint [description=" + description + ", accessData=" + accessData + ", interface=" + itfce
+ ", properties=" + properties + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((accessData == null) ? 0 : accessData.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((itfce == null) ? 0 : itfce.hashCode());
result = prime * result + ((properties == null) ? 0 : properties.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AccessPoint other = (AccessPoint) obj;
if (accessData == null) {
if (other.accessData != null)
return false;
} else if (!accessData.equals(other.accessData))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (itfce == null) {
if (other.itfce != null)
return false;
} else if (!itfce.equals(other.itfce))
return false;
if (properties == null) {
if (other.properties != null)
return false;
} else if (!properties.equals(other.properties))
return false;
return true;
}
}
@XmlRootElement(name="Property")
@XmlType(propOrder={"name","value"})
public static class Property {
@XmlElement(name = "Name")
private String name;
@XmlElement(name = "Value")
private PropertyValue value = new PropertyValue();
public String name() {
return name;
}
public Property nameAndValue(String name,String value) {
this.name = name;
this.value.value=value;
return this;
}
public boolean isEncrypted() {
return value.encrypted;
}
public Property encrypted(boolean encrypted) {
this.value.encrypted = encrypted;
return this;
}
public String value() {
return value.value;
}
@Override
public String toString() {
return "Property [name=" + name + ", value=" + value + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Property other = (Property) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}
public static class PropertyValue {
@XmlAttribute(name="encrypted")
private boolean encrypted;
@XmlValue
private String value;
@Override
public String toString() {
return "[encrypted=" + encrypted + ", value=" + value + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (encrypted ? 1231 : 1237);
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PropertyValue other = (PropertyValue) obj;
if (encrypted != other.encrypted)
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}
}

@ -0,0 +1,377 @@
package org.gcube.common.resources.gcore;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
import org.gcube.common.resources.gcore.common.AnyWrapper;
import org.gcube.common.resources.gcore.utils.Group;
import org.gcube.common.resources.gcore.utils.Utils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Describes instances of stateful services.
*
*/
@XmlRootElement(name="Document")
public class ServiceInstance {
@XmlElement(name="ID")
private String id;
@XmlElement(name="Source")
private URI endpoint;
@XmlElement(name="SourceKey")
private String key;
@XmlElementRef
private Reference keyElement;
@XmlRootElement(name="CompleteSourceKey")
private static class Reference extends AnyWrapper {}
@XmlElement(name="TerminationTime")
private long terminationTime;
@XmlElement(name="LastUpdateMs")
private long lastUpdate;
@XmlElement(name="PublicationMode")
private String publicationMode;
@XmlElementRef
private Properties properties;
public String id() {
return id;
}
public ServiceInstance id(String id) {
this.id = id;
return this;
}
public URI endpoint() {
return endpoint;
}
public ServiceInstance endpoint(URI endpoint) {
this.endpoint = endpoint;
return this;
}
public String key() {
return key;
}
public ServiceInstance key(String key) {
this.key = key;
return this;
}
public EndpointReference reference() {
return new W3CEndpointReferenceBuilder().address(endpoint.toString()).referenceParameter(keyElement.root()).build();
}
public long terminationTime() {
return terminationTime;
}
public ServiceInstance terminationTime(long terminationTime) {
this.terminationTime = terminationTime;
return this;
}
public long lastUpdate() {
return lastUpdate;
}
public ServiceInstance lastUpdate(long lastUpdate) {
this.lastUpdate = lastUpdate;
return this;
}
public String publicationMode() {
return publicationMode;
}
public ServiceInstance publicationMode(String publicationMode) {
this.publicationMode = publicationMode;
return this;
}
public Properties properties() {
return properties;
}
public Properties newProperties() {
return properties=new Properties();
}
@Override
public String toString() {
return "ServiceInstance [id=" + id + ", endpoint=" + endpoint + ", key=" + key + ", reference=" + reference()
+ ", terminationTime=" + terminationTime + ", lastUpdate=" + lastUpdate + ", publicationMode="
+ publicationMode + ", properties=" + properties + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + (int) (lastUpdate ^ (lastUpdate >>> 32));
result = prime * result + ((properties == null) ? 0 : properties.hashCode());
result = prime * result + ((publicationMode == null) ? 0 : publicationMode.hashCode());
result = prime * result + ((keyElement == null) ? 0 : keyElement.hashCode());
result = prime * result + (int) (terminationTime ^ (terminationTime >>> 32));
return result;
}
//NOTE: manually adapted, do not regenerate blindly
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceInstance other = (ServiceInstance) obj;
if (endpoint == null) {
if (other.endpoint != null)
return false;
} else if (!endpoint.equals(other.endpoint))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (lastUpdate != other.lastUpdate)
return false;
if (properties == null) {
if (other.properties != null)
return false;
} else if (!properties.equals(other.properties))
return false;
if (publicationMode == null) {
if (other.publicationMode != null)
return false;
} else if (!publicationMode.equals(other.publicationMode))
return false;
if (keyElement == null) {
if (other.keyElement != null)
return false;
} else if (!keyElement.equals(other.keyElement))
return false;
if (terminationTime != other.terminationTime)
return false;
return true;
}
@XmlRootElement(name="Data")
public static class Properties {
public static final String PROVIDER_NS="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider";
@XmlElement(name="GHN",namespace=PROVIDER_NS)
private String nodeId;
@XmlElement(name="RI",namespace=PROVIDER_NS)
private String endpointId;
@XmlElement(name="ServiceID",namespace=PROVIDER_NS)
private String serviceId;
@XmlElement(name="ServiceClass",namespace=PROVIDER_NS)
private String serviceClass;
@XmlElement(name="ServiceName",namespace=PROVIDER_NS)
private String serviceName;
@XmlElement(name="Scope",namespace=PROVIDER_NS)
private List<String> scopes = new ArrayList<String>();
//this is the element we return to client for modifications
private Element root;
@XmlAnyElement
private List<Element> customProperties;
public String nodeId() {
return nodeId;
}
public Properties nodeId(String nodeId) {
this.nodeId = nodeId;
return this;
}
public String endpointId() {
return endpointId;
}
public Properties endpointId(String endpointId) {
this.endpointId = endpointId;
return this;
}
public String serviceId() {
return serviceId;
}
public Properties serviceId(String serviceId) {
this.serviceId = serviceId;
return this;
}
public String serviceClass() {
return serviceClass;
}
public Properties serviceClass(String serviceClass) {
this.serviceClass = serviceClass;
return this;
}
public String serviceName() {
return serviceName;
}
public Properties serviceName(String serviceName) {
this.serviceName = serviceName;
return this;
}
public Collection<String> scopes() {
return new Group<String>(scopes,String.class);
}
public Element customProperties() {
return root;
}
public Element newCustomProperties() {
return root = Utils.newDocument().getDocumentElement();
}
//after deserialisation, we link the elements to the root
void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
if (customProperties!=null) {
newCustomProperties();
for (Element e: customProperties)
root.appendChild(root.getOwnerDocument().adoptNode(e));
}
customProperties=null;
}
//before serialisation we copy the child elements of the root
void beforeMarshal(Marshaller marshaller) {
if (root!=null) {
customProperties = new ArrayList<Element>();
NodeList list = root.getChildNodes();
for (int i=0;i<list.getLength();i++) {
Node node = list.item(i);
if (node.getNodeType()==Node.ELEMENT_NODE)
customProperties.add((Element) node);
}
}
}
@Override
public String toString() {
return "Properties [nodeId=" + nodeId + ", endpointId=" + endpointId + ", serviceId=" + serviceId
+ ", serviceClass=" + serviceClass + ", serviceName=" + serviceName + ", scopes=" + scopes
+ ", customProperties=" + customProperties + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((customProperties == null) ? 0 : customProperties.hashCode());
result = prime * result + ((endpointId == null) ? 0 : endpointId.hashCode());
result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
result = prime * result + ((scopes == null) ? 0 : scopes.hashCode());
result = prime * result + ((serviceClass == null) ? 0 : serviceClass.hashCode());
result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
return result;
}
//NOTE: manually adapted for DOM equality, do not regenerate blindly
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Properties other = (Properties) obj;
//manually adapter
if (customProperties() == null) {
if (other.customProperties() != null)
return false;
} else if (!customProperties().isEqualNode(other.customProperties()))
return false;
if (endpointId == null) {
if (other.endpointId != null)
return false;
} else if (!endpointId.equals(other.endpointId))
return false;
if (nodeId == null) {
if (other.nodeId != null)
return false;
} else if (!nodeId.equals(other.nodeId))
return false;
if (scopes == null) {
if (other.scopes != null)
return false;
} else if (!scopes.equals(other.scopes))
return false;
if (serviceClass == null) {
if (other.serviceClass != null)
return false;
} else if (!serviceClass.equals(other.serviceClass))
return false;
if (serviceId == null) {
if (other.serviceId != null)
return false;
} else if (!serviceId.equals(other.serviceId))
return false;
if (serviceName == null) {
if (other.serviceName != null)
return false;
} else if (!serviceName.equals(other.serviceName))
return false;
return true;
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,170 @@
package org.gcube.common.resources.gcore.common;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.gcube.common.resources.gcore.utils.Utils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class AnyMixedWrapper {
//this is the element we return to client for modifications
private Element root = Utils.newDocument().getDocumentElement();
//these are the nodes we deserialise
@XmlAnyElement
@XmlMixed
private List<Object> nodes;
public Element root() {
Element response = root;
NodeList list = root.getChildNodes();
if (list.getLength()==1) {
Node child = list.item(0);
if (child instanceof Element)
response = (Element) child;
}
return response;
}
public String asString() {
StringBuilder builder = new StringBuilder();
NodeList list = root.getChildNodes();
for (int i=0; i<list.getLength(); i++) {
Node child = list.item(i);
if (child instanceof Element)
builder.append(toString(child));
else
builder.append(child.getTextContent());
}
return builder.toString();
}
public void setString(String text) {
try {
for (Node node : Utils.parse(text))
root.appendChild(root.getOwnerDocument().importNode(node,true));
}
catch(Exception e) {
throw new RuntimeException("cannot add "+text+" to this resource as it violates well-formedness constraints",e);
}
}
//after deserialisation, we link the nodes to the root
@SuppressWarnings("unused")
private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
if (nodes!=null) {
boolean mixedContent=false;
for (Object node: nodes)
if (node instanceof String && !String.class.cast(node).matches("\\s*")) {//not whitespace?
mixedContent=true;
break;
}
for (Object node: nodes)
if (node instanceof Element)
root.appendChild(root.getOwnerDocument().adoptNode((Element)node));
else
if (mixedContent)
root.appendChild(root.getOwnerDocument().createTextNode((String) node));
}
nodes=null; //flush original input
}
//before serialisation we copy the child nodes of the root
@SuppressWarnings("unused")
private void beforeMarshal(Marshaller marshaller) {
nodes = new ArrayList<Object>();
NodeList list = root.getChildNodes();
for (int i=0;i<list.getLength();i++) {
Node node = list.item(i);
if (node.getNodeType()==Node.ELEMENT_NODE)
nodes.add((Element) node);
else
nodes.add(node.getTextContent());
}
}
@Override
public String toString() {
return "[element=" + root + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((root == null) ? 0 : root.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AnyMixedWrapper other = (AnyMixedWrapper) obj;
if(((root != null) && (other.root != null))){
root.normalize();
other.root.normalize();
}
if (root == null) {
if (other.root != null)
return false;
} else if (!root.isEqualNode(other.root)){
return false;
}
return true;
}
private static TransformerFactory tFactory = TransformerFactory.newInstance();
private static String toString(Node tree) {
try {
String nodeString = null;
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty("omit-xml-declaration", "yes");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(tree);
transformer.transform( source, result );
nodeString = sw.getBuffer().toString();
return nodeString;
}
catch(Exception e) {
throw new RuntimeException("cannot convert DOM to string",e);
}
}
}

@ -0,0 +1,89 @@
package org.gcube.common.resources.gcore.common;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAnyElement;
import org.gcube.common.resources.gcore.utils.Utils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class AnyWrapper {
//this is the element we return to client for modifications
private Element root = Utils.newDocument().getDocumentElement();
//these are the elements we deserialise
@XmlAnyElement
private List<Element> elements;
public Element root() {
return root;
}
//after deserialisation, we link the elements to the root
@SuppressWarnings("unused")
private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
if (elements!=null)
for (Element e: elements)
root.appendChild(root.getOwnerDocument().adoptNode(e));
elements=null;
}
//before serialisation we copy the child elements of the root
@SuppressWarnings("unused")
private void beforeMarshal(Marshaller marshaller) {
elements = new ArrayList<Element>();
NodeList list = root.getChildNodes();
for (int i=0;i<list.getLength();i++) {
Node node = list.item(i);
if (node.getNodeType()==Node.ELEMENT_NODE)
elements.add((Element) node);
}
}
@Override
public String toString() {
return "[element=" + root + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((root == null) ? 0 : root.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AnyWrapper other = (AnyWrapper) obj;
if(((root != null) && (other.root != null))){
root.normalize();
other.root.normalize();
}
if (root == null) {
if (other.root != null)
return false;
} else if (!root.isEqualNode(other.root)){
return false;
}
return true;
}
}

@ -0,0 +1,39 @@
package org.gcube.common.resources.gcore.common;
import javax.xml.bind.annotation.XmlAttribute;
public class BooleanWrapper {
@XmlAttribute(name="value")
public boolean value;
public BooleanWrapper() {}
public BooleanWrapper(boolean value) {
this.value=value;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (value ? 1231 : 1237);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BooleanWrapper other = (BooleanWrapper) obj;
if (value != other.value)
return false;
return true;
}
}

@ -0,0 +1,52 @@
package org.gcube.common.resources.gcore.common;
import java.util.Calendar;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.gcube.common.resources.gcore.utils.DateFormatterAdapter;
import org.gcube.common.resources.gcore.utils.Utils;
public class DateWrapper {
@XmlAttribute(name="value")
@XmlJavaTypeAdapter(DateFormatterAdapter.class)
public Calendar value;
@Override
public String toString() {
// not all the date are mandatory, if a date is optional the value is null
if(value != null)
return Utils.toString(value);
else
return "";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DateWrapper other = (DateWrapper) obj;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}

@ -0,0 +1,47 @@
package org.gcube.common.resources.gcore.common;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
public class FileList {
@XmlElement(name="File")
public Set<String> files=new LinkedHashSet<String>();
@Override
public String toString() {
return "[files=" + files + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((files == null) ? 0 : files.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FileList other = (FileList) obj;
if (files == null) {
if (other.files != null)
return false;
} else if (!files.equals(other.files))
return false;
return true;
}
}

@ -0,0 +1,41 @@
package org.gcube.common.resources.gcore.common;
import javax.xml.bind.annotation.XmlAttribute;
public class GHNReference {
@XmlAttribute(name = "UniqueID")
public String id;
@Override
public String toString() {
return "[id=" + id + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GHNReference other = (GHNReference) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}

@ -0,0 +1,68 @@
package org.gcube.common.resources.gcore.common;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlType(propOrder={"subject", "caSubject"})
@XmlRootElement(name = "RunningInstanceIdentity")
public class Identity {
@XmlElement(name="subject")
public String subject;
@XmlElement(name="CASubject")
public String caSubject;
public void subjects(String subject, String caSubject) {
this.subject=subject;
this.caSubject=caSubject;
}
public String subject() {
return this.subject;
}
public String caSubject() {
return this.caSubject;
}
@Override
public String toString() {
return "Identity [subject=" + subject + ", caSubject=" + caSubject
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((caSubject == null) ? 0 : caSubject.hashCode());
result = prime * result + ((subject == null) ? 0 : subject.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Identity other = (Identity) obj;
if (caSubject == null) {
if (other.caSubject != null)
return false;
} else if (!caSubject.equals(other.caSubject))
return false;
if (subject == null) {
if (other.subject != null)
return false;
} else if (!subject.equals(other.subject))
return false;
return true;
}
}

@ -0,0 +1,139 @@
package org.gcube.common.resources.gcore.common;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@XmlType(propOrder={"name","version","minorVersion","revisionVersion","buildVersion"})
@XmlRootElement(name = "Platform")
public class Platform {
@XmlTransient
public boolean isEmpty=true;
@XmlElement(name="Name")
private String name;
@XmlElement(name="Version")
private Short version;
@XmlElement(name="MinorVersion")
private Short minorVersion;
@XmlElement(name="RevisionVersion")
private Short revisionVersion;
@XmlElement(name="BuildVersion")
private Short buildVersion;
public String name() {
return name;
}
public Platform name(String name) {
this.name = name;
this.isEmpty=false;
return this;
}
public short version() {
return version;
}
public Platform version(short version) {
this.version = version;
this.isEmpty=false;
return this;
}
public Short minorVersion() {
return minorVersion;
}
public Platform minorVersion(short minorVersion) {
this.minorVersion = minorVersion;
this.isEmpty=false;
return this;
}
public Short revisionVersion() {
return revisionVersion;
}
public Platform revisionVersion(short revisionVersion) {
this.revisionVersion = revisionVersion;
this.isEmpty=false;
return this;
}
public Short buildVersion() {
return buildVersion;
}
public Platform buildVersion(short buildVersion) {
this.buildVersion = buildVersion;
this.isEmpty=false;
return this;
}
@Override
public String toString() {
return "[name=" + name + ", version=" + version + ", minorVersion=" + minorVersion
+ ", revisionVersion=" + revisionVersion + ", buildVersion=" + buildVersion + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((buildVersion == null) ? 0 : buildVersion.hashCode());
result = prime * result + (isEmpty ? 1231 : 1237);
result = prime * result + ((minorVersion == null) ? 0 : minorVersion.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((revisionVersion == null) ? 0 : revisionVersion.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Platform other = (Platform) obj;
if (buildVersion == null) {
if (other.buildVersion != null)
return false;
} else if (!buildVersion.equals(other.buildVersion))
return false;
if (isEmpty != other.isEmpty)
return false;
if (minorVersion == null) {
if (other.minorVersion != null)
return false;
} else if (!minorVersion.equals(other.minorVersion))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (revisionVersion == null) {
if (other.revisionVersion != null)
return false;
} else if (!revisionVersion.equals(other.revisionVersion))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}

@ -0,0 +1,41 @@
package org.gcube.common.resources.gcore.common;
import javax.xml.bind.annotation.XmlAttribute;
public class ServiceReference {
@XmlAttribute(name = "UniqueID")
public String id;
@Override
public String toString() {
return "[id=" + id + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceReference other = (ServiceReference) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}

@ -0,0 +1,31 @@
package org.gcube.common.resources.gcore.utils;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
public class DateFormatterAdapter extends XmlAdapter<String, Calendar> {
@Override
public String marshal(Calendar cal) throws Exception {
GregorianCalendar c = new GregorianCalendar();
c.setTime(cal.getTime());
XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
date2.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
return date2.toXMLFormat();
}
@Override
public Calendar unmarshal(String date) throws Exception {
XMLGregorianCalendar gregorianDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(date);
Calendar cal = Calendar.getInstance();
cal.setTime(gregorianDate.toGregorianCalendar().getTime());
return cal;
}
}

@ -0,0 +1,76 @@
package org.gcube.common.resources.gcore.utils;
import java.util.Arrays;
import java.util.Collection;
public class Group<T> extends ReadOnlyGroup<T> implements Collection<T> {
public Group(Collection<T> values, Class<? extends T> clazz) {
super(values,clazz);
}
/**
* Adds a new element to the collection and returns it.
* @return the new element
*/
public T add() {
try {
T t = clazz.newInstance();
add(t);
return t;
}
catch(Exception e) {
throw new RuntimeException("invalid model class, cannot be instantiated reflectively",e);
}
}
public <S extends T> S add(Class<S> subclass) {
try {
S s = subclass.newInstance();
add(s);
return s;
}
catch(Exception e) {
throw new RuntimeException("invalid model class, cannot be instantiated reflectively",e);
}
}
public boolean add(T element) {
return base.add(element);
};
public boolean remove(Object element) {
return base.remove(element);
}
public void clear() {
base.clear();
}
public boolean removeAll(Collection<?> c) {
return base.removeAll(c);
}
public boolean removeAll(Object ... elements) {
return base.removeAll(Arrays.asList(elements));
}
public boolean retainAll(Collection<?> c) {
return base.retainAll(c);
}
public boolean retainAll(Object ... elements) {
return base.retainAll(Arrays.asList(elements));
}
public boolean addAll(@SuppressWarnings("unchecked") T ... elements) {
return base.addAll(Arrays.asList(elements));
}
public boolean addAll(Collection<? extends T> c) {
return base.addAll(c);
}
}

@ -0,0 +1,87 @@
package org.gcube.common.resources.gcore.utils;
import static java.util.Arrays.*;
import java.util.Collection;
import java.util.Iterator;
public class ReadOnlyGroup<T> implements Iterable<T> {
protected final Collection<T> base;
protected final Class<? extends T> clazz;
public ReadOnlyGroup(Collection<T> values, Class<? extends T> clazz) {
this.base=values;
this.clazz=clazz;
}
public boolean contains(Object o) {
return base.contains(o);
}
public boolean containsAll(Collection<?> c) {
return base.containsAll(c);
}
public boolean containsAll(Object ... elements) {
return base.containsAll(asList(elements));
}
// public boolean equals(Object o) {
// return base.equals(o);
// }
//
// public int hashCode() {
// return base.hashCode();
// }
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReadOnlyGroup<?> other = (ReadOnlyGroup<?>) obj;
if (base == null) {
if (other.base != null)
return false;
} else if (!base.equals(other.base))
return false;
return true;
}
@Override
public int hashCode() {
return base.hashCode();
}
public boolean isEmpty() {
return base.isEmpty();
}
public Collection<T> asCollection() {
return base;
}
public int size() {
return base.size();
}
public Object[] toArray() {
return base.toArray();
}
public <E> E[] toArray(E[] a) {
return base.toArray(a);
}
public Iterator<T> iterator() {
return base.iterator();
}
}

@ -0,0 +1,65 @@
package org.gcube.common.resources.gcore.utils;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* Library-wide implementation utilities.
*
*
*/
public class Utils {
static Document emptyDocument;
static SimpleDateFormat dateFormat = new SimpleDateFormat();
static DocumentBuilder builder;
static {
DocumentBuilderFactory.newInstance();
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
emptyDocument=builder.newDocument();
}
catch(Exception e) {
throw new RuntimeException(e);
}
}
public static List<Node> parse(String text) throws Exception {
String wrapped = "<doc>"+text+"</doc>";
List<Node> nodes = new ArrayList<Node>();
Document document = builder.parse(new InputSource(new StringReader(wrapped)));
NodeList children = document.getDocumentElement().getChildNodes();
for (int i=0;i<children.getLength();i++)
nodes.add(children.item(i));
return nodes;
}
public static Document newDocument() {
Document document = builder.newDocument();
document.appendChild(document.createElement("doc"));
return document;
}
public static String toString(Calendar c) {
return dateFormat.format(c.getTime());
}
public static void notNull(String name, Object value) throws IllegalArgumentException {
if (value==null)
throw new IllegalArgumentException("parameter "+ name+" is null");
}
}

@ -0,0 +1,128 @@
package org.gcube.common.resources.gcore.utils;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.NamespaceContext;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Simple XPath evaluator.
*
* @author Fabio Simeoni
*
*/
public class XPathHelper {
/** XPath engine. */;
private static XPathFactory factory = XPathFactory.newInstance();
private XPath engine = factory.newXPath();
private Map<String,String> namespaces = new HashMap<String,String>();
private NamespaceContext nsContext = new NamespaceContext() {
public String getNamespaceURI(String prefix) {
return namespaces.get(prefix);
}
public Iterator<?> getPrefixes(String val) {
return null;
}
public String getPrefix(String uri) {
return null;
}
};
/** Transformation engine. */
private static Transformer transformer;
static {
try {
transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
}
catch(Exception e) {
throw new RuntimeException(e);
}
}
private final Node root;
/**
* Creates an instance with a {@link Node} .
* @param root the node
*/
public XPathHelper(Node root) {
this.root=root;
engine.setNamespaceContext(nsContext);
}
/**
* Declares a namespace for XPath evaluation.
* @param prefix the namespace prefix
* @param uri the namespace URI
*/
public void addNamespace(String prefix,String uri) {
namespaces.put(prefix,uri);
}
/**
* Evaluates an XPath expression and returns matching values as strings.
* @param xpath the expression
* @return the list matching values
*/
public List<String> evaluate(String xpath) {
List<String> results = new ArrayList<String>();
try {
NodeList set = evaluateForNodes(xpath);
for (int i=0;i<set.getLength();i++) {
StreamResult sr = new StreamResult(new StringWriter());
transformer.transform(new DOMSource(set.item(i)),sr);
results.add(sr.getWriter().toString());
}
return results;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* Evaluates an XPath expression and returns matching values as a {@link NodeList}.
* @param xpath the expression
* @return the list matching values
*/
public NodeList evaluateForNodes(String xpath) {
try {
return (NodeList) engine.evaluate(xpath,root, XPathConstants.NODESET);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for GCUBE Datatypes Version 1.2 Last modified: 29/02/2008 Contact: http://www.gcube-system.org
</xs:documentation>
</xs:annotation>
<xs:element name="Resource" type="ResourceType" />
<xs:complexType name="ResourceType">
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="Type" type="xs:string"/>
<xs:element name="Scopes" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Scope" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Profile" type="ProfileType"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string"/>
</xs:complexType>
<xs:complexType name="ProfileType">
<xs:sequence>
<xs:any namespace="##any" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="BooleanValueType">
<xs:attribute name="value" type="xs:boolean" use="required"/>
</xs:complexType>
<xs:complexType name="FreeXMLType">
<xs:sequence>
<xs:any processContents="skip" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FileListType">
<xs:sequence>
<xs:element name="File" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeTextType" mixed="true">
<xs:complexContent mixed="true">
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="identity">
<xs:sequence>
<xs:element name="subject" type="xs:string"/>
<xs:element name="CASubject" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PlatformDescription">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Version" type="xs:short"/>
<xs:element name="MinorVersion" type="xs:short" minOccurs="0"/>
<xs:element name="RevisionVersion" type="xs:short" minOccurs="0"/>
<xs:element name="BuildVersion" type="xs:short" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for GCUBE
Runtime Resource Version 1.0 Last modified:
29/07/2011 Contact:
http://www.gcube-system.org
</xs:documentation>
</xs:annotation>
<xs:redefine schemaLocation="CommonTypeDefinitions.xsd">
<xs:complexType name="ProfileType">
<xs:complexContent>
<xs:restriction base="ProfileType">
<xs:sequence>
<xs:element name="Category" type="xs:string" />
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Version" type="xs:string" minOccurs="0"/>
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="Platform" type="PlatformDescription" />
<xs:element name="RunTime">
<xs:complexType>
<xs:sequence>
<xs:element name="HostedOn" type="xs:string" />
<xs:element ref="GHN" minOccurs="0" />
<xs:element name="Status" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AccessPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element ref="Interface" />
<xs:element name="AccessData" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Username" type="xs:string" minOccurs="0" />
<xs:element name="Password" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Properties" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Property" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="Interface">
<xs:complexType>
<xs:sequence>
<xs:element name="Endpoint">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="EntryName" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GHN">
<xs:complexType>
<xs:attribute name="UniqueID" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Property">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="encrypted" type="xs:boolean" default="false"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for GCUBE Running Instances Version 1.2 Last modified: 16/05/2011 Contact: http://www.gcube-system.org
</xs:documentation>
</xs:annotation>
<!-- RUNNING INSTANCE -->
<xs:redefine schemaLocation="CommonTypeDefinitions.xsd">
<xs:complexType name="ProfileType">
<xs:complexContent>
<xs:restriction base="ProfileType">
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Version" type="xs:string"/>
<xs:element ref="GHN"/>
<xs:element ref="Service"/>
<xs:element name="ServiceName" type="xs:string"/>
<xs:element name="ServiceClass" type="xs:string"/>
<xs:element ref="RunningInstanceSecurity" minOccurs="0"/>
<xs:element name="Platform" type="PlatformDescription" minOccurs="0" maxOccurs="1"/>
<xs:element ref="DeploymentData"/>
<xs:element name="RIEquivalenceFunctions" type="RIFunctionType" minOccurs="0"/>
<xs:element ref="AccessPoint"/>
<xs:element ref="SpecificData" minOccurs="0"/>
<xs:element ref="Accounting" minOccurs="0"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:complexType name="RunningInstanceSecurityType">
<xs:sequence>
<xs:element name="RunningInstanceIdentity" type="identity" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="EntryName" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="DateType">
<xs:attribute name="value" type="xs:dateTime" use="required"/>
</xs:complexType>
<xs:complexType name="RIFunctionType">
<xs:sequence>
<xs:element name="Function" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="ActualParameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Param" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Value" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="RunningInstanceSecurity">
<xs:complexType>
<xs:sequence>
<xs:element name="RunningInstanceInterface" type="RunningInstanceSecurityType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AccessPoint">
<xs:complexType>
<xs:sequence>
<xs:element ref="RunningInstanceInterfaces"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GHN">
<xs:complexType>
<xs:attribute name="UniqueID" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="DeploymentData">
<xs:complexType>
<xs:sequence>
<xs:element name="InstanceName" type="xs:string" minOccurs="0"/>
<xs:element name="LocalPath" type="xs:string" minOccurs="0"/>
<xs:element name="ActivationTime" type="DateType"/>
<xs:element name="TerminationTime" type="DateType" minOccurs="0"/>
<xs:element name="Status" type="xs:string" minOccurs="0"/>
<xs:element name="MessageState" type="xs:string" minOccurs="0"/>
<xs:element name="AvailablePlugins" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Plugin" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RunningInstanceInterfaces">
<xs:complexType>
<xs:sequence>
<xs:element ref="Endpoint" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Endpoint">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="EntryName" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="FactoryURI" type="xs:anyURI"/>
<xs:element name="Service">
<xs:complexType>
<xs:attribute name="UniqueID" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Plugin">
<xs:complexType>
<xs:sequence>
<xs:element name="Service">
<xs:complexType>
<xs:sequence>
<xs:element name="Class" type="xs:string"/>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Version" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Package" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="Version" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Accounting">
<xs:complexType>
<xs:sequence>
<xs:element ref="ScopedAccounting" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ScopedAccounting">
<xs:complexType>
<xs:sequence>
<xs:element name="TotalINCalls" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="AverageINCalls" type="AverageType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="AverageInvocationTime" type="AverageType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="TopCallerGHN" type="TopCallerGHNType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="scope" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="TopCallerGHNType">
<xs:sequence>
<xs:element name="GHNName" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="avgHourlyCalls" type="xs:double" use="required"/>
<xs:attribute name="avgDailyCalls" type="xs:double" use="required"/>
<xs:attribute name="totalCalls" type="xs:long" use="required"/>
</xs:complexType>
<xs:complexType name="AverageType">
<xs:attribute name="interval" type="xs:long" use="required"/>
<xs:attribute name="average" type="xs:double" use="required"/>
</xs:complexType>
<xs:element name="SpecificData" type="FreeXMLType">
<xs:annotation>
<xs:documentation xml:lang="en">
insert here any other property you think is useful to describe a RI-specific feature
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for GCUBE Generic Resource Version 1.4 Last modified: 29/05/2008 Contact: http://www.gcube-system.org
</xs:documentation>
</xs:annotation>
<xs:redefine schemaLocation="CommonTypeDefinitions.xsd">
<xs:complexType name="ProfileType">
<xs:complexContent>
<xs:restriction base="ProfileType">
<xs:sequence>
<xs:element name="SecondaryType" type="xs:string" minOccurs="0"/>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Body" type="FreeTextType"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
</xs:schema>

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for gCube Nodes Version 0.5.0 Last modified:29/05/2009 Contact: http://www.gcube-system.org
</xs:documentation>
</xs:annotation>
<xs:redefine schemaLocation="CommonTypeDefinitions.xsd">
<xs:complexType name="ProfileType">
<xs:complexContent>
<xs:restriction base="ProfileType">
<xs:sequence>
<xs:element name="Infrastructure" type="xs:string"/>
<xs:element ref="GHNDescription"/>
<xs:element ref="Site"/>
<xs:element name="DeployedPackages" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Package" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="GHNDescription">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="ActivationTime" type="xs:dateTime" minOccurs="0"/>
<xs:element name="Status" type="xs:string" minOccurs="0"/>
<xs:element name="StatusMessage" type="xs:string" minOccurs="0"/>
<xs:element ref="Type"/>
<xs:element name="AvailablePlatforms" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Platform" type="PlatformDescription" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SecurityEnabled" type="BooleanValueType"/>
<xs:element ref="SecurityData" minOccurs="0"/>
<xs:element ref="Architecture"/>
<xs:element ref="OperatingSystem"/>
<xs:element ref="Processor" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="NetworkAdapter" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Benchmark" minOccurs="0"/>
<xs:element ref="RunTimeEnv"/>
<xs:element ref="StorageDevice" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="StoragePartition" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="LocalFileSystem" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="RemoteFileSystem" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="StorageDevice2StoragePartition" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="StoragePartition2FileSystem" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Uptime" type="xs:string"/>
<xs:element ref="Load" minOccurs="0"/>
<xs:element ref="HistoricalLoad" minOccurs="0"/>
<xs:element ref="MainMemory"/>
<xs:element name="LocalAvailableSpace" type="xs:integer" minOccurs="0"/>
<xs:element name="LastUpdate" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Type">
<xs:annotation>
<xs:documentation xml:lang="en">
Dynamic: the GHN supports dynamic deployment of new packages
Static: the GHN does not support dynamic deployment of new packages
SelfClening: the GHN supports dynamic deployment of new packages, but only for a short limited period
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Dynamic"/>
<xs:enumeration value="Static"/>
<xs:enumeration value="SelfCleaning"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Architecture">
<xs:complexType>
<xs:attribute name="PlatformType" type="xs:string" use="required"/>
<xs:attribute name="SMPSize" type="xs:integer" use="required"/>
<xs:attribute name="SMTSize" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Benchmark">
<xs:complexType>
<xs:attribute name="SI00" type="xs:integer" use="required"/>
<xs:attribute name="SF00" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Load">
<xs:complexType>
<xs:attribute name="Last1Min" type="xs:double" use="optional"/>
<xs:attribute name="Last5Min" type="xs:double" use="optional"/>
<xs:attribute name="Last15Min" type="xs:double" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="HistoricalLoad">
<xs:complexType>
<xs:attribute name="Last1H" type="xs:double" use="optional"/>
<xs:attribute name="Last1Day" type="xs:double" use="optional"/>
<xs:attribute name="Last1Week" type="xs:double" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="MainMemory">
<xs:complexType>
<xs:attribute name="RAMSize" type="xs:integer"/>
<xs:attribute name="VirtualSize" type="xs:integer"/>
<xs:attribute name="RAMAvailable" type="xs:integer"/>
<xs:attribute name="VirtualAvailable" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="NetworkAdapter">
<xs:complexType>
<xs:attribute name="InboundIP" type="xs:string" use="required"/>
<xs:attribute name="OutboundIP" type="xs:string" use="required"/>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="IPAddress" type="xs:string" use="required"/>
<xs:attribute name="MTU" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="OperatingSystem">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="Release" type="xs:string" use="required"/>
<xs:attribute name="Version" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Processor">
<xs:complexType>
<xs:attribute name="Vendor" type="xs:string" use="required"/>
<xs:attribute name="Model" type="xs:string" use="required"/>
<xs:attribute name="ModelName" type="xs:string" use="required"/>
<xs:attribute name="Family" type="xs:string" use="required"/>
<xs:attribute name="ClockSpeedMhz" type="xs:decimal" use="required"/>
<xs:attribute name="Bogomips" type="xs:decimal" use="required"/>
<xs:attribute name="CacheL1" type="xs:integer" use="required"/>
<xs:attribute name="CacheL1I" type="xs:integer" use="required"/>
<xs:attribute name="CacheL1D" type="xs:integer" use="required"/>
<xs:attribute name="CacheL2" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="SecurityData">
<xs:complexType>
<xs:sequence>
<xs:element name="CA" type="xs:string" minOccurs="0"/>
<xs:element name="CredentialsDistinguishedName" type="xs:string" minOccurs="0"/>
<xs:element name="CredentialsExpireOn" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RunTimeEnv">
<xs:complexType>
<xs:sequence>
<xs:element name="Variable" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Key" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="Value" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Site">
<xs:complexType>
<xs:sequence>
<xs:element name="Location" type="xs:string"/>
<xs:element name="Country">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Latitude" type="xs:string"/>
<xs:element name="Longitude" type="xs:string"/>
<xs:element name="Domain" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="StorageDevice">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="Type" type="xs:string" use="required"/>
<xs:attribute name="TransferRate" type="xs:integer" use="required"/>
<xs:attribute name="Size" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="StorageDevice2StoragePartition">
<xs:complexType>
<xs:attribute name="StorageDeviceName" type="xs:string" use="required"/>
<xs:attribute name="StoragePartitionName" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="StoragePartition">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="Size" type="xs:string" use="required"/>
<xs:attribute name="ReadRate" type="xs:integer" use="required"/>
<xs:attribute name="WriteRate" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="StoragePartition2FileSystem">
<xs:complexType>
<xs:attribute name="StoragePartitionName" type="xs:string" use="required"/>
<xs:attribute name="FileSystemName" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="RemoteFileSystem" type="FileSystemType" />
<xs:element name="LocalFileSystem" type="FileSystemType" />
<xs:complexType name="FileSystemType">
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="Root" type="xs:string" use="required"/>
<xs:attribute name="Size" type="xs:integer" use="required"/>
<xs:attribute name="ReadOnly" type="xs:boolean" use="required"/>
<xs:attribute name="Type" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="Package">
<xs:complexType>
<xs:sequence>
<xs:element name="PackageName" type="xs:string"/>
<xs:element name="PackageVersion" type="xs:string"/>
<xs:element name="ServiceName" type="xs:string"/>
<xs:element name="ServiceClass" type="xs:string"/>
<xs:element name="ServiceVersion" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

@ -0,0 +1,391 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation xml:lang="en">
XML Schema for gCube Services Version 1.2.0 Last modified:16/05/2011 Contact: http://www.gcube-system.org
</xs:documentation>
</xs:annotation><!-- SERVICE -->
<xs:redefine schemaLocation="CommonTypeDefinitions.xsd">
<xs:complexType name="ProfileType">
<xs:complexContent>
<xs:restriction base="ProfileType">
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element ref="Class"/>
<xs:element ref="Name"/>
<xs:element ref="Version"/>
<xs:element ref="Configuration" minOccurs="0"/>
<xs:element name="Dependencies" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Dependency" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="Class"/>
<xs:element ref="Name"/>
<xs:element ref="Version"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Packages">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element ref="Main"/>
<xs:element ref="Software" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:element ref="Software" maxOccurs="unbounded"/>
<xs:sequence>
<xs:element ref="Plugin"/>
<xs:element ref="Software" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="SpecificData" type="FreeTextType" minOccurs="0"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="Class" type="xs:string"/>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Version" type="xs:string"/>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element name="Static" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Configs" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="en">
These configurations have to refer to predefined configuration files distributed with the MAIN package.
At VRE creation time, the VRE designer will choose one.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Config" type="ConfigurationType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Template" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Params">
<xs:complexType>
<xs:sequence>
<xs:element name="Param" type="TemplateParam" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Dynamic" minOccurs="0">
<xs:complexType/>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ConfigurationType">
<xs:sequence>
<xs:element name="File" type="xs:string"/>
<xs:element name="Description" type="xs:string"/>
<xs:element name="Label" type="xs:string"/>
</xs:sequence>
<xs:attribute name="default" type="xs:boolean" use="required"/>
</xs:complexType>
<xs:complexType name="TemplateParam">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Description" type="xs:string"/>
<xs:element name="AllowedValues">
<xs:complexType>
<xs:sequence>
<xs:element name="Value" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string"/>
<xs:element name="Literal" type="xs:string"/>
<xs:element name="Label" type="xs:string"/>
</xs:sequence>
<xs:attribute name="default" type="xs:boolean" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType><!-- PACKAGE -->
<xs:complexType name="Package">
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Version" type="xs:string"/>
<xs:element name="MavenCoordinates" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="groupId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="artifactId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="classifier" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TargetPlatform" type="PlatformDescription" minOccurs="0" maxOccurs="1"/>
<xs:element name="MultiVersion" type="BooleanValueType" minOccurs="0"/>
<xs:element name="Mandatory" minOccurs="0">
<xs:complexType>
<xs:attribute name="level" type="Scopes" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Shareable" minOccurs="0">
<xs:complexType>
<xs:attribute name="level" type="Scopes" default="VO"/>
</xs:complexType>
</xs:element>
<xs:element name="GHNRequirements" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Requirement" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InstallScripts" type="FileListType" minOccurs="0"/>
<xs:element name="UninstallScripts" type="FileListType" minOccurs="0"/>
<xs:element name="RebootScripts" type="FileListType" minOccurs="0"/>
<xs:element name="Dependencies" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Dependency" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SpecificData" type="FreeTextType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="deployable" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:element name="Dependency">
<xs:complexType>
<xs:sequence>
<xs:element ref="Service"/>
<xs:element name="Package" type="xs:string"/>
<xs:element name="Version" type="xs:string" default="1.0" minOccurs="0" maxOccurs="1"/>
<xs:element name="Scope">
<xs:complexType>
<xs:attribute name="level" type="Scopes" use="optional" default="GHN"/>
</xs:complexType>
</xs:element>
<xs:element name="Optional" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Service">
<xs:complexType>
<xs:sequence>
<xs:element ref="Class"/>
<xs:element ref="Name"/>
<xs:element ref="Version" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="Scopes">
<xs:restriction base="xs:string">
<xs:enumeration value="NONE"/>
<xs:enumeration value="GHN"/>
<xs:enumeration value="VRE"/>
<xs:enumeration value="VO"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CategoryType">
<xs:restriction base="xs:string">
<xs:enumeration value="MEM_RAM_AVAILABLE"/>
<xs:enumeration value="MEM_RAM_SIZE"/>
<xs:enumeration value="MEM_VIRTUAL_AVAILABLE"/>
<xs:enumeration value="MEM_VIRTUAL_SIZE"/>
<xs:enumeration value="HOST"/>
<xs:enumeration value="OS"/>
<xs:enumeration value="DISK_SPACE"/>
<xs:enumeration value="LOAD1MIN"/>
<xs:enumeration value="LOAD5MIN"/>
<xs:enumeration value="LOAD15MIN"/>
<xs:enumeration value="PLATFORM"/>
<xs:enumeration value="PROCESSOR_NUM"/>
<xs:enumeration value="PROCESSOR_BOGOMIPS"/>
<xs:enumeration value="SITE_LOCATION"/>
<xs:enumeration value="SITE_COUNTRY"/>
<xs:enumeration value="SITE_DOMAIN"/>
<xs:enumeration value="RUNTIME_ENV_STRING"/>
<xs:enumeration value="RUNTIME_ENV_NUMBER"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="Requirement">
<xs:annotation>
<xs:documentation xml:lang="en">
- the "category" is represented by a tag name of a GHN profile
- the "requirement" is one of the attributes defined for the selected category in the GHN profile
- the "value" is the value of the selected attribute defined for the category in the GHN profile
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="category" type="xs:string" use="required"/><!-- to be considered, must use one of the above enum values -->
<xs:attribute name="key" type="xs:string" use="optional"/>
<xs:attribute name="requirement" type="xs:string" use="optional"/>
<xs:attribute name="value" type="xs:string" use="required"/>
<xs:attribute name="operator" type="OpType" use="required"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="OpType">
<xs:restriction base="xs:string">
<xs:enumeration value="eq"/>
<xs:enumeration value="exist"/>
<xs:enumeration value="ge"/>
<xs:enumeration value="gt"/>
<xs:enumeration value="le"/>
<xs:enumeration value="lt"/>
<xs:enumeration value="ne"/>
<xs:enumeration value="contains"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="Main">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Package">
<xs:sequence>
<xs:element name="GARArchive" type="xs:string"/>
<xs:element name="ServiceEquivalenceFunctions" type="ServiceFunctionType" minOccurs="0"/>
<xs:element name="PortType" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Security" type="SecurityType" minOccurs="0"/>
<xs:element name="WSDL" type="FreeTextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="ServiceFunctionType">
<xs:sequence>
<xs:element name="Function" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="FormalParameters">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Body" type="FreeTextType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="Software">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Package">
<xs:sequence>
<xs:element name="Type" default="library" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="library"/>
<xs:enumeration value="application"/>
<xs:enumeration value="plugin"/>
<xs:enumeration value="webapplication"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EntryPoint" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:element name="Files" type="FileListType"/>
<xs:element name="URI" type="xs:anyURI"/>
</xs:choice>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="Plugin">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Package">
<xs:sequence>
<xs:element name="TargetService" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element ref="Service" minOccurs="1" maxOccurs="1"/>
<xs:element name="Package" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="Version" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EntryPoint" type="xs:string" minOccurs="0"/>
<xs:element name="Files" type="FileListType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<!--<xs:element name="Webapp">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Package">
<xs:sequence>
<xs:element name="TargetPlatform" type="PlatformDescription" minOccurs="1" maxOccurs="1"/>
<xs:element name="EntryPoint" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
--><xs:complexType name="SecurityType">
<xs:sequence>
<xs:element name="Descriptor" type="FreeXMLType" minOccurs="0"/>
<xs:element name="Operations" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="Operation" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="Roles" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
<xs:element name="Roles">
<xs:complexType>
<xs:sequence>
<xs:element name="Role" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Operation">
<xs:complexType>
<xs:sequence>
<xs:element ref="Roles" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="description" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

@ -0,0 +1,170 @@
package org.gcube.common.resources.gcore;
import static junit.framework.Assert.*;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.DeploymentData.Plugin;
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Function.Parameter;
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.ScopedAccounting;
import org.gcube.common.resources.gcore.utils.Group;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.junit.Test;
import org.w3c.dom.Element;
public class GCoreEndpointTest {
@Test
public void bindGCoreEndpoint() throws Exception {
GCoreEndpoint endpoint = unmarshal(GCoreEndpoint.class, "gcoreendpoint.xml");
print(endpoint);
XPathHelper xpath = new XPathHelper(endpoint.profile().specificData());
assertFalse(xpath.evaluate("test").isEmpty());
validate(endpoint);
GCoreEndpoint clone = unmarshal(GCoreEndpoint.class, "gcoreendpoint.xml");
assertEquals(endpoint,clone);
}
private GCoreEndpoint minimalgCoreEndpoint() {
GCoreEndpoint endpoint = new GCoreEndpoint();
endpoint.scopes().add("/some/scope");
endpoint.profile().version("345").
ghnId("nodeid").
serviceId("serviceid").
serviceName("name").
serviceClass("class");
endpoint.profile().newDeploymentData().activationTime(Calendar.getInstance());
endpoint.profile().endpoints().add().nameAndAddress("name",URI.create("http://acme.org"));
return endpoint;
}
@Test
public void buildMinimalGcoreEndpoint() throws Exception {
GCoreEndpoint endpoint = minimalgCoreEndpoint();
print(endpoint);
validate(endpoint);
}
@Test
public void marsharAndUnmarshalDatesTest() throws Exception{
GCoreEndpoint endpoint = minimalgCoreEndpoint();
print(endpoint);
validate(endpoint);
StringWriter stringWriter = new StringWriter();
marshal(endpoint, stringWriter);
StringReader stringreader = new StringReader(stringWriter.toString());
GCoreEndpoint endpoint2 = unmarshal(GCoreEndpoint.class, stringreader);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
assertNotNull(endpoint2.profile().deploymentData().activationTime());
System.out.println(dateFormat.format(endpoint2.profile().deploymentData().activationTime().getTime()));
validate(endpoint2);
}
@Test
public void buildMaximalGCoreEndpoint() throws Exception {
GCoreEndpoint endpoint = minimalgCoreEndpoint();
endpoint.profile().description("description");
////// deployment
endpoint.profile().newDeploymentData().
name("name").
path("path").
status("status").
statusMessage("msg").
terminationTime(Calendar.getInstance()).
activationTime(Calendar.getInstance());
////// plugins
Group<Plugin> plugins = endpoint.profile().deploymentData().plugins();
plugins.add().service("class","name","1").pluginPackage("package").version("2");
plugins.add().service("class2","name2","1").pluginPackage("package2").version("2");
////// endpoints
endpoint.profile().endpoints().add().nameAndAddress("name2",URI.create("http://acme2.org"));
assertFalse(endpoint.profile().hasPlatform());
endpoint.profile().newPlatform().name("name").version((short)2);
validate(endpoint);
////// security
endpoint.profile().security().add().name("name"); //mandatory
validate(endpoint);
endpoint.profile().security().add().name("name2").newIdentity().subjects("subject", "caSubject"); //second with optionals
////// functions
endpoint.profile().functions().add().name("func0");
endpoint.profile().functions().add().name("func1").
parameters().add().nameAndValues("p1", "a","b","c");
Group<Parameter> params = endpoint.profile().functions().add().name("func2").parameters();
params.add().nameAndValues("p2","1");
params.add().nameAndValues("p3","2");
////// specific data
Element custom = endpoint.profile().specificData();
custom.appendChild(custom.getOwnerDocument().createElement("empty"));
///// scoping
ScopedAccounting acc = endpoint.profile().accountings().add();
acc.scope("/some/scope").incomingCalls(100).newTopCaller().name("name").calls(10.5,100.6,20000l);
acc.averageInCalls().add().intervalAndAverage(100L, 20.6);
acc.averageInvocationTime().add().intervalAndAverage(100L, 20.6);
validate(endpoint);
acc.averageInCalls().add().intervalAndAverage(110L, 21.6);
acc.averageInvocationTime().add().intervalAndAverage(110L, 21.6);
print(endpoint);
validate(endpoint);
}
}

@ -0,0 +1,138 @@
package org.gcube.common.resources.gcore;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import static org.junit.Assert.*;
import java.util.List;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.resources.gcore.Resource.Type;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Element;
public class GenericResourceTests {
@Test
public void bindGeneric() throws Exception {
//unmarshal resource
GenericResource generic = unmarshal(GenericResource.class, "generic.xml");
//print it
print(generic);
//resource-specific tests
assertEquals(Type.GENERIC,generic.type());
XPathHelper helper = new XPathHelper(generic.profile().body());
assertFalse(helper.evaluate("other").isEmpty());
//ensure schema conformance
validate(generic);
//test for equality
GenericResource clone = unmarshal(GenericResource.class, "generic.xml");
assertEquals(generic,clone);
}
@Test
public void bindTextGeneric() throws Exception {
//unmarshal resource
GenericResource generic = unmarshal(GenericResource.class, "textgeneric.xml");
//print it
print(generic);
assertEquals("text",generic.profile().bodyAsString());
}
//helper
private GenericResource minimalGeneric() {
GenericResource generic = new GenericResource();
generic.scopes().add("/some/scope");
generic.newProfile().type("type").name("name").newBody();
return generic;
}
@Test
public void buildMinimalGeneric() throws Exception {
GenericResource generic = minimalGeneric();
print(generic);
validate(generic);
}
@Test
public void buildTextGeneric() throws Exception {
GenericResource generic = minimalGeneric();
generic.profile().newBody("<a>hello</a><b>world</b>");
print(generic);
validate(generic);
generic.profile().newBody("mixed<a>hello</a>mixed");
print(generic);
validate(generic);
generic.profile().newBody("freetext");
print(generic);
validate(generic);
}
@Test
public void buildMaximalGeneric() throws Exception {
GenericResource generic = minimalGeneric();
generic.scopes().add("/some/other/scope");
assertEquals(2,generic.scopes().size());
generic.profile().description("desc");
Element body = generic.profile().body();
body.appendChild(body.getOwnerDocument().createElement("added"));
print(generic);
validate(generic);
}
@Test
public void updateGeneric() throws Exception {
GenericResource generic = unmarshal(GenericResource.class, "generic.xml");
generic.scopes().add("/some/other/scope");
generic.profile().description("descupdated").type("type");
Element body = generic.profile().body();
body.appendChild(body.getOwnerDocument().createElement("added"));
print(generic);
List<String> results = new XPathHelper(body).evaluate("added");
Assert.assertEquals(1,results.size());
validate(generic);
}
}

@ -0,0 +1,141 @@
package org.gcube.common.resources.gcore;
import static junit.framework.Assert.*;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import java.math.BigDecimal;
import java.util.Calendar;
import org.gcube.common.resources.gcore.HostingNode;
import org.junit.Test;
/**
*
* @author Fabio Simeoni
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*/
public class HostingNodeTest {
@Test
public void bindNode() throws Exception {
HostingNode node = unmarshal(HostingNode.class, "node.xml");
print(node);
validate(node);
HostingNode clone = unmarshal(HostingNode.class, "node.xml");
assertEquals(node,clone);
}
//helper
private HostingNode minimalNode() {
HostingNode node = new HostingNode();
node.scopes().add("/some/scope");
node.newProfile().infrastructure("infrastructure");
node.profile().newDescription().name("name").uptime("uptime").lastUpdate(Calendar.getInstance());
node.profile().description().newArchitecture().platformType("type").smpSize(30).smtSize(20);
node.profile().description().newOperatingSystem().name("name").version("version").release("release");
node.profile().description().environmentVariables().add().keyAndValue("key", "value");
node.profile().description().newMainMemory().ramAvailable(100).ramSize(200).virtualAvailable(300).virtualSize(350);
node.profile().newSite().location("location").country("it").
domain("domain").latitude("latitude").longitude("longitude");
return node;
}
@Test
public void buildMininimalNode() throws Exception {
HostingNode node = minimalNode();
print(node);
validate(node);
}
@Test
public void buildMaximalNode() throws Exception {
HostingNode node = minimalNode();
node.profile().description().activationTime(Calendar.getInstance());
node.profile().description().platforms().add().name("name").version((short)2);
node.profile().description().newSecurity().authority("auth").
distinguishedName("dn").
expirationDate(Calendar.getInstance());
node.profile().description().processors().add().
family("family").
model("model").
vendor("vendor").modelName("name").
cacheL1(10).cacheL1D(20).cacheL1I(30).cacheL2(40).
bogomips(BigDecimal.valueOf(40000)).
clockSpeedMhz(BigDecimal.valueOf(3000));
node.profile().description().processors().add().
family("family2").
model("model2").
vendor("vendor2").modelName("name2").
cacheL1(10).cacheL1D(20).cacheL1I(30).cacheL2(40).
bogomips(BigDecimal.valueOf(40000)).
clockSpeedMhz(BigDecimal.valueOf(3000));
node.profile().description().networkAdapters().add().
inboundIP("inbound").
outboundIP("outbound").
ipAddress("address").mtu(10).name("name");
node.profile().description().networkAdapters().add().
inboundIP("inbound2").
outboundIP("outbound2").
ipAddress("address2").mtu(10).name("name2");
node.profile().description().newBenchmark().sf(10).si(20);
node.profile().description().storageDevices().add().name("name").size(10).transferRate(10).type("type");
node.profile().description().storageDevices().add().name("name2").size(10).transferRate(10).type("type2");
node.profile().description().storagePartitions().add().name("name").readRate(10).writeRate(20).size("size");
node.profile().description().storagePartitions().add().name("name2").readRate(10).writeRate(20).size("size2");
node.profile().description().localFileSystems().add().name("name").size(10).readOnly(true).root("root").type("type");
node.profile().description().localFileSystems().add().name("name2").size(10).readOnly(true).root("root2").type("type2");
node.profile().description().remoteFileSystems().add().name("name").size(10).readOnly(true).root("root").type("type");
node.profile().description().remoteFileSystems().add().name("name2").size(10).readOnly(true).root("root2").type("type2");
node.profile().description().devicePartitions().add().device("name").name("name");
node.profile().description().devicePartitions().add().device("name2").name("name2");
node.profile().description().fileSystemPartitions().add().fsName("name").storageName("name");
node.profile().description().fileSystemPartitions().add().fsName("name2").storageName("name2");
node.profile().description().newLoad().lastMin(4.5).last15Mins(20.6).last5Mins(5.6);
node.profile().description().newHistoricalLoad().lastDay(67).lastHour(15.3).lastWeek(150.6);
node.profile().description().localAvailableSpace(new Long(100));
node.profile().packages().add().name("name").serviceVersion("1.0.0").packageVersion("version").serviceClass("class").serviceName("name");
node.profile().packages().add().name("name").serviceVersion("2.0.1").packageVersion("version2").serviceClass("class2").serviceName("name2");
print(node);
validate(node);
}
}

@ -0,0 +1,105 @@
package org.gcube.common.resources.gcore;
import static junit.framework.Assert.*;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import java.util.Iterator;
import java.util.Map;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
import org.gcube.common.resources.gcore.utils.Group;
import org.junit.Test;
public class ServiceEndpointTest {
@Test
public void bindServiceEndpoint() throws Exception {
ServiceEndpoint endpoint = unmarshal(ServiceEndpoint.class, "endpoint.xml");
print(endpoint);
validate(endpoint);
//test new map method
testPropertyWithMap(endpoint, "folder");
//end test map
//test for equality
ServiceEndpoint clone = unmarshal(ServiceEndpoint.class, "endpoint.xml");
assertEquals(endpoint,clone);
}
private void testPropertyWithMap(ServiceEndpoint endpoint, String propertyName) {
Group<AccessPoint> apCollection=endpoint.profile().accessPoints();
Iterator<AccessPoint> i=apCollection.iterator();
if(i.hasNext()){
Map<String, Property> map=i.next().propertyMap();
if(map !=null){
Property p =map.get(propertyName);
System.out.println("\n\n Test property folder");
System.out.println("property value founded: "+p.value()+" \n\n");
}
}
}
//helper
private ServiceEndpoint minimalEndpoint() {
ServiceEndpoint endpoint = new ServiceEndpoint();
endpoint.scopes().add("/some/scope");
endpoint.newProfile().category("category").newPlatform().name("name").version((short)2);
endpoint.profile().newRuntime().hostedOn("hosted").ghnId("id").status("status");
return endpoint;
}
@Test
public void buildMinimalEndpoint() throws Exception {
ServiceEndpoint endpoint = minimalEndpoint();
print(endpoint);
validate(endpoint);
}
@Test
public void buildMaximalEndpoint() throws Exception {
ServiceEndpoint endpoint = minimalEndpoint();
endpoint.profile().description("description").
name("name").
version("version");
endpoint.profile().platform().buildVersion((short)1).
minorVersion((short)1).
revisionVersion((short)1);
endpoint.profile().accessPoints().add().name("name").address("address");
validate(endpoint);
endpoint.profile().accessPoints().add().name("name2").address("address2").
description("description").
credentials("pwd", "username");
Group<Property> props = endpoint.profile().accessPoints().add().name("name3").
address("address3").
properties();
props.add().nameAndValue("name","value");
props.add().nameAndValue("name2","value2").encrypted(true);
print(endpoint);
validate(endpoint);
}
}

@ -0,0 +1,45 @@
package org.gcube.common.resources.gcore;
import static junit.framework.Assert.*;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import org.gcube.common.resources.gcore.ServiceInstance;
import org.junit.Test;
import org.w3c.dom.Element;
public class ServiceInstanceTest {
@Test
public void bindServiceInstance() throws Exception {
ServiceInstance instance = unmarshal(ServiceInstance.class, "instance.xml");
print(instance);
ServiceInstance clone = unmarshal(ServiceInstance.class, "instance.xml");
assertEquals(instance,clone);
}
@Test
public void buildServiceInstance() throws Exception {
ServiceInstance instance = new ServiceInstance();
instance.newProperties().serviceId("service").
endpointId("endpoint").
nodeId("node").
serviceClass("class").
serviceName("name").
scopes().add("/some/scope");
Element custom = instance.properties().newCustomProperties();
custom.appendChild(custom.getOwnerDocument().createElement("empty"));
print(instance);
}
}

@ -0,0 +1,178 @@
package org.gcube.common.resources.gcore;
import static java.util.Arrays.*;
import static junit.framework.Assert.*;
import static org.gcube.common.resources.gcore.Resources.*;
import static org.gcube.common.resources.gcore.Software.Profile.GenericPackage.Type.*;
import static org.gcube.common.resources.gcore.Software.Profile.SoftwarePackage.Requirement.OpType.*;
import static org.gcube.common.resources.gcore.TestUtils.*;
import java.net.URI;
import org.gcube.common.resources.gcore.Software;
import org.gcube.common.resources.gcore.Software.Profile.GenericPackage;
import org.gcube.common.resources.gcore.Software.Profile.PluginPackage;
import org.gcube.common.resources.gcore.Software.Profile.ServicePackage;
import org.gcube.common.resources.gcore.Software.Profile.ServicePackage.Function;
import org.gcube.common.resources.gcore.Software.Profile.ServicePackage.PortType;
import org.gcube.common.resources.gcore.Software.Profile.SoftwarePackage.PackageDependency;
import org.junit.Test;
import org.w3c.dom.Element;
public class SoftwareTest {
@Test
public void bindSoftware() throws Exception {
Software service = unmarshal(Software.class, "service.xml");
print(service);
validate(service);
Software clone = unmarshal(Software.class, "service.xml");
assertEquals(service,clone);
validate(service);
}
private Software minimalSoftware() {
Software software = new Software();
software.scopes().add("/some/scope");
software.newProfile().softwareClass("class").softwareName("name");
ServicePackage service = software.profile().packages().add(ServicePackage.class);
service.name("testName").version("testVersion").archive("archive").portTypes().add().name("name");
//not minimal but conveniently done here
PortType pt = service.portTypes().add();
pt.name("name2").newSecurity().newDescriptor().appendChild(pt.security().descriptor().getOwnerDocument().createElement("descriptor"));
pt.newWsdl().appendChild(pt.wsdl().getOwnerDocument().createElement("wsdl"));
//not minimal but conveniently done here
Function f = service.functions().add();
Element body = f.name("name").newBody();
body.appendChild(body.getOwnerDocument().createElement("body"));
f.formalParameters().addAll(asList("param1","param2"));
return software;
}
@Test
public void buildMinimalSoftware() throws Exception {
Software software = minimalSoftware();
print(software);
validate(software);
}
@Test
public void buildMaximalSoftware() throws Exception {
Software software = minimalSoftware();
software.profile().description("description");
software.profile().newConfiguration().newStaticConfiguration().configurations().add().
description("desc").file("file").label("label").isDefault(true);
software.profile().configuration().staticConfiguration().configurations().add().
description("desc2").file("file2").label("label2").isDefault(false);
validate(software);
software.profile().configuration().staticConfiguration().newTemplate().
params().add().name("name").description("descr").
allowedValues().add().
description("description").
label("label").
isDefault(true).literal("lit");
software.profile().configuration().staticConfiguration().template().
params().add().name("name2").description("descr2").
allowedValues().add().
description("description2").
label("label2").
isDefault(false).literal("lit2");
software.profile().dependencies().add().serviceName("name").serviceClass("class").version("version");
software.profile().dependencies().add().serviceName("name2").serviceClass("class2").version("version2");
GenericPackage generic = software.profile().packages().add(GenericPackage.class);
generic.name("testName").type(application).version("testVersion").description("description").files().add("string");
validate(software);
software.profile().packages().add(GenericPackage.class).
name("testName2").version("testVersion2").description("description2").uri(URI.create("http://acme.org"));
generic.newCoordinates().artifactId("id").groupId("gid").version("version").classifier("classifier");
generic.newTargetPlatform().name("name").version((short)1);
generic.multiVersion(false);
generic.entryPoints().addAll(asList("entry1","entry2"));
generic.ghnRequirements().add().category("cat").key("key").requirement("req").operator(exist).value("val");
generic.ghnRequirements().add().category("cat2").key("key2").requirement("req2").operator(exist).value("val2");
generic.installScripts().addAll(asList("installone","installtwo"));
generic.uninstallScripts().addAll(asList("uninstallone","uninstalltwo"));
generic.rebootScripts().addAll(asList("rebootone","reboottwo"));
PackageDependency pDependency= generic.dependencies().add();
pDependency.newService().packageClass("pClass").packageName("pName").version("1.1.1");
pDependency.dependencyPackage("pack1").version("1.1.1").newScope();
Element packageRoot=generic.newSpecificData();
packageRoot.appendChild(packageRoot.getOwnerDocument().createElement("nothingData"));
software.profile().packages().add(GenericPackage.class).
name("testName2").version("testVersion2").
description("description2").uri(URI.create("http://acme.org"));
Element root = software.profile().newSpecificData();
root.appendChild(root.getOwnerDocument().createElement("nothing"));
print(software);
validate(software);
}
@Test
public void buildPlugin() throws Exception {
Software software = new Software();
software.scopes().add("/some/scope");
PluginPackage plugin = software.newProfile().softwareClass("class").softwareName("name").
packages().add(PluginPackage.class);
plugin.name("testName").version("version").newTargetService().servicePackage("package").version("version").
newService().serviceClass("class").serviceName("name").version("version");
plugin.entryPoint("entry");
plugin.files().addAll(asList("file1","file2"));
print(software);
validate(software);
}
}

@ -0,0 +1,12 @@
package org.gcube.common.resources.gcore;
import org.gcube.common.resources.gcore.Resources;
public class TestUtils {
// helper: we use T instead of Resource as service instance does not extend it
public static <T> T unmarshal(Class<T> clazz, String sample) throws Exception {
return Resources.unmarshal(clazz,TestUtils.class.getClassLoader().getResourceAsStream(sample));
}
}

@ -0,0 +1,42 @@
<Resource version="0.4.x">
<ID>03489ee0-240a-11e2-b212-c52eb951fce1</ID>
<Type>RuntimeResource</Type>
<Scopes>
<Scope>/gcube/devsec</Scope>
</Scopes>
<Profile>
<Category>DataSource</Category>
<Name>HTTP GCUBE SVN</Name>
<Description>GCUBE SVN REPOSITORY</Description>
<Platform>
<Name>apache</Name>
<Version>2</Version>
<MinorVersion>0</MinorVersion>
<RevisionVersion>0</RevisionVersion>
<BuildVersion>0</BuildVersion>
</Platform>
<RunTime>
<HostedOn>svn.research-infrastructures.eu/public/d4science/gcube/trunk
</HostedOn>
<GHN UniqueID="" />
<Status />
</RunTime>
<AccessPoint>
<Description>URL</Description>
<Interface>
<Endpoint EntryName="URL">http://svn.research-infrastructures.eu/public/d4science/gcube/trunk
</Endpoint>
</Interface>
<AccessData>
<Username />
<Password>6vW1u92cpdgHzYAgIurn9w==</Password>
</AccessData>
<Properties>
<Property>
<Name>folder</Name>
<Value encrypted="false">./</Value>
</Property>
</Properties>
</AccessPoint>
</Profile>
</Resource>

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource version="test version " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../gcf/src/main/resources/org/gcube/common/resources/kxml/schemas/runninginstance.xsd">
<ID>ID</ID>
<Type>RunningInstance</Type>
<Scopes>
<Scope>Scope</Scope>
<Scope>/gcube/devsec</Scope>
<Scope>/gcube</Scope>
</Scopes>
<Profile xsi:type="ProfileType">
<Description>Description</Description>
<Version>Version</Version>
<GHN UniqueID="80c23170-bb9f-11e1-8c1a-9f84e3238b6c" />
<Service UniqueID="85bc6ad0-2e52-11e2-a340-a5082a0868b4" />
<ServiceName>ServiceName</ServiceName>
<ServiceClass>ServiceClass</ServiceClass>
<RunningInstanceSecurity>
<RunningInstanceInterface EntryName="test entryname">
<RunningInstanceIdentity>
<subject>subject</subject>
<CASubject>CASubject</CASubject>
</RunningInstanceIdentity>
</RunningInstanceInterface>
</RunningInstanceSecurity>
<Platform>
<Name>Name</Name>
<Version>0</Version>
<MinorVersion>0</MinorVersion>
<RevisionVersion>0</RevisionVersion>
<BuildVersion>0</BuildVersion>
</Platform>
<DeploymentData>
<InstanceName>InstanceName</InstanceName>
<LocalPath>LocalPath</LocalPath>
<ActivationTime value="2001-12-31T12:00:00" />
<TerminationTime value="2001-12-31T12:00:00" />
<Status>Status</Status>
<MessageState>MessageState</MessageState>
<AvailablePlugins>
<Plugin>
<Service>
<Class>Class</Class>
<Name>Name</Name>
<Version>Version</Version>
</Service>
<Package>Package</Package>
<Version>Version</Version>
</Plugin>
</AvailablePlugins>
</DeploymentData>
<RIEquivalenceFunctions>
<Function>
<Name>Name</Name>
<ActualParameters>
<Param>
<Name>Name</Name>
<Value>Value</Value>
</Param>
</ActualParameters>
</Function>
</RIEquivalenceFunctions>
<AccessPoint>
<RunningInstanceInterfaces>
<Endpoint EntryName="test endpoint">http://tempuri.org</Endpoint>
</RunningInstanceInterfaces>
</AccessPoint>
<SpecificData>
<test>this is a test</test>
<anotherfield>some other text</anotherfield>
</SpecificData>
<Accounting>
<ScopedAccounting scope="/gcube/devsec">
<TotalINCalls>14</TotalINCalls>
<AverageINCalls average="0.0" interval="10800" />
<AverageINCalls average="0.0" interval="18000" />
<AverageINCalls average="0.0" interval="3600" />
<AverageInvocationTime average="0.11370370370370371"
interval="10800" />
<AverageInvocationTime average="0.08308333333333333"
interval="18000" />
<AverageInvocationTime average="0.06455555555555556"
interval="3600" />
<TopCallerGHN avgDailyCalls="14.0" avgHourlyCalls="3.0"
totalCalls="14">
<GHNName>146.48.87.217</GHNName>
</TopCallerGHN>
</ScopedAccounting>
<ScopedAccounting scope="/gcube">
<TotalINCalls>0</TotalINCalls>
<AverageINCalls average="0.0" interval="10800" />
<AverageINCalls average="0.0" interval="18000" />
<AverageINCalls average="0.0" interval="3600" />
<AverageInvocationTime average="0.0" interval="10800" />
<AverageInvocationTime average="0.0" interval="18000" />
<AverageInvocationTime average="0.0" interval="3600" />
<TopCallerGHN avgDailyCalls="0.0" avgHourlyCalls="0.0"
totalCalls="0">
<GHNName>N/A</GHNName>
</TopCallerGHN>
</ScopedAccounting>
</Accounting>
</Profile>
</Resource>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Resource version="0.4.x">
<ID>b78909d3-4bef-4b3a-b3a1-7eb39fd86a27</ID>
<Scopes>
<Scope>/gcube</Scope>
<Scope>/gcube/devsec</Scope>
</Scopes>
<Type>GenericResource</Type>
<Profile>
<SecondaryType>DataSource</SecondaryType>
<Name>Sarda Sarda collection</Name>
<Description>Sarda Sarda collection</Description>
<Body>
<SourceProperties>
<creationTime>2012-10-25T16:43:33.116+02:00</creationTime>
<user>true</user>
</SourceProperties>
<other>test</other>
</Body>
</Profile>
</Resource>

@ -0,0 +1,57 @@
<Document>
<ID>node24.d.d4science.research-infrastructures.eu8080-wsrf-services-gcube-data-speciesproductsdiscovery-manager-manager
</ID>
<Source>http://node24.d.d4science.research-infrastructures.eu:8080/wsrf/services/gcube/data/speciesproductsdiscovery/manager
</Source>
<SourceKey>manager</SourceKey>
<CompleteSourceKey>
<ns1:ResourceKey
xmlns:ns1="http://gcube-system.org/namespaces/data/speciesproductsdiscovery">manager</ns1:ResourceKey>
</CompleteSourceKey>
<EntryKey />
<GroupKey />
<TerminationTime>1383840644689</TerminationTime>
<TerminationTimeHuman>Thu Nov 07 17:10:44 CET 2013
</TerminationTimeHuman>
<LastUpdateMs>1352304644689</LastUpdateMs>
<LastUpdateHuman>Wed Nov 07 17:10:44 CET 2012</LastUpdateHuman>
<PublicationMode>push</PublicationMode>
<Data>
<ns4:GHN
xmlns:ns4="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns5="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns5:QueryExpressionDialect">3b1f7270-229e-11e2-97a7-e430d3499dac</ns4:GHN>
<ns6:RI
xmlns:ns6="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns7="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns7:QueryExpressionDialect">3b68d780-229e-11e2-97a8-e430d3499dac</ns6:RI>
<ns8:ServiceClass xmlns:ns9="http://www.globus.org/foobar"
xmlns:ns8="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns9:QueryExpressionDialect">DataAccess</ns8:ServiceClass>
<ns10:Scope
xmlns:ns10="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns11="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns11:QueryExpressionDialect">/gcube/devNext</ns10:Scope>
<ns12:Scope
xmlns:ns12="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns13="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns13:QueryExpressionDialect">/gcube</ns12:Scope>
<ns14:Scope
xmlns:ns14="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns15="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns15:QueryExpressionDialect">/gcube/devsec</ns14:Scope>
<ns16:Scope
xmlns:ns16="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns17="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns17:QueryExpressionDialect">/gcube/devsec/devVRE</ns16:Scope>
<ns18:ServiceID
xmlns:ns18="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:ns19="http://www.globus.org/foobar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns19:QueryExpressionDialect">9d6385e0-28f5-11e2-930e-f13bebb24295</ns18:ServiceID>
<ns20:ServiceName xmlns:ns21="http://www.globus.org/foobar"
xmlns:ns20="http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns21:QueryExpressionDialect">SpeciesProductsDiscovery</ns20:ServiceName>
<custom1>custom1</custom1>
<custom2>custom2</custom2>
</Data>
</Document>

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource version="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../schema/node.xsd">
<ID>ID</ID>
<Type>GHN</Type>
<Scopes>
<Scope>Scope</Scope>
</Scopes>
<Profile xsi:type="ProfileType">
<Infrastructure>Infrastructure</Infrastructure>
<GHNDescription>
<Name>Name</Name>
<ActivationTime>2001-12-31T12:00:00</ActivationTime>
<Status>Status</Status>
<StatusMessage>StatusMessage</StatusMessage>
<Type>Dynamic</Type>
<AvailablePlatforms>
<Platform>
<Name>Name</Name>
<Version>0</Version>
<MinorVersion>0</MinorVersion>
<RevisionVersion>0</RevisionVersion>
<BuildVersion>0</BuildVersion>
</Platform>
</AvailablePlatforms>
<SecurityEnabled value="true" />
<SecurityData>
<CA>CA</CA>
<CredentialsDistinguishedName>CredentialsDistinguishedName
</CredentialsDistinguishedName>
<CredentialsExpireOn>2001-12-31T12:00:00</CredentialsExpireOn>
</SecurityData>
<Architecture PlatformType="test platform" SMPSize="0"
SMTSize="0" />
<OperatingSystem Name="testOSName" Release="release"
Version="1.0" />
<Processor Bogomips="0.00000000000000000000000012312313"
CacheL1="0" CacheL1D="0" CacheL1I="0" CacheL2="0"
ClockSpeedMhz="0.00000000000000000000000000000000000000000000000000000000000000000000000012313"
Family="testFamily" Model="testModel" ModelName="modelName" Vendor="testVendor" />
<NetworkAdapter IPAddress="192.168.0.1" InboundIP="192.168.0.2"
MTU="0" Name="NameTest" OutboundIP="10.1.108.2" />
<Benchmark SF00="0" SI00="0" />
<RunTimeEnv>
<Variable>
<Key>Key</Key>
<Value>Value</Value>
</Variable>
<Variable>
<Key>Key1</Key>
<Value>Value1</Value>
</Variable>
<Variable>
<Key>Key2</Key>
<Value>Value2</Value>
</Variable>
</RunTimeEnv>
<StorageDevice Name="testName" Size="0" TransferRate="0"
Type="testType" />
<StorageDevice Name="testName1" Size="0" TransferRate="0"
Type="testType1" />
<StoragePartition Name="testName" ReadRate="0" Size="1"
WriteRate="0" />
<StoragePartition Name="testName1" ReadRate="0"
Size="2" WriteRate="0" />
<StoragePartition Name="testName2" ReadRate="0"
Size="3" WriteRate="0" />
<LocalFileSystem Name="testName" ReadOnly="true"
Root="testRoot" Size="0" Type="testType" />
<RemoteFileSystem Name="testMame" ReadOnly="true"
Root="testRoot" Size="0" Type="testType" />
<StorageDevice2StoragePartition
StorageDeviceName="testStorage" StoragePartitionName="testStoragePartName" />
<StorageDevice2StoragePartition
StorageDeviceName="testStorage1" StoragePartitionName="testStoragePartName1" />
<StorageDevice2StoragePartition
StorageDeviceName="testStorage2" StoragePartitionName="testStoragePartName2" />
<StorageDevice2StoragePartition
StorageDeviceName="testStorage3" StoragePartitionName="testStoragePartName3" />
<StoragePartition2FileSystem
FileSystemName="testfsName0" StoragePartitionName="testpn0" />
<StoragePartition2FileSystem
FileSystemName="testfsName1" StoragePartitionName="testpn1" />
<StoragePartition2FileSystem
FileSystemName="testfsName2" StoragePartitionName="testpn2" />
<Uptime>Uptime</Uptime>
<Load Last15Min="0.0" Last1Min="0.0" Last5Min="0.0" />
<HistoricalLoad Last1Day="0.0" Last1H="0.0" Last1Week="0.0" />
<MainMemory RAMAvailable="0" RAMSize="0" VirtualAvailable="0"
VirtualSize="0" />
<LocalAvailableSpace>0</LocalAvailableSpace>
<LastUpdate>2001-12-31T12:00:00</LastUpdate>
</GHNDescription>
<Site>
<Location>Location</Location>
<Country>IT</Country>
<Latitude>Latitude</Latitude>
<Longitude>Longitude</Longitude>
<Domain>Domain</Domain>
</Site>
<DeployedPackages>
<Package>
<PackageName>ResultSetService</PackageName>
<PackageVersion>3.1.0</PackageVersion>
<ServiceName>ResultSetService</ServiceName>
<ServiceClass>Search</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>ResultSetLibrary</PackageName>
<PackageVersion>[3.1.0,4.0.0)</PackageVersion>
<ServiceName>ResultSetLibrary</ServiceName>
<ServiceClass>Search</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>ResultSetService-stubs</PackageName>
<PackageVersion>[3.1.0,4.0.0)</PackageVersion>
<ServiceName>ResultSetService</ServiceName>
<ServiceClass>Search</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>ResultSetGarbageCollector</PackageName>
<PackageVersion>[3.1.0,4.0.0)</PackageVersion>
<ServiceName>ResultSetGarbageCollector</ServiceName>
<ServiceClass>Search</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>IS-Registry-stubs</PackageName>
<PackageVersion>2.1.0</PackageVersion>
<ServiceName>IS-Registry</ServiceName>
<ServiceClass>InformationSystem</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>GHNManager-stubs</PackageName>
<PackageVersion>1.5.0</PackageVersion>
<ServiceName>GHNManager</ServiceName>
<ServiceClass>VREManagement</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>GHNManager-service</PackageName>
<PackageVersion>1.5.0</PackageVersion>
<ServiceName>GHNManager</ServiceName>
<ServiceClass>VREManagement</ServiceClass>
<ServiceVersion>1.0.0</ServiceVersion>
</Package>
<Package>
<PackageName>Deployer-service</PackageName>
<PackageVersion>2.3.0-SNAPSHOT</PackageVersion>
<ServiceName>Deployer</ServiceName>
<ServiceClass>VREManagement</ServiceClass>
<ServiceVersion>1.00.00</ServiceVersion>
</Package>
</DeployedPackages>
</Profile>
</Resource>

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource version="0.4.x">
<ID>16a182f0-b609-11e1-959a-8f8c3e6664f5</ID>
<Type>Service</Type>
<Scopes>
<Scope>/d4science.research-infrastructures.eu</Scope>
<Scope>/d4science.research-infrastructures.eu/Ecosystem</Scope>
<Scope>/d4science.research-infrastructures.eu/FARM</Scope>
<Scope>/d4science.research-infrastructures.eu/gCubeApps</Scope>
<Scope>/d4science.research-infrastructures.eu/gCubeApps/VesselActivitiesAnalyzer
</Scope>
<Scope>/d4science.research-infrastructures.eu/EUBrazilOpenBio</Scope>
</Scopes>
<Profile>
<Class>DataAccess</Class>
<Name>tree-manager-service</Name>
<Version>1.0.0</Version>
<Packages>
<Main deployable="true">
<Name>tree-manager-service</Name>
<Version>2.0.0</Version>
<MavenCoordinates>
<groupId>org.gcube.data.access</groupId>
<artifactId>tree-manager-service</artifactId>
<version>2.0.0</version>
</MavenCoordinates>
<Shareable level="VO" />
<GARArchive>tree-manager-service-2.0.0.gar</GARArchive>
<PortType>
<Name>gcube/data/tm/binder</Name>
</PortType>
<PortType>
<Name>gcube/data/tm/reader</Name>
</PortType>
<PortType>
<Name>gcube/data/tm/writer</Name>
</PortType>
</Main>
<Software>
<Name>tree-manager-stubs</Name>
<Version>2.0.0</Version>
<MavenCoordinates>
<groupId>org.gcube.data.access</groupId>
<artifactId>tree-manager-stubs</artifactId>
<version>2.0.0</version>
</MavenCoordinates>
<Shareable level="VO" />
<Type>library</Type>
<Files>
<File>tree-manager-stubs-2.0.0.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Resource version="0.4.x">
<ID>b78909d3-4bef-4b3a-b3a1-7eb39fd86a27</ID>
<Scopes>
<Scope>/gcube</Scope>
<Scope>/gcube/devsec</Scope>
</Scopes>
<Type>GenericResource</Type>
<Profile>
<SecondaryType>DataSource</SecondaryType>
<Name>Sarda Sarda collection</Name>
<Description>Sarda Sarda collection</Description>
<Body>text</Body>
</Profile>
</Resource>
Loading…
Cancel
Save