Search in sources :

Example 1 with EzyPluginEntryLoader

use of com.tvd12.ezyfoxserver.ext.EzyPluginEntryLoader in project ezyfox-server by youngmonkeys.

the class EzyPluginsStarter method startPlugin.

protected EzyPluginEntry startPlugin(String pluginName, EzyPluginEntryLoader loader) throws Exception {
    EzyPluginEntry entry = loader.load();
    entry.config(getPluginContext(pluginName));
    entry.start();
    return entry;
}
Also used : EzyPluginEntry(com.tvd12.ezyfoxserver.ext.EzyPluginEntry)

Example 2 with EzyPluginEntryLoader

use of com.tvd12.ezyfoxserver.ext.EzyPluginEntryLoader in project ezyfox-server by youngmonkeys.

the class EzyPluginsStarter method newPluginEntryLoader.

protected EzyPluginEntryLoader newPluginEntryLoader(String pluginName) throws Exception {
    Class<EzyPluginEntryLoader> pluginLoaderClass = getPluginEntryLoaderClass(pluginName);
    EzyPluginSetting pluginSetting = getPluginByName(pluginName);
    if (pluginSetting.getEntryLoaderArgs() == null) {
        return pluginLoaderClass.newInstance();
    }
    return (EzyPluginEntryLoader) pluginLoaderClass.getConstructors()[0].newInstance(pluginSetting.getEntryLoaderArgs());
}
Also used : EzyPluginEntryLoader(com.tvd12.ezyfoxserver.ext.EzyPluginEntryLoader) EzyPluginSetting(com.tvd12.ezyfoxserver.setting.EzyPluginSetting)

Example 3 with EzyPluginEntryLoader

use of com.tvd12.ezyfoxserver.ext.EzyPluginEntryLoader in project ezyfox-server by youngmonkeys.

the class EzyPluginsStarterTest method test1.

@Test
public void test1() {
    EzyPluginsStarter starter = new EzyPluginsStarter.Builder() {

        @Override
        public EzyPluginsStarter build() {
            return new EzyPluginsStarter(this) {

                public java.util.Set<String> getPluginNames() {
                    return Sets.newHashSet("test");
                }

                public EzyPluginEntryLoader newPluginEntryLoader(String pluginName) throws Exception {
                    throw new Exception();
                }
            };
        }
    }.zoneContext(EzyZoneContextsTest.newDefaultZoneContext()).build();
    starter.start();
}
Also used : EzyPluginsStarter(com.tvd12.ezyfoxserver.EzyPluginsStarter) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyPluginsStarter (com.tvd12.ezyfoxserver.EzyPluginsStarter)1 EzyPluginEntry (com.tvd12.ezyfoxserver.ext.EzyPluginEntry)1 EzyPluginEntryLoader (com.tvd12.ezyfoxserver.ext.EzyPluginEntryLoader)1 EzyPluginSetting (com.tvd12.ezyfoxserver.setting.EzyPluginSetting)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1