Repository Management with Nexus
21.2. Nexus Extension Points

The simplest Nexus plugin contain a single class, SampleEventInspector, which contributes an EventInspector to the Nexus Application. This simple event inspector will do nothing more than print a message every time it accepts and inspects an event.
A Simple Event Inspector.
package org.sample.plugin;
import org.sonatype.nexus.proxy.events.EventInspector;
import org.sonatype.plexus.appevents.Event;
public class SampleEventInspector implements EventInspector {
public boolean accepts( Event<?> evt ) {
return true;
}
public void inspect( Event<?> evt ) {
System.out.println( "Invoked with event: " +
evt.toString() + " with sender " +
evt.getEventSender().toString() );
}
}
During the build of this nexus plugin, this class is compiled and then scanned for concrete classes that implement extension point interfaces defined in the following section. The EventInspector interface in the nexus-api project has been marked with the @ExtensionPoint annotation. The plugin build takes the @ExtensionPoint, @Named, and @Inject annotations that may be present and generates a plugin descriptor which is packaged in the plugin’s JAR.
When the plugin is present in Nexus during start-up, the Nexus plugin manager reads the plugin metadata and instantiates the appropriate components. To implement a plugin, you simply implement some of these interfaces.
