changeset 911:03948c38134a

Introduce Service and ExtensionPoint annotations Thermostat currently has a large number of interfaces that are meant to be used as services (where a client obtains an instance of the interface from OSGi) or as extension points (where a client registers an instance of the interface as an OSGi service and thermostat makes use of it). There is no clear indication of which interfaces are what. Clarify this by introducing two annotations @Service and @ExtensionPoint that should be used to document the purpose of the interface. These annotations do not imply any behaviour and are for documentation purposes only. Also introduce an annotation processor that writes "plugin-docs.xml" files containing some basic documentation about classes marked with @Service or @ExtensionPoint. Nothing explicit needs to be done to invoke the annotation processor, simply including a dependency on thermostat-annotations (needed to use @Service/@ExtensionPoint anyway) is enough. These xml files are not included in the jars. Reviewed-by: ebaron, jerboaa, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-January/004983.html PR1255
author Omair Majid <omajid@redhat.com>
date Tue, 15 Jan 2013 13:00:50 -0500
parents 421d8a954893
children bf46bf74d05c
files agent/command/src/main/java/com/redhat/thermostat/agent/command/RequestReceiver.java agent/core/src/main/java/com/redhat/thermostat/agent/VmStatusListener.java agent/core/src/main/java/com/redhat/thermostat/backend/Backend.java annotations/pom.xml annotations/src/main/java/com/redhat/thermostat/annotations/ExtensionPoint.java annotations/src/main/java/com/redhat/thermostat/annotations/Service.java annotations/src/main/java/com/redhat/thermostat/annotations/internal/AnnotationProcessor.java annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor annotations/src/test/java/com/redhat/thermostat/annotations/internal/AnnotationProcessorTest.java client/command/src/main/java/com/redhat/thermostat/client/command/RequestQueue.java client/core/src/main/java/com/redhat/thermostat/client/core/InformationService.java client/core/src/main/java/com/redhat/thermostat/client/core/views/AgentInformationViewProvider.java client/core/src/main/java/com/redhat/thermostat/client/core/views/ClientConfigViewProvider.java client/core/src/main/java/com/redhat/thermostat/client/core/views/HostInformationViewProvider.java client/core/src/main/java/com/redhat/thermostat/client/core/views/VmInformationViewProvider.java client/core/src/main/java/com/redhat/thermostat/client/osgi/service/ContextAction.java client/core/src/main/java/com/redhat/thermostat/client/osgi/service/MenuAction.java client/core/src/main/java/com/redhat/thermostat/client/osgi/service/VMContextAction.java common/core/pom.xml common/core/src/main/java/com/redhat/thermostat/common/ApplicationService.java common/core/src/main/java/com/redhat/thermostat/common/CommandLoadingBundleActivator.java common/core/src/main/java/com/redhat/thermostat/common/DbService.java common/core/src/main/java/com/redhat/thermostat/common/TimerFactory.java common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuViewProvider.java host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java host-memory/client-core/src/main/java/com/redhat/thermostat/host/memory/client/core/HostMemoryViewProvider.java host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/MemoryStatDAO.java host-overview/client-core/src/main/java/com/redhat/thermostat/host/overview/client/core/HostOverviewViewProvider.java keyring/pom.xml keyring/src/main/java/com/redhat/thermostat/utils/keyring/Keyring.java launcher/src/main/java/com/redhat/thermostat/launcher/BundleManager.java launcher/src/main/java/com/redhat/thermostat/launcher/Launcher.java pom.xml storage/core/pom.xml storage/core/src/main/java/com/redhat/thermostat/storage/core/Storage.java unix-process-handler/src/main/java/com/redhat/thermostat/service/process/UNIXProcessHandler.java vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/VmClassStatViewProvider.java vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/VmCpuViewProvider.java vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/VmCpuStatDAO.java vm-gc/client-core/src/main/java/com/redhat/thermostat/vm/gc/client/core/VmGcViewProvider.java vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/VmGcStatDAO.java vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapDumpDetailsViewProvider.java vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapHistogramViewProvider.java vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapViewProvider.java vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectDetailsViewProvider.java vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectRootsViewProvider.java vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDAO.java vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/MemoryStatsViewProvider.java vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/VmMemoryStatDAO.java vm-overview/client-core/src/main/java/com/redhat/thermostat/vm/overview/client/core/VmOverviewViewProvider.java
diffstat 57 files changed, 730 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/agent/command/src/main/java/com/redhat/thermostat/agent/command/RequestReceiver.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/agent/command/src/main/java/com/redhat/thermostat/agent/command/RequestReceiver.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,7 @@
 
 package com.redhat.thermostat.agent.command;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.common.command.Request;
 import com.redhat.thermostat.common.command.Response;
 
@@ -48,6 +49,7 @@
  *
  * @see ReceiverRegistry#registerReceiver(RequestReceiver)
  */
+@ExtensionPoint
 public interface RequestReceiver {
 
     public Response receive(Request request);
--- a/agent/core/src/main/java/com/redhat/thermostat/agent/VmStatusListener.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/agent/core/src/main/java/com/redhat/thermostat/agent/VmStatusListener.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,13 +36,15 @@
 
 package com.redhat.thermostat.agent;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * A listener that is notified when a JVM starts or is stopped.
  * <p>
  * Register an instance of this class as an OSGi service, and it will be
  * notified of all VM {@link Status} events.
  */
-//@ExtensionPoint
+@ExtensionPoint
 public interface VmStatusListener {
 
     enum Status {
--- a/agent/core/src/main/java/com/redhat/thermostat/backend/Backend.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/agent/core/src/main/java/com/redhat/thermostat/backend/Backend.java	Tue Jan 15 13:00:50 2013 -0500
@@ -40,6 +40,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.common.LaunchException;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.dao.DAOFactory;
@@ -48,7 +49,11 @@
 /**
  * Represents a plugin that runs on the agent and performs monitoring of host
  * and applications.
+ * <p>
+ * To register a new backend, register an instance of the class with the OSGi
+ * service registry.
  */
+@ExtensionPoint
 public abstract class Backend implements Ordered {
 
     private boolean initialConfigurationComplete = false;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/pom.xml	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2013 Red Hat, Inc.
+
+ This file is part of Thermostat.
+
+ Thermostat is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ Thermostat is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Thermostat; see the file COPYING.  If not see
+ <http://www.gnu.org/licenses />.
+
+ Linking this code with other modules is making a combined work
+ based on this code.  Thus, the terms and conditions of the GNU
+ General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this code give
+ you permission to link this code with independent modules to
+ produce an executable, regardless of the license terms of these
+ independent modules, and to copy and distribute the resulting
+ executable under terms of your choice, provided that you also
+ meet, for each linked independent module, the terms and conditions
+ of the license of that module.  An independent module is a module
+ which is not derived from or based on this code.  If you modify
+ this code, you may extend this exception to your version of the
+ library, but you are not obligated to do so.  If you do not wish
+ to do so, delete this exception statement from your version.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>com.redhat.thermostat</groupId>
+    <artifactId>thermostat</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>thermostat-annotations</artifactId>
+  <packaging>bundle</packaging>
+
+  <name>Thermostat Annotations</name>
+  <url>${project.parent.url}</url>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>com.redhat.thermostat.annotations</Bundle-SymbolicName>
+            <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor>
+            <Export-Package>
+              com.redhat.thermostat.annotations,
+            </Export-Package>
+            <Private-Package>
+              com.redhat.thermostat.annotations.internal,
+            </Private-Package>
+            <!-- Do not autogenerate uses clauses in Manifests -->
+            <_nouses>true</_nouses>
+          </instructions>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <!-- dont try to run the annotation process on this module
+               it will pick up the service file and try to run the (not yet
+               compiled) annotation processor and fail mysteriously -->
+          <compilerArgument>-proc:none</compilerArgument>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/src/main/java/com/redhat/thermostat/annotations/ExtensionPoint.java	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates a point where the functionality can be extended by a plugin.
+ * To register the plugin, register a new instance of the class annotated by
+ * {@link ExtensionPoint} as an OSGi service.
+ * <p>
+ * To register a class as an OSGi service, use
+ * {@link BundleContext#registerService}.
+ * <p>
+ * This is the whiteboard pattern.
+ */
+@Documented
+@Retention(RetentionPolicy.SOURCE)
+public @interface ExtensionPoint {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/src/main/java/com/redhat/thermostat/annotations/Service.java	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that the annotated class is a service available through OSGi.
+ * Clients can obtain an instance of this service and use it directly.
+ * <p>
+ * An instance of this service (if one is registered) can be obtained using
+ * {@link BundleContext#getService(ServiceReference)} or
+ * {@link OSGIUtils#getService(Class)}.
+ * <p>
+ * This does not infer any behaviour on a class; this is for documentation
+ * purposes only.
+ */
+@Documented
+@Retention(RetentionPolicy.SOURCE)
+public @interface Service {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/src/main/java/com/redhat/thermostat/annotations/internal/AnnotationProcessor.java	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.annotations.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+
+/**
+ * An annotation processor that runs and finds @Service and @ExtensionPoint
+ * annotations. A list  of classes using these annotations are written to
+ * a <code>META-INF/thermostat/plugin-docs.xml<code> file.
+ */
+@SupportedAnnotationTypes("com.redhat.thermostat.*")
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
+public class AnnotationProcessor extends AbstractProcessor {
+
+    private enum ExposedAs { EXTENSION_POINT, SERVICE }
+
+    private boolean firstRound = false;
+
+    @Override
+    public synchronized void init(ProcessingEnvironment processingEnv) {
+        super.init(processingEnv);
+        firstRound = true;
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (!firstRound) {
+            return false;
+        }
+
+        firstRound = false;
+
+        processingEnv.getMessager().printMessage(Kind.NOTE, "Searching for Service and ExtensionPoint annotations");
+
+        List<PluginPointInformation> points = findPluginPoints(annotations, roundEnv);
+
+        processingEnv.getMessager().printMessage(Kind.NOTE, "found " + points.size() + " classes useful for plugins");
+
+        Element[] sourceElements = new Element[points.size()];
+        for (int i = 0; i < points.size(); i++) {
+            sourceElements[i] = points.get(i).annotatedClass;
+        }
+
+        if (points.size() > 0) {
+            try {
+                FileObject filer = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT,
+                        "",
+                        "META-INF" + File.separator + "thermostat" + File.separator + "plugin-docs.xml",
+                        sourceElements);
+                try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(filer.openOutputStream(), "UTF-8"))) {
+                    writeXml(writer, points);
+                }
+            } catch (IOException e) {
+                processingEnv.getMessager().printMessage(Kind.ERROR, "Error writing to docs file: " + e.getMessage());
+            }
+        }
+
+        return false;
+    }
+
+    private List<PluginPointInformation> findPluginPoints(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        List<PluginPointInformation> pluginPointInfo = new ArrayList<>();
+
+        for (TypeElement annotation : annotations) {
+            ExposedAs exposedType = null;
+            if (annotation.getSimpleName().toString().contains("Service")) {
+                exposedType = ExposedAs.SERVICE;
+            } else if (annotation.getSimpleName().toString().contains("ExtensionPoint")) {
+                exposedType = ExposedAs.EXTENSION_POINT;
+            } else {
+                processingEnv.getMessager().printMessage(Kind.WARNING, "Unrecognized annotation: " + annotation.getSimpleName());
+                continue;
+            }
+
+            Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(annotation);
+            for (Element element : elements) {
+                TypeElement te = (TypeElement) element;
+                pluginPointInfo.add(new PluginPointInformation(te, exposedType, processingEnv.getElementUtils().getDocComment(te)));
+            }
+        }
+        return pluginPointInfo;
+    }
+
+    private void writeXml(PrintWriter writer, List<PluginPointInformation> points) {
+        writer.println("<?xml?>");
+
+        writer.println("<!-- autogenerated by " + this.getClass().getName() + " -->");
+
+        for (PluginPointInformation info: points) {
+            String tag = info.exposedAs == ExposedAs.SERVICE ? "service" : "extension-point";
+
+            writer.println("  <" + tag + ">");
+            writer.println("    <name>" + info.annotatedClass.getQualifiedName() + "</name>");
+            if (info.javadoc != null) {
+                writer.println("    <doc><![CDATA[");
+                writer.println(info.javadoc);
+                writer.println("]]></doc>");
+            }
+            writer.println("  </" + tag + ">");
+        }
+    }
+
+    private static class PluginPointInformation {
+        private TypeElement annotatedClass;
+        private ExposedAs exposedAs;
+        private String javadoc;
+
+        public PluginPointInformation(TypeElement annotatedClass, ExposedAs exposedAs, String javadoc) {
+            this.annotatedClass = annotatedClass;
+            this.exposedAs = exposedAs;
+            this.javadoc = javadoc;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,2 @@
+# This jar provides the following annotation processors:
+com.redhat.thermostat.annotations.internal.AnnotationProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotations/src/test/java/com/redhat/thermostat/annotations/internal/AnnotationProcessorTest.java	Tue Jan 15 13:00:50 2013 -0500
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.annotations.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.redhat.thermostat.annotations.ExtensionPoint;
+import com.redhat.thermostat.annotations.Service;
+
+public class AnnotationProcessorTest {
+
+	private ProcessingEnvironment processingEnv;
+	private RoundEnvironment roundEnv;
+	private FileObject procesorOutputFile;
+	private Messager messager;
+	private Elements elementUtils;
+
+	private static final String AUTO_GENERATED_COMMENT = "<!-- autogenerated by " + AnnotationProcessor.class.getName() + " -->";
+
+	@Before
+	public void setUp() throws IOException {
+		procesorOutputFile = mock(FileObject.class);
+		Filer filer = mock(Filer.class);
+		when(filer.createResource(
+				eq(StandardLocation.CLASS_OUTPUT),
+				eq(""),
+				eq("META-INF/thermostat/plugin-docs.xml"),
+				any(Element.class)))
+			.thenReturn(procesorOutputFile);
+
+		messager = mock(Messager.class);
+
+		elementUtils = mock(Elements.class);
+
+		processingEnv = mock(ProcessingEnvironment.class);
+		when(processingEnv.getFiler()).thenReturn(filer);
+		when(processingEnv.getMessager()).thenReturn(messager);
+        when(processingEnv.getElementUtils()).thenReturn(elementUtils);
+
+        roundEnv = mock(RoundEnvironment.class);
+	}
+
+	@Test
+	public void testNoAnnotationProducesNoFile() {
+		Set<? extends TypeElement> annotations = new TreeSet<>();
+
+		AnnotationProcessor processor = new AnnotationProcessor();
+		processor.init(processingEnv);
+		processor.process(annotations, roundEnv);
+
+		verifyZeroInteractions(procesorOutputFile);
+	}
+
+	@Test
+    public void testProcessOnServiceClass() throws IOException {
+		final String CLASS_NAME = "c.r.t.annotations.Test";
+		final String JAVADOC = "some javadoc";
+		final String ANNOTATION_CLASS_NAME = Service.class.getName();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        when(procesorOutputFile.openOutputStream()).thenReturn(out);
+
+        TypeElement serviceAnnotation = mock(TypeElement.class);
+        Name serviceAnnotationName = mock(Name.class);
+        when(serviceAnnotationName.toString()).thenReturn(ANNOTATION_CLASS_NAME);
+        when(serviceAnnotation.getSimpleName()).thenReturn(serviceAnnotationName);
+
+        TypeElement annotatedClass = mock(TypeElement.class);
+        Name annotatedClassName = mock(Name.class);
+        when(annotatedClass.getQualifiedName()).thenReturn(annotatedClassName);
+        when(annotatedClassName.toString()).thenReturn(CLASS_NAME);
+
+        Set<TypeElement> annotations = new HashSet();
+        annotations.add(serviceAnnotation);
+
+        Set annotatedClasses = new HashSet();
+        annotatedClasses.add(annotatedClass);
+
+        when(roundEnv.getElementsAnnotatedWith(serviceAnnotation)).thenReturn(annotatedClasses);
+
+        when(elementUtils.getDocComment(annotatedClass)).thenReturn(JAVADOC);
+
+        AnnotationProcessor processor = new AnnotationProcessor();
+        processor.init(processingEnv);
+        processor.process(annotations, roundEnv);
+
+        String actualFileContents = out.toString("UTF-8");
+        String expectedFileContents = "<?xml?>\n"
+        		+ AUTO_GENERATED_COMMENT + "\n"
+                + "  <service>\n"
+                + "    <name>" + CLASS_NAME + "</name>\n"
+                + "    <doc><![CDATA[\n"
+                + JAVADOC + "\n"
+                + "]]></doc>\n"
+                + "  </service>\n"
+                + "";
+
+        assertEquals(expectedFileContents, actualFileContents);
+    }
+
+	@Test
+    public void testProcessOnExtensionPointClass() throws IOException {
+		final String CLASS_NAME = "c.r.t.annotations.Test";
+		final String JAVADOC = "some javadoc";
+		final String ANNOTATION_CLASS_NAME = ExtensionPoint.class.getName();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        when(procesorOutputFile.openOutputStream()).thenReturn(out);
+
+        TypeElement serviceAnnotation = mock(TypeElement.class);
+        Name serviceAnnotationName = mock(Name.class);
+        when(serviceAnnotationName.toString()).thenReturn(ANNOTATION_CLASS_NAME);
+        when(serviceAnnotation.getSimpleName()).thenReturn(serviceAnnotationName);
+
+        TypeElement annotatedClass = mock(TypeElement.class);
+        Name annotatedClassName = mock(Name.class);
+        when(annotatedClass.getQualifiedName()).thenReturn(annotatedClassName);
+        when(annotatedClassName.toString()).thenReturn(CLASS_NAME);
+
+        Set<TypeElement> annotations = new HashSet();
+        annotations.add(serviceAnnotation);
+
+        Set annotatedClasses = new HashSet();
+        annotatedClasses.add(annotatedClass);
+
+        when(roundEnv.getElementsAnnotatedWith(serviceAnnotation)).thenReturn(annotatedClasses);
+
+        when(elementUtils.getDocComment(annotatedClass)).thenReturn(JAVADOC);
+
+        AnnotationProcessor processor = new AnnotationProcessor();
+        processor.init(processingEnv);
+        processor.process(annotations, roundEnv);
+
+        String actualFileContents = out.toString("UTF-8");
+        String expectedFileContents = "<?xml?>\n"
+        		+ AUTO_GENERATED_COMMENT + "\n"
+                + "  <extension-point>\n"
+                + "    <name>" + CLASS_NAME + "</name>\n"
+                + "    <doc><![CDATA[\n"
+                + JAVADOC + "\n"
+                + "]]></doc>\n"
+                + "  </extension-point>\n"
+                + "";
+
+        assertEquals(expectedFileContents, actualFileContents);
+    }
+
+}
--- a/client/command/src/main/java/com/redhat/thermostat/client/command/RequestQueue.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/command/src/main/java/com/redhat/thermostat/client/command/RequestQueue.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,7 @@
 
 package com.redhat.thermostat.client.command;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.command.Request;
 
 /**
@@ -45,6 +46,7 @@
  * and response (if any) are processed asynchronously. An instance of this can
  * be obtained from OSGi.
  */
+@Service
 public interface RequestQueue {
 
     public void putRequest(Request request);
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/InformationService.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/InformationService.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,7 @@
 
 package com.redhat.thermostat.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.controllers.InformationServiceController;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.dao.Ref;
@@ -46,7 +47,13 @@
  * <p>
  * An {@code InformationService} provides some sort of information about
  * something. Plug-ins should normally implement this as a entry point.
+ * <p>
+ * To provide an implementation of {@link InformationService}, register an
+ * instance of this interface as an OSGi service with the property
+ * {@link Constants#GENERIC_SERVICE_CLASSNAME} set to the name of the Class
+ * that this {@link InformationService} provides information for.
  */
+@ExtensionPoint
 public interface InformationService<T extends Ref> extends Ordered {
     
     /**
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/views/AgentInformationViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/views/AgentInformationViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,12 @@
 
 package com.redhat.thermostat.client.core.views;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
- * Provides an AgentInformationViewProvider
+ * Provides an {@link AgentInformationDisplayView}
  */
+@ExtensionPoint
 public interface AgentInformationViewProvider extends ViewProvider {
 
     @Override
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/views/ClientConfigViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/views/ClientConfigViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,12 @@
 
 package com.redhat.thermostat.client.core.views;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * A services that provides {@link ClientConfigurationView}s.
  */
+@ExtensionPoint
 public interface ClientConfigViewProvider extends ViewProvider {
 
     @Override
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/views/HostInformationViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/views/HostInformationViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,12 @@
 
 package com.redhat.thermostat.client.core.views;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * This services provides an appropriate {@link HostInformationView}.
  */
+@ExtensionPoint
 public interface HostInformationViewProvider extends ViewProvider {
 
     @Override
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/views/VmInformationViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/views/VmInformationViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,12 @@
 
 package com.redhat.thermostat.client.core.views;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * A service that provides a {@link VmInformationView}
  */
+@ExtensionPoint
 public interface VmInformationViewProvider extends ViewProvider {
 
     @Override
--- a/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/ContextAction.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/ContextAction.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,8 @@
 
 package com.redhat.thermostat.client.osgi.service;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * Marker service for context menu actions.
  * <br /><br />
@@ -56,6 +58,7 @@
  * 
  * <strong>Exported entry point</strong>: com.redhat.thermostat.client.osgi.service.ContextAction
  */
+@ExtensionPoint
 public interface ContextAction {
     
     String getName();
--- a/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/MenuAction.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/MenuAction.java	Tue Jan 15 13:00:50 2013 -0500
@@ -35,6 +35,8 @@
  */
 package com.redhat.thermostat.client.osgi.service;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * Allows plugins to register menu items.
  * <p>
@@ -42,6 +44,7 @@
  * register a service that implements this class with the property
  * "parentMenu" set to "File".
  */
+@ExtensionPoint
 public interface MenuAction extends ContextAction {
 
     public static enum Type {
--- a/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/VMContextAction.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/osgi/service/VMContextAction.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,12 +36,14 @@
 
 package com.redhat.thermostat.client.osgi.service;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.Filter;
 import com.redhat.thermostat.common.dao.VmRef;
 
 /**
  * A context action for VMs
  */
+@ExtensionPoint
 public interface VMContextAction extends ContextAction {
 
     void execute(VmRef referece);
--- a/common/core/pom.xml	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/pom.xml	Tue Jan 15 13:00:50 2013 -0500
@@ -160,6 +160,12 @@
       <systemPath>${java.home}/../lib/tools.jar</systemPath>
     </dependency>
     <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-annotations</artifactId>
+      <version>${project.version}</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
     	<groupId>com.redhat.thermostat</groupId>
     	<artifactId>thermostat-keyring</artifactId>
     	<version>${project.version}</version>
--- a/common/core/src/main/java/com/redhat/thermostat/common/ApplicationService.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/ApplicationService.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,6 +38,9 @@
 
 import java.util.concurrent.ExecutorService;
 
+import com.redhat.thermostat.annotations.Service;
+
+@Service
 public interface ApplicationService {
 
     ApplicationCache getApplicationCache();
--- a/common/core/src/main/java/com/redhat/thermostat/common/CommandLoadingBundleActivator.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/CommandLoadingBundleActivator.java	Tue Jan 15 13:00:50 2013 -0500
@@ -45,7 +45,7 @@
 import com.redhat.thermostat.common.cli.CommandRegistry;
 import com.redhat.thermostat.common.cli.CommandRegistryImpl;
 
-/*
+/**
  * Superclass for activators that need to register commands.  The bundle for this
  * activator should contain a META-INF/services/com.redhat.thermostat.common.cli.Command
  * file containing the class names that should be loaded as commands.  If this activator
--- a/common/core/src/main/java/com/redhat/thermostat/common/DbService.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/DbService.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.common;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.ConnectionException;
 
+@Service
 public interface DbService {
 
     /**
--- a/common/core/src/main/java/com/redhat/thermostat/common/TimerFactory.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/TimerFactory.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,9 @@
 
 package com.redhat.thermostat.common;
 
+/**
+ * An instance of this can be obtained from {@link ApplicationService}.
+ */
 public interface TimerFactory {
 
     Timer createTimer();
--- a/common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,6 +38,8 @@
 
 import org.apache.commons.cli.Options;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
+
 /**
  * Represents a command on the command line.
  * <p>
@@ -51,6 +53,7 @@
  * <p>
  * @see CommandRegistry
  */
+@ExtensionPoint
 public interface Command {
 
     public static final String NAME = "COMMAND_NAME";
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,10 +38,12 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.AgentInformation;
 
+@Service
 public interface AgentInfoDAO extends Countable {
 
     static final Key<Long> START_TIME_KEY = new Key<>("startTime", false);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,10 +38,12 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.BackendInformation;
 
+@Service
 public interface BackendInfoDAO {
 
     static final Key<String> BACKEND_NAME = new Key<>("name", true);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,10 +38,12 @@
 
 import java.util.Collection;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.HostInfo;
 
+@Service
 public interface HostInfoDAO extends Countable {
 
     static Key<String> hostNameKey = new Key<>("hostname", true);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,10 +38,12 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.NetworkInterfaceInfo;
 
+@Service
 public interface NetworkInterfaceInfoDAO {
 
     static Key<String> ifaceKey = new Key<>("interfaceName", true);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -40,10 +40,12 @@
 import java.util.List;
 import java.util.Map;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.VmInfo;
 
+@Service
 public interface VmInfoDAO extends Countable {
 
     static final Key<Integer> vmPidKey = new Key<>("vmPid", false);
--- a/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.host.cpu.client.core;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@Service
 public interface HostCpuViewProvider extends ViewProvider {
 
     @Override
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,12 +38,14 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.Countable;
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.CpuStat;
 
+@Service
 public interface CpuStatDAO extends Countable {
 
     static Key<List<Double>> cpuLoadKey = new Key<>("perProcessorUsage", false);
--- a/host-memory/client-core/src/main/java/com/redhat/thermostat/host/memory/client/core/HostMemoryViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/host-memory/client-core/src/main/java/com/redhat/thermostat/host/memory/client/core/HostMemoryViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.host.memory.client.core;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@Service
 public interface HostMemoryViewProvider extends ViewProvider {
 
     @Override
--- a/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/MemoryStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/MemoryStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,12 +38,14 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.Countable;
 import com.redhat.thermostat.common.dao.HostRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.MemoryStat;
 
+@Service
 public interface MemoryStatDAO extends Countable {
 
     static Key<Long> memoryTotalKey = new Key<>("total", false);
--- a/host-overview/client-core/src/main/java/com/redhat/thermostat/host/overview/client/core/HostOverviewViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/host-overview/client-core/src/main/java/com/redhat/thermostat/host/overview/client/core/HostOverviewViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.host.overview.client.core;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@Service
 public interface HostOverviewViewProvider extends ViewProvider {
 
     @Override
--- a/keyring/pom.xml	Tue Jan 15 11:38:58 2013 -0500
+++ b/keyring/pom.xml	Tue Jan 15 13:00:50 2013 -0500
@@ -115,6 +115,12 @@
       <artifactId>org.osgi.compendium</artifactId>
       <scope>provided</scope>
     </dependency>
-    
+
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-annotations</artifactId>
+      <version>${project.version}</version>
+      <scope>compile</scope>
+    </dependency>
   </dependencies>
 </project>
--- a/keyring/src/main/java/com/redhat/thermostat/utils/keyring/Keyring.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/keyring/src/main/java/com/redhat/thermostat/utils/keyring/Keyring.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,14 @@
 
 package com.redhat.thermostat.utils.keyring;
 
+import com.redhat.thermostat.annotations.Service;
+
 /**
  * Manages sensitive data, like {@link Credentials}, securely.
+ * <p>
+ * An instance of this class can be obtained from OSGi as a service.
  */
+@Service
 public interface Keyring {
 
     /**
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/BundleManager.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/BundleManager.java	Tue Jan 15 13:00:50 2013 -0500
@@ -42,6 +42,7 @@
 import org.osgi.framework.BundleException;
 import org.osgi.framework.launch.Framework;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.Configuration;
 import com.redhat.thermostat.common.cli.CommandInfoNotFoundException;
 import com.redhat.thermostat.common.cli.CommandInfoSource;
@@ -50,6 +51,7 @@
 /**
  * A Service that provides features to load bundles for given command names.
  */
+@Service
 public abstract class BundleManager {
 
     public abstract void setPrintOSGiInfo(boolean printOSGiInfo);
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/Launcher.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/Launcher.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,12 +38,14 @@
 
 import java.util.Collection;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.tools.ApplicationState;
 
 /**
  * Launcher is the main entry point for all Thermostat commands.
  */
+@Service
 public interface Launcher {
 
     /**
--- a/pom.xml	Tue Jan 15 11:38:58 2013 -0500
+++ b/pom.xml	Tue Jan 15 13:00:50 2013 -0500
@@ -117,6 +117,7 @@
   </repositories>
 
   <modules>
+    <module>annotations</module>
     <module>distribution</module>
     <module>main</module>
     <module>launcher</module>
--- a/storage/core/pom.xml	Tue Jan 15 11:38:58 2013 -0500
+++ b/storage/core/pom.xml	Tue Jan 15 13:00:50 2013 -0500
@@ -84,6 +84,12 @@
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-annotations</artifactId>
+      <version>${project.version}</version>
+      <scope>compile</scope>
+    </dependency>
   </dependencies>
 
 </project>
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/core/Storage.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/storage/core/src/main/java/com/redhat/thermostat/storage/core/Storage.java	Tue Jan 15 13:00:50 2013 -0500
@@ -39,6 +39,7 @@
 import java.io.InputStream;
 import java.util.UUID;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.storage.model.Pojo;
 
 /**
@@ -46,6 +47,7 @@
  * Implementations may use memory, a file, some database or even a network
  * server as the backing store.
  */
+@Service
 public interface Storage {
 
     void setAgentId(UUID id);
--- a/unix-process-handler/src/main/java/com/redhat/thermostat/service/process/UNIXProcessHandler.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/unix-process-handler/src/main/java/com/redhat/thermostat/service/process/UNIXProcessHandler.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,6 +36,9 @@
 
 package com.redhat.thermostat.service.process;
 
+import com.redhat.thermostat.annotations.Service;
+
+@Service
 public interface UNIXProcessHandler {
     
     public static String ID = "com.redhat.thermostat.service.process.UNIXProcessHandler";
--- a/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/VmClassStatViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/VmClassStatViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,9 +36,10 @@
 
 package com.redhat.thermostat.vm.classstat.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
-
+@ExtensionPoint
 public interface VmClassStatViewProvider extends ViewProvider {
 
     @Override
--- a/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,11 +38,13 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.VmClassStat;
 
+@Service
 public interface VmClassStatDAO {
 
     static final Key<Long> loadedClassesKey = new Key<>("loadedClasses", false);
@@ -54,4 +56,4 @@
 
     public void putVmClassStat(VmClassStat stat);
 
-}
\ No newline at end of file
+}
--- a/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/VmCpuViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/VmCpuViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.cpu.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface VmCpuViewProvider extends ViewProvider {
 
     @Override
--- a/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/VmCpuStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/VmCpuStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,11 +38,13 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.VmCpuStat;
 
+@Service
 public interface VmCpuStatDAO {
 
     static final Key<Double> vmCpuLoadKey = new Key<>("cpuLoad", false);
--- a/vm-gc/client-core/src/main/java/com/redhat/thermostat/vm/gc/client/core/VmGcViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-gc/client-core/src/main/java/com/redhat/thermostat/vm/gc/client/core/VmGcViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.gc.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface VmGcViewProvider extends ViewProvider {
 
     @Override
--- a/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/VmGcStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/VmGcStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,11 +38,13 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.VmGcStat;
 
+@Service
 public interface VmGcStatDAO {
 
     static final Key<String> collectorKey = new Key<>("collectorName", false);
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapDumpDetailsViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapDumpDetailsViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.heap.analysis.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface HeapDumpDetailsViewProvider extends ViewProvider {
 
     @Override
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapHistogramViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapHistogramViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.heap.analysis.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface HeapHistogramViewProvider extends ViewProvider {
 
     @Override
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.heap.analysis.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface HeapViewProvider extends ViewProvider {
 
     @Override
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectDetailsViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectDetailsViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.heap.analysis.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface ObjectDetailsViewProvider extends ViewProvider {
 
     @Override
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectRootsViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/ObjectRootsViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.heap.analysis.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface ObjectRootsViewProvider extends ViewProvider {
 
     @Override
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -41,11 +41,13 @@
 import java.io.InputStream;
 import java.util.Collection;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.HeapInfo;
 
+@Service
 public interface HeapDAO {
 
     static final Key<String> heapIdKey = new Key<String>("heapId", false);
--- a/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/MemoryStatsViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/MemoryStatsViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.memory.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface MemoryStatsViewProvider extends ViewProvider {
 
     @Override
--- a/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/VmMemoryStatDAO.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/VmMemoryStatDAO.java	Tue Jan 15 13:00:50 2013 -0500
@@ -38,12 +38,14 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.annotations.Service;
 import com.redhat.thermostat.common.dao.VmRef;
 import com.redhat.thermostat.storage.core.Category;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.model.VmMemoryStat;
 import com.redhat.thermostat.storage.model.VmMemoryStat.Generation;
 
+@Service
 public interface VmMemoryStatDAO {
 
     static final Key<Generation[]> generationsKey = new Key<>("generations", false);
--- a/vm-overview/client-core/src/main/java/com/redhat/thermostat/vm/overview/client/core/VmOverviewViewProvider.java	Tue Jan 15 11:38:58 2013 -0500
+++ b/vm-overview/client-core/src/main/java/com/redhat/thermostat/vm/overview/client/core/VmOverviewViewProvider.java	Tue Jan 15 13:00:50 2013 -0500
@@ -36,8 +36,10 @@
 
 package com.redhat.thermostat.vm.overview.client.core;
 
+import com.redhat.thermostat.annotations.ExtensionPoint;
 import com.redhat.thermostat.client.core.views.ViewProvider;
 
+@ExtensionPoint
 public interface VmOverviewViewProvider extends ViewProvider {
 
     @Override