2016-11-24 17:53:50 +01:00
|
|
|
package org.gcube.data_catalogue.grsf_publish_ws.utils.threads;
|
|
|
|
|
2016-11-25 13:56:27 +01:00
|
|
|
import java.beans.IntrospectionException;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
2016-11-24 17:53:50 +01:00
|
|
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
|
|
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Extract the time series present in the record, load them as resource on ckan and on the .catalogue
|
|
|
|
* folder under the vre folder.
|
|
|
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
|
|
*/
|
|
|
|
public class ManageTimeSeriesThread extends Thread{
|
|
|
|
|
|
|
|
// Logger
|
|
|
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ManageTimeSeriesThread.class);
|
|
|
|
|
2016-11-25 13:56:27 +01:00
|
|
|
private Common record;
|
|
|
|
private String packageId;
|
|
|
|
private String username;
|
|
|
|
private DataCatalogue catalogue;
|
|
|
|
private String context;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param record
|
|
|
|
* @param packageId
|
|
|
|
* @param username
|
|
|
|
* @param catalogue
|
|
|
|
* @param context
|
|
|
|
*/
|
2016-11-24 17:53:50 +01:00
|
|
|
public ManageTimeSeriesThread(Common record, String packageId,
|
|
|
|
String username, DataCatalogue catalogue, String context) {
|
2016-11-25 13:56:27 +01:00
|
|
|
super();
|
|
|
|
this.record = record;
|
|
|
|
this.packageId = packageId;
|
|
|
|
this.username = username;
|
|
|
|
this.catalogue = catalogue;
|
|
|
|
this.context = context;
|
|
|
|
}
|
2016-11-24 17:53:50 +01:00
|
|
|
|
2016-11-25 13:56:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2016-11-24 17:53:50 +01:00
|
|
|
logger.info("Time series manager thread started");
|
|
|
|
try {
|
2016-11-25 13:56:27 +01:00
|
|
|
HelperMethods.manageTimeSeries(record, packageId, username, catalogue, context);
|
|
|
|
logger.info("The time series manager thread ended correctly");
|
|
|
|
} catch (IllegalAccessException | IllegalArgumentException
|
|
|
|
| InvocationTargetException | IntrospectionException e) {
|
|
|
|
logger.error("Failed to attach csv files to the product...");
|
2016-11-24 17:53:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|