Search in sources :

Example 1 with EzyAppEntryLoader

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

the class EzyAppsStarter method newAppEntryLoader.

protected EzyAppEntryLoader newAppEntryLoader(String appName) throws Exception {
    Class<EzyAppEntryLoader> entryLoaderClass = getAppEntryLoaderClass(appName);
    EzyAppSetting appSetting = getAppByName(appName);
    if (appSetting.getEntryLoaderArgs() == null) {
        return entryLoaderClass.newInstance();
    }
    return (EzyAppEntryLoader) entryLoaderClass.getConstructors()[0].newInstance(appSetting.getEntryLoaderArgs());
}
Also used : EzyAppSetting(com.tvd12.ezyfoxserver.setting.EzyAppSetting) EzyAppEntryLoader(com.tvd12.ezyfoxserver.ext.EzyAppEntryLoader)

Example 2 with EzyAppEntryLoader

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

the class EzyAppsStarter method startApp.

protected EzyAppEntry startApp(String appName, EzyAppEntryLoader loader) throws Exception {
    EzyAppEntry entry = loader.load();
    entry.config(getAppContext(appName));
    entry.start();
    return entry;
}
Also used : EzyAppEntry(com.tvd12.ezyfoxserver.ext.EzyAppEntry)

Example 3 with EzyAppEntryLoader

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

the class EzyAppsStarterTest method test1.

@Test
public void test1() {
    Map<String, ClassLoader> loaders = new ConcurrentHashMap<>();
    EzyAppsStarter starter = new EzyAppsStarter.Builder() {

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

                public EzyAppEntryLoader newAppEntryLoader(String appName) {
                    throw new RuntimeException();
                }

                public java.util.Set<String> getAppNames() {
                    return Sets.newHashSet("test");
                }
            };
        }
    }.zoneContext(EzyZoneContextsTest.newDefaultZoneContext()).appClassLoaders(loaders).build();
    starter.start();
}
Also used : EzyAppsStarter(com.tvd12.ezyfoxserver.EzyAppsStarter) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) EzyAppEntryLoader(com.tvd12.ezyfoxserver.ext.EzyAppEntryLoader) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyAppEntryLoader (com.tvd12.ezyfoxserver.ext.EzyAppEntryLoader)2 EzyAppsStarter (com.tvd12.ezyfoxserver.EzyAppsStarter)1 EzyAppEntry (com.tvd12.ezyfoxserver.ext.EzyAppEntry)1 EzyAppSetting (com.tvd12.ezyfoxserver.setting.EzyAppSetting)1 BaseTest (com.tvd12.test.base.BaseTest)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Test (org.testng.annotations.Test)1