ref 11711: SAI - Add a simple text viewer so that log files created by Data Miner algorithms can be directly viewed in the browser

https://support.d4science.org/issues/11711

Added service info[ticket #12594]
Added support to show log information [ticket #11711]
Added support to show files html, json, pdf, txt [ticket #17106]
Updated information show to the user when a computation is submitted [ticket #17030]

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@181877 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-10-01 08:42:49 +00:00
parent 99efe07a1c
commit a39d350e59
3 changed files with 30 additions and 17 deletions

View File

@ -48,7 +48,6 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory; import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory;
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification; import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfo; import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfo;
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData;
import org.n52.wps.client.ExecuteRequestBuilder; import org.n52.wps.client.ExecuteRequestBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -216,19 +215,18 @@ public class SClient4WPS extends SClient {
@Override @Override
public ServiceInfo getServiceInfo() throws ServiceException { public ServiceInfo getServiceInfo() throws ServiceException {
try { try {
ArrayList<ServiceInfoData> serviceProperties = new ArrayList<>();
ServiceInfo serviceInfo=null;
if (discoveredByIS) { if (discoveredByIS) {
logger.info("DataMiner Service discovered by IS"); logger.info("DataMiner Service discovered by IS");
serviceProperties = InformationSystemUtils.retrieveServiceProperties( serviceInfo = InformationSystemUtils.retrieveServiceInfo(
Constants.DATAMINER_SERVICE_CATEGORY, Constants.DATA_MINER_SERVICE_NAME, Constants.DATAMINER_SERVICE_CATEGORY, Constants.DATA_MINER_SERVICE_NAME,
serviceCredentials.getScope()); serviceCredentials.getScope());
} else { } else {
logger.info("DataMiner Service not discovered by IS no properties available"); logger.info("DataMiner Service not discovered by IS no properties available");
serviceProperties serviceInfo=new ServiceInfo(serviceAddress,null);
.add(new ServiceInfoData("Address", serviceAddress, Constants.DEFAULT_SERVICE_INFO_CATEGORY));
} }
ServiceInfo serviceInfo = new ServiceInfo(serviceProperties);
logger.info("Service Info retrieved: " + serviceInfo); logger.info("Service Info retrieved: " + serviceInfo);
return serviceInfo; return serviceInfo;

View File

@ -9,6 +9,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.dataminermanagercl.shared.Constants; import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
import org.gcube.data.analysis.dataminermanagercl.shared.exception.ServiceException; import org.gcube.data.analysis.dataminermanagercl.shared.exception.ServiceException;
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfo;
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData; import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData;
import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery; import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
@ -69,13 +70,13 @@ public class InformationSystemUtils {
} }
} }
public static ArrayList<ServiceInfoData> retrieveServiceProperties(String category, String name, String scope) public static ServiceInfo retrieveServiceInfo(String category, String name, String scope)
throws Exception { throws Exception {
try { try {
logger.debug("Retrieve Service Properties"); logger.debug("Retrieve Service Properties");
ArrayList<ServiceInfoData> serviceProperties = new ArrayList<>();
if (scope == null || scope.length() == 0) if (scope == null || scope.length() == 0)
return serviceProperties; return null;
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
@ -85,15 +86,17 @@ public class InformationSystemUtils {
.setResult("$resource/Profile/AccessPoint"); .setResult("$resource/Profile/AccessPoint");
DiscoveryClient<AccessPoint> client = ICFactory.clientFor(AccessPoint.class); DiscoveryClient<AccessPoint> client = ICFactory.clientFor(AccessPoint.class);
List<AccessPoint> accessPointList = client.submit(query); List<AccessPoint> accessPointList = client.submit(query);
String serviceAddress=null;
ArrayList<ServiceInfoData> serviceProperties = new ArrayList<>();
if (accessPointList != null && !accessPointList.isEmpty()) { if (accessPointList != null && !accessPointList.isEmpty()) {
AccessPoint accessPoint = accessPointList.get(0); AccessPoint accessPoint = accessPointList.get(0);
if (accessPoint.address() != null && !accessPoint.address().isEmpty()) { if (accessPoint.address() != null && !accessPoint.address().isEmpty()) {
String accessPointAddress = accessPoint.address(); String accessPointAddress = accessPoint.address();
int wpsWebProcessingServiceIndex = accessPointAddress.indexOf(Constants.WPSWebProcessingService); int wpsWebProcessingServiceIndex = accessPointAddress.indexOf(Constants.WPSWebProcessingService);
if (wpsWebProcessingServiceIndex > 0) { if (wpsWebProcessingServiceIndex > 0) {
String address = accessPointAddress.substring(0, wpsWebProcessingServiceIndex); serviceAddress = accessPointAddress.substring(0, wpsWebProcessingServiceIndex);
serviceProperties.add(new ServiceInfoData("Address", address, Constants.DEFAULT_SERVICE_INFO_CATEGORY));
} }
} }
@ -118,11 +121,13 @@ public class InformationSystemUtils {
} }
} }
logger.debug("Service Properties: " + serviceProperties); ServiceInfo serviceInfo=new ServiceInfo(serviceAddress,serviceProperties);
return serviceProperties;
logger.debug("Service Info: " + serviceInfo);
return serviceInfo;
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error in discovery DataMiner Service Endpoint Properties in scope: " + scope); logger.error("Error in discovery DataMiner Service Endpoint Info in scope: " + scope);
logger.error(e.getLocalizedMessage(), e); logger.error(e.getLocalizedMessage(), e);
throw e; throw e;
} }

View File

@ -12,17 +12,27 @@ import java.util.ArrayList;
public class ServiceInfo implements Serializable { public class ServiceInfo implements Serializable {
private static final long serialVersionUID = 9046784925213335261L; private static final long serialVersionUID = 9046784925213335261L;
private String serviceAddress;
private ArrayList<ServiceInfoData> serviceProperties; private ArrayList<ServiceInfoData> serviceProperties;
public ServiceInfo() { public ServiceInfo() {
super(); super();
} }
public ServiceInfo(ArrayList<ServiceInfoData> serviceProperties) { public ServiceInfo(String serviceAddress, ArrayList<ServiceInfoData> serviceProperties) {
super(); super();
this.serviceAddress = serviceAddress;
this.serviceProperties = serviceProperties; this.serviceProperties = serviceProperties;
} }
public String getServiceAddress() {
return serviceAddress;
}
public void setServiceAddress(String serviceAddress) {
this.serviceAddress = serviceAddress;
}
public ArrayList<ServiceInfoData> getServiceProperties() { public ArrayList<ServiceInfoData> getServiceProperties() {
return serviceProperties; return serviceProperties;
} }
@ -33,7 +43,7 @@ public class ServiceInfo implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "ServiceInfo [serviceProperties=" + serviceProperties + "]"; return "ServiceInfo [serviceAddress=" + serviceAddress + ", serviceProperties=" + serviceProperties + "]";
} }
} }