first import
This commit is contained in:
commit
87e4643333
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<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"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/context-manager-model"/>
|
||||
<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 kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>VREManager</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
|
@ -0,0 +1,6 @@
|
|||
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,11 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="VREManager">
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module archiveName="context-manager-model-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/context-manager-model/context-manager-model">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="VREManager"/>
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/ContextManager/target/classes"/>
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="jst.web" version="4.0"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
|||
Window
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -0,0 +1,2 @@
|
|||
New Context Manager
|
||||
- deve essere un coda per scope perchè uno solo lo deve prendere quel update se ci sono pù contextManager nello stesso scope
|
|
@ -0,0 +1,7 @@
|
|||
<application mode='online'>
|
||||
<name>ContextManager</name>
|
||||
<group>VREManagement</group>
|
||||
<version>${version}</version>
|
||||
<description>ContextManager webapp</description>
|
||||
<local-persistence location='target' />
|
||||
</application>
|
|
@ -0,0 +1,278 @@
|
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>VREManager</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>VREManager</name>
|
||||
<packaging>war</packaging>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<webappDirectory>${project.basedir}/src/main/webapp/WEB-INF</webappDirectory>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-smartgears-bom</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>context-manager-model</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-smartgears-app</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-smartgears</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/xstream/xstream -->
|
||||
<dependency>
|
||||
<groupId>xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resourcemanagement</groupId>
|
||||
<artifactId>whn-manager-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-control-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMQClient -->
|
||||
<dependency>
|
||||
<groupId>com.rabbitmq</groupId>
|
||||
<artifactId>amqp-client</artifactId>
|
||||
<version>5.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- jersey & weld -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet-core</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-cdi1x</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-cdi1x-servlet</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.servlet</groupId>
|
||||
<artifactId>weld-servlet-core</artifactId>
|
||||
<version>2.2.10.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss</groupId>
|
||||
<artifactId>jandex</artifactId>
|
||||
<version>1.2.2.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.enterprise/cdi-api -->
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-common -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-common</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.inject/jersey-hk2 -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework</groupId>
|
||||
<artifactId>jersey-test-framework-core</artifactId>
|
||||
<version>2.32</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
||||
<artifactId>jersey-test-framework-provider-jetty</artifactId>
|
||||
<version>2.32</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-weld2-se</artifactId>
|
||||
<version>2.30.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<phase>process-resources</phase>
|
||||
<configuration>
|
||||
<outputDirectory>${webappDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>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,58 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.smartgears.ApplicationManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ContextAppManager implements ApplicationManager {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ContextAppManager.class);
|
||||
|
||||
|
||||
MultiKeysMap<String, String, ScopeDescriptor> scopeDescriptorMap = new MultiKeysMap<String, String,ScopeDescriptor>();
|
||||
|
||||
@Override
|
||||
public void onInit() {
|
||||
String currentContext = ScopeProvider.instance.get();
|
||||
logger.info("resource initialization started in {} ",currentContext);
|
||||
|
||||
SimpleQuery query = queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text eq 'VRE' or $resource/Profile/SecondaryType/text eq 'VO'");
|
||||
|
||||
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
List<GenericResource> resources = client.submit(query);
|
||||
for (GenericResource resource : resources) {
|
||||
try {
|
||||
String body = resource.profile().bodyAsString();
|
||||
ScopeDescriptor scopeDescr = ResourceBinder.get().bind(body);
|
||||
scopeDescriptorMap.put(scopeDescr.context, resource.id(), scopeDescr);
|
||||
} catch (JAXBException e) {
|
||||
logger.error("cannot unmarshal resource",e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShutdown() {
|
||||
}
|
||||
|
||||
public MultiKeysMap<String, String, ScopeDescriptor> getScopeDescriptorMap() {
|
||||
return scopeDescriptorMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
@Path("")
|
||||
public class ContextManagerApplication extends Application {
|
||||
|
||||
@Override
|
||||
public Set<Class<?>> getClasses() {
|
||||
final Set<Class<?>> classes = new HashSet<Class<?>>();
|
||||
// register resources and features
|
||||
//classes.add(XMLQueryAccess.class);
|
||||
//classes.add(XMLResources.class);
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A thread-safe Map with multiple keys allowing multiple values per key
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class MultiKeysMap<K1, K2, V> implements Iterable<V> {
|
||||
|
||||
private List<V> values = Collections.synchronizedList(new LinkedList<V>());
|
||||
|
||||
private List<WrappedValue> wrappedValues = Collections.synchronizedList(new LinkedList<WrappedValue>());
|
||||
|
||||
private Map<K1, HashSet<V>> k1values = Collections.synchronizedMap(new HashMap<K1, HashSet<V>>());
|
||||
|
||||
private Map<K2, HashSet<V>> k2values = Collections.synchronizedMap(new HashMap<K2, HashSet<V>>());
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Iterator<V> iterator() {
|
||||
return values.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Associates the specified value with the two keys
|
||||
*
|
||||
* @param key1 the value's primary key
|
||||
* @param key2 the value's secondary key
|
||||
* @param value the value
|
||||
*/
|
||||
public void put(K1 key1, K2 key2, V value) {
|
||||
WrappedValue wrappedValue = this.new WrappedValue(value);
|
||||
wrappedValue.addKey1(key1);
|
||||
wrappedValue.addKey2(key2);
|
||||
if (wrappedValues.contains(wrappedValue))
|
||||
wrappedValues.remove(wrappedValue);
|
||||
wrappedValues.add(wrappedValue);
|
||||
if (values.contains(value))
|
||||
values.remove(value);
|
||||
values.add(value);
|
||||
//add the value index to k1values
|
||||
if (!k1values.containsKey(key1))
|
||||
k1values.put(key1, new HashSet<V>());
|
||||
k1values.get(key1).add(value);
|
||||
//add the value index to k2values
|
||||
if (!k2values.containsKey(key2))
|
||||
k2values.put(key2, new HashSet<V>());
|
||||
k2values.get(key2).add(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* removes the given values and its keys from the map
|
||||
* @param value
|
||||
*/
|
||||
public void removeValue(V value) {
|
||||
values.remove(value);
|
||||
WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value));
|
||||
|
||||
k1values.get(wvalue.key1).remove(value);
|
||||
if (k1values.get(wvalue.key1).isEmpty())
|
||||
k1values.remove(wvalue.key1);
|
||||
|
||||
k2values.get(wvalue.key2).remove(value);
|
||||
if (k2values.get(wvalue.key2).isEmpty())
|
||||
k2values.remove(wvalue.key2);
|
||||
|
||||
wrappedValues.remove(wvalue);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all the values associated to the primary key
|
||||
*
|
||||
* @param key the key of type K1
|
||||
*/
|
||||
public void removeValuesByPrimaryKey(K1 key) {
|
||||
Set<V> valuesToRemove = k1values.get(key);
|
||||
if (valuesToRemove == null)
|
||||
return;
|
||||
Iterator<V> iterator = valuesToRemove.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
V value = iterator.next();
|
||||
values.remove(value);
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value));
|
||||
k2values.get(wvalue.key2).remove(value);
|
||||
if (k2values.get(wvalue.key2).isEmpty())
|
||||
k2values.remove(wvalue.key2);
|
||||
wrappedValues.remove(wvalue);
|
||||
}
|
||||
|
||||
k1values.remove(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes all the values associated to the secondary key
|
||||
*
|
||||
* @param key the key of type K2
|
||||
*/
|
||||
public void removeValuesBySecondaryKey(K2 key) {
|
||||
Set<V> valuesToRemove = k2values.get(key);
|
||||
if (valuesToRemove == null)
|
||||
return;
|
||||
Iterator<V> iterator = valuesToRemove.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
V value = iterator.next();
|
||||
values.remove(value);
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value));
|
||||
k1values.get(wvalue.key1).remove(value);
|
||||
if (k1values.get(wvalue.key1).isEmpty())
|
||||
k1values.remove(wvalue.key1);
|
||||
wrappedValues.remove(wvalue);
|
||||
}
|
||||
|
||||
k2values.remove(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int wrappedIndexOf(V value) {
|
||||
int index = 0;
|
||||
if (value==null)
|
||||
return -1;
|
||||
for (WrappedValue wvalue : wrappedValues) {
|
||||
if (wvalue.equals(value))
|
||||
return index;
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the values to which this map maps the specified primary key
|
||||
*
|
||||
* @param key key whose associated values are to be returned
|
||||
* @return the values to which this map maps the specified primary key
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<V> getValuesByPrimaryKey(K1 key) {
|
||||
return k1values.get(key) == null? (Set<V>)Collections.emptySet(): k1values.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the values to which this map maps the specified primary key
|
||||
* @param key key whose associated values are to be returned
|
||||
* @return @return the values to which this map maps the specified secondary key
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<V> getValuesBySecondaryKey(K2 key) {
|
||||
return k2values.get(key) == null? (Set<V>)Collections.emptySet(): k2values.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set view of the primary keys contained in this map
|
||||
*
|
||||
* @return a set view of the primary keys contained in this map
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<K1> primaryKeySet() {
|
||||
return k1values.keySet() == null? (Set<K1>)Collections.emptySet(): k1values.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set view of the secondary keys contained in this map
|
||||
*
|
||||
* @return a set view of the secondary keys contained in this map
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<K2> secondaryKeySet() {
|
||||
return k2values.keySet() == null? (Set<K2>)Collections.emptySet(): k2values.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection view of the values contained in this map
|
||||
*
|
||||
* @return a collection view of the values contained in this map
|
||||
*/
|
||||
public Collection<V> values() {
|
||||
return Collections.unmodifiableCollection(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all mapping from this maps
|
||||
*/
|
||||
public void clean () {
|
||||
values.clear();
|
||||
wrappedValues.clear();
|
||||
k1values.clear();
|
||||
k2values.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Internal Map object
|
||||
*
|
||||
* It maps a value V to both its primary and secondary key
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
class WrappedValue {
|
||||
|
||||
V value;
|
||||
K1 key1;
|
||||
K2 key2;
|
||||
WrappedValue(V value) { this.value = value;}
|
||||
void addKey1(K1 key) {this.key1=key;}
|
||||
void addKey2(K2 key) {this.key2=key;}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ((value == null) ? 0 : value.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() == obj.getClass()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
WrappedValue other = (WrappedValue) obj;
|
||||
if ((this.value == null) && (other.value == null)) {
|
||||
return true;
|
||||
} else if (this.value.equals(other.value)) {
|
||||
return true;
|
||||
}
|
||||
} else { //check if obj is the wrapped object
|
||||
if (this.value.equals(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Transforms from {@link Date} to a valid string representation for the <em>xs:dateAndTime</em> XML Schema data type and vice versa.
|
||||
* It can be used to write/read a {@link Date} object to/from a profile.
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public final class ProfileDate {
|
||||
|
||||
static final DateFormat dateAndTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
|
||||
/**
|
||||
* Transforms the input {@link Date} in a valid string representation for the <em>xs:dateAndTime</em> XML Schema data type
|
||||
* @param date the {@link Date} object to tranform
|
||||
* @return the {@link String} object
|
||||
*/
|
||||
public static synchronized String toXMLDateAndTime(Date date) {
|
||||
String formatted = dateAndTime.format(date);
|
||||
StringBuilder toXS = new StringBuilder();
|
||||
toXS.append(formatted.substring(0, formatted.length()-2));
|
||||
toXS.append(":");
|
||||
toXS.append(formatted.substring(formatted.length()-2, formatted.length()));
|
||||
return toXS.toString();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the input <em>xs:dateAndTime</em> representation in a {@link Date} object
|
||||
* @param date the string representation of <em>xs:dateAndTime</em> (e.g. " 2009-05-12T16:46:03+02:00 ")
|
||||
* @return the {@link Date} object
|
||||
* @throws ParseException if the input date is not in an valid format
|
||||
*/
|
||||
public static synchronized Date fromXMLDateAndTime(String date) throws ParseException {
|
||||
|
||||
//the test is for backward compatibility, to read the old profiles that have no time zone in the dateAndTime fields
|
||||
Pattern p = Pattern.compile("^.*T\\d{2}:\\d{2}:\\d{2}$"); //ends with 'T'HH:mm:ss
|
||||
if (p.matcher(date).matches()) {
|
||||
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(date);
|
||||
} else {
|
||||
StringBuilder toDate = new StringBuilder();
|
||||
toDate.append(date.substring(0, date.length()-3));
|
||||
toDate.append(date.substring(date.length()-2, date.length()));
|
||||
return dateAndTime.parse(toDate.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
public class ResourceBinder {
|
||||
|
||||
private JAXBContext jaxbContext;
|
||||
|
||||
private static ResourceBinder binder = null;
|
||||
|
||||
|
||||
public static synchronized ResourceBinder get() {
|
||||
if (binder==null) {
|
||||
try {
|
||||
JAXBContext context = JAXBContext.newInstance(ScopeDescriptor.class);
|
||||
binder= new ResourceBinder(context);
|
||||
} catch (JAXBException e) {
|
||||
throw new RuntimeException("cannot create jaxbContext",e);
|
||||
}
|
||||
}
|
||||
return binder;
|
||||
}
|
||||
|
||||
private ResourceBinder(JAXBContext context) {
|
||||
this.jaxbContext = context;
|
||||
}
|
||||
|
||||
public ScopeDescriptor bind(String xml) throws JAXBException{
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
ScopeDescriptor scopedRes = (ScopeDescriptor)unmarshaller.unmarshal(new StringReader(xml));
|
||||
return scopedRes;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.enterprise.inject.Any;
|
||||
import javax.enterprise.inject.Default;
|
||||
import javax.enterprise.inject.Instance;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler;
|
||||
import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector;
|
||||
|
||||
|
||||
@Singleton
|
||||
public class ResourceManager {
|
||||
|
||||
@Inject
|
||||
@Any
|
||||
Instance<ResourceHandler> resourcesHandlers;
|
||||
|
||||
@Inject
|
||||
@Default
|
||||
BackendConnector defaultCollector;
|
||||
|
||||
public ScopedResource addResourceToContext(String context, Resource resource) {
|
||||
ResourceHandler handler = retrieveHandler(resource.type());
|
||||
handler.addResource(context, resource);
|
||||
return getScopedResource(resource);
|
||||
}
|
||||
|
||||
public ScopedResource removeResourceFromContext(String context, String id ) {
|
||||
Resource res = retrieveResource(id);
|
||||
ResourceHandler handler = retrieveHandler(res.type());
|
||||
handler.removeResource(context, res);
|
||||
return getScopedResource(res);
|
||||
}
|
||||
|
||||
private Resource retrieveResource(String id) {
|
||||
return defaultCollector.find(id);
|
||||
/*
|
||||
XQuery query = ICFactory.queryFor(Resource.class);
|
||||
query.addCondition(String.format("$resource/ID/text() eq '%s'",id));
|
||||
query.setResult("<Ret>{$resource/Type}{$resource}</Ret>");
|
||||
DiscoveryClient<? extends Resource> client = ICFactory.clientWith(new ResourceParser());
|
||||
List<? extends Resource> resources = client.submit(query);
|
||||
//TODO check return size
|
||||
return resources.get(0);
|
||||
|
||||
public static class ResourceParser implements ResultParser<Resource>{
|
||||
|
||||
private enum ResourceType {
|
||||
GenericResource(GenericResource.class),
|
||||
RuntimeResource(ServiceEndpoint.class),
|
||||
RunningInstance(GCoreEndpoint.class),
|
||||
Service(Software.class),
|
||||
GHN(HostingNode.class);
|
||||
|
||||
private Class<? extends Resource> managerClass;
|
||||
|
||||
ResourceType(Class<? extends Resource> managerClass) {
|
||||
this.managerClass = managerClass;
|
||||
}
|
||||
|
||||
public Class<? extends Resource> getManagerClass(){
|
||||
return this.managerClass;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource parse(String res) throws Exception {
|
||||
String type = res.replaceAll("<Ret>\\s*<Type>([^<]*).*", "$1");
|
||||
String resource = res.replaceAll(".*(<Resource.*>.*</Resource>).*", "$1");
|
||||
Class<? extends Resource> classForUnmrshalling= ResourceType.valueOf(type).getManagerClass();
|
||||
return Resources.unmarshal(classForUnmrshalling, new StringReader(resource));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private ResourceHandler retrieveHandler(Type type) {
|
||||
Iterator<ResourceHandler> it = resourcesHandlers.iterator();
|
||||
while (it.hasNext()) {
|
||||
ResourceHandler rh = it.next();
|
||||
if (rh.getManagedResources().contains(type))
|
||||
return rh;
|
||||
}
|
||||
|
||||
//TODO return handler not found
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private ScopedResource getScopedResource(Resource res) {
|
||||
return new ScopedResource(res.id(), res.type().name(), Long.toString(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "Body")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class ScopeDescriptor {
|
||||
|
||||
@XmlElement(name = "Scope")
|
||||
String context;
|
||||
|
||||
|
||||
@XmlElement(name = "Service")
|
||||
String service;
|
||||
|
||||
@XmlElement(name = "Manager")
|
||||
String manager;
|
||||
|
||||
@XmlElement(name = "Designer")
|
||||
String designer;
|
||||
|
||||
@XmlElement(name = "StartTime")
|
||||
String startTime;
|
||||
|
||||
@XmlElement(name = "SecurityEnabled")
|
||||
boolean secure = false;
|
||||
|
||||
|
||||
@XmlElementWrapper(name="ScopedRescources")
|
||||
@XmlElement(name="ScopedRescource")
|
||||
List<ScopedResource> scopedResources = null;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopeDescriptor [context=" + context + ", manager=" + manager + ", designer=" + designer
|
||||
+ ", startTime=" + startTime + ", secure=" + secure + ", scopedResources=" + scopedResources + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
public class ScopedResource {
|
||||
|
||||
@XmlElement(name = "ResourceID")
|
||||
String id;
|
||||
|
||||
@XmlElement(name = "ResourceType")
|
||||
String type;
|
||||
|
||||
@XmlElement(name = "JointTime")
|
||||
String jointTime;
|
||||
|
||||
@XmlElement(name = "HostedOn")
|
||||
String hostedOn;
|
||||
|
||||
|
||||
|
||||
public ScopedResource(String id, String type, String jointTime) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.jointTime = jointTime;
|
||||
}
|
||||
|
||||
public ScopedResource(String id, String type, String jointTime, String hostedOn) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.jointTime = jointTime;
|
||||
this.hostedOn = hostedOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopedResource [id=" + id + ", type=" + type + ", jointTime=" + jointTime + ", hostedOn=" + hostedOn
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.vremanagement.contextmanager.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.inject.Any;
|
||||
import javax.enterprise.inject.Instance;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.vremanagement.contextmanager.ContextAppManager;
|
||||
import org.gcube.vremanagement.contextmanager.model.operators.context.CustomContextOperator;
|
||||
import org.gcube.vremanagement.contextmanager.model.operators.context.MandatoryContextOperator;
|
||||
|
||||
|
||||
@Singleton
|
||||
public class ContextHandler {
|
||||
|
||||
@Inject
|
||||
@Any
|
||||
Instance<MandatoryContextOperator> mandatoryContextOperators;
|
||||
|
||||
@Inject
|
||||
@Any
|
||||
Instance<CustomContextOperator> customContextOperators;
|
||||
|
||||
public void createContext(String contextName, List<String> resourcesId, ContextAppManager appContext) {
|
||||
mandatoryContextOperators.forEach(co -> co.onCreateContext(SecurityTokenProvider.instance.get(), contextName, null));
|
||||
}
|
||||
|
||||
public void removeContext(String contextName, ContextAppManager appContext) {
|
||||
mandatoryContextOperators.forEach(co -> co.onDisposeContext(SecurityTokenProvider.instance.get(), contextName, null));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.vremanagement.contextmanager.handlers;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
|
||||
public interface ResourceHandler {
|
||||
|
||||
public List<Type> getManagedResources();
|
||||
|
||||
public void addResource(String contextName, Resource resource);
|
||||
|
||||
public void removeResource(String contextName, Resource resource);
|
||||
|
||||
//in case of resource created directly by the publisher
|
||||
public void createResourceNotified(String contextName, Resource resource);
|
||||
|
||||
//in case of resource deleted directly by the publisher
|
||||
public void removeResourceNotified(String contextName, Resource resource);
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.vremanagement.contextmanager.handlers.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.inject.Default;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler;
|
||||
import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector;
|
||||
|
||||
public class DynamicResourceHandler implements ResourceHandler {
|
||||
|
||||
@Inject
|
||||
@Default
|
||||
BackendConnector defaultCollector;
|
||||
|
||||
@Override
|
||||
public List<Type> getManagedResources() {
|
||||
return Arrays.asList(Type.GCOREENDPOINT, Type.NODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResource(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeResource(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createResourceNotified(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeResourceNotified(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.vremanagement.contextmanager.handlers.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.inject.Any;
|
||||
import javax.enterprise.inject.Instance;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Resource.Type;
|
||||
import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler;
|
||||
import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector;
|
||||
|
||||
public class StaticResourceHandler implements ResourceHandler {
|
||||
|
||||
@Inject
|
||||
@Any
|
||||
Instance<BackendConnector> collectors;
|
||||
|
||||
@Override
|
||||
public List<Type> getManagedResources() {
|
||||
return Arrays.asList(Type.GENERIC, Type.ENDPOINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResource(String contextName, Resource resource) {
|
||||
collectors.forEach(c-> c.addResourceToContext(contextName, resource));
|
||||
//ADD resource operator execution onAdd
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeResource(String contextName, Resource resource) {
|
||||
collectors.forEach(c-> c.removeResourceFromContext(contextName, resource));
|
||||
//ADD resource operator execution onREmove
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createResourceNotified(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeResourceNotified(String contextName, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package org.gcube.vremanagement.contextmanager.services;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.smartgears.ApplicationManagerProvider;
|
||||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.smartgears.annotations.ManagedBy;
|
||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||
import org.gcube.vremanagement.contextmanager.ResourceManager;
|
||||
import org.gcube.vremanagement.contextmanager.ContextAppManager;
|
||||
import org.gcube.vremanagement.contextmanager.handlers.ContextHandler;
|
||||
import org.gcube.vremanagement.contextmanager.model.types.ContextList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Path("contexts")
|
||||
@ManagedBy(ContextAppManager.class)
|
||||
public class ContextService {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(ContextService.class);
|
||||
|
||||
ApplicationContext appContext = ContextProvider.get();
|
||||
|
||||
@Inject
|
||||
ContextHandler contextHandler;
|
||||
|
||||
@Inject
|
||||
ResourceManager resourceHandler;
|
||||
|
||||
@RequestScoped
|
||||
@PathParam("vre")
|
||||
String vre;
|
||||
|
||||
@RequestScoped
|
||||
@PathParam("resourceId")
|
||||
String resourceId;
|
||||
|
||||
@RequestScoped
|
||||
@PathParam("infra")
|
||||
String infra;
|
||||
|
||||
@RequestScoped
|
||||
@PathParam("vo")
|
||||
String vo;
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("")
|
||||
public ContextList getContexts() {
|
||||
return new ContextList(Arrays.asList("/gcube","/gcube/devsec"));
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{infra}/{vo}/{vre}")
|
||||
public String createVREContext(List<String> resourceIds) {
|
||||
try {
|
||||
String fullContext = String.format("/%s/%s/%s", infra,vo,vre);
|
||||
validateCall(fullContext);
|
||||
contextHandler.createContext(fullContext, resourceIds, (ContextAppManager)ApplicationManagerProvider.get());
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{infra}/{vo}/{vre}")
|
||||
public String disposeVREContext() {
|
||||
try {
|
||||
String fullContext = String.format("/%s/%s/%s", infra,vo,vre);
|
||||
validateCall(fullContext);
|
||||
contextHandler.removeContext(fullContext, (ContextAppManager)ApplicationManagerProvider.get());
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{context:(.*(?=/resources))}/resources/{resourceId}")
|
||||
public String removeResourceFromContext(@PathParam("context") String context) {
|
||||
log.info("remove resource {} from context {}", resourceId, context);
|
||||
try {
|
||||
validateCall(context);
|
||||
resourceHandler.removeResourceFromContext(context, resourceId);
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{context:(.*(?=/resources))}/resources")
|
||||
public String addResourceToContext(@PathParam("context") String context, Resource resource) {
|
||||
log.info("adding resource {} to context {}", resource.id(), context);
|
||||
try {
|
||||
validateCall(context);
|
||||
resourceHandler.addResourceToContext(context, resource);
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void validateCall(String fullContext) throws Exception {
|
||||
String currentContext = ScopeProvider.instance.get();
|
||||
if (!fullContext.startsWith(currentContext))
|
||||
throw new Exception("invalid call");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
|
||||
bean-discovery-mode="all">
|
||||
</beans>
|
|
@ -0,0 +1,7 @@
|
|||
<application mode='online'>
|
||||
<name>ContextManager</name>
|
||||
<group>VREManagement</group>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<description>ContextManager webapp</description>
|
||||
<local-persistence location='target' />
|
||||
</application>
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.inject.Default;
|
||||
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector;
|
||||
|
||||
@Default
|
||||
public class BackendConnectorTester implements BackendConnector {
|
||||
|
||||
@Override
|
||||
public Resource find(String resourceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createContext(String contextName, String parentContextId, List<String> resourceIds) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeContext(String contextId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addResourceToContext(String contextId, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeResourceFromContext(String contextId, Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateResource(Resource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import javax.ws.rs.core.Application;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.vremanagement.contextmanager.model.types.ContextList;
|
||||
import org.gcube.vremanagement.contextmanager.services.ContextService;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.glassfish.jersey.test.JerseyTest;
|
||||
import org.jboss.weld.environment.se.Weld;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ContextServiceIntegrationTest extends JerseyTest {
|
||||
|
||||
@Override
|
||||
protected Application configure() {
|
||||
/*Class<ExternalRequestScope>[] extScopes = ServiceFinder.find(ExternalRequestScope.class, true).toClassArray();
|
||||
for (Class<ExternalRequestScope> ers : extScopes) {
|
||||
System.out.println("ESR "+ers.getName());
|
||||
}*/
|
||||
|
||||
final Weld weld = new Weld();
|
||||
weld.initialize();
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> weld.shutdown()));
|
||||
|
||||
return new ResourceConfig(ContextService.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getContexts_whenCorrectRequest_thenResponseIsOk() {
|
||||
|
||||
|
||||
Response response = target("/contexts").request()
|
||||
.get();
|
||||
|
||||
assertEquals("Http Response should be 200: ", Status.OK.getStatusCode(), response.getStatus());
|
||||
assertEquals("Http Content-Type should be: ", MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
|
||||
|
||||
assertTrue(((ContextList)response.getEntity()).getContexts().size()>0);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.gcube.vremanagement.contextmanager;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ResourceTest {
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindResource() throws Exception{
|
||||
|
||||
SimpleQuery query = queryFor(GenericResource.class);
|
||||
query.addCondition("$resource/Profile/SecondaryType/text() eq 'VO'");
|
||||
|
||||
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
||||
List<GenericResource> resources = client.submit(query);
|
||||
|
||||
System.out.println(resources.get(0).profile().bodyAsString());
|
||||
|
||||
System.out.println(ResourceBinder.get().bind("<Body>"+resources.get(0).profile().bodyAsString()+"</Body>"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void regExpr() {
|
||||
String regexpr = ".*(?=/resources)";
|
||||
String val = "/gcube/devsec/devVRE/resources";
|
||||
System.out.println(val.replaceFirst(regexpr, "ciao"));
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
|
||||
bean-discovery-mode="all">
|
||||
</beans>
|
|
@ -0,0 +1,12 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
|
||||
</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,6 @@
|
|||
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
|
||||
bean-discovery-mode="all">
|
||||
</beans>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
Manifest-Version: 1.0
|
||||
Build-Jdk-Spec: 14
|
||||
Specification-Title: VREManager
|
||||
Specification-Version: 1.0
|
||||
Implementation-Title: VREManager
|
||||
Implementation-Version: 1.0.0-SNAPSHOT
|
||||
Build-Time: 20201203-131437
|
||||
Created-By: Maven Integration for Eclipse
|
||||
SCM-Branch:
|
||||
SCM-Revision:
|
||||
SCM-Revision-URL: https://code-repo.d4science.org/gCubeSystem/maven-pare
|
||||
nt/VREManager/commit/${buildNumber}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#Generated by Maven Integration for Eclipse
|
||||
#Thu Dec 03 14:14:48 CET 2020
|
||||
m2e.projectLocation=C\:\\Users\\tilli\\eclipse-workspace\\ContextManager
|
||||
m2e.projectName=ContextManager
|
||||
groupId=org.gcube.vremanagement
|
||||
artifactId=VREManager
|
||||
version=1.0.0-SNAPSHOT
|
|
@ -0,0 +1,278 @@
|
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>VREManager</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>VREManager</name>
|
||||
<packaging>war</packaging>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<webappDirectory>${project.basedir}/src/main/webapp/WEB-INF</webappDirectory>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-smartgears-bom</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.vremanagement</groupId>
|
||||
<artifactId>context-manager-model</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-smartgears-app</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-smartgears</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/xstream/xstream -->
|
||||
<dependency>
|
||||
<groupId>xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resourcemanagement</groupId>
|
||||
<artifactId>whn-manager-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-control-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMQClient -->
|
||||
<dependency>
|
||||
<groupId>com.rabbitmq</groupId>
|
||||
<artifactId>amqp-client</artifactId>
|
||||
<version>5.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- jersey & weld -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet-core</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-cdi1x</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-cdi1x-servlet</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.servlet</groupId>
|
||||
<artifactId>weld-servlet-core</artifactId>
|
||||
<version>2.2.10.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss</groupId>
|
||||
<artifactId>jandex</artifactId>
|
||||
<version>1.2.2.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.enterprise/cdi-api -->
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-common -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-common</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.inject/jersey-hk2 -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>2.32</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework</groupId>
|
||||
<artifactId>jersey-test-framework-core</artifactId>
|
||||
<version>2.32</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
||||
<artifactId>jersey-test-framework-provider-jetty</artifactId>
|
||||
<version>2.32</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext.cdi</groupId>
|
||||
<artifactId>jersey-weld2-se</artifactId>
|
||||
<version>2.30.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<phase>process-resources</phase>
|
||||
<configuration>
|
||||
<outputDirectory>${webappDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>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,6 @@
|
|||
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
|
||||
bean-discovery-mode="all">
|
||||
</beans>
|
|
@ -0,0 +1,12 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
|
||||
</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
</configuration>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue