mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-01 12:19:14 +01:00
added PluginBackendListener
This commit is contained in:
@@ -42,6 +42,9 @@ import sonia.scm.util.Util;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -50,6 +53,30 @@ import java.util.Arrays;
|
||||
public abstract class AbstractPluginBackend implements PluginBackend
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void addListener(PluginBackendListener listener)
|
||||
{
|
||||
listenerSet.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param listeners
|
||||
*/
|
||||
@Override
|
||||
public void addListeners(Collection<PluginBackendListener> listeners)
|
||||
{
|
||||
listenerSet.addAll(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -79,4 +106,37 @@ public abstract class AbstractPluginBackend implements PluginBackend
|
||||
addScannedFiles(Arrays.asList(scannedFiles));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void removeListener(PluginBackendListener listener)
|
||||
{
|
||||
listenerSet.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param plugins
|
||||
*/
|
||||
protected void fireEvent(Collection<PluginInformation> plugins)
|
||||
{
|
||||
for (PluginBackendListener listener : listenerSet)
|
||||
{
|
||||
listener.addedNewPlugins(plugins);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Set<PluginBackendListener> listenerSet =
|
||||
new HashSet<PluginBackendListener>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user