if(message instanceof ListAll) {
final String url = ConfigFactory.load().getString("restopengov.ckan-rest-api");
try {
String response = new Resty().text(url).toString();
Type listType = new TypeToken<ArrayList<String>>() {}.getType();
List<String> datasetList = new Gson().fromJson(response, listType);
for(String dataset : datasetList) {
System.out.println(dataset);
}
getContext().system().shutdown();
} catch (Exception e) {
e.printStackTrace();
}
} else if(message instanceof FetchAll) {
final String url = ConfigFactory.load().getString("restopengov.ckan-rest-api");
try {
String response = new Resty().text(url).toString();
Type listType = new TypeToken<ArrayList<String>>() {}.getType();
List<String> datasetList = new Gson().fromJson(response, listType);
getSelf().tell(datasetList);