Search in sources :

Example 1 with PluginRegistration

use of com.gitblit.models.PluginRegistry.PluginRegistration in project gitblit by gitblit.

the class PluginManager method getRegisteredPlugins.

@Override
public synchronized List<PluginRegistration> getRegisteredPlugins() {
    List<PluginRegistration> list = new ArrayList<PluginRegistration>();
    Map<String, PluginRegistration> map = new TreeMap<String, PluginRegistration>();
    for (PluginRegistry registry : getRegistries()) {
        list.addAll(registry.registrations);
        for (PluginRegistration reg : list) {
            reg.installedRelease = null;
            map.put(reg.id, reg);
        }
    }
    for (PluginWrapper pw : pf4j.getPlugins()) {
        String id = pw.getDescriptor().getPluginId();
        Version pv = pw.getDescriptor().getVersion();
        PluginRegistration reg = map.get(id);
        if (reg != null) {
            reg.installedRelease = pv.toString();
        }
    }
    return list;
}
Also used : Version(ro.fortsoft.pf4j.Version) PluginRegistry(com.gitblit.models.PluginRegistry) ArrayList(java.util.ArrayList) PluginRegistration(com.gitblit.models.PluginRegistry.PluginRegistration) PluginWrapper(ro.fortsoft.pf4j.PluginWrapper) TreeMap(java.util.TreeMap)

Example 2 with PluginRegistration

use of com.gitblit.models.PluginRegistry.PluginRegistration in project gitblit by gitblit.

the class PluginManager method lookupRelease.

@Override
public synchronized PluginRelease lookupRelease(String pluginId, String version) {
    PluginRegistration reg = lookupPlugin(pluginId);
    if (reg == null) {
        return null;
    }
    PluginRelease pv;
    if (StringUtils.isEmpty(version)) {
        pv = reg.getCurrentRelease(getSystemVersion());
    } else {
        pv = reg.getRelease(version);
    }
    return pv;
}
Also used : PluginRelease(com.gitblit.models.PluginRegistry.PluginRelease) PluginRegistration(com.gitblit.models.PluginRegistry.PluginRegistration)

Aggregations

PluginRegistration (com.gitblit.models.PluginRegistry.PluginRegistration)2 PluginRegistry (com.gitblit.models.PluginRegistry)1 PluginRelease (com.gitblit.models.PluginRegistry.PluginRelease)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 PluginWrapper (ro.fortsoft.pf4j.PluginWrapper)1 Version (ro.fortsoft.pf4j.Version)1