-
Notifications
You must be signed in to change notification settings - Fork 9
Home
Plain Old Java Objects (POJOs) used for deserializing OpenTripPlanner server responses on Android devices using Jackson.
This code is licensed under the L-GPL license per the main OTP project, as they are modified versions of classes contained in that project.
This project is used by OpenTripPlanner for Android mobile app, OneBusAway Android, as well as the test project OTP Java Client.
While it's mainly designed for Android, with some modifications other Java-based client platforms can use it as well.
For more details on using the library in your app, see the following opentripplanner-dev Google Group posts:
- https://groups.google.com/forum/#!topic/opentripplanner-dev/m4tKSXvfwjQ
- https://groups.google.com/d/msg/opentripplanner-dev/qZxG5Aw8M94/x776HDoTlJQJ
This repository holds objects for multiple versions of OTP server deployments.
For OTP servers version 0.9.0 and higher, OTP Server versions can be determined via the serverInfo() REST API method of your server.
For example, the HTTP request:
http://rtp.trimet.org/opentripplanner-api-webapp/ws/serverinfo
...will return a response that looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<serverInfo>
<serverVersion>
<version>0.9.1-SNAPSHOT</version>
<major>0</major>
<minor>9</minor>
<incremental>1</incremental>
<qualifier>SNAPSHOT</qualifier>
<commit>de91d05ef4bff7d22ef0b3bec8991625b3b2c797</commit>
</serverVersion>
<cpuName>Intel(R) Xeon(R) CPU X5660 @ 2.80GHz</cpuName>
<nCores>24</nCores>
</serverInfo>
This project supports the following OTP server versions, so far:
- v0.8.0 and lower - Legacy OTP servers that don't have a serverInfo() REST API method. Support will be spotty, since there may have been changes in the REST API over multiple versions, and we have no way to programmatically determine this.
- v0.9.2-SNAPSHOT - As of ~Nov. 10, 2012.
All dependencies are managed via Maven.
Note that this project uses Lombak to auto-generate getter and setter methods, so you'll need to follow the process defined here to install Lombak into your Eclipse instance, or here for IntelliJ.
To support unlisted OTP versions that don't currently work with this project, we'll need to add/edit OTP objects from the main OTP server project.
We're structuring the package names as follows:
- org.opentripplanner.VERSIONNUMBER.*
For example, objects that come from the v0.9.2-SNAPSHOT OTP server release are in the packages:
- org.opentripplanner.v092snapshot.api.model
- org.opentripplanner.v092snapshot.common.model ...
Existing classes in the org.opentripplanner.api.* and other packages that don't contain version numbers are from version 0.8.0 or below, when the serverInfo() REST API method didn't exit. To cut down on object bloat in the POJOs project, we should try to reuse classes from these main packages before adding new classes to VERSIONNUMBER packages.
We suggest testing if your OTP server API works with these POJOs by using the OTP-Java-Client Android project, which makes a quick request to a hard-coded (by you) URL and says if the request passes or failed.
You'll also need to strip the XML annotations and imports from the OTP server classes, since they aren't supported by Android (more here).
To help with this, we include an Ant script, commentOutXmlAnnotations.xml
, which will comment out all the XML annotations and imports from the OTP server files. Right-click on the file in Eclipse, and then select "Run As->Ant Build", and this will process all .java files in all project subdirectories. See here more details on the Ant script. After commenting out these items, you're on your own for making the classes compatible with Android and Jackson - it will probably take some trial-and-error to make them work.
We've set up a repository to hold the artifacts from this project as a Gihub project - cutr-mvn-repo.
At CUTR, we should run the following at the command-line to create a new artifact:
mvn -DaltDeploymentRepository=cutr-snapshots::default::file:"/Git Projects/cutr-mvn-repo/snapshots" clean deploy
Then commit using Git and push new artifacts to Github.
Note that the "snapshots" in the command-line should be replaced with "releases" for release versions.