scopes modified
This commit is contained in:
parent
e7b910588e
commit
161ee3978b
16
pom.xml
16
pom.xml
|
@ -24,14 +24,13 @@
|
|||
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</developerConnection>
|
||||
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
|
||||
</scm>
|
||||
<properties>
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
<liferay.version>6.2.5</liferay.version>
|
||||
<guice.version>3.0</guice.version>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<!-- To make this work on gwt-run you need to set up global env vars. on
|
||||
MacOSX edit this file /etc/launchd.conf and put "setenv CATALINA_HOME /Users/massi/portal/Portal-Bundle/gCore"
|
||||
|
@ -40,6 +39,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>localRun</id>
|
||||
|
@ -312,14 +312,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>exploded</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<webappDirectory>${webappDirectory}</webappDirectory>
|
||||
</configuration>
|
||||
|
@ -329,7 +321,7 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -12,12 +12,14 @@ import java.util.Set;
|
|||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
import org.gcube.common.keycloak.KeycloakClient;
|
||||
import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||
import org.gcube.common.keycloak.model.AccessToken.Access;
|
||||
import org.gcube.common.keycloak.model.ModelUtils;
|
||||
import org.gcube.common.keycloak.model.TokenResponse;
|
||||
import org.gcube.common.keycloak.model.AccessToken.Access;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.types.reference.Type;
|
||||
|
@ -25,6 +27,7 @@ import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
|||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.UtilityResource;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pieve mail:alessandro.pieve@isti.cnr.it
|
||||
|
@ -32,7 +35,7 @@ import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResou
|
|||
*/
|
||||
public class RegistryClientRequester {
|
||||
|
||||
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
private static ResourceRegistryClient resourceRegistryClient;
|
||||
|
||||
private static KeycloakClient client = KeycloakClientFactory.newInstance();
|
||||
|
||||
|
@ -40,21 +43,26 @@ public class RegistryClientRequester {
|
|||
private static final String clientID = "resource-registry-portlet-expieve";
|
||||
private static final String secret = "179bd3bc-5cc4-11ec-bf63-0242ac130001";
|
||||
|
||||
private static final String rootScope = "/gcube";
|
||||
|
||||
public static final Set<String> getAvailableContexts() throws Exception {
|
||||
Set<String> contexts = new HashSet<String>();
|
||||
Set<String> contextList = new HashSet<String>();
|
||||
ScopeProvider.instance.set(rootScope);
|
||||
AccessTokenProvider.instance.set(getTokenForContext(rootScope));
|
||||
try {
|
||||
TokenResponse response = client.queryOIDCToken(new URL(endpoint), clientID, secret);
|
||||
Map<String, Access> resourceAccess = ModelUtils.getAccessTokenFrom(response).getResourceAccess();
|
||||
for (String context : resourceAccess.keySet()) {
|
||||
try {
|
||||
ScopeBean scope = new ScopeBean(context.replaceAll("%2F", "/"));
|
||||
contexts.add(scope.toString());
|
||||
}catch (IllegalArgumentException e) { }
|
||||
}
|
||||
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
|
||||
contextList = contextCache.getContextFullNameToUUIDAssociation().keySet();
|
||||
|
||||
} catch (Exception e) {
|
||||
return Collections.emptySet();
|
||||
}finally {
|
||||
AccessTokenProvider.instance.reset();
|
||||
ScopeProvider.instance.reset();
|
||||
}
|
||||
return contexts;
|
||||
return contextList;
|
||||
}
|
||||
|
||||
private static String getTokenForContext(String context) {
|
||||
|
@ -84,9 +92,14 @@ public class RegistryClientRequester {
|
|||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(getTokenForContext(scope));
|
||||
try {
|
||||
|
||||
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
List<Type> types = resourceRegistryClient.getType(Resource.class, true);
|
||||
|
||||
System.out.println("resource type returned "+types.size());
|
||||
|
||||
for (Type t : types) {
|
||||
System.out.println("resource type found "+t.getName()+ " in "+scope);
|
||||
|
||||
String val = null;
|
||||
if (t.getName().equals("EService"))
|
||||
val= "RunningInstance";
|
||||
|
@ -94,7 +107,15 @@ public class RegistryClientRequester {
|
|||
val = "GenericResource";
|
||||
if (t.getName().equals("HostingNode"))
|
||||
val = "GHN";
|
||||
retval.put(val, UtilityResource.getSubResourcesTreeQuery(resourceRegistryClient, t.getName()));
|
||||
try {
|
||||
if (val!=null) {
|
||||
ArrayList<String> subtrees = UtilityResource.getSubResourcesTreeQuery(resourceRegistryClient, t.getName());
|
||||
if (!subtrees.isEmpty())
|
||||
retval.put(val, subtrees);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -117,7 +138,7 @@ public class RegistryClientRequester {
|
|||
AccessTokenProvider.instance.set(getTokenForContext(scope));
|
||||
try {
|
||||
|
||||
|
||||
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
List<String>resource=new ArrayList<String>();
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -260,7 +260,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
|||
ServerConsole.trace(LOG_PREFIX, "[GET-SCOPES] getting available scopes");
|
||||
Vector<String> retval = new Vector<String>();
|
||||
try {
|
||||
//TODO
|
||||
retval.addAll(RegistryClientRequester.getAvailableContexts());
|
||||
} catch (Exception e) {
|
||||
retval.add("/gcube");
|
||||
retval.add("/gcube/devsec");
|
||||
|
|
|
@ -130,7 +130,12 @@ public class UtilityResource {
|
|||
identifiedFacet="SoftwareFacet";
|
||||
break;
|
||||
|
||||
default:
|
||||
return new ArrayList<>(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
String query="SELECT DISTINCT("+field+") AS "+field+" "
|
||||
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- To Comment out -->
|
||||
<!-- <set-property name="user.agent" value="safari,gecko1_8" /> -->
|
||||
<set-property name="user.agent" value="safari,gecko1_8" />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
|
||||
<portlet>
|
||||
<portlet-name>resources-management</portlet-name>
|
||||
<display-name>Resources Management</display-name>
|
||||
<display-name>Resource Registry Management</display-name>
|
||||
<portlet-class>org.gcube.portlets.admin.resourcemanagement.server.portlet.ResourceManagementPortlet</portlet-class>
|
||||
<init-param>
|
||||
<name>view-jsp</name>
|
||||
|
@ -13,7 +13,7 @@
|
|||
<mime-type>text/html</mime-type>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>Resources Management</title>
|
||||
<title>Resource Registry Management</title>
|
||||
<short-title>Resources Management</short-title>
|
||||
<keywords>Resources Management</keywords>
|
||||
</portlet-info>
|
||||
|
|
|
@ -14,16 +14,6 @@
|
|||
<src>ServiceMap_devsec.xml</src>
|
||||
<scope>/gcube/devsec</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/devNext</name>
|
||||
<src>ServiceMap_devNext.xml</src>
|
||||
<scope>/gcube/devNext</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/preprod</name>
|
||||
<src>ServiceMap_preprod.xml</src>
|
||||
<scope>/gcube/preprod</scope>
|
||||
</vo>
|
||||
</vos>
|
||||
</infrastructure>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ RUNNING_MODE = STANDALONE
|
|||
DEFAULT_USER = massimiliano.assante
|
||||
|
||||
# The scope that will be used as default
|
||||
DEFAULT_SCOPE =/gcube/devNext
|
||||
DEFAULT_SCOPE =/gcube
|
||||
# the target of update notification (if in singleton mode)
|
||||
# mails MUST be separated by ;
|
||||
USERMAIL_TO = m.assante@gmail.com
|
||||
|
|
Loading…
Reference in New Issue