You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2013/10/06 22:00:53 UTC

Re: svn commit: r1529670 - /commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java

On 6 October 2013 20:47,  <jl...@apache.org> wrote:
> Author: jlmonteiro
> Date: Sun Oct  6 19:47:22 2013
> New Revision: 1529670
>
> URL: http://svn.apache.org/r1529670
> Log:
> Adding a constant for the activation flag.
>
> Modified:
>     commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java
>
> Modified: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java?rev=1529670&r1=1529669&r2=1529670&view=diff
> ==============================================================================
> --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java (original)
> +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java Sun Oct  6 19:47:22 2013
> @@ -29,13 +29,18 @@ import java.util.regex.Pattern;
>  public final class PluginRepository {
>      public static Collection<PluginInfo> PLUGIN_INFO = new CopyOnWriteArrayList<PluginInfo>();
>
> +    /** This flag is used to activate a plugin by its name [plugin.name]. The default value is true which means that
> +     * every plugin discovered will be used.
> +     */
> +    public static final String ACTIVATED_FLAG = ".activated";
> +

Thanks, I think it's getting there.

Perhaps it could be linked to the following:

http://commons.apache.org/sandbox/commons-monitoring/configuration.html

[Unfortunately, the URL will change on promotion, so including it in
Javadoc is not ideal.
I think it would be OK in code comments though, as a developer should
be able to work out the new location.]

Additionally, maybe the documentation page should link to the constant name.

The class will only behave correctly if the exact property name is
used, which is why it's important that the documentation agrees with
the code.

>      static {
>          for (final Plugin plugin : ServiceLoader.load(Plugin.class, Plugin.class.getClassLoader())) {
>              final String name = plugin.name();
>              if (name == null) {
>                  throw new IllegalArgumentException("plugin name can't be null");
>              }
> -            if (!Configuration.is(name + ".activated", true)) {
> +            if (!Configuration.is(name + ACTIVATED_FLAG, true)) {
>                  continue;
>              }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org