diff --git a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/SClient4WPS.java b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/SClient4WPS.java index 6bd4e7e..5cb91c0 100644 --- a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/SClient4WPS.java +++ b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/SClient4WPS.java @@ -278,7 +278,12 @@ public class SClient4WPS extends SClient { logger.debug("getOperatorsClassifications: "+refresh); LinkedHashMap operatorsToCategoriesMap = new LinkedHashMap<>(); LinkedHashMap> categoriesToOperatorsMap = new LinkedHashMap<>(); - + + if(refresh){ + logger.debug("Clear Processes Descriptions: Refresh"); + process.clear(); + } + requestCapability(refresh); if (processesBriefs == null || processesDescriptionType == null) { throw new ServiceException("Algorithms WPS not available!"); @@ -429,7 +434,9 @@ public class SClient4WPS extends SClient { SClient4WPSSession wpsClient = null; processesDescriptionType = null; processesBriefs = null; - + + logger.debug("Request Capability: refresh="+refresh); + try { wpsClient = createWPSClientSession(); diff --git a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/wps/SClient4WPSSession.java b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/wps/SClient4WPSSession.java index 4f79f5a..58fa330 100644 --- a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/wps/SClient4WPSSession.java +++ b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/dmservice/wps/SClient4WPSSession.java @@ -105,12 +105,12 @@ public class SClient4WPSSession implements Serializable { if (refresh) { logger.debug("LoggedServices: " + loggedServices.keySet()); if (loggedServices.containsKey(url)) { - loggedServices.remove(url); + loggedServices.remove(url); } - if(processDescriptions.containsKey(url)){ + if (processDescriptions.containsKey(url)) { processDescriptions.remove(url); } - + CapabilitiesDocument capsDoc = retrieveCapsViaGET(url); if (capsDoc != null) { logger.debug("Adding caps to logged services " + url); @@ -141,7 +141,7 @@ public class SClient4WPSSession implements Serializable { } else { logger.debug("Service not registered"); } - + CapabilitiesDocument capsDoc = retrieveCapsViaGET(url); if (capsDoc != null) { logger.debug("Adding caps to logged services " + url); @@ -238,8 +238,7 @@ public class SClient4WPSSession implements Serializable { * @throws IOException * IOException */ - private ProcessDescriptionsDocument getProcessDescriptionsFromCache(String wpsUrl) - throws IOException { + private ProcessDescriptionsDocument getProcessDescriptionsFromCache(String wpsUrl) throws IOException { if (!descriptionsAvailableInCache(wpsUrl)) { try { connect(wpsUrl); @@ -321,7 +320,7 @@ public class SClient4WPSSession implements Serializable { public ProcessDescriptionsDocument describeAllProcesses(String url) throws WPSClientException { CapabilitiesDocument doc = loggedServices.get(url); if (doc == null) { - logger.warn("serviceCaps are null, perhaps server does not exist"); + logger.debug("serviceCaps are null, perhaps server does not exist"); return null; } ProcessBriefType[] processes = doc.getCapabilities().getProcessOfferings().getProcessArray(); @@ -420,7 +419,7 @@ public class SClient4WPSSession implements Serializable { logger.debug("retrieveCapsViaGET: " + url); ClientCapabiltiesRequest req = new ClientCapabiltiesRequest(); url = req.getRequest(url); - logger.debug("url req: "+url); + logger.debug("url req: " + url); try { String authString = user + ":" + password; logger.debug("auth string: " + authString); @@ -433,19 +432,19 @@ public class SClient4WPSSession implements Serializable { connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setRequestProperty("Authorization", "Basic " + encoded); - logger.debug("Request: "+connection.toString()); + logger.debug("Request: " + connection.toString()); InputStream is = connection.getInputStream(); Document doc = checkInputStream(is); CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory.parse(doc, options); return capabilitiesDocument; } catch (MalformedURLException e) { - logger.error(e.getLocalizedMessage(),e); + logger.error(e.getLocalizedMessage(), e); throw new WPSClientException("Capabilities URL seems to be unvalid: " + url, e); } catch (IOException e) { - logger.error(e.getLocalizedMessage(),e); + logger.error(e.getLocalizedMessage(), e); throw new WPSClientException("Error occured while retrieving capabilities from url: " + url, e); } catch (XmlException e) { - logger.error(e.getLocalizedMessage(),e); + logger.error(e.getLocalizedMessage(), e); throw new WPSClientException("Error occured while parsing XML", e); } } @@ -501,6 +500,7 @@ public class SClient4WPSSession implements Serializable { options); Files.delete(tempFile); + logger.debug("RetrieveDescriptions via GET: success"); return processDescriptionsDocument; } catch (MalformedURLException e) {