Removed log4j dependency

This commit is contained in:
Giancarlo Panichi 2022-12-19 11:00:20 +01:00
parent 4f8dbc7b62
commit 48bd133abc
6 changed files with 36 additions and 45 deletions

View File

@ -32,9 +32,10 @@
<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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<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>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="resource-management-evo-portlet">
<wb-module deploy-name="resource-registry-management-1.0.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -11,8 +11,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="resource-management"/>
<property name="context-root" value="resource-registry-management"/>
</wb-module>

10
pom.xml
View File

@ -254,21 +254,15 @@
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>

View File

@ -22,6 +22,8 @@ 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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -30,6 +32,8 @@ import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResou
*/
public class RegistryClientRequester {
private static Logger logger = LoggerFactory.getLogger(RegistryClientRequester.class);
private static ResourceRegistryClient resourceRegistryClient;
private static KeycloakClient client = KeycloakClientFactory.newInstance();
@ -87,13 +91,16 @@ public class RegistryClientRequester {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(getTokenForContext(scope));
try {
logger.info("GetResourcesTree: [Scope: {}]",scope);
resourceRegistryClient = ResourceRegistryClientFactory.create();
List<Type> types = resourceRegistryClient.getType(Resource.class, true);
System.out.println("resource type returned "+types.size());
logger.info("Resources Types: {}",types.size());
for (Type t : types) {
System.out.println("resource type found "+t.getName()+ " in "+scope);
logger.info("Resource Type: {} in {} ",t.getName(),scope);
String val = null;
if (t.getName().equals("EService"))
@ -134,22 +141,23 @@ public class RegistryClientRequester {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(getTokenForContext(scope));
try {
logger.info("GetResourcesByTypeSubType: [Scope:{}, Type:{}]",scope, type);
resourceRegistryClient = ResourceRegistryClientFactory.create();
List<String>resource=new ArrayList<String>();
switch (type) {
case "RunningInstance":
System.out.println("---------------->RunningInstance ");
logger.info("---------------->RunningInstance ");
resource=UtilityResource.createListEservice(resourceRegistryClient, type,subType);
break;
case "GenericResource":
System.out.println("---------------->GenericResource ");
logger.info("---------------->GenericResource ");
//resource=UtilityResource.CreateListConfiguration(scope,type,subType);
resource=UtilityResource.createListConfigurationQuery(resourceRegistryClient, type,subType);
break;
case "GHN":
System.out.println("---------------->GHN ");
logger.info("---------------->GHN ");
resource=UtilityResource.createListHostingNode(resourceRegistryClient, type,subType);
break;

View File

@ -1,30 +1,17 @@
package org.gcube.portlets.admin.resourcemanagement.shared.resource;
import java.io.StringWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
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.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.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
@ -40,6 +27,8 @@ import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVola
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,7 +40,7 @@ import org.json.JSONObject;
*/
public class UtilityResource {
private static Logger logger = LoggerFactory.getLogger(UtilityResource.class);
public static ArrayList<String> getSubResourcesTree(ResourceRegistryClient resourceRegistryClient, String entity, String scope) throws Exception{
ArrayList<String> list = new ArrayList<>();
@ -79,7 +68,7 @@ public class UtilityResource {
case "Configuration":
if(f instanceof SoftwareFacet){
// System.out.println("------------Configuration--SoftwareFacet-- identified by GenericResource");
// logger.info("------------Configuration--SoftwareFacet-- identified by GenericResource");
SoftwareFacet sf = (SoftwareFacet) f;
if (!list.contains(sf.getGroup())){
list.add(sf.getGroup());
@ -89,7 +78,7 @@ public class UtilityResource {
case "EService": //GcoreEndPoint
if(f instanceof SoftwareFacet){
System.out.println("------------EService--SoftwareFacet-- identified by Gcore End point and Service End Point");
logger.info("------------EService--SoftwareFacet-- identified by Gcore End point and Service End Point");
SoftwareFacet sf = (SoftwareFacet) f;
if (!list.contains(sf.getGroup()))
list.add(sf.getGroup());
@ -139,22 +128,22 @@ public class UtilityResource {
String query="SELECT DISTINCT("+field+") AS "+field+" "
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
System.out.println("------------query----------->"+query);
logger.info("------------query----------->"+query);
String result=resourceRegistryClient.rawQuery(query, true);
if (result!=null&&!result.isEmpty()) {
System.out.println("--------result-------->"+result);
logger.info("--------result-------->"+result);
JSONArray jsonArray = new JSONArray(result);
for(int i=0;i < jsonArray.length();i++){
list.add(jsonArray.getJSONObject(i).get(field).toString());
}
} else {
System.out.println("--------result-------->Attention invalid result!");
logger.info("--------result-------->Attention invalid result!");
}
}catch (Exception e) {
e.printStackTrace();
logger.error(e.getLocalizedMessage(),e);
}
return list;
@ -179,7 +168,7 @@ public class UtilityResource {
query="SELECT header,name, description FROM (TRAVERSE outE('IsIdentifiedBy'),inV('SoftwareFacet') "
+ " FROM Configuration ) where group='"+subTypeC+"'";
}
System.out.println("------------query list configuration----------->"+query);
logger.info("------------query list configuration----------->"+query);
JAXBContext context = JAXBContext.newInstance(GenericResourceObject.class);
Marshaller m = context.createMarshaller();
@ -198,7 +187,7 @@ public class UtilityResource {
String result=resourceRegistryClient.rawQuery(query, true);
try{
if (result!=null&&!result.isEmpty()) {
System.out.println("--------result-------->"+result);
logger.info("--------result-------->"+result);
JSONArray jsonArray = new JSONArray(result);
for(int i=0;i < jsonArray.length();i++){
@ -207,7 +196,7 @@ public class UtilityResource {
//id="b981efde-18ea-4867-98e7-5d024fcfc0cb"+i;
JSONObject header=new JSONObject(jsonArray.getJSONObject(i).get("header").toString());
id=(String) header.get("uuid");
System.out.println("------------id----------->"+id);
logger.info("------------id----------->"+id);
try{
name=jsonArray.getJSONObject(i).getString("name");
@ -231,10 +220,10 @@ public class UtilityResource {
}
} else {
System.out.println("--------result-------->Attention invalid result!");
logger.info("--------result-------->Attention invalid result!");
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getLocalizedMessage(),e);
}
return resource;
@ -435,7 +424,7 @@ public class UtilityResource {
CacheList.resourceid.put(id, new ResourceObject(name, eh.toString()));
List<ConsistsOf<? extends Resource, ? extends Facet>> consist = eh.getConsistsOf();
for (ConsistsOf<? extends Resource, ? extends Facet> c : consist) {
//System.out.println("------------ConsistsOf--ConsistsOf-- c"+c.toString());
//logger.info("------------ConsistsOf--ConsistsOf-- c"+c.toString());
if(c instanceof ConsistsOf){
if (c.getTarget() instanceof SimplePropertyFacet){