removed ScopeProvier

This commit is contained in:
Lucio Lelii 2022-05-25 18:58:02 +02:00
parent 558e8af575
commit 9f90b83724
7 changed files with 50 additions and 33 deletions

View File

@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<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.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java"> <classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
@ -13,16 +23,5 @@
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

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

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3.0.0-SNAPSHOT] - [2022-05-13]
porting to new IAM
## [v2.1.0] - [2022-02-04] ## [v2.1.0] - [2022-02-04]
added OfflineObserver for test purpose added OfflineObserver for test purpose

21
pom.xml
View File

@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
@ -12,7 +13,7 @@
<artifactId>common-smartgears-app</artifactId> <artifactId>common-smartgears-app</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<name>Smartgears Application</name> <name>Smartgears Application</name>
<properties> <properties>
<distroDirectory>distro</distroDirectory> <distroDirectory>distro</distroDirectory>
@ -24,6 +25,18 @@
<url>https://code-repo.d4science.org/gCubeSystem/common-smartgears-app</url> <url>https://code-repo.d4science.org/gCubeSystem/common-smartgears-app</url>
</scm> </scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-smartgears-bom</artifactId>
<version>3.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
@ -56,8 +69,8 @@
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId> <artifactId>common-smartgears</artifactId>
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -4,12 +4,10 @@ import java.net.URL;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener; import javax.servlet.annotation.WebListener;
import org.gcube.smartgears.Constants;
import org.gcube.smartgears.annotations.ManagedBy; import org.gcube.smartgears.annotations.ManagedBy;
import org.gcube.smartgears.application.manager.AppManagerObserver; import org.gcube.smartgears.application.manager.AppManagerObserver;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;
@ -66,7 +64,7 @@ public class ContextListener implements ServletContextListener {
} }
if (managers.size()>0){ if (managers.size()>0){
observer = ApplicationManagerProvider.instance.getObserver(); observer = ApplicationManagerProvider.instance.getObserver();
observer.setStartingTokens(context.configuration().startTokens()); observer.setStartingTokens(context.configuration().authorizedContexts());
observer.setApplicationManagerClasses(managers); observer.setApplicationManagerClasses(managers);
observer.register(); observer.register();

View File

@ -3,12 +3,13 @@ package org.gcube.smartgears;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import org.gcube.common.events.Hub; import org.gcube.common.events.Hub;
import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.smartgears.configuration.application.ApplicationConfiguration; import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
import org.gcube.smartgears.context.Properties; import org.gcube.smartgears.context.Properties;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.context.container.ContainerContext; import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.smartgears.lifecycle.application.ApplicationLifecycle; import org.gcube.smartgears.lifecycle.application.ApplicationLifecycle;
import org.gcube.smartgears.persistence.Persistence; import org.gcube.smartgears.persistence.PersistenceWriter;
/** /**
* Embedded in an application, makes available its context as a gCube resource. * Embedded in an application, makes available its context as a gCube resource.
@ -56,12 +57,7 @@ public class ContextProvider {
public ApplicationConfiguration configuration() { public ApplicationConfiguration configuration() {
return delegate.configuration(); return delegate.configuration();
} }
@Override
public <T> T profile(Class<T> type) {
return delegate.profile(type);
}
@Override @Override
public ApplicationLifecycle lifecycle() { public ApplicationLifecycle lifecycle() {
return delegate.lifecycle(); return delegate.lifecycle();
@ -71,12 +67,7 @@ public class ContextProvider {
public Hub events() { public Hub events() {
return delegate.events(); return delegate.events();
} }
@Override
public Persistence persistence() {
return delegate.persistence();
}
@Override @Override
public ServletContext application() { public ServletContext application() {
return delegate.application(); return delegate.application();
@ -96,6 +87,17 @@ public class ContextProvider {
public String id() { public String id() {
return delegate.id(); return delegate.id();
} }
@Override
public GCoreEndpoint profile() {
return delegate.profile();
}
@Override
public PersistenceWriter persistence() {
// TODO Auto-generated method stub
return delegate.persistence();
}
} }
} }

View File

@ -104,7 +104,7 @@ public class OnlineObserver implements AppManagerObserver{
public synchronized void onStop(ApplicationContext appContext){ public synchronized void onStop(ApplicationContext appContext){
for (String token :appContext.configuration().startTokens()){ for (String token :appContext.configuration().authorizedContexts()){
try { try {
String context = authorizationService().get(token).getContext(); String context = authorizationService().get(token).getContext();
for (Future<ApplicationManager> appManagerEntry: instanciatedManagerPerScope.get(context)){ for (Future<ApplicationManager> appManagerEntry: instanciatedManagerPerScope.get(context)){