Examples of addEntityHandler()


Examples of org.onebusaway.csv_entities.CsvEntityReader.addEntityHandler()

        "src/test/resources/org/onebusaway/uk/naptan/csv/test_data"));
    AnnotationDrivenEntitySchemaFactory entitySchema = new AnnotationDrivenEntitySchemaFactory();
    entitySchema.addPackageToScan("org.onebusaway.uk.naptan.csv");
    reader.setEntitySchemaFactory(entitySchema);
    ListEntityHandler<NaPTANStop> stopHandler = new ListEntityHandler<NaPTANStop>();
    reader.addEntityHandler(stopHandler);
    reader.readEntities(NaPTANStop.class);
    reader.close();
    List<NaPTANStop> stops = stopHandler.getValues();
    assertEquals(2, stops.size());
    NaPTANStop stop = stops.get(0);
View Full Code Here

Examples of org.onebusaway.csv_entities.CsvEntityReader.addEntityHandler()

    CsvEntityReader reader = new CsvEntityReader();
    reader.setInputLocation(_naptanCsvPath);
    AnnotationDrivenEntitySchemaFactory entitySchema = new AnnotationDrivenEntitySchemaFactory();
    entitySchema.addPackageToScan("org.onebusaway.uk.naptan.csv");
    reader.setEntitySchemaFactory(entitySchema);
    reader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object arg0) {
        NaPTANStop stop = (NaPTANStop) arg0;
        _stopsByAtcoId.put(stop.getAtcoCode(), stop);
      }
View Full Code Here

Examples of org.onebusaway.csv_entities.CsvEntityReader.addEntityHandler()

  public void readStationLocations(File path) throws CsvEntityIOException,
      IOException {
    BufferedReader reader = new BufferedReader(new FileReader(path));
    CsvEntityReader csvEntityReader = new CsvEntityReader();
    csvEntityReader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object bean) {
        StationLocation stationLocation = (StationLocation) bean;
        Point2D.Double xy = ProjectionSupport.convertFromLatLon(
            stationLocation.getLat(), stationLocation.getLon());
View Full Code Here

Examples of org.onebusaway.csv_entities.CsvEntityReader.addEntityHandler()

    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);
View Full Code Here

Examples of org.onebusaway.csv_entities.CsvEntityReader.addEntityHandler()

   * Private Methods
   ****/

  private void register(InputStream in) throws IOException {
    CsvEntityReader reader = getReader();
    reader.addEntityHandler(new EntityHandlerImpl());
    reader.readEntities(TccParticipantRegistrationBean.class, in);
  }

  private CsvEntityReader getReader() {
    CsvEntityReader reader = new CsvEntityReader();
View Full Code Here

Examples of org.onebusaway.gtfs.serialization.GtfsReader.addEntityHandler()

        reader.setInputSource(gtfsBundle.getCsvInputSource());
        reader.setEntityStore(store);
        reader.setInternStrings(true);

        if (LOG.isDebugEnabled())
            reader.addEntityHandler(counter);

        if (gtfsBundle.getDefaultBikesAllowed())
            reader.addEntityHandler(new EntityBikeability(true));

        for (Class<?> entityClass : reader.getEntityClasses()) {
View Full Code Here

Examples of org.onebusaway.gtfs.serialization.GtfsReader.addEntityHandler()

        if (LOG.isDebugEnabled())
            reader.addEntityHandler(counter);

        if (gtfsBundle.getDefaultBikesAllowed())
            reader.addEntityHandler(new EntityBikeability(true));

        for (Class<?> entityClass : reader.getEntityClasses()) {
            LOG.info("reading entities: " + entityClass.getName());
            reader.readEntities(entityClass);
            store.flush();
View Full Code Here

Examples of org.onebusaway.gtfs.serialization.GtfsReader.addEntityHandler()

    GtfsReader reader = new GtfsReader();
    reader.setDefaultAgencyId("1");
    reader.getEntityClasses().retainAll(Arrays.asList(Stop.class));
    reader.setInputLocation(new File(args[0]));
    reader.addEntityHandler(new EntityHandlerImpl(bounds));
    reader.run();
  }

  private static class EntityHandlerImpl implements EntityHandler {
View Full Code Here

Examples of org.onebusaway.gtfs.serialization.GtfsReader.addEntityHandler()

   
    GtfsReader reader = new GtfsReader();
    reader.setDefaultAgencyId("1");
    reader.getEntityClasses().retainAll(Arrays.asList(Stop.class));
    reader.setInputLocation(new File(args[0]));
    reader.addEntityHandler(new EntityHandlerImpl(points));
    reader.run();
  }

  private static Geometry readPoints(String arg) throws NumberFormatException, IOException {
   
View Full Code Here

Examples of org.onebusaway.gtfs.serialization.GtfsReader.addEntityHandler()

      StopToPolygonEntityHandler handler = new StopToPolygonEntityHandler(2500);

      for (GtfsBundle bundle : bundles) {
        System.err.println(bundle.getPath());
        GtfsReader reader = new GtfsReader();
        reader.addEntityHandler(handler);
        reader.setInputLocation(bundle.getPath());
        if (bundle.getDefaultAgencyId() != null)
          reader.setDefaultAgencyId(bundle.getDefaultAgencyId());
        reader.readEntities(Stop.class);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.