changeset 992:e7411f4afdf1

Add some javadocs to plugin-related classes Reviewed-by: rkennke Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-February/005798.html
author Omair Majid <omajid@redhat.com>
date Thu, 21 Feb 2013 16:26:10 -0500
parents a379ce735df5
children e7ffb5dcd2dd
files launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginCommandInfoSource.java launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginConfigurationParser.java
diffstat 2 files changed, 43 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginCommandInfoSource.java	Thu Feb 21 13:34:34 2013 -0500
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginCommandInfoSource.java	Thu Feb 21 16:26:10 2013 -0500
@@ -56,6 +56,16 @@
 import com.redhat.thermostat.launcher.internal.PluginConfiguration.CommandExtensions;
 import com.redhat.thermostat.launcher.internal.PluginConfiguration.NewCommand;
 
+/**
+ * Searches for plugins under <code>$THERMOSTAT_HOME/plugins/</code> and
+ * provides information about all commands specified by them.
+ * <p>
+ * Each plugin is located under
+ * <code>$THERMOSTAT_HOME/plugins/$PLUGIN_NAME/</code> and must have a
+ * <code>plugin.xml</code> file in the main plugin directory.
+ *
+ * @see PluginConfigurationParser how the plugin.xml file is parsed
+ */
 public class PluginCommandInfoSource implements CommandInfoSource {
 
     private static final String PLUGIN_CONFIG_FILE = "plugin.xml";
@@ -69,8 +79,7 @@
         this(new File(internalJarRoot), new File(pluginRootDir), new PluginConfigurationParser());
     }
 
-    public PluginCommandInfoSource(File internalJarRoot, File pluginRootDir,
-            PluginConfigurationParser parser) {
+    PluginCommandInfoSource(File internalJarRoot, File pluginRootDir, PluginConfigurationParser parser) {
         File[] pluginDirs = pluginRootDir.listFiles();
         if (pluginDirs == null) {
             logger.log(Level.SEVERE, "plugin root dir " + pluginRootDir + " does not exist");
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginConfigurationParser.java	Thu Feb 21 13:34:34 2013 -0500
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/PluginConfigurationParser.java	Thu Feb 21 16:26:10 2013 -0500
@@ -64,7 +64,38 @@
 
 /**
  * Parses the configuration of a plugin as specified in an {@code File} or an
- * {@code InputStream}.
+ * {@code InputStream}. This configuration describes which new commands this
+ * plugin provides as well as additional jars to load for existing commands.
+ * <p>
+ * A example configuration looks like the following:
+ *
+ * <pre>
+ * &lt;?xml version="1.0"?&gt;
+ * &lt;plugin&gt;
+ *   &lt;commands&gt;
+ *     &lt;command type="extends"&gt;
+ *       &lt;name&gt;gui&lt;/name&gt;
+ *       &lt;bundles&gt;
+ *         &lt;bundle&gt;hello-world-plugin-0.1-SNAPSHOT.jar&lt;/bundle&gt;
+ *       &lt;/bundles&gt;
+ *       &lt;dependencies&gt;
+ *         &lt;dependency&gt;thermostat-client-core-0.6.0-SNAPSHOT.jar&lt;/dependency&gt;
+ *       &lt;/dependencies&gt;
+ *     &lt;/command&gt;
+ *     &lt;command type="provides"&gt;
+ *       &lt;name&gt;hello&lt;/name&gt;
+ *       &lt;description&gt;print hello&lt;/description&gt;
+ *       &lt;usage&gt;hello&lt;/usage&gt;
+ *       &lt;bundles&gt;
+ *         &lt;bundle&gt;hello-world-plugin-0.1-SNAPSHOT.jar&lt;/bundle&gt;
+ *       &lt;/bundles&gt;
+ *       &lt;dependencies&gt;
+ *         &lt;dependency&gt;thermostat-client-core-0.6.0-SNAPSHOT.jar&lt;/dependency&gt;
+ *       &lt;/dependencies&gt;
+ *     &lt;/command&gt;
+ *   &lt;/commands&gt;
+ * &lt;/plugin&gt;
+ * </pre>
  * <p>
  * This class is thread-safe
  */