sonatype/nexus — pull request #116 by cstamas (2011-11-30 22:26:31+00:00)
Title: Move Spice Timeline into a plugin

This change moves the "Spice Timeline" (this one here: https://github.com/sonatype/spice-timeline) from core into a plugin together with its dependencies.

What does it buys for us?

First, with this change, it is easy-peasy to remove completely the timeline plugin, and your Nexus will work just fine -- it's nice if you are not interested in feeds (you loose them without timeline), but you are interested in more performance. When plugin removed, a "noop" timeline is used (and feeds will be always empty).

Second, as spice-timeline was in core, it's dependencies was in core too, like Google Protobuf and Lucene. And this took us into impossible situation. For example: as Maven Indexer become independent project, we are tied and kept as "hostage" of it's Lucene version, and whenever it updates Lucene we have to bump Lucene version used in spice-timeline too to keep them aligned. Moreover, this makes Maven Indexer totally non-extensible (by adding IndexCreators in another plugin): the indexer plugin has it's own Lucene JARs, the core has another (same versioned) Lucene JARs and there will be linkage exceptions. If plugin includes it's Lucene, it still ends up with Linking errors. Having this situation, we were is check-mate position with extending anything that would use Lucene classes in API (Maven Indexer API has Lucene classes in it, that's another story).

Same of these stands for Google Protobuf (ie. if we had the ActiveMQ plugin that would for some reason wanted to share some protobuf generated classes, it's a no go).

Lucene and Protobuf are -- this is my own opinion -- too much "key technologies" to remain "pinned" by core. Core should not have any of those two.

How it works?

Simply, the `RedirectingTimeline` class took over the "default" NexusTimeline role, and it is "smart" about detecting the presence of "real" Timeline implementation. If a plexus lookup for the "real thing" fails, it still safely falls back to NOOP NexusTimeline implementation.

The sisu-timeline related classes are moved into newly introduced nexus-timeline-plugin (since they rely on it's classes), and simply on NexusInited event, Timeline swap is tried. When nexus is inited (that happens when all the plugins are loaded), Timeline is activated and put in place. If plugin not found, everything continues as from boot, NOOP one is used.