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
This commit is contained in:
parent
f65236e7ba
commit
13752b61d5
|
@ -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<String> retrieveServiceAddress(String category,
|
||||
String name, String scope) throws Exception {
|
||||
public static List<String> 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<String> client = ICFactory.client();
|
||||
List<String> 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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue