2018-12-04 12:06:22 +01:00
|
|
|
package org.gcube.gcat.persistence.ckan;
|
|
|
|
|
|
|
|
import javax.ws.rs.InternalServerErrorException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class CKANUtility {
|
|
|
|
|
|
|
|
public static String getSysAdminAPI() {
|
|
|
|
try {
|
2019-09-12 17:58:39 +02:00
|
|
|
return CKANInstance.getInstance().getSysAdminToken();
|
2018-12-04 12:06:22 +01:00
|
|
|
} catch(Exception e) {
|
|
|
|
throw new InternalServerErrorException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-12 14:26:24 +02:00
|
|
|
public static String getApiKey() {
|
2018-12-04 12:06:22 +01:00
|
|
|
try {
|
2019-09-16 12:00:49 +02:00
|
|
|
CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
|
2019-09-12 14:26:24 +02:00
|
|
|
return ckanUser.getApiKey();
|
2019-09-16 14:48:18 +02:00
|
|
|
} catch(Exception e) {
|
2018-12-04 12:06:22 +01:00
|
|
|
throw new InternalServerErrorException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|