From 13752b61d5502dded74456c50721eae29176abed Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 3 May 2018 12:56:06 +0000 Subject: [PATCH] Updated client library for netcdf files git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@167297 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/is/InformationSystemUtils.java | 18 ++++++------------ .../server/storage/StorageUtil.java | 12 ++++-------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/is/InformationSystemUtils.java b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/is/InformationSystemUtils.java index 72a2d03..70096a7 100644 --- a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/is/InformationSystemUtils.java +++ b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/is/InformationSystemUtils.java @@ -19,11 +19,9 @@ import org.slf4j.LoggerFactory; */ public class InformationSystemUtils { - private static Logger logger = LoggerFactory - .getLogger(InformationSystemUtils.class); + private static Logger logger = LoggerFactory.getLogger(InformationSystemUtils.class); - public static List retrieveServiceAddress(String category, - String name, String scope) throws Exception { + public static List retrieveServiceAddress(String category, String name, String scope) throws Exception { try { if (scope == null || scope.length() == 0) @@ -32,20 +30,16 @@ public class InformationSystemUtils { ScopeProvider.instance.set(scope); SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class); - query.addCondition( - "$resource/Profile/Category/text() eq '" + category + "'") - .addCondition( - "$resource/Profile/Name/text() eq '" + name + "'") - .setResult( - "$resource/Profile/AccessPoint/Interface/Endpoint/text()"); + query.addCondition("$resource/Profile/Category/text() eq '" + category + "'") + .addCondition("$resource/Profile/Name/text() eq '" + name + "'") + .setResult("$resource/Profile/AccessPoint/Interface/Endpoint/text()"); DiscoveryClient client = ICFactory.client(); List addresses = client.submit(query); return addresses; } catch (Throwable e) { - logger.error("Error in discovery DataMiner Service Endpoint in scope: " - + scope); + logger.error("Error in discovery DataMiner Service Endpoint in scope: " + scope); logger.error("Error: " + e.getLocalizedMessage()); e.printStackTrace(); throw e; diff --git a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/storage/StorageUtil.java b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/storage/StorageUtil.java index 3b44c6d..84bfaf8 100644 --- a/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/storage/StorageUtil.java +++ b/src/main/java/org/gcube/data/analysis/dataminermanagercl/server/storage/StorageUtil.java @@ -22,19 +22,15 @@ public class StorageUtil { private static Logger logger = LoggerFactory.getLogger(StorageUtil.class); - - public static String saveOnStorageInTemporalFile(InputStream is) - throws ServiceException { + public static String saveOnStorageInTemporalFile(InputStream is) throws ServiceException { try { logger.debug("SaveOnStorageInTemporalFile()"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); Double v = Math.random() * 10000; - String tempFile = "P_" + sdf.format(new Date()) + "_" - + v.intValue() + ".xml"; + String tempFile = "P_" + sdf.format(new Date()) + "_" + v.intValue() + ".xml"; String remotePath = "/DataMiner/AlgoritmsParameters/" + tempFile; - IClient client = new StorageClient("DataAnalysis", "DataMiner", - "DataMiner", AccessType.PUBLIC, MemoryType.VOLATILE) - .getClient(); + IClient client = new StorageClient("DataAnalysis", "DataMiner", "DataMiner", AccessType.PUBLIC, + MemoryType.VOLATILE).getClient(); String storageId = client.put(true).LFile(is).RFile(remotePath); logger.debug("Storage id: " + storageId); String publicLink = client.getHttpUrl().RFile(remotePath);