Search in sources :

Example 1 with EzyPluginSetting

use of com.tvd12.ezyfoxserver.setting.EzyPluginSetting in project ezyfox-server-example by tvd12.

the class PluginEntry method setupBeanContext.

@Override
protected void setupBeanContext(EzyPluginContext context, EzyBeanContextBuilder builder) {
    EzyPluginSetting setting = context.getPlugin().getSetting();
    String pluginConfigFile = getConfigFile(setting);
    PluginConfig pluginConfig = readPluginConfig(pluginConfigFile);
    logger.info("simple-chat plugin config: {}", pluginConfig);
}
Also used : PluginConfig(com.example.simple_chat.plugin.config.PluginConfig) EzyPluginSetting(com.tvd12.ezyfoxserver.setting.EzyPluginSetting)

Example 2 with EzyPluginSetting

use of com.tvd12.ezyfoxserver.setting.EzyPluginSetting in project ezyfox-server by youngmonkeys.

the class EzyPluginInfoController method handle.

@Override
public void handle(EzyServerContext ctx, EzyPluginInfoRequest request) {
    EzyUser user = request.getUser();
    EzySession session = request.getSession();
    EzyPluginInfoParams params = request.getParams();
    EzyZoneContext zoneCtx = ctx.getZoneContext(user.getZoneId());
    EzyPluginContext pluginCtx = zoneCtx.getPluginContext(params.getPluginName());
    if (pluginCtx != null) {
        EzyPluginSetting setting = pluginCtx.getPlugin().getSetting();
        EzyResponse response = newPluginInfoResponse(setting);
        ctx.send(response, session, false);
    }
}
Also used : EzyUser(com.tvd12.ezyfoxserver.entity.EzyUser) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyPluginInfoParams(com.tvd12.ezyfoxserver.request.EzyPluginInfoParams) EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext) EzyResponse(com.tvd12.ezyfoxserver.response.EzyResponse) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) EzyPluginSetting(com.tvd12.ezyfoxserver.setting.EzyPluginSetting)

Example 3 with EzyPluginSetting

use of com.tvd12.ezyfoxserver.setting.EzyPluginSetting in project ezyfox-server by youngmonkeys.

the class EzyBroadcastPluginsEventImpl method getPluginContextMaps.

private EzyMapSet<EzyConstant, EzyPluginContext> getPluginContextMaps() {
    Collection<EzyPluginContext> pluginContexts = context.getPluginContexts();
    EzyMapSet<EzyConstant, EzyPluginContext> pluginContextMaps = new EzyHashMapSet<>();
    for (EzyPluginContext pluginContext : pluginContexts) {
        EzyPluginSetting pluginSetting = pluginContext.getPlugin().getSetting();
        Set<EzyConstant> listenEvents = pluginSetting.getListenEvents().getEvents();
        for (EzyConstant listenEvent : listenEvents) {
            pluginContextMaps.addItem(listenEvent, pluginContext);
        }
    }
    return pluginContextMaps;
}
Also used : EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext) EzyConstant(com.tvd12.ezyfox.constant.EzyConstant) EzyHashMapSet(com.tvd12.ezyfox.util.EzyHashMapSet) EzyPluginSetting(com.tvd12.ezyfoxserver.setting.EzyPluginSetting)

Example 4 with EzyPluginSetting

use of com.tvd12.ezyfoxserver.setting.EzyPluginSetting 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 5 with EzyPluginSetting

use of com.tvd12.ezyfoxserver.setting.EzyPluginSetting in project ezyfox-server by youngmonkeys.

the class EzyPluginSendResponseImpl method newResponse.

protected EzyResponse newResponse(EzyData data) {
    EzyPluginSetting setting = context.getPlugin().getSetting();
    EzyRequestPluginResponseParams params = newResponseParams();
    params.setPluginId(setting.getId());
    params.setData(data);
    return new EzyRequestPluginResponse(params);
}
Also used : EzyRequestPluginResponseParams(com.tvd12.ezyfoxserver.response.EzyRequestPluginResponseParams) EzyRequestPluginResponse(com.tvd12.ezyfoxserver.response.EzyRequestPluginResponse) EzyPluginSetting(com.tvd12.ezyfoxserver.setting.EzyPluginSetting)

Aggregations

EzyPluginSetting (com.tvd12.ezyfoxserver.setting.EzyPluginSetting)10 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)5 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)4 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)4 EzyPlugin (com.tvd12.ezyfoxserver.EzyPlugin)3 EzyPluginSetup (com.tvd12.ezyfoxserver.command.EzyPluginSetup)3 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)3 Test (org.testng.annotations.Test)3 PluginConfig (com.example.simple_chat.plugin.config.PluginConfig)1 EzyBeanContext (com.tvd12.ezyfox.bean.EzyBeanContext)1 EzyBeanContextBuilder (com.tvd12.ezyfox.bean.EzyBeanContextBuilder)1 EzySingleton (com.tvd12.ezyfox.bean.annotation.EzySingleton)1 EzyBindingContext (com.tvd12.ezyfox.binding.EzyBindingContext)1 EzyMarshaller (com.tvd12.ezyfox.binding.EzyMarshaller)1 EzyUnmarshaller (com.tvd12.ezyfox.binding.EzyUnmarshaller)1 EzyConstant (com.tvd12.ezyfox.constant.EzyConstant)1 EzyReflection (com.tvd12.ezyfox.reflect.EzyReflection)1 EzyReflectionProxy (com.tvd12.ezyfox.reflect.EzyReflectionProxy)1 EzyHashMapSet (com.tvd12.ezyfox.util.EzyHashMapSet)1 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)1