• Share this article:

Building an Eclipse RCP for EBay

Monday, October 31, 2005 - 08:59 by Wayne Beaton

I sorted it out. Last month, I wrote about some work that I was doing with the EBay SDK and Eclipse RCP. I had a few problems getting the integration to work, but I’ve sorted them out. I demoed it to Ian today and even he thought it looks pretty cool.

So far, the demo isn’t all that interesting. It gets the user to login by providing a user name and password, and then opens up the workbench with a single view that shows a tree of categories. Categories can be nested arbitrarily deep, so you can click on the little ‘+’ sign to expose the child categories. Of course, it would be too painful to load in the entire category tree, so it does it on demand using the deferred population like the CVS browser (i.e. it shows “Pending…” while it loads the subtree).

As I mentioned in my previous post, there is some weirdness: there is no way to log a user on by userid and password. To log on a user, you have to direct a browser to a specific page on the EBay site which will take care of gathering the user’s information. Once the user has logged onto the EBay site, the RCP application can take over. At first, I thought that making this work would be hard. It’s actually pretty easy.

Before the workbench is opened by the application, my application creates a separate shell with a org.eclipse.swt.browser.Browser that points to the initial login page. An org.eclipse.swt.browser.LocationListener is added to the browser; after the user logs on successfully, they are directed to a “success” page. The listener detects this and closes the shell. It then opens the workbench.

I need to add a little flourish to the site (i.e. now that I’ve got it working, I need to make it look prettier) and add some branding in the form of a splash screen, but it’s mostly there. I’m going to set it up to browse auctions first. Once I start to get a little more familiar with the EBay API, I’m going to set it up to watch for auctions that fit some kind of pattern. At least that’s my plan. I’m sure it will evolve.

At some point in the future, I’m going to have to look into moving the application from the relatively safety of the sandbox to the real world. Technically, I think this is pretty easy. There are some legal things to consider and–of course–the small matter of payment. I’m a little concerned about one thing: the EBay API goes a long way to avoid letting an application get ahold of a user’s password, but the application’s identity is relatively easy to steal. In order to gain access to the site through the API, the application must provide a collection of identifing strings. My fear is that it is relatively easy to obtain these strings and impersonate my application. I’m sure that somebody else has thought of this, so I’m going to poke around a bit and see what I can uncover.