Search in sources :

Example 1 with RegistryDonePlugin

use of aQute.bnd.service.RegistryDonePlugin in project bnd by bndtools.

the class Processor method getPlugins.

/**
	 * Return a list of plugins. Plugins are defined with the -plugin command.
	 * They are class names, optionally associated with attributes. Plugins can
	 * implement the Plugin interface to see these attributes. Any object can be
	 * a plugin.
	 */
public Set<Object> getPlugins() {
    Set<Object> p;
    synchronized (this) {
        p = plugins;
        if (p != null)
            return p;
        plugins = p = new CopyOnWriteArraySet<>();
        missingCommand = new HashSet<String>();
    }
    // We only use plugins now when they are defined on our level
    // and not if it is in our parent. We inherit from our parent
    // through the previous block.
    String spe = getProperty(PLUGIN);
    if (NONE.equals(spe))
        return p;
    // The owner of the plugin is always in there.
    p.add(this);
    setTypeSpecificPlugins(p);
    if (parent != null)
        p.addAll(parent.getPlugins());
    //
    // Look only local
    //
    spe = mergeLocalProperties(PLUGIN);
    String pluginPath = mergeProperties(PLUGINPATH);
    loadPlugins(p, spe, pluginPath);
    addExtensions(p);
    for (RegistryDonePlugin rdp : getPlugins(RegistryDonePlugin.class)) {
        try {
            rdp.done();
        } catch (Exception e) {
            error("Calling done on %s, gives an exception %s", rdp, e);
        }
    }
    return p;
}
Also used : RegistryDonePlugin(aQute.bnd.service.RegistryDonePlugin) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) FileNotFoundException(java.io.FileNotFoundException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

RegistryDonePlugin (aQute.bnd.service.RegistryDonePlugin)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)1