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 {
|
public class InformationSystemUtils {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory.getLogger(InformationSystemUtils.class);
|
||||||
.getLogger(InformationSystemUtils.class);
|
|
||||||
|
|
||||||
public static List<String> retrieveServiceAddress(String category,
|
public static List<String> retrieveServiceAddress(String category, String name, String scope) throws Exception {
|
||||||
String name, String scope) throws Exception {
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (scope == null || scope.length() == 0)
|
if (scope == null || scope.length() == 0)
|
||||||
|
@ -32,20 +30,16 @@ public class InformationSystemUtils {
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class);
|
SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class);
|
||||||
query.addCondition(
|
query.addCondition("$resource/Profile/Category/text() eq '" + category + "'")
|
||||||
"$resource/Profile/Category/text() eq '" + category + "'")
|
.addCondition("$resource/Profile/Name/text() eq '" + name + "'")
|
||||||
.addCondition(
|
.setResult("$resource/Profile/AccessPoint/Interface/Endpoint/text()");
|
||||||
"$resource/Profile/Name/text() eq '" + name + "'")
|
|
||||||
.setResult(
|
|
||||||
"$resource/Profile/AccessPoint/Interface/Endpoint/text()");
|
|
||||||
DiscoveryClient<String> client = ICFactory.client();
|
DiscoveryClient<String> client = ICFactory.client();
|
||||||
List<String> addresses = client.submit(query);
|
List<String> addresses = client.submit(query);
|
||||||
|
|
||||||
return addresses;
|
return addresses;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error in discovery DataMiner Service Endpoint in scope: "
|
logger.error("Error in discovery DataMiner Service Endpoint in scope: " + scope);
|
||||||
+ scope);
|
|
||||||
logger.error("Error: " + e.getLocalizedMessage());
|
logger.error("Error: " + e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -22,19 +22,15 @@ public class StorageUtil {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(StorageUtil.class);
|
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 {
|
try {
|
||||||
logger.debug("SaveOnStorageInTemporalFile()");
|
logger.debug("SaveOnStorageInTemporalFile()");
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||||
Double v = Math.random() * 10000;
|
Double v = Math.random() * 10000;
|
||||||
String tempFile = "P_" + sdf.format(new Date()) + "_"
|
String tempFile = "P_" + sdf.format(new Date()) + "_" + v.intValue() + ".xml";
|
||||||
+ v.intValue() + ".xml";
|
|
||||||
String remotePath = "/DataMiner/AlgoritmsParameters/" + tempFile;
|
String remotePath = "/DataMiner/AlgoritmsParameters/" + tempFile;
|
||||||
IClient client = new StorageClient("DataAnalysis", "DataMiner",
|
IClient client = new StorageClient("DataAnalysis", "DataMiner", "DataMiner", AccessType.PUBLIC,
|
||||||
"DataMiner", AccessType.PUBLIC, MemoryType.VOLATILE)
|
MemoryType.VOLATILE).getClient();
|
||||||
.getClient();
|
|
||||||
String storageId = client.put(true).LFile(is).RFile(remotePath);
|
String storageId = client.put(true).LFile(is).RFile(remotePath);
|
||||||
logger.debug("Storage id: " + storageId);
|
logger.debug("Storage id: " + storageId);
|
||||||
String publicLink = client.getHttpUrl().RFile(remotePath);
|
String publicLink = client.getHttpUrl().RFile(remotePath);
|
||||||
|
|
Loading…
Reference in New Issue