Rename methods in PluginConfigFactory to be more explicit

The methods in PluginConfigFactory that return the plugin
configuration are renamed so that it is more explicit which plugin
configuration is returned (the plugin configuration from
'gerrit.config' or from 'project.config').

This renaming breaks plugins that already use PluginConfigFactory, but
since PluginConfigFactory was introduced quite late in the 2.8
development phase it should be OK to do the rename before 2.8 is
released.

In a future change it is planned to add support for plugin
configuration that is stored in own configuration files (e.g.
'my-plugin.config'). For this it is required to add new accessor
methods to PluginConfigFactory. The rename of the existing methods
ensures that there will be no conflict with the names of the new
accessor methods.

In addition this change adds JavaDoc comments to the methods in
PluginConfigFactory so that it is more clear which plugin
configuration they return.

Change-Id: I7c3e97d70cb16457cab6062e5d5126d8ed5de022
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index 7a35115..5e10a62 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -482,7 +482,7 @@
 
 [...]
 
-String language = cfg.get("helloworld")
+String language = cfg.getFromGerritConfig("helloworld")
                      .getString("language", "English");
 ----
 
@@ -528,7 +528,7 @@
 
 [...]
 
-boolean enabled = cfg.get(project, "helloworld")
+boolean enabled = cfg.getFromProjectConfig(project, "helloworld")
                      .getBoolean("enabled", false);
 ----
 
@@ -542,7 +542,7 @@
 
 [...]
 
-boolean enabled = cfg.getWithInheritance(project, "helloworld")
+boolean enabled = cfg.getFromProjectConfigWithInheritance(project, "helloworld")
                      .getBoolean("enabled", false);
 ----
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
index 90b6d2f..294d8a5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
@@ -37,12 +37,49 @@
     this.projectStateFactory = projectStateFactory;
   }
 
-  public PluginConfig get(String pluginName) {
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'gerrit.config' file.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'gerrit.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   *   [plugin "my-plugin"]
+   *     myKey = myValue
+   *
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'gerrit.config' file
+   */
+  public PluginConfig getFromGerritConfig(String pluginName) {
     return new PluginConfig(pluginName, cfg);
   }
 
-  public PluginConfig get(Project.NameKey projectName, String pluginName)
-      throws NoSuchProjectException {
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'project.config' file of the specified project.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'project.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   *   [plugin "my-plugin"]
+   *     myKey = myValue
+   *
+   * @param projectName the name of the project for which the plugin
+   *        configuration should be returned
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'project.config' file of the
+   *         specified project
+   * @throws NoSuchProjectException thrown if the specified project does not
+   *         exist
+   */
+  public PluginConfig getFromProjectConfig(Project.NameKey projectName,
+      String pluginName) throws NoSuchProjectException {
     ProjectState projectState = projectCache.get(projectName);
     if (projectState == null) {
       throw new NoSuchProjectException(projectName);
@@ -50,8 +87,45 @@
     return projectState.getConfig().getPluginConfig(pluginName);
   }
 
-  public PluginConfig getWithInheritance(Project.NameKey projectName,
-      String pluginName) throws NoSuchProjectException {
-    return get(projectName, pluginName).withInheritance(projectStateFactory);
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'project.config' file of the specified project. Parameters which are not
+   * set in the 'project.config' of this project are inherited from the parent
+   * project's 'project.config' files.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'project.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   * child project:
+   *   [plugin "my-plugin"]
+   *     myKey = childValue
+   *
+   * parent project:
+   *   [plugin "my-plugin"]
+   *     myKey = parentValue
+   *     anotherKey = someValue
+   *
+   * return:
+   *   [plugin "my-plugin"]
+   *     myKey = childValue
+   *     anotherKey = someValue
+   *
+   * @param projectName the name of the project for which the plugin
+   *        configuration should be returned
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'project.config' file of the
+   *         specified project with inherited non-set parameters from the
+   *         parent projects
+   * @throws NoSuchProjectException thrown if the specified project does not
+   *         exist
+   */
+  public PluginConfig getFromProjectConfigWithInheritance(
+      Project.NameKey projectName, String pluginName)
+      throws NoSuchProjectException {
+    return getFromProjectConfig(projectName, pluginName).withInheritance(
+        projectStateFactory);
   }
 }