ref 19213: Reinforce the information in the Service Profile tab

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

Updated to include new info
This commit is contained in:
Giancarlo Panichi 2021-10-06 12:08:32 +02:00
parent 0e4357bdc2
commit fc3c48a570
3 changed files with 83 additions and 66 deletions

View File

@ -4,11 +4,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v1.14.2-SNAPSHOT] - 2021-05-18
## [v1.14.2-SNAPSHOT] - 2021-10-06
### Fixes
### Features
- Updated to support new veriosn of StorageHub
- Added cluster description in Service Info [#19213]
## [v1.14.1] - 2020-05-20

View File

@ -67,10 +67,10 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
@Override
public void init() throws ServletException {
super.init();
System.out.println("Fix JAXP: jdk.xml.entityExpansionLimit=0");
logger.info("Fix JAXP: jdk.xml.entityExpansionLimit=0");
System.setProperty("jdk.xml.entityExpansionLimit", "0");
System.out.println("initializing StatAlgoImporterService");
logger.info("initializing StatAlgoImporterService");
String notificationRecipientsFile = "/statalgoimporter/properties/NotificationRecipients.txt";
InputStream notificationRecipientsInputStream = this.getServletContext()
.getResourceAsStream(notificationRecipientsFile);
@ -78,17 +78,17 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
try {
text = IOUtils.toString(notificationRecipientsInputStream, StandardCharsets.UTF_8.name());
} catch (IOException e) {
System.out.println(e.getLocalizedMessage());
System.out.println(e.getStackTrace().toString());
logger.error(e.getLocalizedMessage(),e);
}
ArrayList<Recipient> recipients = new ArrayList<Recipient>();
try {
JSONObject obj = new JSONObject(text);
System.out.println("" + obj);
logger.info("" + obj);
JSONArray arr = obj.getJSONArray("recipients");
for (int i = 0; i < arr.length(); i++) {
JSONObject dest = arr.getJSONObject(i);
System.out.println("" + dest);
logger.info("" + dest);
String user = dest.getString("user");
String surname = dest.getString("surname");
String name = dest.getString("name");
@ -96,7 +96,11 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
recipients.add(rec);
}
System.out.println("Recipients: " + recipients);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(),e);
logger.info("Recipients not set");
}
logger.info("Recipients: " + recipients);
SessionUtil.setDefaultRecipients(this.getServletContext(), recipients);
}

View File

@ -79,7 +79,8 @@ public class InformationSystemUtils {
+ ". " + "Resource parsing failed!";
logger.error(error);
logger.error(
"Error {resource=" + genericResource + ", error=" + e.getLocalizedMessage() + "}",e);
"Error {resource=" + genericResource + ", error=" + e.getLocalizedMessage() + "}",
e);
throw new StatAlgoImporterServiceException(error, e);
}
break;
@ -155,7 +156,7 @@ public class InformationSystemUtils {
}
} catch (Throwable e) {
String error = "Error in discovery DataMiner PoolManager gCubeEndpoint resource on IS in scope: "
String error = "Error in discovery DataMiner PoolManager gCoreEndpoint resource on IS in scope: "
+ scope;
logger.error(error);
logger.error(
@ -251,8 +252,7 @@ public class InformationSystemUtils {
logger.debug("SocialNetworking URI: " + socialNetworkingURI);
if (socialNetworkingURI == null || socialNetworkingResources.isEmpty()) {
String error = "Error in discovery SocialNetworking gCubeEndpoint resource on IS in scope: "
+ scope;
String error = "Error in discovery SocialNetworking gCubeEndpoint resource on IS in scope: " + scope;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
@ -270,9 +270,7 @@ public class InformationSystemUtils {
}
}
public static ServiceInfo retrieveServiceInfo(String category, String name, String scope)
throws Exception {
public static ServiceInfo retrieveServiceInfo(String category, String name, String scope) throws Exception {
try {
logger.debug("Retrieve DataMiner Service Properties");
@ -294,14 +292,26 @@ public class InformationSystemUtils {
ArrayList<ServiceInfoData> serviceProperties = new ArrayList<>();
if (accessPointList != null && !accessPointList.isEmpty()) {
AccessPoint accessPoint = accessPointList.get(0);
for (int i = 0; i < accessPointList.size(); i++) {
AccessPoint accessPoint = accessPointList.get(i);
if (accessPoint != null) {
if (i == 0) {
if (accessPoint.address() != null && !accessPoint.address().isEmpty()) {
String accessPointAddress = accessPoint.address();
int wpsWebProcessingServiceIndex = accessPointAddress.indexOf(Constants.WPSWebProcessingService);
int wpsWebProcessingServiceIndex = accessPointAddress
.indexOf(Constants.WPSWebProcessingService);
if (wpsWebProcessingServiceIndex > 0) {
serviceAddress = accessPointAddress.substring(0, wpsWebProcessingServiceIndex);
}
}
}
String categoryDescription;
if (accessPoint.description() == null && accessPoint.description().isEmpty()) {
categoryDescription = Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY;
} else {
categoryDescription = accessPoint.description();
}
if (accessPoint.properties() != null && !accessPoint.propertyMap().isEmpty()) {
for (String key : accessPoint.propertyMap().keySet()) {
@ -310,19 +320,22 @@ public class InformationSystemUtils {
if (property.name().contains(":")) {
String[] propertyWithCategory = property.name().split(":");
if (propertyWithCategory.length >= 2) {
serviceProperties.add(new ServiceInfoData(propertyWithCategory[1],property.value(),propertyWithCategory[0]));
serviceProperties.add(new ServiceInfoData(propertyWithCategory[1],
property.value(), propertyWithCategory[0]));
} else {
serviceProperties.add(new ServiceInfoData(property.name(), property.value(), Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY));
serviceProperties.add(new ServiceInfoData(property.name(), property.value(),
categoryDescription));
}
} else {
serviceProperties.add(new ServiceInfoData(property.name(), property.value(), Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY));
serviceProperties.add(new ServiceInfoData(property.name(), property.value(),
categoryDescription));
}
}
}
}
}
}
}
ServiceInfo serviceInfo = new ServiceInfo(serviceAddress, serviceProperties);