* moved modifying methods of @PluginRegistry@ into @MutablePluginRegistry@

git-svn-id: svn+ssh://svn.synyx.de/var/svn/synyx/opensource/hera/trunk@8470 5a64d73e-33d6-4ccc-9058-23f8668ecac9
This commit is contained in:
Oliver Gierke
2009-12-28 20:39:48 +00:00
parent 273a0e169a
commit 456575717f
3 changed files with 60 additions and 29 deletions

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.synyx.hera.core;
import java.util.List;
/**
* Extension of {@link PluginRegistry} with additional methods to modify the
* registry.
*
* @author Oliver Gierke - gierke@synyx.de
*/
public interface MutablePluginRegistry<T extends Plugin<S>, S> extends
PluginRegistry<T, S> {
/**
* Register plugins.
*
* @param plugins the plugins to set
*/
void setPlugins(List<? extends T> plugins);
/**
* Adds a given plugin to the registry.
*
* @param plugin
*/
void addPlugin(T plugin);
/**
* Removes a given plugin from the registry.
*
* @param plugin
*/
boolean removePlugin(T plugin);
}

View File

@@ -13,30 +13,6 @@ import java.util.List;
*/
public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
/**
* Register plugins.
*
* @param plugins the plugins to set
*/
void setPlugins(List<? extends T> plugins);
/**
* Adds a given plugin to the registry.
*
* @param plugin
*/
void addPlugin(T plugin);
/**
* Removes a given plugin from the registry.
*
* @param plugin
*/
boolean removePlugin(T plugin);
/**
* Returns the first plugin found for the given originating system. Thus,
* further configured plugins are ignored.

View File

@@ -30,7 +30,7 @@ import java.util.List;
* @author Oliver Gierke - gierke@synyx.de
*/
public class SimplePluginRegistry<T extends Plugin<S>, S> implements
PluginRegistry<T, S> {
MutablePluginRegistry<T, S> {
// Registered plugins
private List<T> plugins;
@@ -78,7 +78,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements
/*
* (non-Javadoc)
*
* @see org.synyx.hera.core.PluginRegistry#setPlugins(java.util.List)
* @see org.synyx.hera.core.MutablePluginRegistry#setPlugins(java.util.List)
*/
public void setPlugins(List<? extends T> plugins) {
@@ -90,7 +90,9 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements
/*
* (non-Javadoc)
*
* @see org.synyx.hera.core.PluginRegistry#addPlugin(T)
* @see
* org.synyx.hera.core.MutablePluginRegistry#addPlugin(org.synyx.hera.core
* .Plugin)
*/
public void addPlugin(T plugin) {
@@ -102,8 +104,8 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements
* (non-Javadoc)
*
* @see
* org.synyx.hera.core.PluginRegistry#removePlugin(org.synyx.hera.core.Plugin
* )
* org.synyx.hera.core.MutablePluginRegistry#removePlugin(org.synyx.hera
* .core.Plugin)
*/
public boolean removePlugin(T plugin) {