ref 19213: Reinforce the information in the Service Profile tab

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

Updated to include new info
master
Giancarlo Panichi 3 years ago
parent 0e4357bdc2
commit fc3c48a570

@ -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

@ -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,25 +78,29 @@ 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>();
JSONObject obj = new JSONObject(text);
System.out.println("" + obj);
JSONArray arr = obj.getJSONArray("recipients");
for (int i = 0; i < arr.length(); i++) {
JSONObject dest = arr.getJSONObject(i);
System.out.println("" + dest);
String user = dest.getString("user");
String surname = dest.getString("surname");
String name = dest.getString("name");
Recipient rec = new Recipient(user, surname, name);
recipients.add(rec);
try {
JSONObject obj = new JSONObject(text);
logger.info("" + obj);
JSONArray arr = obj.getJSONArray("recipients");
for (int i = 0; i < arr.length(); i++) {
JSONObject dest = arr.getJSONObject(i);
logger.info("" + dest);
String user = dest.getString("user");
String surname = dest.getString("surname");
String name = dest.getString("name");
Recipient rec = new Recipient(user, surname, name);
recipients.add(rec);
}
} catch (Exception e) {
logger.error(e.getLocalizedMessage(),e);
logger.info("Recipients not set");
}
System.out.println("Recipients: " + recipients);
logger.info("Recipients: " + recipients);
SessionUtil.setDefaultRecipients(this.getServletContext(), recipients);
}

@ -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;
@ -88,12 +89,12 @@ public class InformationSystemUtils {
}
}
if(saiDescriptorJaxB==null){
if (saiDescriptorJaxB == null) {
String error = "Error in discovery SAI generic resource on IS in scope " + scope;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
return saiDescriptorJaxB;
@ -109,7 +110,7 @@ public class InformationSystemUtils {
public static String retrieveDataMinerPoolManager(String scope) throws StatAlgoImporterServiceException {
try {
logger.info("Retrieve dataminer-pool-manager in scope: "+scope);
logger.info("Retrieve dataminer-pool-manager in scope: " + scope);
if (scope == null || scope.length() == 0)
return null;
@ -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(
@ -171,7 +172,7 @@ public class InformationSystemUtils {
}
logger.debug("DataMiner PoolManager URI: " + poolManagerURI);
if(poolManagerURI==null||poolManagerURI.isEmpty()){
if (poolManagerURI == null || poolManagerURI.isEmpty()) {
String error = "Error in discovery DataMiner PoolManager gCubeEndpoint resource on IS in scope: "
+ scope;
logger.error(error);
@ -191,7 +192,7 @@ public class InformationSystemUtils {
public static String retrieveSocialNetworkingService(String scope) throws StatAlgoImporterServiceException {
try {
logger.info("Retrieve SocialNetworkingService in scope: "+scope);
logger.info("Retrieve SocialNetworkingService in scope: " + scope);
if (scope == null || scope.length() == 0)
return null;
@ -250,14 +251,13 @@ 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;
if (socialNetworkingURI == null || socialNetworkingResources.isEmpty()) {
String error = "Error in discovery SocialNetworking gCubeEndpoint resource on IS in scope: " + scope;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
return socialNetworkingURI;
} catch (StatAlgoImporterServiceException e) {
@ -270,14 +270,12 @@ 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");
if (scope == null || scope.length() == 0){
logger.error("Invalid request scope: "+scope);
if (scope == null || scope.length() == 0) {
logger.error("Invalid request scope: " + scope);
return null;
}
@ -289,42 +287,57 @@ public class InformationSystemUtils {
.setResult("$resource/Profile/AccessPoint");
DiscoveryClient<AccessPoint> client = ICFactory.clientFor(AccessPoint.class);
List<AccessPoint> accessPointList = client.submit(query);
String serviceAddress=null;
String serviceAddress = null;
ArrayList<ServiceInfoData> serviceProperties = new ArrayList<>();
if (accessPointList != null && !accessPointList.isEmpty()) {
AccessPoint accessPoint = accessPointList.get(0);
if (accessPoint.address() != null && !accessPoint.address().isEmpty()) {
String accessPointAddress = accessPoint.address();
int wpsWebProcessingServiceIndex = accessPointAddress.indexOf(Constants.WPSWebProcessingService);
if (wpsWebProcessingServiceIndex > 0) {
serviceAddress = accessPointAddress.substring(0, wpsWebProcessingServiceIndex);
}
}
if (accessPoint.properties() != null && !accessPoint.propertyMap().isEmpty()) {
for (String key : accessPoint.propertyMap().keySet()) {
Property property = accessPoint.propertyMap().get(key);
if (property != null&&property.name() != null && !property.name().isEmpty()){
if(property.name().contains(":")) {
String[] propertyWithCategory=property.name().split(":");
if(propertyWithCategory.length>=2){
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));
if (accessPointList != null && !accessPointList.isEmpty()) {
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);
if (wpsWebProcessingServiceIndex > 0) {
serviceAddress = accessPointAddress.substring(0, wpsWebProcessingServiceIndex);
}
} else {
serviceProperties.add(new ServiceInfoData(property.name(), property.value(), Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY));
}
}
}
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()) {
Property property = accessPoint.propertyMap().get(key);
if (property != null && property.name() != null && !property.name().isEmpty()) {
if (property.name().contains(":")) {
String[] propertyWithCategory = property.name().split(":");
if (propertyWithCategory.length >= 2) {
serviceProperties.add(new ServiceInfoData(propertyWithCategory[1],
property.value(), propertyWithCategory[0]));
} else {
serviceProperties.add(new ServiceInfoData(property.name(), property.value(),
categoryDescription));
}
} else {
serviceProperties.add(new ServiceInfoData(property.name(), property.value(),
categoryDescription));
}
}
}
}
}
}
}
ServiceInfo serviceInfo=new ServiceInfo(serviceAddress,serviceProperties);
ServiceInfo serviceInfo = new ServiceInfo(serviceAddress, serviceProperties);
logger.debug("DataMiner Service Info: " + serviceInfo);
return serviceInfo;

Loading…
Cancel
Save