public void importFile(String fileName, String providerspecificid,
String mdprovider) throws Exception {
System.out.println("Importing " + fileName + " / " + mdprovider
+ " / " + providerspecificid);
final Date8Time6Parser d8t6p = new Date8Time6Parser();
MarketDataInstrument tempMdi = mdiDao.findByProvId(mdprovider,
providerspecificid);
if (tempMdi == null) {
tempMdi = new MarketDataInstrument();
tempMdi.setProviderSpecificId(providerspecificid);
tempMdi.setMdProvider(mdprovider);
mdiDao.create(tempMdi);
}
final MarketDataInstrument mdi = tempMdi;
tempMdi = null;
//
final SimpleDateFormat sdf = new SimpleDateFormat(
"yyyyMMdd HH:mm:ss.SSS");
final SimpleDateFormat sdf2 = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
sdf2.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println("All set, ready to parse for " + mdi.getId()
+ " /// " + System.currentTimeMillis());
final long l1 = System.currentTimeMillis();
final CsvMapReader cmr = new CsvMapReader();
cmr.read(new IEventListener<Map<String, String>>() {
@Override
public void eventFired(Map<String, String> event) {
final String date = event.get("DATE");
String time = event.get("TIME");
if(time==null)time = "00:00:00.000";
final String dateTime = date + " " + time;
final Iterator<Entry<String, String>> it = event.entrySet()
.iterator();
TimeStamp ts;
try {
if(dateTime.indexOf("-")!=-1)
ts = new TimeStamp(sdf2.parse(dateTime));
else
ts = new TimeStamp(sdf.parse(dateTime));
while (it.hasNext()) {
Entry<String, String> entry = it.next();
String key = entry.getKey().toUpperCase();
if (key.equals("DATE"))
continue;
if (key.equals("TIME"))
continue;
iaw.write(mdi.getId(), ts, key,
Double.parseDouble(entry
.getValue()));
if (lineCounter++ > 100) {
lineCounter = 0;
try {