use of org.onebusaway.csv_entities.CsvEntityReader in project onebusaway-application-modules by camsys.
the class OrbcadRecordFtpSource method setup.
/**
**
* Private Methods
***
*/
@Override
protected void setup() {
_reader = new CsvEntityReader();
AnnotationDrivenEntitySchemaFactory entitySchemaFactory = new AnnotationDrivenEntitySchemaFactory();
entitySchemaFactory.addEntityClass(OrbcadRecord.class);
_reader.setEntitySchemaFactory(entitySchemaFactory);
_reader.addEntityHandler(new RecordHandler());
}
use of org.onebusaway.csv_entities.CsvEntityReader in project onebusaway-application-modules by camsys.
the class OrbcadRecordHttpSource method setup.
/**
**
* Protected Methods
***
*/
protected void setup() {
_reader = new CsvEntityReader();
AnnotationDrivenEntitySchemaFactory entitySchemaFactory = new AnnotationDrivenEntitySchemaFactory();
entitySchemaFactory.addEntityClass(OrbcadRecord.class);
_reader.setEntitySchemaFactory(entitySchemaFactory);
_reader.addEntityHandler(new RecordHandler());
}
use of org.onebusaway.csv_entities.CsvEntityReader in project onebusaway-application-modules by camsys.
the class BlockLocationHistoryServiceImpl method getHistoryForTripId.
@Override
public Map<AgencyAndIdInstance, List<BlockLocationArchiveRecord>> getHistoryForTripId(AgencyAndId tripId) {
TripEntry trip = _transitGraphDao.getTripEntryForId(tripId);
if (trip == null)
return null;
BlockEntry block = trip.getBlock();
List<File> files = getFilesForBlockId(block.getId());
CsvEntityReader reader = new CsvEntityReader();
reader.setTokenizerStrategy(new DelimiterTokenizerStrategy("\t"));
EntityHandlerImpl handler = new EntityHandlerImpl(tripId);
reader.addEntityHandler(handler);
try {
for (File file : files) {
InputStream in = openFileForInput(file);
reader.readEntities(BlockLocationArchiveRecord.class, in);
in.close();
}
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
Map<AgencyAndIdInstance, List<BlockLocationArchiveRecord>> recordsByInstance = handler.getRecordsByInstance();
for (List<BlockLocationArchiveRecord> records : recordsByInstance.values()) Collections.sort(records, new DistanceAlongBlockComparator());
return recordsByInstance;
}
Aggregations