Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.
barbeau edited this page Sep 28, 2012 · 79 revisions

SIRI REST Client

SiriRestClient is an open-source reference implementation Android library for interacting with the RESTful SIRI (Service Interface for Real Time Information) interface for real-time transit data, such as that currently being used by the [MTA Bus Time API] (http://bustime.mta.info/wiki/Developers/SIRIIntro).

SIRI is a public transportation standard developed by the European standards organization CEN. More information about SIRI can be found at the main SIRI website.

All SiriRestClient source code is licensed under Apache 2.0.

Getting Started

Setting up your environment

This project was created in Eclipse using the Android SDK and Android Plugin for Eclipse. Libraries and dependencies are managed using [Maven] (http://eclipse.org/m2e/) (with a few exceptions for Jackson XML libraries and the OneBusAway SIRI POJOs, as discussed below).

Getting the code

To get started with this project, use a Git client to clone this repository to your local computer. Then, in Eclipse do "File->Import->Maven->Existing Maven Projects", and point to the directory where you cloned the repo.

You'll also need the SIRI POJOs project for Jackson data binding. Clone this project using Git as well, and then add this as a dependency in your SiriRestClient app via "Properties->Java Build Path->Projects->Add..".

Next, you'll need to resolve a few dependencies on other projects, which is discussed in the next section below.

Dependencies

SiriRestClient has dependencies on Jackson for parsing JSON and XML. Some dependencies for this are included in the "libs" folder of the project, and some are managed via Maven. No configuration should be required for these dependencies to build with the SiriRestClient.

Please see the Parsing JSON and XML on Android wiki page for a full description of the use of Jackson with Android.

Build the project

After you've completed the above steps, clean and build the project. If you have any problems, try cleaning both projects, and restarting Eclipse, then building the SiriRestClient project.

Using this library in an Android app

See the SiriRestClientUI project for an example of how to use this library in an Android app.

Regenerating the client SIRI API code

We anticipate that the SIRI specification will change over time and the SIRI Plain Old Java Objects (POJOs) code will need to be regenerated. The SIRI v1.3 POJOs are maintained in their own OBA SIRI v1.3 POJOs project. If a new version of SIRI is released (e.g., v2.0), a new SIRI POJOs project will need to be created for this version of SIRI.

There are two strategies for creating new SIRI POJOs needed for data binding with a new version of SIRI:

  1. Use tools such as [json gen] (http://jsongen.byingtondesign.com/) to generate POJOs based on SIRI JSON data

  2. Strip the XML annotations and other characteristics that are incompatible with Android from the SIRI JAXB classes to create true POJOs that work on Android. See the current SIRI POJO project wiki for details on how to perform this manual process.

Tutorials

We've developed several tutorials based on what we've learned implementing the SiriRestClient, especially in the area of JSON and XML parsing on Android: