initial import v 1.3.0-SNAPSHOT
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/information-system/registry-publisher/1.3@181494 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
commit
9b645a137e
|
@ -0,0 +1,33 @@
|
|||
<?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"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>registry-publisher</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
#Mon Dec 03 11:56:31 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,5 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -0,0 +1,5 @@
|
|||
#Mon Dec 03 11:51:29 CET 2012
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,7 @@
|
|||
v 1.2.5 (10-09-2014)
|
||||
* update test class code, update removeById method
|
||||
v 1.2.4 (30-06-2014)
|
||||
* added method removeByID in AdvancedPublisher class
|
||||
v 1.2.3 (03-04-2014)
|
||||
* added filtering on scope promotion for some kind of resources: genericResource, GcoreEndpoint and Software
|
||||
* update remove operation
|
|
@ -0,0 +1,2 @@
|
|||
${gcube.license}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
The gCube System - ${name}
|
||||
--------------------------------------------------
|
||||
|
||||
${description}
|
||||
|
||||
|
||||
${gcube.description}
|
||||
|
||||
${gcube.funding}
|
||||
|
||||
|
||||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
${version} (${buildDate})
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
||||
Authors
|
||||
--------------------------------------------------
|
||||
|
||||
* Fabio Simeoni (fabio.simeoni-AT-fao.org), FAO of the UN, Italy
|
||||
* Lucio Lelii (lucio.lelii-AT-isti.cnr.it), CNR, Italy
|
||||
* Roberto Cirillo (roberto.cirillo-AT-isti.cnr.it), ISTI-CNR.
|
||||
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
* Roberto Cirillo (roberto.cirillo-AT-isti.cnr.it), ISTI-CNR.
|
||||
|
||||
|
||||
Download information
|
||||
--------------------------------------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from the gCube website:
|
||||
${gcube.website}
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------------------------------
|
||||
|
||||
Installation documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}
|
||||
|
||||
|
||||
Documentation
|
||||
--------------------------------------------------
|
||||
|
||||
Documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}
|
||||
|
||||
Support
|
||||
--------------------------------------------------
|
||||
|
||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||
${gcube.issueTracking}
|
||||
|
||||
|
||||
Licensing
|
||||
--------------------------------------------------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,33 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-9" date="2017-07-28">
|
||||
<Change>VO create modified to perform resource registration only once per VO scope</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-8" date="2017-03-27">
|
||||
<Change>added update and create only on VOs</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-7" date="2016-10-3">
|
||||
<Change>removed scope promotion on PublisherImpl</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-6" date="2014-09-10">
|
||||
<Change>remove log4j.properties file from src/main/resources folder</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-5" date="2014-09-10">
|
||||
<Change>add dependency range for ic-client on pom</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-4" date="2014-06-30">
|
||||
<Change>added method removeByID in AdvancedPublisher class</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-3" date="2014-04-03">
|
||||
<Change>added filtering on scope promotion for some kind of resources: genericResource, GcoreEndpoint and Software</Change>
|
||||
<Change>update remove operation</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-2" date="2014-01-30">
|
||||
<Change>bug fixing</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry-publisher.1-2-1" date="2013-10-30">
|
||||
<Change>Second Release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="registry-publisher-1.0.0" date="2013-01-17">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,31 @@
|
|||
<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>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>
|
||||
</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>InformationSystem</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,118 @@
|
|||
<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>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</connection>
|
||||
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>registry-publisher</artifactId>
|
||||
<version>1.2.9-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-gcore-stubs</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</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,23 @@
|
|||
package org.gcube.common.resources.gcore;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceMediator {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ResourceMediator.class);
|
||||
|
||||
public static void setId(Resource resource, String id) {
|
||||
resource.setId(id);
|
||||
log.debug(id+"new id resource: "+resource.id());
|
||||
}
|
||||
|
||||
public static void setScope(Resource resource, String scope){
|
||||
resource.scopes().add(scope);
|
||||
}
|
||||
public static void removeScope(Resource resource, String scope){
|
||||
resource.scopes().remove(scope);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.informationsystem.publisher.utils.RegistryStubs;
|
||||
/**
|
||||
* Wrapper class of RegistryPublisherImpl class that implements the RegistryPublisher interface
|
||||
*
|
||||
* @author rcirillo
|
||||
*
|
||||
*/
|
||||
public class AdvancedPublisher extends AdvancedPublisherCommonUtils implements RegistryPublisher {
|
||||
|
||||
private RegistryPublisher publisher;
|
||||
private RegistryStubs registry;
|
||||
|
||||
public AdvancedPublisher(){
|
||||
publisher=new RegistryPublisherImpl();
|
||||
registry=new RegistryStubs();
|
||||
}
|
||||
|
||||
public AdvancedPublisher(RegistryPublisher publisher){
|
||||
this.publisher=publisher;
|
||||
registry=new RegistryStubs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T create(T resource) {
|
||||
return publisher.create(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T update(T resource) {
|
||||
return publisher.update(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T remove(T resource) {
|
||||
return publisher.remove(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T vosCreate(T resource, List<String> scopes) {
|
||||
return publisher.vosCreate(resource, scopes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T vosUpdate(T resource) {
|
||||
return publisher.vosUpdate(resource);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ResourceMediator;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
//import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.ResourceDoesNotExistException;
|
||||
import org.gcube.informationsystem.publisher.utils.RegistryStubs;
|
||||
import org.gcube.informationsystem.publisher.utils.ValidationUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class AdvancedPublisherCommonUtils {
|
||||
|
||||
protected RegistryStubs registry;
|
||||
private static final Logger log = LoggerFactory.getLogger(AdvancedPublisher.class);
|
||||
|
||||
/**
|
||||
* Remove the input resource:
|
||||
* if is a VRE scope: delete profile from IS
|
||||
* if is a VO scope: delete profile from IS
|
||||
* if is a INFRA scope: delete profile in the infra and for every VO under the infrastructures
|
||||
* @throws IllegalArgumentException if there are problems to contact the Registry service
|
||||
*/
|
||||
public <T extends Resource> T forceRemove(T resource){
|
||||
RegistryStub stub=null;
|
||||
registry=new RegistryStubs();
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
if(new ScopeBean(currentScope).is(Type.VRE) || new ScopeBean(currentScope).is(Type.VO)){
|
||||
ScopeGroup<String> scopes=resource.scopes();
|
||||
List<String> scopesToRemove=new LinkedList<String>();
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
log.debug(" check scope: "+scope);
|
||||
// if the scope is present in the resource then The resource will be removed from VO
|
||||
if(scope.equals(currentScope)){
|
||||
ScopeProvider.instance.set(scope);
|
||||
try{
|
||||
stub=registry.getStubs();
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}
|
||||
log.debug("remove scope "+scope);
|
||||
try{
|
||||
stub.remove(resource.id(), resource.type().toString());
|
||||
}catch(ResourceDoesNotExistException e){
|
||||
// if the scope is a VRE scope probably the resource has already been deleted from VO scope
|
||||
// it must be removed from the resource
|
||||
}
|
||||
scopesToRemove.add(scope);
|
||||
}
|
||||
}
|
||||
for(String scope : scopesToRemove){
|
||||
ResourceMediator.removeScope(resource, scope);
|
||||
}
|
||||
|
||||
}else{ // it is a INFRA scope, the resource will be removed from all the VO scopes under this infra
|
||||
ScopeGroup<String> scopes=resource.scopes();
|
||||
List<String> scopesToRemove=new LinkedList<String>();
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
log.debug(" check scope: "+scope);
|
||||
String voScope=null;
|
||||
if(new ScopeBean(scope).is(Type.VRE)){
|
||||
voScope=new ScopeBean(scope).enclosingScope().toString();
|
||||
}
|
||||
// if the scope is present in the resource then The resource will be removed from VO
|
||||
if((scope.equals(currentScope)) || (ValidationUtils.isChildScope(currentScope, scope)) || ( (voScope != null) && (ValidationUtils.isChildScope(currentScope, voScope)) )){
|
||||
ScopeProvider.instance.set(scope);
|
||||
try{
|
||||
stub=registry.getStubs();
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}
|
||||
log.debug("remove scope "+scope);
|
||||
try{
|
||||
stub.remove(resource.id(), resource.type().toString());
|
||||
}catch(ResourceDoesNotExistException e){
|
||||
// if the scope is a VRE scope probably the resource has already been deleted from VO scope
|
||||
// it must be removed from the resource
|
||||
}
|
||||
scopesToRemove.add(scope);
|
||||
}
|
||||
}
|
||||
for(String scope : scopesToRemove){
|
||||
ResourceMediator.removeScope(resource, scope);
|
||||
}
|
||||
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void removeById(String id, org.gcube.common.resources.gcore.Resource.Type type){
|
||||
RegistryStub stub=null;
|
||||
registry=new RegistryStubs();
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
try{
|
||||
stub=registry.getStubs();
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}
|
||||
log.debug("remove "+id+" from scope "+currentScope);
|
||||
try{
|
||||
stub.remove(id, type.toString());
|
||||
}catch(ResourceDoesNotExistException e){
|
||||
// if the scope is a VRE scope probably the resource has already been deleted from VO scope
|
||||
// it must be removed from the resource
|
||||
}
|
||||
}
|
||||
|
||||
public void removeById(String id, org.gcube.common.resources.gcore.Resource.Type type, URI endpoint){
|
||||
RegistryStub stub=null;
|
||||
registry=new RegistryStubs();
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
try{
|
||||
stub=registry.getStubs(endpoint);
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}
|
||||
log.debug("remove "+id+" from scope "+currentScope);
|
||||
try{
|
||||
stub.remove(id, type.toString());
|
||||
}catch(ResourceDoesNotExistException e){
|
||||
// if the scope is a VRE scope probably the resource has already been deleted from VO scope
|
||||
// it must be removed from the resource
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper class of ScopedPublisherImpl class that implements the ScopedPublisher interface
|
||||
*
|
||||
* @author rcirillo
|
||||
*
|
||||
*/
|
||||
|
||||
public class AdvancedScopedPublisher extends AdvancedPublisherCommonUtils implements ScopedPublisher {
|
||||
|
||||
private ScopedPublisher publisher;
|
||||
|
||||
public AdvancedScopedPublisher(){
|
||||
publisher=new ScopedPublisherImpl();
|
||||
}
|
||||
|
||||
public AdvancedScopedPublisher(ScopedPublisher publisher){
|
||||
this.publisher=publisher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T create(T resource, List<String> scopes)
|
||||
throws RegistryNotFoundException {
|
||||
return publisher.create(resource, scopes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T update(T resource)
|
||||
throws RegistryNotFoundException {
|
||||
return publisher.update(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T remove(T resource, List<String> scopes)
|
||||
throws RegistryNotFoundException {
|
||||
return publisher.remove(resource, scopes);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void remove(String id, Type type, List<String> scopes)
|
||||
// throws RegistryNotFoundException {
|
||||
// publisher.remove(id, type, scopes);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
|
||||
public interface RegistryPublisher {
|
||||
|
||||
/**
|
||||
* The resource is created in the current scope and it is updated in the other scopes that are presents in the resource.
|
||||
* If is a VRE scope then in the resource will be added also the VO and INFRA scopes if they are not already presents in the resource
|
||||
* If is a VO scope then in the resource will be added also the INFRA scope if it is not already present in the resource
|
||||
* @throws IllegalStateException if the current scope is incompatible with the scope defined in the resource or if the scope is already defined in the resource
|
||||
* @throws IllegalArgumentException if there are problems to contact the Registry service or the resource is not a valid resource
|
||||
*/
|
||||
<T extends Resource> T create(T resource);
|
||||
|
||||
/**
|
||||
* The resource is created in all VOs scopes that are presents in the resource.
|
||||
* @throws IllegalStateException if scopes is null
|
||||
* @throws IllegalArgumentException if there are problems to contact the Registry service or the resource is not a valid resource
|
||||
*/
|
||||
< T extends Resource> T vosCreate(T resource, List<String> scopes);
|
||||
|
||||
/**
|
||||
* The resource will be updated on all the scopes that are defined in the resource.
|
||||
* If an updating operation fail. It will be repeated with best-effort delivery approach
|
||||
* @throws IllegalStateException if the current scope is not defined in the resource.
|
||||
* @throws IllegalArgumentException if there are problems with the registry service or the resource is not a valid resource
|
||||
*/
|
||||
<T extends Resource> T update(T resource);
|
||||
|
||||
/**
|
||||
* The resource will be updated on all the VO scopes that are defined in the resource.
|
||||
* If an updating operation fail. It will be repeated with best-effort delivery approach
|
||||
* @throws IllegalStateException if the current scope is not defined in the resource.
|
||||
* @throws IllegalArgumentException if there are problems with the registry service or the resource is not a valid resource
|
||||
*/
|
||||
<T extends Resource> T vosUpdate(T resource);
|
||||
|
||||
/**
|
||||
* The resource will be removed from current scope.
|
||||
* if the scope is the last scope in the resource, the profile will be deleted from IS else:
|
||||
* if it is a VRE scope then the profile will be updated without the VRE scope;
|
||||
* if it is a VO scope but there is another VRE scope, belong to the VO, defined in the resource then throw IllegalArgumentException;
|
||||
* if it is a INFRA scope but there is another VRE or VO scope , belong to the INFRA, defined in the resource then throw IllegalArgumentException.
|
||||
* @throws IllegalArgumentException if the current scope is not defined in the resource or if there is another VRE scope defined in the resource
|
||||
* @return the resource without the current scope if the remove operation has been successfully completed
|
||||
*/
|
||||
<T extends Resource> T remove(T resource);
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
public class RegistryPublisherFactory {
|
||||
|
||||
private static RegistryPublisher singleton = new RegistryPublisherImpl();
|
||||
|
||||
public static RegistryPublisher create(){
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
public static void setPublisher(RegistryPublisher registryPublisher){
|
||||
singleton = registryPublisher;
|
||||
}
|
||||
|
||||
public static ScopedPublisher scopedPublisher(){
|
||||
return new ScopedPublisherImpl(singleton);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,407 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ResourceMediator;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
import org.gcube.informationsystem.publisher.scope.ValidatorProvider;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.CreateException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.InvalidResourceException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.ResourceNotAcceptedException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.UpdateException;
|
||||
import org.gcube.informationsystem.publisher.utils.RegistryStubs;
|
||||
import org.gcube.informationsystem.publisher.utils.ValidationUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class RegistryPublisherImpl implements RegistryPublisher {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisher.class);
|
||||
private static final int REGISTRY_THRESHOLD = 5;
|
||||
private RegistryStubs registry;
|
||||
/**
|
||||
* Used in create operation. If is not null the update on this scope will never be done
|
||||
*/
|
||||
private String scopeCreated;
|
||||
|
||||
protected RegistryPublisherImpl(){
|
||||
registry=new RegistryStubs();
|
||||
};
|
||||
|
||||
/**
|
||||
* The resource is created in the current scope and it is updated in the other scopes that are presents in the resource.
|
||||
* If is a VRE scope then in the resource will be added also the VO and INFRA scope if they are not present
|
||||
* If is a VO scope then in the resource will be added also the INFRA scope if it is not present
|
||||
* @throws RegistryNotFoundException if no service endpoints can be discovered
|
||||
* @throws InvalidResourceExceptionwhen the resource type is invalid service.
|
||||
* @throws ResourceNotAcceptedException when the resource is not accepted cause it doesn't satisfy a requirement
|
||||
* @throws CreateException when something is failed on creation
|
||||
*/
|
||||
|
||||
public < T extends Resource> T create(T resource){
|
||||
String scope=ScopeProvider.instance.get();
|
||||
T res = internalCreate(resource, scope);
|
||||
scopeCreated=scope;
|
||||
res=update(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public < T extends Resource> T vosCreate(T resource, List<String> scopes){
|
||||
T res = internalVosCreate(resource, scopes);
|
||||
return res;
|
||||
}
|
||||
|
||||
private < T extends Resource> T internalVosCreate(T resource, List<String> scopes){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ValidationUtils.valid("resource", resource);// helper that throws an IllegalArgumentException if resource are null
|
||||
ValidationUtils.valid("scopes", scopes);// helper that throws an IllegalArgumentException if scopes are null
|
||||
if ((resource.id()== null) || (resource.id().isEmpty())){
|
||||
// set id
|
||||
String id=UUID.randomUUID().toString();
|
||||
log.debug("id generated: "+id);
|
||||
ResourceMediator.setId(resource, id);
|
||||
}
|
||||
|
||||
HashSet<String> vosScopes = new HashSet<String>();
|
||||
for(String scope: scopes){
|
||||
ScopeBean scopeBean = new ScopeBean(scope);
|
||||
if(scopeBean.is(Type.VRE))
|
||||
vosScopes.add(scopeBean.enclosingScope().toString());
|
||||
else vosScopes.add(scope);
|
||||
log.debug("[VOCREATE] scope found {}",scope);
|
||||
ResourceMediator.setScope(resource, scope);
|
||||
}
|
||||
|
||||
try {
|
||||
Resources.validate(resource);
|
||||
} catch (Exception e) {
|
||||
log.error("the resource is not valid", e);
|
||||
throw new IllegalArgumentException("the resource is not valid ", e.getCause());
|
||||
}
|
||||
|
||||
try{
|
||||
for (String voScope: vosScopes){
|
||||
// if update is calling on create operation and the scope is not equal to create operation scope or if is a simple update operation, try to update it
|
||||
log.trace("[VOCREATE] resource "+resource.id()+" update in scope {} with scopes {} ",voScope, resource.scopes().asCollection());
|
||||
ScopeProvider.instance.set(voScope);
|
||||
//retrieve registry stub
|
||||
RegistryStub stub = getRegistryStub();
|
||||
createResource(resource, voScope, stub);
|
||||
}
|
||||
}finally{
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
log.trace("[VOCREATE] resource created with scopes {}",resource.scopes().asCollection());
|
||||
return resource;
|
||||
}
|
||||
|
||||
private < T extends Resource> T internalCreate(T resource, String scope){
|
||||
log.trace("registry-publisher: create method");
|
||||
|
||||
ValidationUtils.valid("resource", resource);// helper that throws an IllegalArgumentException if resource are null
|
||||
ValidationUtils.valid("scopes", scope);// helper that throws an IllegalArgumentException if scopes are null
|
||||
if(ValidationUtils.isPresent(resource, scope))
|
||||
throw new IllegalStateException("The scope "+scope+" is already present in the resource. The create operation can't be performed ");
|
||||
log.debug("resource id found: "+resource.id());
|
||||
if ((resource.id()== null) || (resource.id().isEmpty())){
|
||||
// set id
|
||||
String id=UUID.randomUUID().toString();
|
||||
log.debug("id generated: "+id);
|
||||
ResourceMediator.setId(resource, id);
|
||||
}
|
||||
// set scope on resource
|
||||
log.debug("scope set in resource: {} ",scope);
|
||||
ResourceMediator.setScope(resource, scope);
|
||||
// check if the scope is compatible with the scopes defined in the resources
|
||||
ValidatorProvider.getValidator(resource).checkScopeCompatibility(resource, Arrays.asList(scope));
|
||||
// add enclosing scopes to the resource with filtering on GenericResource, RunningIstance, and Service resources
|
||||
String type=resource.type().toString();
|
||||
|
||||
/*
|
||||
if((!type.equalsIgnoreCase("GenericResource")) && (!(type.equalsIgnoreCase("RunningInstance"))) && (!(type.equalsIgnoreCase("Service")))){
|
||||
ValidationUtils.addEnclosingScopesOnResource(resource, scope);
|
||||
}else{
|
||||
log.debug(" Resource type: "+type+": for this type of resource there isn't scope promotion");
|
||||
}*/
|
||||
try {
|
||||
Resources.validate(resource);
|
||||
} catch (Exception e) {
|
||||
log.error("the resource is not valid", e);
|
||||
throw new IllegalArgumentException("the resource is not valid ", e.getCause());
|
||||
}
|
||||
//retrieve registry stub
|
||||
RegistryStub stub = getRegistryStub();
|
||||
createResource(resource, scope, stub);
|
||||
log.trace("resource created in scope {} with scopes {}",scope, resource.scopes().asCollection());
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The resource will be updated on all the scopes that are defined in the resource.
|
||||
* If an updating operation fail. It will be repeated with best-effort delivery approach
|
||||
* @throws RegistryNotFoundException if no service endpoints can be discovered
|
||||
* @throws InvalidResourceException when the resource type is invalid service.
|
||||
* @throws ResourceNotAcceptedException when the resource is not accepted cause it doesn't satisfy a requirement
|
||||
* @throws CreateException when something is failed on creation
|
||||
*/
|
||||
public <T extends Resource> T update(T resource){
|
||||
log.trace("[UPDATE] update resource with id : "+resource.id());
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ValidationUtils.valid("resource", resource);// helper that throws an IllegalArgumentException if resource are null
|
||||
validateScope(resource); // is empty
|
||||
try {
|
||||
Resources.validate(resource);
|
||||
} catch (Exception e) {
|
||||
log.error("the resource is not valid", e);
|
||||
throw new IllegalArgumentException("the resource is not valid", e);
|
||||
}
|
||||
// retrieves the scopes on resource
|
||||
ScopeGroup<String> scopes=resource.scopes();
|
||||
int tries=0;
|
||||
try{
|
||||
for(String scope: scopes){
|
||||
log.debug("[UPDATE] check update operation on scope "+scope);
|
||||
// if update is calling on create operation and the scope is not equal to create operation scope or if is a simple update operation, try to update it
|
||||
if((scopeCreated == null) || ((scopeCreated!=null) && (!scopeCreated.equals(scope)))){
|
||||
log.trace("[UPDATE] resource update in scope {} with scopes {} ",scope, resource.scopes().asCollection());
|
||||
ScopeProvider.instance.set(scope);
|
||||
registryUpdate(resource, tries);
|
||||
tries=0;
|
||||
}else{
|
||||
log.trace("skip updating on scope "+scopeCreated);
|
||||
}
|
||||
|
||||
}
|
||||
}finally{
|
||||
scopeCreated=null;
|
||||
// reset the scope
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T vosUpdate(T resource) {
|
||||
log.trace("[VOUPDATE] update resource with id : "+resource.id());
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ValidationUtils.valid("resource", resource);// helper that throws an IllegalArgumentException if resource are null
|
||||
validateScope(resource); // is empty
|
||||
try {
|
||||
Resources.validate(resource);
|
||||
} catch (Exception e) {
|
||||
log.error("the resource is not valid", e);
|
||||
throw new IllegalArgumentException("the resource is not valid", e);
|
||||
}
|
||||
|
||||
HashSet<String> vosScopes = new HashSet<String>();
|
||||
int tries=0;
|
||||
for(String scope: resource.scopes().asCollection()){
|
||||
ScopeBean scopeBean = new ScopeBean(scope);
|
||||
if(scopeBean.is(Type.VRE))
|
||||
vosScopes.add(scopeBean.enclosingScope().toString());
|
||||
else vosScopes.add(scope);
|
||||
log.debug("[VOUPDATE] scope found {}",scope);
|
||||
}
|
||||
|
||||
log.debug("[VOUPDATE] scopes in resources {}",resource.scopes().asCollection());
|
||||
|
||||
try{
|
||||
for (String voScope: vosScopes){
|
||||
log.debug("[VOUPDATE] check update operation on scope {} ",voScope);
|
||||
// if update is calling on create operation and the scope is not equal to create operation scope or if is a simple update operation, try to update it
|
||||
if((scopeCreated == null) || ((scopeCreated!=null) && (!scopeCreated.equals(voScope)))){
|
||||
log.trace("[VOUPDATE] resource "+resource.id()+" update in scope {} with scopes {} ",voScope, resource.scopes().asCollection());
|
||||
ScopeProvider.instance.set(voScope);
|
||||
registryUpdate(resource, tries);
|
||||
tries=0;
|
||||
}else{
|
||||
log.trace("[VOUPDATE] skip updating on scope {}",scopeCreated);
|
||||
}
|
||||
|
||||
}
|
||||
}finally{
|
||||
scopeCreated=null;
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource will be removed from current scope
|
||||
* if the scope is the last scope in the resource, the profile will be deleted from IS else
|
||||
* if it is a VRE scope then the profile will be updated without the VRE scope,
|
||||
* if it is a VO scope but there is another VRE scope, belong to the VO, defined in the resource then throw IllegalArgumentException
|
||||
*
|
||||
* @throws IllegalArgumentException if no service endpoints can be discovered or if there is another VRE scope defined in the resource
|
||||
*/
|
||||
public <T extends Resource> T remove(T resource){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info(" remove resource with id : "+resource.id()+" from scope: "+currentScope);
|
||||
ValidationUtils.valid("resource", resource);// helper that throws an IllegalArgumentException if resource are null
|
||||
ValidationUtils.valid("scopes", currentScope);// helper that throws an IllegalArgumentException if scopes are null
|
||||
validateScope(resource);
|
||||
try {
|
||||
Resources.validate(resource);
|
||||
} catch (Exception e) {
|
||||
log.error("the resource is not valid", e);
|
||||
throw new IllegalArgumentException("the resource is not valid", e);
|
||||
}
|
||||
log.info(" remove "+currentScope+" scope from resource "+resource.id());
|
||||
ResourceMediator.removeScope(resource, currentScope);
|
||||
// retrieves the scopes on resource and update it
|
||||
// updateResource(resource, currentScope);
|
||||
try{
|
||||
updateResourceRemoveOperation(resource, currentScope);
|
||||
}catch(Exception e){
|
||||
ResourceMediator.setScope(resource, currentScope);
|
||||
log.error("exception message: "+e.getMessage());
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
private void registryUpdate(Resource resource, int tries){
|
||||
log.trace("try to update resource with id: "+resource.id()+" times "+(tries+1)+" on scope: "+ScopeProvider.instance.get());
|
||||
try{
|
||||
registry.getStubs().update(resource.id(),resource.type().toString(), toXml(resource) );
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(InvalidResourceException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(ResourceNotAcceptedException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(UpdateException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(SOAPFaultException e) {
|
||||
log.warn("Failed update resource on "+registry.getEndPoints().get(0)+" times: "+(tries+1));
|
||||
if(tries< REGISTRY_THRESHOLD){
|
||||
tries++;
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
registryUpdate(resource, tries);
|
||||
}
|
||||
throw new IllegalArgumentException(JAXWSUtils.remoteCause(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String toXml(Resource resource){
|
||||
StringWriter writer = new StringWriter();
|
||||
Resources.marshal(resource, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
private void validateScope(Resource resource){
|
||||
ValidatorProvider.getValidator(resource).validate(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* If is the last scope on Resource, the resource will be removed else the resource will be updated
|
||||
* @param resource
|
||||
* @param currentScope
|
||||
*/
|
||||
private <T extends Resource> void updateResourceRemoveOperation(T resource, String currentScope) {
|
||||
if(!isRemoveNeeded(resource, currentScope)){
|
||||
updateResource(resource, currentScope);
|
||||
}else{ // remove the profile from IC
|
||||
log.info("the resource have only the "+currentScope+" scope defined. Remove the resource "+resource.id()+" from IC");
|
||||
// if the resource not have any scope, the resource will be removed
|
||||
try {
|
||||
log.debug("remove from IS scope "+currentScope);
|
||||
registry.getStubs().remove(resource.id(), resource.type().toString());
|
||||
} catch (Exception e) {
|
||||
log.error("the resource can't be removed ", e);
|
||||
throw new IllegalArgumentException("the resource can't be removed from scope "+currentScope, e);
|
||||
}
|
||||
// ScopeBean currentScopeBean=new ScopeBean(currentScope);
|
||||
// if(currentScopeBean.is(Type.VRE)){
|
||||
// log.debug("remove from resource scope "+currentScopeBean.enclosingScope().toString());
|
||||
// ResourceMediator.removeScope(resource, currentScopeBean.enclosingScope().toString());
|
||||
// log.debug("remove from resource scope "+currentScope);
|
||||
// ResourceMediator.removeScope(resource, currentScope);
|
||||
// }else if(currentScopeBean.is(Type.VO)){
|
||||
// log.debug("remove from resource scope "+currentScope);
|
||||
// ResourceMediator.removeScope(resource, currentScope);
|
||||
// }
|
||||
updateResource(resource, currentScope);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private <T extends Resource> boolean isRemoveNeeded(T resource, String scope){
|
||||
if(ValidationUtils.isCompatibleScopeForRemove(resource, scope)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private <T extends Resource> void createResource(T resource, String scope, RegistryStub stub) {
|
||||
try{
|
||||
log.info("create resource with id "+resource.id()+" in scope: "+scope);
|
||||
String type=null;
|
||||
type=resource.type().toString();
|
||||
log.info("resource type is: "+type);
|
||||
if(resource.type().equals("ServiceEndpoint"))
|
||||
type="RuntimeResource";
|
||||
stub.create(toXml(resource), type);
|
||||
}catch(InvalidResourceException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(ResourceNotAcceptedException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(CreateException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}catch(SOAPFaultException e) {
|
||||
throw new IllegalArgumentException(JAXWSUtils.remoteCause(e));
|
||||
}
|
||||
log.info("created resource "+resource.id()+" on scope "+scope);
|
||||
}
|
||||
|
||||
private RegistryStub getRegistryStub() {
|
||||
RegistryStub stub=null;
|
||||
try{
|
||||
stub=registry.getStubs();
|
||||
}catch(RegistryNotFoundException e){
|
||||
throw new IllegalArgumentException(e.getCause());
|
||||
}
|
||||
return stub;
|
||||
}
|
||||
|
||||
private <T extends Resource> void updateResource(T resource, String currentScope) {
|
||||
ScopeGroup scopes=resource.scopes();
|
||||
int tries=0;
|
||||
for(Iterator it=scopes.iterator();it.hasNext();){
|
||||
String scope=(String)it.next();
|
||||
ScopeProvider.instance.set(scope);
|
||||
registryUpdate(resource, tries);
|
||||
|
||||
}
|
||||
// reset the scope
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
|
||||
public interface ScopedPublisher {
|
||||
|
||||
/**
|
||||
* The resource is created in all the scopes in the list and the resource is updated in all the other scopes that are presents in the resource
|
||||
* @throws IllegalStateException if the current scope is incompatible with the scope defined in the resource
|
||||
* @throws IllegalArgumentException if there are problems to contact the Registry service or the resource is not a valid resource
|
||||
*/
|
||||
public <T extends Resource> T create(T resource, List<String> scopes) throws RegistryNotFoundException;
|
||||
|
||||
/**
|
||||
* The resource will be updated on all scopes that are defined in the resource.
|
||||
* If an updating operation fail. It will be repeated with best-effort strategy.
|
||||
* @throws IllegalStateException if the current scope is not defined in the resource.
|
||||
* @throws IllegalArgumentException if there are problems with the registry service or the resource is not a valid resource
|
||||
*/
|
||||
public <T extends Resource> T update(T resource) throws RegistryNotFoundException;
|
||||
|
||||
/**
|
||||
* Remove a resource from all the scopes in the input list, if and only if all the scopes are defined in the resource
|
||||
* @throws IllegalArgumentException if one or more scopes in the list are not defined in the resource
|
||||
* @return the resource without the current scope if the remove operation is succesfully
|
||||
*/
|
||||
public <T extends Resource> T remove(T resource, List<String> scopes) throws RegistryNotFoundException;
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
public class ScopedPublisherImpl implements ScopedPublisher{
|
||||
private RegistryPublisher registryPublisher;
|
||||
private static final Logger log = LoggerFactory.getLogger(ScopedPublisherImpl.class);
|
||||
|
||||
|
||||
protected ScopedPublisherImpl(){
|
||||
registryPublisher=new RegistryPublisherImpl();
|
||||
}
|
||||
|
||||
protected ScopedPublisherImpl(RegistryPublisher rp){
|
||||
registryPublisher=rp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T create(T resource, List<String> scopes) throws RegistryNotFoundException{
|
||||
return registryPublisher.vosCreate(resource, scopes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T update(T resource) throws RegistryNotFoundException{
|
||||
log.info("[UPDATE] call to registryPublisher upadate method on resource "+resource.id()+" in scope {} with scopes {} ", ScopeProvider.instance.get(), resource.scopes().asCollection());
|
||||
return registryPublisher.vosUpdate(resource);
|
||||
}
|
||||
|
||||
|
||||
// public void remove(String id, Type type, List<String> scopes) throws RegistryNotFoundException {
|
||||
// String currentScope=ScopeProvider.instance.get();
|
||||
// for(String scope : scopes){
|
||||
// ScopeProvider.instance.set(scope);
|
||||
// log.info("call to registryPublisher remove method with scope "+scope);
|
||||
// registryPublisher.remove(id, type);
|
||||
// }
|
||||
// ScopeProvider.instance.set(currentScope);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <T extends Resource> T remove(T resource, List<String> scopes) throws RegistryNotFoundException{
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
for(String scope : scopes){
|
||||
ScopeProvider.instance.set(scope);
|
||||
registryPublisher.remove(resource);
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
return resource;
|
||||
}
|
||||
|
||||
}
|
39
src/main/java/org/gcube/informationsystem/publisher/cache/RegistryCache.java
vendored
Normal file
39
src/main/java/org/gcube/informationsystem/publisher/cache/RegistryCache.java
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.informationsystem.publisher.cache;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RegistryCache extends LinkedHashMap<String,List<URI>>{
|
||||
|
||||
private final int capacity;
|
||||
private long accessCount = 0;
|
||||
private long hitCount = 0;
|
||||
|
||||
public RegistryCache(int capacity){
|
||||
super(capacity + 1, 1.1f, true);
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public List<URI> get(String key){
|
||||
accessCount++;
|
||||
if (containsKey(key)){
|
||||
hitCount++;
|
||||
}
|
||||
List<URI> value = super.get(key);
|
||||
return value;
|
||||
}
|
||||
|
||||
protected boolean removeEldestEntry(Map.Entry eldest){
|
||||
return size() > capacity;
|
||||
}
|
||||
|
||||
public long getAccessCount(){
|
||||
return accessCount;
|
||||
}
|
||||
|
||||
public long getHitCount(){
|
||||
return hitCount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.gcube.informationsystem.publisher.exception;
|
||||
|
||||
public class RegistryNotFoundException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8265959805049300612L;
|
||||
|
||||
public RegistryNotFoundException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public RegistryNotFoundException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public RegistryNotFoundException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public RegistryNotFoundException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DefaultScopeValidator<R> implements Validator<Resource>{
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(DefaultScopeValidator.class);
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void validate(R resource) {
|
||||
// log.info("validate method of "+this.getClass());
|
||||
// String currentScope=ScopeProvider.instance.get();
|
||||
// ScopeGroup<String> scopes=resource.scopes();
|
||||
// boolean founded= false;
|
||||
// for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
// String scope=it.next();
|
||||
// if(scope.equals(currentScope))
|
||||
// founded=true;
|
||||
// }
|
||||
// if(!founded)
|
||||
// throw new IllegalStateException(" scope "+currentScope+" not present in resource");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class type() {
|
||||
return Resource.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void checkScopeCompatibility(R resource,
|
||||
List<String> scopesList) {
|
||||
// for(String scope: scopesList){
|
||||
// ScopeGroup<String> scopes=resource.scopes();
|
||||
// for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
// String scopeItem=it.next();
|
||||
// if((!scopeItem.contains(scope)) && (!scope.contains(scopeItem)))
|
||||
// throw new IllegalStateException("The scope "+scope+" is not compatible with scope: "+scopeItem+" that is present in the resource"+ resource.id());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
|
||||
|
||||
public class DefaultValidatorContext implements IValidatorContext{
|
||||
|
||||
final static List<Validator> validators = Arrays.asList((Validator)new DefaultScopeValidator());
|
||||
|
||||
@Override
|
||||
public List<Validator> getValidators() {
|
||||
return validators;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IValidatorContext {
|
||||
|
||||
List<Validator> getValidators();
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ScopeValidatorScanner {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(ScopeValidatorScanner.class);
|
||||
private static ClassLoader loader;
|
||||
|
||||
public static IValidatorContext provider() {
|
||||
|
||||
loader = Thread.currentThread().getContextClassLoader();
|
||||
// addJarsToClasspath("customValidator.jar","scope-validator.jar");
|
||||
try {
|
||||
IValidatorContext impl = null;
|
||||
ServiceLoader<IValidatorContext> loader = ServiceLoader.load(IValidatorContext.class);
|
||||
Iterator<IValidatorContext> iterator = loader.iterator();
|
||||
List<IValidatorContext> impls = new ArrayList<IValidatorContext>();
|
||||
while(iterator.hasNext())
|
||||
impls.add(iterator.next());
|
||||
if (impls.size()==0) {
|
||||
impl = new DefaultValidatorContext();
|
||||
}
|
||||
else if (impls.size()>1)
|
||||
throw new Exception("mis-configured environment: detected multiple default validator "+impls);
|
||||
else
|
||||
impl=impls.get(0);
|
||||
log.info("using scope validator "+impl);
|
||||
return impl;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("could not configure scope validator", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addJarsToClasspath(String ... jars) {
|
||||
|
||||
List<URL> jarUrls = new ArrayList<URL>();
|
||||
for (String jar : jars)
|
||||
jarUrls.add(loader.getResource(jar));
|
||||
URLClassLoader urlClassLoader
|
||||
= new URLClassLoader(jarUrls.toArray(new URL[0]),loader);
|
||||
Thread.currentThread().setContextClassLoader(urlClassLoader);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
|
||||
public interface Validator <R extends Resource>{
|
||||
|
||||
<R extends Resource> void validate(R resource);
|
||||
<R extends Resource> void checkScopeCompatibility(R resource, List<String> scopes);
|
||||
|
||||
public Class<R> type();
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.gcube.informationsystem.publisher.scope;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
|
||||
public class ValidatorProvider {
|
||||
|
||||
private static Map<Class, Validator> validatorsMap= new LinkedHashMap<Class, Validator>();
|
||||
|
||||
|
||||
public static Validator getValidator(Resource resource){
|
||||
Validator validator=null;
|
||||
if(validatorsMap.isEmpty()){
|
||||
IValidatorContext context= ScopeValidatorScanner.provider();
|
||||
List<Validator> validators=context.getValidators();
|
||||
for(Validator v :validators){
|
||||
validatorsMap.put(v.type(), v);
|
||||
}
|
||||
}
|
||||
validator=validatorsMap.get(resource.getClass());
|
||||
if (validator==null)
|
||||
validator=new DefaultScopeValidator();
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.collector;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.*;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.GCoreService;
|
||||
|
||||
/**
|
||||
* Stub-related constants.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public class CollectorConstants {
|
||||
|
||||
//public constants
|
||||
public static final String namespace = "http://gcube-system.org/namespaces/informationsystem/collector/XQueryAccess/service";
|
||||
public static final String localname = "XQueryAccessService";
|
||||
public static final QName name = new QName(namespace,localname);
|
||||
|
||||
public static String service_class="InformationSystem";
|
||||
public static String service_name="IS-Collector";
|
||||
|
||||
//package-private constants for JAXWS interface annotations
|
||||
static final String target_namespace = "http://gcube-system.org/namespaces/informationsystem/collector/XQueryAccess";
|
||||
static final String portType = "XQueryAccessPortType";
|
||||
static final String port = "XQueryAccessPortTypePort";
|
||||
|
||||
public final static GCoreService<CollectorStub> collector = service().withName(name).
|
||||
coordinates(service_class, service_name).
|
||||
andInterface(CollectorStub.class);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.collector;
|
||||
|
||||
import static org.gcube.informationsystem.publisher.stubs.collector.CollectorConstants.*;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebResult;
|
||||
import javax.jws.WebService;
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
/**
|
||||
* A local interface to the resource discovery service.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@WebService(name=portType,targetNamespace=target_namespace)
|
||||
public interface CollectorStub {
|
||||
|
||||
/**
|
||||
* Executes a {@link QueryStub}.
|
||||
* @param query the query
|
||||
* @return the query results
|
||||
* @throws MalformedQueryException if the query is malformed
|
||||
* @throws SOAPFaultException if the query cannot be executed
|
||||
*/
|
||||
@WebMethod(operationName="XQueryExecute")
|
||||
@WebResult(name="Dataset")
|
||||
String execute(@WebParam(name="XQueryExpression") String query) throws MalformedQueryException;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.collector;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
/**
|
||||
* Thrown by {@link CollectorStub#execute(String)} when the query cannot be submitted to the Information Collector
|
||||
* service.
|
||||
*/
|
||||
@WebFault(name = "XQueryFaultType")
|
||||
public class MalformedQueryException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public MalformedQueryException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.*;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.GCoreService;
|
||||
|
||||
/**
|
||||
* Stub-related constants.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public class RegistryConstants {
|
||||
|
||||
//public constants
|
||||
public static final String namespace = "http://gcube-system.org/namespaces/informationsystem/registry/resourceregistration/service";
|
||||
public static final String localname = "ResourceRegistrationService";
|
||||
public static final QName name = new QName(namespace,localname);
|
||||
|
||||
public static String service_class="InformationSystem";
|
||||
public static String service_name="IS-Registry";
|
||||
public static String service_entrypoint="gcube/informationsystem/registry/ResourceRegistration";
|
||||
|
||||
//package-private constants for JAXWS interface annotations
|
||||
static final String target_namespace = "http://gcube-system.org/namespaces/informationsystem/registry/resourceregistration";
|
||||
static final String portType = "ResourceRegistrationPortType";
|
||||
static final String port = "ResourceRegistrationPortTypePort";
|
||||
|
||||
public final static GCoreService<RegistryStub> registry = service().withName(name).
|
||||
coordinates(service_class, service_name).
|
||||
andInterface(RegistryStub.class);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry;
|
||||
|
||||
import static org.gcube.informationsystem.publisher.stubs.registry.RegistryConstants.*;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebResult;
|
||||
import javax.jws.WebService;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.CreateException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.InvalidResourceException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.RemoveException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.ResourceDoesNotExistException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.ResourceNotAcceptedException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.faults.UpdateException;
|
||||
|
||||
/**
|
||||
* A local interface to the resource discovery service.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@WebService(name=portType,targetNamespace=target_namespace)
|
||||
public interface RegistryStub {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param profile the profile in xml
|
||||
* @param type the type of the resource to store
|
||||
*
|
||||
* @throws InvalidResourceException if the profile is not valid
|
||||
* @throws ResourceNotAcceptedException if some filter is applied registry side
|
||||
* @throws CreateException if something goes wrong on creation
|
||||
*/
|
||||
@WebMethod(operationName="create")
|
||||
@WebResult()
|
||||
void create(@WebParam(name="profile") String profile, @WebParam(name="type") String type ) throws InvalidResourceException,
|
||||
ResourceNotAcceptedException, CreateException;
|
||||
/**
|
||||
*
|
||||
* @param id the id of the resource to update
|
||||
* @param type the type of the resource to update
|
||||
* @param profile the profile in xml
|
||||
*
|
||||
* @throws InvalidResourceException if the profile is not valid
|
||||
* @throws ResourceNotAcceptedException if some filter is applied registry side
|
||||
* @throws UpdateException if something goes wrong on update
|
||||
*/
|
||||
@WebMethod(operationName="update")
|
||||
@WebResult()
|
||||
void update(@WebParam(name="uniqueID") String id, @WebParam(name="type") String type, @WebParam(name="xmlProfile") String profile ) throws InvalidResourceException,
|
||||
ResourceNotAcceptedException, UpdateException;
|
||||
/**
|
||||
*
|
||||
* @param id the id of the resource to remove
|
||||
* @param type the type of the resource to remove
|
||||
*
|
||||
* @throws ResourceDoesNotExistException if the resource is not stored on the Collector
|
||||
* @throws RemoveException if something goes wrong during deletion
|
||||
*/
|
||||
@WebMethod(operationName="remove")
|
||||
@WebResult()
|
||||
void remove(@WebParam(name="uniqueID") String id, @WebParam(name="type") String type) throws ResourceDoesNotExistException,
|
||||
RemoveException;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#create(String, String)} when something is failed on creation
|
||||
*/
|
||||
@WebFault(name = "CreateFault")
|
||||
public class CreateException extends PublisherException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public CreateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#create(String, String)} when the resource type is invalid
|
||||
* service.
|
||||
*/
|
||||
@WebFault(name = "InvalidResourceFault")
|
||||
public class InvalidResourceException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public InvalidResourceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidResourceException(Exception e1) {
|
||||
super(e1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
public abstract class PublisherException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PublisherException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PublisherException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PublisherException(String arg0) {
|
||||
super(arg0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public PublisherException(Throwable arg0) {
|
||||
super(arg0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#remove(String, String)} when something is failed on remove
|
||||
*/
|
||||
@WebFault(name = "RemoveFault")
|
||||
public class RemoveException extends PublisherException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public RemoveException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#remove(String, String)} when the resource does not exist in the collector
|
||||
*/
|
||||
@WebFault(name = "ResourceDoesNotExistFault")
|
||||
public class ResourceDoesNotExistException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public ResourceDoesNotExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#create(String, String)} when the resource is not accepted cause it doesn't satisfy a requirement
|
||||
*/
|
||||
@WebFault(name = "ResourceNotAcceptedFault")
|
||||
public class ResourceNotAcceptedException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public ResourceNotAcceptedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.informationsystem.publisher.stubs.registry.faults;
|
||||
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
|
||||
/**
|
||||
* Thrown by {@link RegistryStub#update(String, String)} when something is failed on update
|
||||
*/
|
||||
@WebFault(name = "UpdateFault")
|
||||
public class UpdateException extends PublisherException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public UpdateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package org.gcube.informationsystem.publisher.utils;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.StubFactory.stubFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.publisher.cache.RegistryCache;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryConstants;
|
||||
import org.gcube.informationsystem.publisher.stubs.registry.RegistryStub;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.api.ResultParser;
|
||||
import org.gcube.resources.discovery.client.impl.DelegateClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.resources.discovery.icclient.ICClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistryStubs {
|
||||
|
||||
private RegistryCache cache = new RegistryCache(10);
|
||||
private List<URI> endpoints;
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryStubs.class);
|
||||
|
||||
|
||||
|
||||
public List<URI> getEndPoints(){
|
||||
String scope=ScopeProvider.instance.get();
|
||||
// able/disable cache
|
||||
endpoints=(List<URI>)cache.get(scope);
|
||||
if(endpoints==null){
|
||||
SimpleQuery query = queryFor(GCoreEndpoint.class);
|
||||
ResultParser<URI> uriParser =new ResultParser<URI>() {
|
||||
|
||||
@Override
|
||||
public URI parse(String result) throws Exception {
|
||||
return new URI(result.replaceAll("\n", ""));
|
||||
}
|
||||
|
||||
};
|
||||
DiscoveryClient<URI> client = new DelegateClient<URI>(uriParser, new ICClient());
|
||||
query.addCondition("$resource/Profile/ServiceClass/text() eq '"+RegistryConstants.service_class+"'")
|
||||
.addCondition("$resource/Profile/ServiceName/text() eq '"+RegistryConstants.service_name+"'")
|
||||
.setResult("$resource/Profile/AccessPoint/RunningInstanceInterfaces/Endpoint[string(@EntryName) eq '"+RegistryConstants.service_entrypoint+"']/string()");
|
||||
endpoints = client.submit(query);
|
||||
if (endpoints.size()==0){
|
||||
throw new IllegalArgumentException("No registry endpoint founded");
|
||||
}
|
||||
// able/disable cache
|
||||
cache.put(scope, endpoints);
|
||||
}
|
||||
return endpoints;
|
||||
}
|
||||
|
||||
public RegistryStub getStubs() throws RegistryNotFoundException{
|
||||
URI endpoint=null;
|
||||
//use another method to cache epr
|
||||
endpoint = getEndPoints().get(0);
|
||||
log.debug("get stubs from endpoint: "+ endpoint);
|
||||
return stubFor(RegistryConstants.registry).at(endpoint);
|
||||
}
|
||||
|
||||
public RegistryStub getStubs(URI endpoint) throws RegistryNotFoundException{
|
||||
log.debug("get stubs from endpoint: "+ endpoint);
|
||||
return stubFor(RegistryConstants.registry).at(endpoint);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package org.gcube.informationsystem.publisher.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ResourceMediator;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.informationsystem.publisher.RegistryPublisher;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class ValidationUtils {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ValidationUtils.class);
|
||||
|
||||
public static void valid(String name, Object object){
|
||||
if (object==null)
|
||||
throw new IllegalArgumentException(name+" is null");
|
||||
}
|
||||
|
||||
public static < R extends Resource > boolean isPresent(R resource, String currentScope){
|
||||
ScopeGroup<String> scopes=resource.scopes();
|
||||
boolean founded= false;
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
if(scope.equals(currentScope))
|
||||
founded=true;
|
||||
}
|
||||
if(founded)
|
||||
throw new IllegalArgumentException(" scope "+currentScope+" is already present in resource");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If scope is a VRE scope and the VO and INFRA scopes are not present in the resource, this method add these scopes to the resource
|
||||
* @param resource the resource
|
||||
* @param scope a scope
|
||||
*/
|
||||
public static <T extends Resource> void addEnclosingScopesOnResource(T resource, String scope){
|
||||
if(new ScopeBean(scope).is(Type.VRE)){
|
||||
String voScope=new ScopeBean(scope).enclosingScope().toString();
|
||||
String infraScope=new ScopeBean(voScope).enclosingScope().toString();
|
||||
// The scope collection is a set, I can add scope without checking
|
||||
log.debug("adding "+voScope+" to the resource "+resource.id());
|
||||
ResourceMediator.setScope(resource, voScope);
|
||||
log.debug("adding "+infraScope+" to the resource "+resource.id());
|
||||
ResourceMediator.setScope(resource, infraScope);
|
||||
}else if(new ScopeBean(scope).is(Type.VO)){
|
||||
String infraScope=new ScopeBean(scope).enclosingScope().toString();
|
||||
log.debug("adding "+infraScope+" to the resource "+resource.id());
|
||||
// The scope collection is a set, I can add scope without checking
|
||||
ResourceMediator.setScope(resource, infraScope);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends Resource> boolean isCompatibleScopeForRemove(T resource, String scope){
|
||||
log.info("scope: "+scope+" check if update is needed inr resource: "+resource.id());
|
||||
if(resource.scopes().size() == 0)
|
||||
return true;
|
||||
if(new ScopeBean(scope).is(Type.VRE)){
|
||||
log.debug(" "+scope+" is a VRE scope");
|
||||
if(anotherBrotherVREOrVOOnResource(resource, scope)){
|
||||
log.debug("found another VRE or VO scope on the resource: ");
|
||||
return false;
|
||||
}else return true;
|
||||
}else if(new ScopeBean(scope).is(Type.VO)){
|
||||
log.debug(" "+scope+" is a VO scope");
|
||||
if(anotherSonVREOnResource(resource, scope)){
|
||||
return false; //throw new IllegalArgumentException("the resource "+resource.id()+" have another scope defined in the same VO. The VO is "+scope);
|
||||
}else return true;
|
||||
}else{ // is a INFRA scope
|
||||
if(anotherInfraScopeOnResource(resource, scope)){
|
||||
return false;//throw new IllegalArgumentException("the resource "+resource.id()+" have another scope defined in the same INFRA. The INFRA is "+scope);
|
||||
}else return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends Resource> boolean anotherBrotherVREOrVOOnResource(T resource, String scope){
|
||||
if(!new ScopeBean(scope).is(Type.VRE))
|
||||
throw new IllegalArgumentException("anotherBrotherVREOrVOOnResource method: the input scope must be a VRE scope");
|
||||
String enclosedScope=new ScopeBean(scope).enclosingScope().toString();
|
||||
log.debug("VO scope "+enclosedScope);
|
||||
for(String s : resource.scopes()){
|
||||
log.debug(" check scope "+s);
|
||||
if(isChildScope(enclosedScope, s)){
|
||||
log.debug("the scope "+s+" is another VRE scope defined in the resource. Not Remove needed ");
|
||||
return true;
|
||||
}else if((enclosedScope != null) && (enclosedScope.toString().equals(s))){
|
||||
log.debug("the scope "+s+" is the father VO scope defined in the resource. Not Remove needed ");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
log.debug("other brother VRE scope or VO scope not found on the resource ");
|
||||
return false;
|
||||
}
|
||||
|
||||
public static <T extends Resource> boolean anotherSonVREOnResource(T resource, String scope){
|
||||
if(!new ScopeBean(scope).is(Type.VO))
|
||||
throw new IllegalArgumentException("anotherSonVREOnResource method: the input scope must be a VO scope");
|
||||
for(String s : resource.scopes()){
|
||||
if(isChildScope(scope, s)){
|
||||
log.debug("the scope "+s+" is another VO scope defined in the resource ");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChildScope(String fatherScope, String sonScope) {
|
||||
ScopeBean currentEnclosedScope=new ScopeBean(sonScope).enclosingScope();
|
||||
if((currentEnclosedScope != null) && (currentEnclosedScope.toString().equals(fatherScope))){
|
||||
log.debug("check scope"+fatherScope+": found another son VRE scope "+sonScope);
|
||||
return true;
|
||||
}else return false;
|
||||
}
|
||||
|
||||
public static <T extends Resource> boolean anotherInfraScopeOnResource(T resource, String scope){
|
||||
if(!new ScopeBean(scope).is(Type.INFRASTRUCTURE))
|
||||
throw new IllegalArgumentException("anotherInfraScopeOnResource method: the input scope must be a INFRASTRUCTURE scope");
|
||||
String infraScopeFound=null;
|
||||
for(String s : resource.scopes()){
|
||||
while(new ScopeBean(s).enclosingScope() != null){
|
||||
s=new ScopeBean(s).enclosingScope().toString();
|
||||
|
||||
}
|
||||
infraScopeFound=s;
|
||||
if(infraScopeFound.equals(scope)){
|
||||
log.debug("check scope"+scope+": found another scope on infra "+s);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BodyWithNSTests {
|
||||
|
||||
// @Test
|
||||
public void buildMassiAndvalentinaGeneric() throws Exception {
|
||||
|
||||
GenericResource generic = new GenericResource();
|
||||
generic.newProfile().name("test Nov 6 Rob").type("test").description("this is a test " + new Date());
|
||||
|
||||
String text = "<ns3:Record xmlns:ns3=\"http://gcube-system.org/namespaces/common\" "
|
||||
+ "xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\"><ciao>nn va</ciao></ns3:Record>";
|
||||
|
||||
generic.profile().newBody(text);
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
Resources.marshal(generic,writer);
|
||||
|
||||
GenericResource parsed = Resources.unmarshal(GenericResource.class,new StringReader(writer.toString()));
|
||||
|
||||
Resources.print(parsed);
|
||||
|
||||
Resources.validate(parsed);
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
RegistryPublisher rp=RegistryPublisherFactory.create();
|
||||
rp.create(generic);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import org.gcube.informationsystem.publisher.scope.IValidatorContext;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConfigurationTest {
|
||||
|
||||
private ClassLoader loader;
|
||||
// static final String relativePath="src/test/java/META-INF/services/org.gcube.informationsystem.publisher.scope.IValidatorContext";
|
||||
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
loader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void alternativeProvidersCanBeConfigured() {
|
||||
addJarsToClasspath("customValidator.jar");
|
||||
List<IValidatorContext> impls=load();
|
||||
assertEquals(impls.size(), 1);
|
||||
}
|
||||
|
||||
private List<IValidatorContext> load(){
|
||||
ServiceLoader<IValidatorContext> loader = ServiceLoader.load(IValidatorContext.class);
|
||||
Iterator<IValidatorContext> iterator = loader.iterator();
|
||||
List<IValidatorContext> impls = new ArrayList<IValidatorContext>();
|
||||
while(iterator.hasNext())
|
||||
impls.add(iterator.next());
|
||||
System.out.println("size: "+impls.size());
|
||||
if(impls.size()==1){
|
||||
IValidatorContext context = impls.get(0);
|
||||
for( Validator validator : context.getValidators()){
|
||||
System.out.println("implementation found: "+ validator.type());
|
||||
}
|
||||
}
|
||||
return impls;
|
||||
}
|
||||
|
||||
private void addJarsToClasspath(String ... jars) {
|
||||
|
||||
List<URL> jarUrls = new ArrayList<URL>();
|
||||
for (String jar : jars)
|
||||
jarUrls.add(loader.getResource(jar));
|
||||
|
||||
URLClassLoader urlClassLoader
|
||||
= new URLClassLoader(jarUrls.toArray(new URL[0]),loader);
|
||||
|
||||
|
||||
Thread.currentThread().setContextClassLoader(urlClassLoader);
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown() {
|
||||
Thread.currentThread().setContextClassLoader(loader);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.*;
|
||||
import org.gcube.informationsystem.publisher.scope.IValidatorContext;
|
||||
import org.gcube.informationsystem.publisher.scope.ScopeValidatorScanner;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DefaultConfigurationTest {
|
||||
|
||||
@Test
|
||||
public void testDefaultValidator(){
|
||||
IValidatorContext context=ScopeValidatorScanner.provider();
|
||||
List<Validator> list= context.getValidators();
|
||||
assertNotNull(list);
|
||||
Validator validator =list.get(0);
|
||||
System.out.println("found validator: "+validator.type());
|
||||
assertEquals(validator.type().toString().trim(),"class org.gcube.common.resources.gcore.Resource");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.helpers.Loader;
|
||||
import org.gcube.informationsystem.publisher.scope.IValidatorContext;
|
||||
import org.gcube.informationsystem.publisher.scope.ScopeValidatorScanner;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DefaultScopeValidatorTest {
|
||||
|
||||
static final String relativePath="/src/test/java/META-INF/services/org.gcube.informationsystem.publisher.scope.IValidatorContext";
|
||||
|
||||
// @BeforeClass
|
||||
public static void deleteServiceInfo(){
|
||||
URL url=Thread.currentThread().getClass().getResource("/");
|
||||
if(url != null){
|
||||
File f =new File(url.getPath());
|
||||
String rootPath=f.getParentFile().getParentFile().getAbsolutePath();
|
||||
System.out.println(" "+f.exists()+" path "+rootPath);
|
||||
File service=new File(rootPath+relativePath);
|
||||
|
||||
if(service.exists()){
|
||||
boolean del=service.delete();
|
||||
System.out.println("deleted? "+del);
|
||||
}
|
||||
}
|
||||
System.out.println("url founded "+url);
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testDefaultValidator(){
|
||||
IValidatorContext context=ScopeValidatorScanner.provider();
|
||||
List<Validator> list= context.getValidators();
|
||||
for(Validator validator : list){
|
||||
System.out.println("validator founded: "+validator.type());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.junit.Assert.*;
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class GCoreEndpointPublisherTests {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisherTests.class);
|
||||
static GCoreEndpoint running;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu/EUBrazilOpenBio");
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
running = Resources.unmarshal(GCoreEndpoint.class, PublisherTest.class.getClassLoader().getResourceAsStream("gCoreEndpoint.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
print(running);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.GCOREENDPOINT,running.type());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerCreate(){
|
||||
r=rp.create(running);
|
||||
System.out.println("new resource created: ");
|
||||
if(r!=null)
|
||||
print(r);
|
||||
assertEquals(running,r);
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void forceDeleteResource(){
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PublisherTest {
|
||||
|
||||
static Logger log = LoggerFactory.getLogger(PublisherTest.class);
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
// ScopeProvider.instance.set("/gcube/devsec/devVre");
|
||||
// log.trace("starting client");
|
||||
// RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
||||
// AdvancedPublisher publisher=new AdvancedPublisher(registryPublisher);
|
||||
// publisher.removeFromAllScopes("testError", Type.GENERIC);
|
||||
}
|
||||
|
||||
|
||||
public static <T> T unmarshal(Class<T> clazz, String sample) throws Exception {
|
||||
return Resources.unmarshal(clazz,PublisherTest.class.getClassLoader().getResourceAsStream(sample));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.junit.Assert.*;
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistryPublisherTests {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisherTests.class);
|
||||
static GenericResource generic;
|
||||
// static GCoreEndpoint running;
|
||||
// static ServiceEndpoint runtime;
|
||||
// static Software service;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
ScopeProvider.instance.set("/gcube/devNext");
|
||||
// ScopeProvider.instance.set("/gcube/devsec");
|
||||
generic = Resources.unmarshal(GenericResource.class, PublisherTest.class.getClassLoader().getResourceAsStream("generic.xml"));
|
||||
// runtime = Resources.unmarshal(ServiceEndpoint.class, PublisherTest.class.getClassLoader().getResourceAsStream("broker.xml"));
|
||||
// service = Resources.unmarshal(Software.class, PublisherTest.class.getClassLoader().getResourceAsStream("service.xml"));
|
||||
// running = Resources.unmarshal(GCoreEndpoint.class, PublisherTest.class.getClassLoader().getResourceAsStream("gCoreEndpoint.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
//print it
|
||||
print(generic);
|
||||
// print(runtime);
|
||||
// print(service);
|
||||
// print(running);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.GENERIC,generic.type());
|
||||
// assertEquals(Type.ENDPOINT,runtime.type());
|
||||
// assertEquals(Type.SOFTWARE ,service.type());
|
||||
// assertEquals(Type.GCOREENDPOINT,running.type());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerCreate(){
|
||||
r=rp.create(generic);
|
||||
// r=rp.create(runtime);
|
||||
// r=rp.create(service);
|
||||
// r=rp.create(running);
|
||||
System.out.println("new resource created: ");
|
||||
if(r!=null)
|
||||
print(r);
|
||||
// try {
|
||||
// Thread.sleep(15000);
|
||||
// } catch (InterruptedException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// String currentScope=ScopeProvider.instance.get();
|
||||
// ScopeGroup<String> scopes=r.scopes();
|
||||
// for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
// String scope=it.next();
|
||||
// log.info("set scope "+scope);
|
||||
// ScopeProvider.instance.set(scope);
|
||||
// SimpleQuery query = queryFor(GenericResource.class);
|
||||
// query.addCondition("$resource/Profile/SecondaryType/text() eq 'PublisherBotoxTest' and $resource/Profile/Name eq 'TestNewPublisher' ");
|
||||
// DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
// List<GenericResource> resources = client.submit(query);
|
||||
// if(resources.size() > 0){
|
||||
// System.out.println("resource found in scope "+scope);
|
||||
// GenericResource resource=resources.get(0);
|
||||
// log.info("r founded "+resource.id()+" "+resource.toString());
|
||||
// log.info("original resource: "+r.id()+" "+r.toString());
|
||||
// assertEquals(resource.scopes(), r.scopes());
|
||||
// log.info("assert ok in scope "+scope);
|
||||
// }
|
||||
// }
|
||||
// ScopeProvider.instance.set(currentScope);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void removeResource(){
|
||||
rp.remove(generic);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void forceDeleteResource(){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
String enclosedScope=new ScopeBean(currentScope).enclosingScope().toString();
|
||||
while( enclosedScope != null){
|
||||
ScopeProvider.instance.set(enclosedScope);
|
||||
advancedPublisher.forceRemove(r);
|
||||
if(new ScopeBean(enclosedScope).enclosingScope() != null)
|
||||
enclosedScope=new ScopeBean(enclosedScope).enclosingScope().toString();
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistryRemoveTests {
|
||||
|
||||
static GenericResource generic;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryUpdateTests.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
ScopeProvider.instance.set("/gcube/devNext");
|
||||
generic = Resources.unmarshal(GenericResource.class, PublisherTest.class.getClassLoader().getResourceAsStream("generic.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
//print it
|
||||
print(generic);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.GENERIC,generic.type());
|
||||
r=rp.create(generic);
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeFromCurrentScope(){
|
||||
r=rp.remove(generic);
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ScopeGroup<String> scopes=r.scopes();
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
log.info("set scope "+scope);
|
||||
ScopeProvider.instance.set(scope);
|
||||
SimpleQuery query = queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text() eq 'PublisherBotoxTest' and $resource/Profile/Name eq 'TestNewPublisher5' ");
|
||||
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
List<GenericResource> resources = client.submit(query);
|
||||
if(resources.size() > 0){
|
||||
System.out.println("resource found in scope "+scope+ " size "+resources.size());
|
||||
GenericResource resource=resources.get(0);
|
||||
log.info("r founded "+resource.id()+" "+resource.toString());
|
||||
log.info("original resource: "+r.id()+" "+r.toString());
|
||||
assertEquals(resource.scopes(), r.scopes());
|
||||
log.info("assert ok in scope "+scope);
|
||||
}
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void removeResource(){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
ScopeBean scopeBean=new ScopeBean(currentScope).enclosingScope();
|
||||
if(scopeBean!=null){
|
||||
String enclosedScope=scopeBean.toString();
|
||||
while( enclosedScope != null){
|
||||
ScopeProvider.instance.set(enclosedScope);
|
||||
advancedPublisher.forceRemove(r);
|
||||
scopeBean=new ScopeBean(enclosedScope).enclosingScope();
|
||||
if(scopeBean!=null){
|
||||
enclosedScope=scopeBean.toString();
|
||||
}else enclosedScope=null;
|
||||
}
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ResourceMediator;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistryUpdateTests {
|
||||
|
||||
static GenericResource generic;
|
||||
static RegistryPublisher rp;
|
||||
static GenericResource r;
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryUpdateTests.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
||||
generic = Resources.unmarshal(GenericResource.class, PublisherTest.class.getClassLoader().getResourceAsStream("generic.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
//print it
|
||||
print(generic);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.GENERIC,generic.type());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerUpdate(){
|
||||
rp.create(generic);
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("old description "+generic.profile().description());
|
||||
String newDescription="testUpdateDescription";
|
||||
generic.profile().description(newDescription);
|
||||
System.out.println("new description "+generic.profile().description());
|
||||
r=rp.update(generic);
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ScopeGroup<String> scopes=r.scopes();
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
log.info("set scope "+scope);
|
||||
ScopeProvider.instance.set(scope);
|
||||
SimpleQuery query = queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text() eq 'PublisherBotoxTest' and $resource/Profile/Name eq 'TestNewPublisher' ");
|
||||
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
List<GenericResource> resources = client.submit(query);
|
||||
if(resources.size() > 0){
|
||||
System.out.println("resource found in scope "+scope+ " size "+resources.size());
|
||||
GenericResource resource=resources.get(0);
|
||||
log.info("r founded "+resource.id()+" "+resource.toString());
|
||||
log.info("original resource: "+r.id()+" "+r.toString());
|
||||
assertEquals(resource.scopes(), r.scopes());
|
||||
assertEquals(resource.profile().description(), r.profile().description());
|
||||
log.info("assert ok in scope "+scope);
|
||||
}
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeResource(){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
ScopeBean scopeBean=new ScopeBean(currentScope).enclosingScope();
|
||||
if(scopeBean!=null){
|
||||
String enclosedScope=scopeBean.toString();
|
||||
while( enclosedScope != null){
|
||||
ScopeProvider.instance.set(enclosedScope);
|
||||
advancedPublisher.forceRemove(r);
|
||||
scopeBean=new ScopeBean(enclosedScope).enclosingScope();
|
||||
if(scopeBean!=null){
|
||||
enclosedScope=scopeBean.toString();
|
||||
}else enclosedScope=null;
|
||||
}
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.publisher.AdvancedPublisher;
|
||||
import org.gcube.informationsystem.publisher.RegistryPublisher;
|
||||
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class RemoveByIdTests {
|
||||
|
||||
static GenericResource generic;
|
||||
static AdvancedPublisher arp;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
private static String scope="/gcube/devNext";
|
||||
private String id="c66bb9b0-e571-11e2-9f13-fcb948ca7a75";//aedc90ed-6df2-437c-ac0f-ffecbafda893
|
||||
private Type type=Type.ENDPOINT;
|
||||
private String endpointString="http://node20.d.d4science.research-infrastructures.eu:8080/wsrf/services/gcube/informationsystem/registry/ResourceRegistration";
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
ScopeProvider.instance.set(scope);
|
||||
rp=RegistryPublisherFactory.create();
|
||||
arp=new AdvancedPublisher(rp);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void removeFromCurrentScope(){
|
||||
arp.removeById(id, type);
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void removeFromCurrentScopeWithEndpoint(){
|
||||
URI endpoint=null;
|
||||
try {
|
||||
endpoint=new URI(endpointString);
|
||||
} catch (URISyntaxException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
arp.removeById(id, type, endpoint);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.gcube.informationsystem.publisher.scope.IValidatorContext;
|
||||
import org.gcube.informationsystem.publisher.scope.ScopeValidatorScanner;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
public class ScopeValidatorTest {
|
||||
|
||||
// static IValidatorContext context;
|
||||
static final String IMPL_CLASS="org.gcube.informationsystem.scope.validator.ValidatorContextImpl";
|
||||
static final String relativePath="src/test/java/META-INF/services/org.gcube.informationsystem.publisher.scope.IValidatorContext";
|
||||
|
||||
// @Rule
|
||||
// public static TemporaryFolder testFolder = new TemporaryFolder();
|
||||
|
||||
public static File service;
|
||||
|
||||
// @BeforeClass
|
||||
public static void writeServiceInfo() throws IOException{
|
||||
service=new File(relativePath);
|
||||
FileOutputStream file = new FileOutputStream(service);
|
||||
PrintStream output = new PrintStream(file);
|
||||
output.print(IMPL_CLASS);
|
||||
output.flush();
|
||||
output.close();
|
||||
System.out.println("file writed ");
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
public void test(){
|
||||
IValidatorContext context=ScopeValidatorScanner.provider();
|
||||
List<Validator> list= context.getValidators();
|
||||
for(Validator validator : list){
|
||||
System.out.println("validator founded: "+validator.type());
|
||||
}
|
||||
}
|
||||
|
||||
// @AfterClass
|
||||
// public static void deleteServiceInfo() throws IOException{
|
||||
// if(service.exists()){
|
||||
// boolean del=service.delete();
|
||||
// System.out.println("deleted? "+del);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ScopedPublisherTests {
|
||||
|
||||
static GenericResource generic;
|
||||
static ScopedPublisher sp;
|
||||
static List<String> scopes;
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisherTests.class);
|
||||
static Resource r;
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
// ScopeProvider.instance.set("/gcube/devsec");
|
||||
generic = Resources.unmarshal(GenericResource.class, PublisherTest.class.getClassLoader().getResourceAsStream("generic.xml"));
|
||||
sp=RegistryPublisherFactory.scopedPublisher();
|
||||
scopes=new ArrayList<String>();
|
||||
scopes.add("/gcube/devNext");
|
||||
scopes.add("/gcube/devsec/devVRE");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
//print it
|
||||
print(generic);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.GENERIC,generic.type());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scopedPublisherCreate(){
|
||||
try {
|
||||
r=sp.create(generic, scopes);
|
||||
} catch (RegistryNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("new resource created: ");
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
ScopeGroup<String> scopes=r.scopes();
|
||||
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
|
||||
String scope=it.next();
|
||||
if(currentScope==null){
|
||||
currentScope=scope;
|
||||
}
|
||||
log.info("set scope "+scope);
|
||||
ScopeProvider.instance.set(scope);
|
||||
SimpleQuery query = queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text() eq 'PublisherBotoxTest' and $resource/Profile/Name eq 'TestNewPublisher' ");
|
||||
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
List<GenericResource> resources = client.submit(query);
|
||||
if(resources.size() > 0){
|
||||
System.out.println("resource found in scope "+scope+" resource found "+resources.size());
|
||||
GenericResource resource=resources.get(0);
|
||||
log.info("r founded "+resource.id()+" "+resource.toString());
|
||||
log.info("original resource: "+r.id()+" "+r.toString());
|
||||
assertEquals(resource, r);
|
||||
log.info("assert ok in scope "+scope);
|
||||
}
|
||||
}
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void removeResource(){
|
||||
log.info("remove resource "+r.id()+" from all scopes ");
|
||||
AdvancedScopedPublisher advancedPublisher=new AdvancedScopedPublisher(sp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.junit.Assert.*;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ServiceEndpointPublisherTests {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisherTests.class);
|
||||
static ServiceEndpoint runtime;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu/EUBrazilOpenBio");
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
runtime = Resources.unmarshal(ServiceEndpoint.class, PublisherTest.class.getClassLoader().getResourceAsStream("broker.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
print(runtime);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.ENDPOINT,runtime.type());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerCreate(){
|
||||
r=rp.create(runtime);
|
||||
System.out.println("new resource created: ");
|
||||
if(r!=null)
|
||||
print(r);
|
||||
assertEquals(runtime,r);
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void forceDeleteResource(){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.informationsystem.publisher;
|
||||
|
||||
import static org.gcube.common.resources.gcore.Resources.print;
|
||||
import static org.junit.Assert.*;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Software;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.common.resources.gcore.Resources;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SoftwarePublisherTests {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistryPublisherTests.class);
|
||||
static Software service;
|
||||
static RegistryPublisher rp;
|
||||
static Resource r;
|
||||
|
||||
@BeforeClass
|
||||
public static void init(){
|
||||
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu/EUBrazilOpenBio");
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
service = Resources.unmarshal(Software.class, PublisherTest.class.getClassLoader().getResourceAsStream("service.xml"));
|
||||
rp=RegistryPublisherFactory.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printTest(){
|
||||
print(service);
|
||||
//resource-specific tests
|
||||
assertEquals(Type.SOFTWARE ,service.type());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerCreate(){
|
||||
r=rp.create(service);
|
||||
System.out.println("new resource created: ");
|
||||
if(r!=null)
|
||||
print(r);
|
||||
assertEquals(service,r);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void forceDeleteResource(){
|
||||
String currentScope=ScopeProvider.instance.get();
|
||||
log.info("force remove resource "+r.id()+" to scope "+currentScope);
|
||||
AdvancedPublisher advancedPublisher=new AdvancedPublisher(rp);
|
||||
advancedPublisher.forceRemove(r);
|
||||
ScopeProvider.instance.set(currentScope);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.informationsystem.scope.validator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MyGenericResourceValidator<R> implements Validator<GenericResource> {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MyGenericResourceValidator.class);
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void validate(R resource) {
|
||||
log.info("validate method of "+this.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class type() {
|
||||
return GenericResource.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void checkScopeCompatibility(R resource,
|
||||
List<String> scopes) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.informationsystem.scope.validator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MyServiceEndpointValidator<R> implements Validator<ServiceEndpoint>{
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MyServiceEndpointValidator.class);
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void validate(R resource) {
|
||||
log.info("validate method of "+this.getClass());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class type() {
|
||||
return ServiceEndpoint.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends Resource> void checkScopeCompatibility(R resource,
|
||||
List<String> scopes) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.informationsystem.scope.validator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.publisher.scope.IValidatorContext;
|
||||
import org.gcube.informationsystem.publisher.scope.Validator;
|
||||
|
||||
public class ValidatorContextImpl implements IValidatorContext{
|
||||
|
||||
final static List<Validator> validators = Arrays.asList(new MyGenericResourceValidator(), new MyServiceEndpointValidator());
|
||||
|
||||
@Override
|
||||
public List<Validator> getValidators() {
|
||||
return validators;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<Resource version="0.4.x">
|
||||
<ID>e6705ad0-fa8a-11e2-92fd-b6f8c481951b</ID>
|
||||
<Type>RuntimeResource</Type>
|
||||
<Scopes>
|
||||
<Scope>/d4science.research-infrastructures.eu</Scope>
|
||||
<Scope>/d4science.research-infrastructures.eu/gCubeApps</Scope>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Category>Database</Category>
|
||||
<Name>Obis2Repository</Name>
|
||||
<Description>Obis2Repository</Description>
|
||||
<Platform>
|
||||
<Name>postgres</Name>
|
||||
<Version>8</Version>
|
||||
<MinorVersion>4</MinorVersion>
|
||||
<RevisionVersion>0</RevisionVersion>
|
||||
<BuildVersion>0</BuildVersion>
|
||||
</Platform>
|
||||
<RunTime>
|
||||
<HostedOn>obis2.i-marine.research-infrastructures.eu</HostedOn>
|
||||
<GHN UniqueID="" />
|
||||
<Status>READY</Status>
|
||||
</RunTime>
|
||||
<AccessPoint>
|
||||
<Description>jdbc connection url</Description>
|
||||
<Interface>
|
||||
<Endpoint EntryName="jdbc">jdbc:postgresql://obis2.i-marine.research-infrastructures.eu:5432/obis</Endpoint>
|
||||
</Interface>
|
||||
<AccessData>
|
||||
<Username>postgres</Username>
|
||||
<Password>Db/lnp5cAPwrAfjqorqctA==</Password>
|
||||
</AccessData>
|
||||
<Properties>
|
||||
<Property>
|
||||
<Name>dialect</Name>
|
||||
<Value encrypted="false">org.hibernate.dialect.PostgreSQLDialect</Value>
|
||||
</Property>
|
||||
<Property>
|
||||
<Name>dbname</Name>
|
||||
<Value encrypted="false">obis</Value>
|
||||
</Property>
|
||||
<Property>
|
||||
<Name>driver</Name>
|
||||
<Value encrypted="false">org.postgresql.Driver</Value>
|
||||
</Property>
|
||||
</Properties>
|
||||
</AccessPoint>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,44 @@
|
|||
<Resource version="0.4.x">
|
||||
<ID></ID>
|
||||
<Type>RuntimeResource</Type>
|
||||
<Scopes>
|
||||
<Scope>/d4science.research-infrastructures.eu</Scope>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Category>Database</Category>
|
||||
<Name>StatisticalManagerDataBase</Name>
|
||||
<Description>DB for Statistical Manager Service</Description>
|
||||
<Platform>
|
||||
<Name>postgres</Name>
|
||||
<Version>8</Version>
|
||||
<MinorVersion>4</MinorVersion>
|
||||
<RevisionVersion>0</RevisionVersion>
|
||||
<BuildVersion>0</BuildVersion>
|
||||
</Platform>
|
||||
<RunTime>
|
||||
<HostedOn>db1.p.d4science.research-infrastructures.eu</HostedOn>
|
||||
<GHN UniqueID="" />
|
||||
<Status>READY</Status>
|
||||
</RunTime>
|
||||
<AccessPoint>
|
||||
<Description>jdbc conection url</Description>
|
||||
<Interface>
|
||||
<Endpoint EntryName="jdbc">jdbc:postgresql://db1.p.d4science.research-infrastructures.eu/testdb</Endpoint>
|
||||
</Interface>
|
||||
<AccessData>
|
||||
<Username>utente</Username>
|
||||
<Password>UwNMZOK7FlIjGPR+NZCV6w==</Password>
|
||||
</AccessData>
|
||||
</AccessPoint>
|
||||
<AccessPoint>
|
||||
<Description>Hibernate connection url</Description>
|
||||
<Interface>
|
||||
<Endpoint EntryName="hibernate">jdbc:postgresql://db1.p.d4science.research-infrastructures.eu/dataSpace</Endpoint>
|
||||
</Interface>
|
||||
<AccessData>
|
||||
<Username>utente</Username>
|
||||
<Password>UwNMZOK7FlIjGPR+NZCV6w==</Password>
|
||||
</AccessData>
|
||||
</AccessPoint>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Resource version="0.4.x">
|
||||
<ID></ID>
|
||||
<Type>RuntimeResource</Type>
|
||||
<Scopes>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Category>Service</Category>
|
||||
<Name>MessageBrokerTestPublisher</Name>
|
||||
<Description></Description>
|
||||
<Platform>
|
||||
<Name>ActiveMQ</Name>
|
||||
<Version>5</Version>
|
||||
<MinorVersion>6</MinorVersion>
|
||||
<RevisionVersion>0</RevisionVersion>
|
||||
<BuildVersion>0</BuildVersion>
|
||||
</Platform>
|
||||
<RunTime>
|
||||
<HostedOn>message-broker.d4science.research-infrastructures.eu</HostedOn>
|
||||
<GHN UniqueID=""/>
|
||||
<Status>READY</Status>
|
||||
</RunTime>
|
||||
<AccessPoint>
|
||||
<Description>openwire interface</Description>
|
||||
<Interface>
|
||||
<Endpoint EntryName="openwire">tcp://message-broker.d4science.research-infrastructures.eu:6166</Endpoint>
|
||||
</Interface>
|
||||
<AccessData>
|
||||
<Username></Username>
|
||||
<Password>6vW1u92cpdgHzYAgIurn9w==</Password>
|
||||
</AccessData>
|
||||
</AccessPoint>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,55 @@
|
|||
<Resource version="0.4.x">
|
||||
|
||||
<ID>dec27470-447e-11e2-a749-e3b17e68146a</ID>
|
||||
|
||||
<Type>GenericResource</Type>
|
||||
|
||||
<Scopes>
|
||||
|
||||
<Scope>/gcube</Scope>
|
||||
|
||||
</Scopes>
|
||||
|
||||
<Profile>
|
||||
|
||||
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||
|
||||
<Name>Cotrix</Name>
|
||||
|
||||
<Description>Cotrix application</Description>
|
||||
|
||||
<Body>
|
||||
|
||||
<AppId>org.cotrix.web</AppId>
|
||||
|
||||
<ThumbnailURL>http://ftp.d4science.org/apps/profiles/cotrix.png</ThumbnailURL>
|
||||
|
||||
<EndPoint>
|
||||
|
||||
<Scope>/gcube/devsec/devVRE</Scope>
|
||||
|
||||
<URL>/group/devvre/cotrix</URL>
|
||||
|
||||
</EndPoint>
|
||||
|
||||
<EndPoint>
|
||||
|
||||
<Scope>/gcube/devsec</Scope>
|
||||
|
||||
<URL>/group/devsec/cotrix</URL>
|
||||
|
||||
</EndPoint>
|
||||
|
||||
<EndPoint>
|
||||
|
||||
<Scope>/gcube/devsec/devNext</Scope>
|
||||
|
||||
<URL>/group/devnext/cotrix</URL>
|
||||
|
||||
</EndPoint>
|
||||
|
||||
</Body>
|
||||
|
||||
</Profile>
|
||||
|
||||
</Resource>
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<service-map scope='/gcube/devsec'>
|
||||
<services>
|
||||
<service name='XQueryAccessService' endpoint='http://dlib01.isti.cnr.it:8080/wsrf/services/gcube/informationsystem/collector/XQueryAccess' />
|
||||
</services>
|
||||
</service-map>
|
|
@ -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>Test</Category>
|
||||
<Name>TestRR</Name>
|
||||
<Description>RR TEST</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,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Resource version="0.4.x">
|
||||
<ID>5d244ab0-9d79-11e3-af18-dd5904b11dd6</ID>
|
||||
<Type>RunningInstance</Type>
|
||||
<Scopes>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Description>Test</Description>
|
||||
<Version>3.1.0</Version>
|
||||
<GHN UniqueID="5c647d20-9d79-11e3-af16-dd5904b11aaa" />
|
||||
<Service UniqueID="050f6160-9fc3-11e3-b0a8-f86cfdccaaa" />
|
||||
<ServiceName>ResultSetService</ServiceName>
|
||||
<ServiceClass>Search</ServiceClass>
|
||||
<DeploymentData>
|
||||
<ActivationTime value="2014-02-27T16:22:50+01:00" />
|
||||
<Status>ready</Status>
|
||||
</DeploymentData>
|
||||
<AccessPoint>
|
||||
<RunningInstanceInterfaces>
|
||||
<Endpoint EntryName="gcube/common/test/test">http://nodetest.isti.cnr.it:8080/wsrf/services/gcube/common/test/test</Endpoint>
|
||||
</RunningInstanceInterfaces>
|
||||
</AccessPoint>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Resource version="0.4.x">
|
||||
<ID>321e10bb-a906-4d82-89ba-197ccdd75d3f</ID>
|
||||
<Scopes>
|
||||
<!-- <Scope>/gcube</Scope> -->
|
||||
<!-- <Scope>/gcube/devNext</Scope> -->
|
||||
<!-- <Scope>/gcube/devsec/devVRE</Scope> -->
|
||||
</Scopes>
|
||||
<Type>GenericResource</Type>
|
||||
<Profile>
|
||||
<SecondaryType>PublisherBotoxTest</SecondaryType>
|
||||
<Name>Test</Name>
|
||||
<Description>Test </Description>
|
||||
<Body>
|
||||
<SourceProperties>
|
||||
<creationTime>2014-09-05T14:33:33.116+02:00</creationTime>
|
||||
<user>true</user>
|
||||
</SourceProperties>
|
||||
<other>test</other>
|
||||
</Body>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Resource version="0.4.x">
|
||||
<ID>t78909d3-4bef-4b3a-b3a1-7eb39fd86a27</ID>
|
||||
<Scopes>
|
||||
<!--Scope>/gcube</Scope-->
|
||||
<!--Scope>/gcube/devsec</Scope-->
|
||||
</Scopes>
|
||||
<Type>GenericResource</Type>
|
||||
<Profile>
|
||||
<SecondaryType>PublisherBotoxTest</SecondaryType>
|
||||
<Name>TestNewPublisher</Name>
|
||||
<Description>TestNewPublisher</Description>
|
||||
<Body>
|
||||
<SourceProperties>
|
||||
<creationTime>2013-08-28T14:33:33.116+02:00</creationTime>
|
||||
<user>true</user>
|
||||
</SourceProperties>
|
||||
<other>test</other>
|
||||
</Body>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,981 @@
|
|||
<Resource version="1.3.0">
|
||||
<ID>bb6e2d69-cccc-42ef-9985-fae2cba85753</ID>
|
||||
<Type>GHN</Type>
|
||||
<Scopes>
|
||||
<!-- <Scope>/gcube</Scope> -->
|
||||
<Scope>/gcube/devsec/devVRE</Scope>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Infrastructure>gcube</Infrastructure>
|
||||
<GHNDescription>
|
||||
<Name>rcirillo-test.ghn.it:8080</Name>
|
||||
<ActivationTime>2013-12-03T11:08:16+01:00</ActivationTime>
|
||||
<Status>certified</Status>
|
||||
<Type>Dynamic</Type>
|
||||
<SecurityEnabled value="false" />
|
||||
<Architecture PlatformType="i386" SMPSize="0" SMTSize="0" />
|
||||
<OperatingSystem Name="Linux" Release="" Version="3.2.0-53-generic" />
|
||||
|
||||
<Processor Bogomips="6184.64" CacheL1="6144" CacheL1D="0" CacheL1I="0" CacheL2="0" ClockSpeedMhz="3101.0" Family="6" Model="42" ModelName="Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz" Vendor="GenuineIntel" />
|
||||
|
||||
<Processor Bogomips="6184.16" CacheL1="6144" CacheL1D="0" CacheL1I="0" CacheL2="0" ClockSpeedMhz="1600.0" Family="6" Model="42" ModelName="Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz" Vendor="GenuineIntel" />
|
||||
|
||||
<Processor Bogomips="6184.17" CacheL1="6144" CacheL1D="0" CacheL1I="0" CacheL2="0" ClockSpeedMhz="3101.0" Family="6" Model="42" ModelName="Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz" Vendor="GenuineIntel" />
|
||||
|
||||
<Processor Bogomips="6184.17" CacheL1="6144" CacheL1D="0" CacheL1I="0" CacheL2="0" ClockSpeedMhz="1600.0" Family="6" Model="42" ModelName="Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz" Vendor="GenuineIntel" />
|
||||
|
||||
<NetworkAdapter IPAddress="146.48.85.73" InboundIP="" MTU="0" Name="local-adapter" OutboundIP="" />
|
||||
|
||||
<RunTimeEnv>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>TERM</Key>
|
||||
|
||||
<Value>xterm</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>M3_HOME</Key>
|
||||
|
||||
<Value>/usr/local/apache-maven/apache-maven-3.0.4</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_SESSION_PATH</Key>
|
||||
|
||||
<Value>/org/freedesktop/DisplayManager/Session0</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_CONTROL</Key>
|
||||
|
||||
<Value>/tmp/keyring-UxzBZa</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>JAVA_HOME</Key>
|
||||
|
||||
<Value>/usr/local/java/sun-jdk-6-linux-x86-1.6.0.16</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SHLVL</Key>
|
||||
|
||||
<Value>1</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LESSCLOSE</Key>
|
||||
|
||||
<Value>/usr/bin/lesspipe %s %s</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XFILESEARCHPATH</Key>
|
||||
|
||||
<Value>/usr/dt/app-defaults/%L/Dt</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SESSION_MANAGER</Key>
|
||||
|
||||
<Value>local/rcirillo-cnr.isti.cnr.it:@/tmp/.ICE-unix/1769,unix/rcirillo-cnr.isti.cnr.it:/tmp/.ICE-unix/1769</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>COLORTERM</Key>
|
||||
|
||||
<Value>gnome-terminal</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_DESKTOP_SESSION_ID</Key>
|
||||
|
||||
<Value>this-is-deprecated</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>M3</Key>
|
||||
|
||||
<Value>/usr/local/apache-maven/apache-maven-3.0.4/bin</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GDMSESSION</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_SESSION_COOKIE</Key>
|
||||
|
||||
<Value>d42b5ce427dfcf7226bbc48200000009-1381330528.868244-973891316</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>COMPIZ_CONFIG_PROFILE</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_DATA_DIRS</Key>
|
||||
|
||||
<Value>/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>MANDATORY_PATH</Key>
|
||||
|
||||
<Value>/usr/share/gconf/ubuntu.mandatory.path</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>PWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.42</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWID</Key>
|
||||
|
||||
<Value>62914566</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LOGNAME</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GPG_AGENT_INFO</Key>
|
||||
|
||||
<Value>/tmp/keyring-UxzBZa/gpg:0:1</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>_</Key>
|
||||
|
||||
<Value>/bin/sh</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>NLSPATH</Key>
|
||||
|
||||
<Value>/usr/dt/lib/nls/msg/%L/%N.cat</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LD_LIBRARY_PATH</Key>
|
||||
|
||||
<Value>/usr/local/java/jdk1.6.0.16/jre/lib/i386/server:/usr/local/java/jdk1.6.0.16/jre/lib/i386:/usr/local/java/jdk1.6.0.16/jre/../lib/i386</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SHELL</Key>
|
||||
|
||||
<Value>/bin/bash</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DBUS_SESSION_BUS_ADDRESS</Key>
|
||||
|
||||
<Value>unix:abstract=/tmp/dbus-Cn8BAkdY1z,guid=38ad666c775b2a4d58adfa8700000061</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_PID</Key>
|
||||
|
||||
<Value>1758</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_CONFIG_DIRS</Key>
|
||||
|
||||
<Value>/etc/xdg/xdg-ubuntu:/etc/xdg</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_CURRENT_DESKTOP</Key>
|
||||
|
||||
<Value>Unity</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DESKTOP_SESSION</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>JRE_HOME</Key>
|
||||
|
||||
<Value>/usr/local/java/jdk1.6.0.16/jre</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DISPLAY</Key>
|
||||
|
||||
<Value>:0</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>UBUNTU_MENUPROXY</Key>
|
||||
|
||||
<Value>libappmenu.so</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>USER</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>HOME</Key>
|
||||
|
||||
<Value>/home/rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GHN_HOME</Key>
|
||||
|
||||
<Value>/home/rcirillo/ghn</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GLOBUS_LOCATION</Key>
|
||||
|
||||
<Value>/home/rcirillo/gCore</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XAUTHORITY</Key>
|
||||
|
||||
<Value>/home/rcirillo/.Xauthority</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LESSOPEN</Key>
|
||||
|
||||
<Value>| /usr/bin/lesspipe %s</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DEFAULTS_PATH</Key>
|
||||
|
||||
<Value>/usr/share/gconf/ubuntu.default.path</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_SEAT_PATH</Key>
|
||||
|
||||
<Value>/org/freedesktop/DisplayManager/Seat0</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LANG</Key>
|
||||
|
||||
<Value>en_US.UTF-8</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>Java</Key>
|
||||
|
||||
<Value>1.6.0_16</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SmartGears</Key>
|
||||
|
||||
<Value>1.0.0-SNAPSHOT</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>ghn-update-interval-in-secs</Key>
|
||||
|
||||
<Value>60</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>CATALINA_HOME</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.42/</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWID</Key>
|
||||
|
||||
<Value>63229945</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.39</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>PWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.39</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.42</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.39/webapps</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SmartGears</Key>
|
||||
|
||||
<Value>1.0.1-SNAPSHOT</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SESSION_MANAGER</Key>
|
||||
|
||||
<Value>local/rcirillo-cnr.isti.cnr.it:@/tmp/.ICE-unix/1689,unix/rcirillo-cnr.isti.cnr.it:/tmp/.ICE-unix/1689</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_SESSION_COOKIE</Key>
|
||||
|
||||
<Value>d42b5ce427dfcf7226bbc48200000009-1384861380.927751-1601996142</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GDM_LANG</Key>
|
||||
|
||||
<Value>en_US</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XAUTHORITY</Key>
|
||||
|
||||
<Value>/var/run/gdm/auth-for-rcirillo-OhHcgc/database</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWPATH</Key>
|
||||
|
||||
<Value>7</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>USERNAME</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_CONTROL</Key>
|
||||
|
||||
<Value>/tmp/keyring-qdWlJd</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWID</Key>
|
||||
|
||||
<Value>52544429</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GPG_AGENT_INFO</Key>
|
||||
|
||||
<Value>/tmp/keyring-qdWlJd/gpg:0:1</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DBUS_SESSION_BUS_ADDRESS</Key>
|
||||
|
||||
<Value>unix:abstract=/tmp/dbus-vEOiFR7tGG,guid=5e7a147626aec6489b9f3d3e00000021</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_PID</Key>
|
||||
|
||||
<Value>1672</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LANGUAGE</Key>
|
||||
|
||||
<Value>en_US:en</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWID</Key>
|
||||
|
||||
<Value>52428806</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>TERM</Key>
|
||||
|
||||
<Value>xterm</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>M3_HOME</Key>
|
||||
|
||||
<Value>/usr/local/apache-maven/apache-maven-3.0.4</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>JAVA_HOME</Key>
|
||||
|
||||
<Value>/usr/local/java/sun-jdk-6-linux-x86-1.6.0.16</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LESSCLOSE</Key>
|
||||
|
||||
<Value>/usr/bin/lesspipe %s %s</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SESSION_MANAGER</Key>
|
||||
|
||||
<Value>local/rcirillo-cnr.isti.cnr.it:@/tmp/.ICE-unix/1689,unix/rcirillo-cnr.isti.cnr.it:/tmp/.ICE-unix/1689</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_DESKTOP_SESSION_ID</Key>
|
||||
|
||||
<Value>this-is-deprecated</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>M3</Key>
|
||||
|
||||
<Value>/usr/local/apache-maven/apache-maven-3.0.4/bin</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>COMPIZ_CONFIG_PROFILE</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_SESSION_COOKIE</Key>
|
||||
|
||||
<Value>d42b5ce427dfcf7226bbc48200000009-1384861380.927751-1601996142</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GDMSESSION</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>MANDATORY_PATH</Key>
|
||||
|
||||
<Value>/usr/share/gconf/ubuntu.mandatory.path</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>PWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.39</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>NLSPATH</Key>
|
||||
|
||||
<Value>/usr/dt/lib/nls/msg/%L/%N.cat</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_CURRENT_DESKTOP</Key>
|
||||
|
||||
<Value>Unity</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_CONFIG_DIRS</Key>
|
||||
|
||||
<Value>/etc/xdg/xdg-ubuntu:/etc/xdg</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GLOBUS_LOCATION</Key>
|
||||
|
||||
<Value>/home/rcirillo/gCore</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GHN_HOME</Key>
|
||||
|
||||
<Value>/home/rcirillo/ghn</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GDM_LANG</Key>
|
||||
|
||||
<Value>en_US</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XAUTHORITY</Key>
|
||||
|
||||
<Value>/var/run/gdm/auth-for-rcirillo-OhHcgc/database</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWPATH</Key>
|
||||
|
||||
<Value>7</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>USERNAME</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_CONTROL</Key>
|
||||
|
||||
<Value>/tmp/keyring-qdWlJd</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SHLVL</Key>
|
||||
|
||||
<Value>1</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XFILESEARCHPATH</Key>
|
||||
|
||||
<Value>/usr/dt/app-defaults/%L/Dt</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>COLORTERM</Key>
|
||||
|
||||
<Value>gnome-terminal</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>XDG_DATA_DIRS</Key>
|
||||
|
||||
<Value>/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LOGNAME</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>WINDOWID</Key>
|
||||
|
||||
<Value>52428806</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GPG_AGENT_INFO</Key>
|
||||
|
||||
<Value>/tmp/keyring-qdWlJd/gpg:0:1</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>_</Key>
|
||||
|
||||
<Value>/bin/sh</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LD_LIBRARY_PATH</Key>
|
||||
|
||||
<Value>/usr/local/java/jdk1.6.0.16/jre/lib/i386/server:/usr/local/java/jdk1.6.0.16/jre/lib/i386:/usr/local/java/jdk1.6.0.16/jre/../lib/i386</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>OLDPWD</Key>
|
||||
|
||||
<Value>/home/rcirillo/tomcat7/apache-tomcat-7.0.39/webapps</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DBUS_SESSION_BUS_ADDRESS</Key>
|
||||
|
||||
<Value>unix:abstract=/tmp/dbus-vEOiFR7tGG,guid=5e7a147626aec6489b9f3d3e00000021</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SHELL</Key>
|
||||
|
||||
<Value>/bin/bash</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>GNOME_KEYRING_PID</Key>
|
||||
|
||||
<Value>1672</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LANGUAGE</Key>
|
||||
|
||||
<Value>en_US:en</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>JRE_HOME</Key>
|
||||
|
||||
<Value>/usr/local/java/jdk1.6.0.16/jre</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DESKTOP_SESSION</Key>
|
||||
|
||||
<Value>ubuntu</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DISPLAY</Key>
|
||||
|
||||
<Value>:0</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>USER</Key>
|
||||
|
||||
<Value>rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>UBUNTU_MENUPROXY</Key>
|
||||
|
||||
<Value>libappmenu.so</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>HOME</Key>
|
||||
|
||||
<Value>/home/rcirillo</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LESSOPEN</Key>
|
||||
|
||||
<Value>| /usr/bin/lesspipe %s</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>DEFAULTS_PATH</Key>
|
||||
|
||||
<Value>/usr/share/gconf/ubuntu.default.path</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>LANG</Key>
|
||||
|
||||
<Value>en_US.UTF-8</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>Java</Key>
|
||||
|
||||
<Value>1.6.0_16</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>SmartGears</Key>
|
||||
|
||||
<Value>1.0.1-SNAPSHOT</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
<Variable>
|
||||
|
||||
<Key>ghn-update-interval-in-secs</Key>
|
||||
|
||||
<Value>60</Value>
|
||||
|
||||
</Variable>
|
||||
|
||||
</RunTimeEnv>
|
||||
|
||||
<LocalFileSystem Name="" ReadOnly="false" Root="/home/rcirillo/ghn/state" Size="0" Type="" />
|
||||
|
||||
<Uptime>13 days</Uptime>
|
||||
|
||||
<Load Last15Min="0.12" Last1Min="0.07" Last5Min="0.15" />
|
||||
|
||||
<MainMemory RAMAvailable="921" RAMSize="7969" VirtualAvailable="145" VirtualSize="158" />
|
||||
|
||||
<LastUpdate>2013-12-03T10:06:19+01:00</LastUpdate>
|
||||
|
||||
</GHNDescription>
|
||||
|
||||
<Site>
|
||||
|
||||
<Location>rome</Location>
|
||||
|
||||
<Country>it</Country>
|
||||
|
||||
<Latitude>41.9000</Latitude>
|
||||
|
||||
<Longitude>12.5000</Longitude>
|
||||
|
||||
<Domain>rcirillo-test.ghn.cnr.it</Domain>
|
||||
|
||||
</Site>
|
||||
|
||||
</Profile>
|
||||
|
||||
</Resource>
|
|
@ -0,0 +1,19 @@
|
|||
# Set root category priority to WARN and its only appender to A1.
|
||||
log4j.rootCategory=ERROR, A1
|
||||
|
||||
log4j.rootLogger=TRACE
|
||||
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
|
||||
|
||||
# A1 uses PatternLayout.
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.A1.layout.ConversionPattern=[PUBLISHER] %d{HH:mm:ss,SSS} %-5p %c{2} [%t,%M:%L] %m%n
|
||||
|
||||
|
||||
# Display any warnings generated by our code
|
||||
log4j.category.org.gcube.informationsystem.publisher=TRACE,A1
|
||||
log4j.additivity.org.gcube.informationsystem.publisher=false
|
||||
|
||||
|
||||
|
Binary file not shown.
|
@ -0,0 +1,31 @@
|
|||
<Resource version="0.4.x">
|
||||
<ID>3aa0e790-b609-11e1-959a-8f8c3e6664f5</ID>
|
||||
<Type>Service</Type>
|
||||
<Scopes>
|
||||
<!-- <Scope>/d4science.research-infrastructures.eu</Scope> -->
|
||||
<!-- <Scope>/d4science.research-infrastructures.eu/FARM</Scope> -->
|
||||
<!-- <Scope>/d4science.research-infrastructures.eu/gCubeApps</Scope> -->
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Description>Test Profile: registry publisher test </Description>
|
||||
<Class>Test</Class>
|
||||
<Name>NameTest</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>NameTest</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>org.gcube.test</groupId>
|
||||
<artifactId>test-test-test</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</MavenCoordinates>
|
||||
<Shareable level="VO" />
|
||||
<Type>library</Type>
|
||||
<Files>
|
||||
<File>test-test-test-1.0.0.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
Loading…
Reference in New Issue