Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.
barbeau edited this page Oct 10, 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). See the SiriRestClientUI project for an example of how to use this library in an Android app.

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

Using this library in an Android app

To add this library to your project using Maven, add the following to your pom.xml file:

<!-- SIRI POJOs -->
<dependency>
    <groupId>edu.usf.cutr.siri</groupId>    
    <artifactId>onebusaway-siri-api-v13-pojos</artifactId>    
    <version>1.0.0</version>
</dependency>
    
<!-- SiriRestClient -->
<dependency>
    <groupId>edu.usf.cutr.siri</groupId>
    <artifactId>sirirestclient</artifactId>
    <version>1.0.0-SNAPSHOT</version>            
</dependency>   

Compiling the code yourself

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/). Note that you'll need to install the m2e Android Maven plugin in Eclipse.

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. XML parsing requires that you install additional modified XML library artifacts in your local Maven repository. See the Modifying XML libraries for Android for details.

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.

Deploying to your local Maven repository

If you've modified this project and want to install the resulting artifact in your local Maven respository, run the following at the command line:

mvn clean install

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: