Hi Phil, Thanks for the help - the compile worked with the following code in case it's of use to anyone else:
import java.util.HashMap;
import java.util.Map;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import com.infiniteautomation.datafilesource.contexts.AbstractCSVDataSource;
import com.infiniteautomation.datafilesource.dataimage.NumericImportPoint;
public class epiCSV
extends AbstractCSVDataSource {
DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-ddThh:mm:ss");
Map<String, Integer> headerMap = new HashMap<String, Integer>();
@Override
public void importRow(String[] row, int rowNum) {
if(rowNum == 0) for (int k = 0; k < row.length; ++k) { headerMap.put(row[k], k); }
else this.parsedPoints.add(
new NumericImportPoint(
row[headerMap.get("ExportID")],
Double.parseDouble(row[headerMap.get("Value")]),
dtf.parseDateTime(row[headerMap.get("Date")]).getMillis(),
new HashMap<String, String>() ) );
}
}
I copied the class into /web/modules/dataFile/web/templates/CSV/ and removed the .class extension, removed the placeholder file, saved the datasource, restarted etc. but I can't seem to get the 'template' to show up in the drop down list on the UI when adding a new data source (screenshot attached). Not sure if I'm missing another step?
Thanks,
Brendan
Attachment: download link