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