As this project has gone on, as expected, we have been adding features. So far, along with the core bike rental system features, there is now plans for LUAS integration, a map of secure bicycle lock-up facilities and possibly cycle lane support too.

As all the info relating to the bike stations (availabile number of bikes, location etc etc) is retrieved from one location, there will be a need to create another data source containing the info for these new features. As its only a college project, proof of concept is only needed, meaning the data does not have to be correct, it just needs to work, and pull back some info, be it dynamic or static. However, if some new official, correct, data source was found, simply changing the location to where the parser is pointing would then make it a fully functional, accurate piece of software! Until that day comes, a customised backend running a RESTful service will have to suffice.

Lets take the secure bike lock-up facility as an example here. There are no known (to me) sources at this time that contain the locations of any bike parking facilities, so for the purposes of this project, these locations will have to be fabricated. This will be done by storing mock coordinates in a data source (which I’ll get to in a minute), then writing a RESTful web service, most likely in NetBeans, which will run off glassfish server, and serve the results in either XML or JSON format. I reckon XML will probably be best route here, even though, as far as I know, there is built in support for both formats in NetBeans/glassfish. I’m not sure if there are any performance gains in choosing JSON, but looking at the raw data from both, the XML seems a lot more readable with its tags, so I’m hoping its a lot easier to parse. Although, going back to what I just said a few lines back, there is built in support for both so I think either option is the same at the high level NetBeans deals with it. Feel free to correct me in the comments if JSON performs better.

Keeping with the XML line here, we will need to store these coordinates somewhere. For peace of mind, and transparency of functions, it is my opinion that storing the details of the bike lock-up facilities in an XML file will make it a lot easier to read (for humans at least) by having matching tags in the data source and the XML data produced by the server. We also have to take into account what the iPhone can handle. This whole RESTful service thing is something I’ve only been looking into for a matter of days, hence why I’m unsure about performance vs XML files, so I’m also unsure if any differences exist between how the iPhone will handle XML and JSON when parsing them and storing the coordinates as arrays of strings, so for arguments sake, and to keep in line with the rest of the project, XML will what I will be focusing on, except if I discover JSONs performance gains far outweigh XMLs, as above.

So, after a few minutes playing around with this, I’ve managed to get my own server running, and it was surprisingly easy! Luckily enough, as you know, Java is pretty popular, as is NetBeans, so there is plenty of documentation online. For example, the easiest, most straightforward guide I found is here: Getting Started with RESTful Web Services from the netbeans.org docs. In 10 minutes flat, you can have your own server running, complete with a sample database, serving out a choice of both XML and JSON, which works perfect on Firefox, Internet Explorer, even an Android phones stock browser….but unfortunately not Google Chrome. But as far as I know, when using the UIWebView in the iPhone SDK, the iPhone uses the Safari renderer to display the Google Maps themselves, rather than some Google provided solution, ie Chromiums renderer, so this browser incompatibility shouldnt be a problem….hopefully. I’ve no idea what the case is when using MapView in either iPhone or Android, but I’d imagine its some sort of JVM solution so should be fine.