Monday, February 23, 2009

p2 likes its 404s straight up

Setting up p2 to work with a repository that is behind HTTPS has been quite challenging. First I ran into this Java bug which was affecting ECF, the underlying transport for p2.

After moving past that problem, I was getting a lot of "No repository found at.." error messages, even though I knew damn well there was a repository hosted at the URL I was specifying.

After digging through the p2 code with the debugger turned on, I found the problem. You can deploy your repository metadata in two formats, compressed (JAR) or uncompressed (XML). When the repository manager goes out to a URL to look for the repository contents, it tries to find the JAR version first. If that fails with a 404, then it looks for the XML version.

I was deploying the XML version, and the fallback behavior wasn't working. It was pulling in an empty artifacts file, and trying to parse it, which of course failed. Turns out the web server was sending a 302 redirect with a user friendly page explaining that the page had moved. I found this by intentionally hitting a bad URL with Firefox, using Firebug to examine the response headers:

You can see that the 404 is coming AFTER the 302, which is too late. ECF was relying on the 404 to cause a FileNotFoundException, which translates into a known failure status in the p2 repository manager code, from which it can recover and try again with a different filename.

After tweaking the web server to return a 404 immediately, I was able to refresh the repository in the Software Updates dialog without any errors.

Sunday, February 22, 2009

First look at e4

I finally had some time to take a look at the first e4 Milestone. Download and install from here. New and Noteworthy here.

My main interest is in the declarative UI and CSS components. So I spun up the photo demo per Boris' instructions. It works and looks about what I would expect for the first milestone. I found the CSS file and tweaked it a bit, restarted, and saw my changes take effect. That was cool. Some thoughts on CSS in Eclipse:

  • Styling RCP apps can be left up to a designer. I wonder what the collaboration challenges will be like.
  • What does this mean for native widgets? Will people go hog wild and make their application so customized that it doesn't look like it fits in anymore? Ditto for plugins. I see a need for a whole host of new UI standards..
  • I wonder how well you can hot replace your CSS tweaks.
  • I haven't looked at Tk-UI (the CSS engine) much yet, but I wonder to what extent they support the CSS spec, and how much of that translates meaningfully into SWT constructs. First thing I'd be looking for is a mapping document.

Quick spin through the photo demo is complete. Lets look under the covers at the app itself. First class I look at is ExitHandler. Except, its not a handler. Or at least it doesn't extend AbstractHandler.. what's going on here? I can only guess: dependency injection. This will take some getting used to.

I also see an .xmi file. Quickly I can scan through it and see the structure of the entire user interface. I'm comparing this to the umpteen times I've had to follow that "parent" instance variable up the tree, to figure out where the heck a particular Composite lives, and what the structure is.

I can see already that I'm going to need Ctrl+Click to go from the .xmi file to the relevant classes. (Maybe I just need the appropriate EMF editor)

I have to wonder what newproject.js is. I can only think it is related to writing plug-ins in other languages. I see mention of Rhino as the toolkit. Perhaps the BIRT team can lend some expertise in this area.

I hope to get to the Resource model changes next time.


A little about me. I've been a Java developer in the Washington DC area for about 5 years. I started out in the web tier, and began building Eclipse apps in 2005. I took a short hiatus from SWT to work with GWT for about a year, then back into Eclipse last spring.

I've worked with a wide variety of Eclipse technologies, including RCP, EMF, GEF, and BIRT. Lately I've been spending a lot of time hacking the Equinox p2 component.

Over the years, I've accumulated a fair amount of knowledge about the inner workings of Eclipse; I hope to share what I've learned on this blog. And so off we go..