Skip to content

Commit

Permalink
small things
Browse files Browse the repository at this point in the history
  • Loading branch information
tinypony committed Feb 17, 2015
1 parent 0a9513a commit ed17788
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 80 deletions.
169 changes: 93 additions & 76 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,78 +1,95 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.aalto.emn</groupId>
<artifactId>snippets</artifactId>
<version>1.0-SNAPSHOT</version>
<description>Project for analyzing bus schedule data</description>
<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.30</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.19.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.19.0</version>
</dependency>
<!-- Core GTFS Library -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>1.3.3</version>
</dependency>
<!-- Optional Hibernate GTFS Database Persistence -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-hibernate</artifactId>
<version>1.3.3</version>
</dependency>
<!-- Optional GTFS Transformation Library -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-transformer</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.aalto.emn</groupId>
<artifactId>snippets</artifactId>
<version>1.0-SNAPSHOT</version>
<description>Project for analyzing bus schedule data</description>

<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.30</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.19.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.19.0</version>
</dependency>
<!-- Core GTFS Library -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>1.3.3</version>
</dependency>
<!-- Optional Hibernate GTFS Database Persistence -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-hibernate</artifactId>
<version>1.3.3</version>
</dependency>
<!-- Optional GTFS Transformation Library -->
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-transformer</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>edu.aalto.emn.SnippetMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
10 changes: 8 additions & 2 deletions src/main/java/edu/aalto/emn/RuterGTFSHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.onebusaway.csv_entities.EntityHandler;
import org.onebusaway.gtfs.impl.GtfsDaoImpl;
Expand Down Expand Up @@ -64,11 +65,16 @@ public void parseAndDump() throws IOException {
this.processTrips();
this.processStops();


for(String tripId: trips.keySet()) {
Set<String> keySet = trips.keySet();
int i=0;

for(String tripId: keySet) {
BusTrip trip = trips.get(tripId);
tripsColl.insert(trip.toMongoObj());
i++;
System.out.println("Imported " + i + " trips out of "+keySet.size() + " \r");
}

System.out.println("Imported " + trips.size() + " bus trips");
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/aalto/emn/dataobject/BusStop.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.xml.sax.Attributes;


public class BusStop{
public class BusStop {
private String id;
private String name;
private String x;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/aalto/emn/dataobject/BusTrip.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ public BasicDBObject toMongoObj() {

BasicDBObject obj = new BasicDBObject();
obj.append("serviceId", this.getServiceID())
.append("direction", this.getDirection())
.append("companyId", this.getCompany())
.append("route", this.getRoute())
.append("serviceNbr", this.getServiceNbr())
.append("route", this.getRoute())
.append("stops", this.getDBStops())
.append("footnodeId", this.getFootnoteId())
.append("dates", this.getDates());
Expand Down

0 comments on commit ed17788

Please sign in to comment.