Search in sources :

Example 1 with ExtensionFactory

use of ro.fortsoft.pf4j.ExtensionFactory in project gitblit by gitblit.

the class PluginManager method start.

@Override
public PluginManager start() {
    File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins");
    dir.mkdirs();
    pf4j = new DefaultPluginManager(dir) {

        @Override
        protected PluginFactory createPluginFactory() {
            return new GuicePluginFactory();
        }

        @Override
        protected ExtensionFactory createExtensionFactory() {
            return new GuiceExtensionFactory();
        }
    };
    try {
        Version systemVersion = Version.createVersion(Constants.getVersion());
        pf4j.setSystemVersion(systemVersion);
    } catch (Exception e) {
        logger.error(null, e);
    }
    pf4j.loadPlugins();
    logger.debug("Starting plugins");
    pf4j.startPlugins();
    return this;
}
Also used : Version(ro.fortsoft.pf4j.Version) ExtensionFactory(ro.fortsoft.pf4j.ExtensionFactory) DefaultPluginFactory(ro.fortsoft.pf4j.DefaultPluginFactory) PluginFactory(ro.fortsoft.pf4j.PluginFactory) File(java.io.File) DefaultPluginManager(ro.fortsoft.pf4j.DefaultPluginManager) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 DefaultPluginFactory (ro.fortsoft.pf4j.DefaultPluginFactory)1 DefaultPluginManager (ro.fortsoft.pf4j.DefaultPluginManager)1 ExtensionFactory (ro.fortsoft.pf4j.ExtensionFactory)1 PluginFactory (ro.fortsoft.pf4j.PluginFactory)1 Version (ro.fortsoft.pf4j.Version)1