本文整理了Java中net.ymate.platform.core.YMP.getEvents()
方法的一些代码示例,展示了YMP.getEvents()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YMP.getEvents()
方法的具体详情如下:
包路径:net.ymate.platform.core.YMP
类名称:YMP
方法名:getEvents
暂无
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public Object handle(Class<?> targetClass) throws Exception {
if (!targetClass.isInterface() && ClassUtils.isInterfaceOf(targetClass, IEventRegister.class)) {
((IEventRegister) targetClass.newInstance()).register(__owner.getEvents());
}
return null;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
@SuppressWarnings("unchecked")
public Object handle(Class<?> targetClass) throws Exception {
if (!targetClass.isInterface() && ClassUtils.isInterfaceOf(targetClass, IEvent.class)) {
__owner.getEvents().registerEvent((Class<? extends IEvent>) targetClass);
}
return null;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void onInited(IPluginContext context, IPlugin plugin) {
if (__pluginFactory != null) {
if (__pluginFactory.getOwner().getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + context.getPluginMeta().toString() + " initialized.");
}
__owner.getEvents().fireEvent(new PluginEvent(plugin, PluginEvent.EVENT.PLUGIN_INITED));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void onDestroy(IPluginContext context, IPlugin plugin) {
if (__pluginFactory != null) {
if (__pluginFactory.getOwner().getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + context.getPluginMeta().toString() + " destroyed.");
}
__owner.getEvents().fireEvent(new PluginEvent(plugin, PluginEvent.EVENT.PLUGIN_DESTROYED));
}
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyRemoveAll(String cacheName) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_REMOVED_ALL)
.addParamExtend("cacheName", cacheName));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void onShutdown(IPluginContext context, IPlugin plugin) {
if (__pluginFactory != null) {
if (__pluginFactory.getOwner().getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + context.getPluginMeta().toString() + " shutdown.");
}
__owner.getEvents().fireEvent(new PluginEvent(plugin, PluginEvent.EVENT.PLUGIN_SHUTDOWN));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void onStarted(IPluginContext context, IPlugin plugin) {
if (__pluginFactory != null) {
if (__pluginFactory.getOwner().getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + context.getPluginMeta().toString() + " started.");
}
__owner.getEvents().fireEvent(new PluginEvent(plugin, PluginEvent.EVENT.PLUGIN_STARTED));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
private void __doFireEvent(WebEvent.EVENT event, Object eventSource) {
__owner.getOwner().getEvents().fireEvent(new WebEvent(__owner, event).addParamExtend(WebEvent.EVENT_SOURCE, eventSource));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyElementExpired(String cacheName, Object key) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_EXPIRED)
.addParamExtend("cacheName", cacheName)
.addParamExtend("key", key));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyElementEvicted(String cacheName, Object key) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_EVICTED)
.addParamExtend("cacheName", cacheName)
.addParamExtend("key", key));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyElementRemoved(String cacheName, Object key) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_REMOVED)
.addParamExtend("cacheName", cacheName)
.addParamExtend("key", key));
}
代码示例来源:origin: suninformation/ymate-platform-v2
private void __doFireEvent(WebEvent.EVENT event, Object eventSource) {
if (__isInited) {
YMP.get().getEvents().fireEvent(new WebEvent(WebMVC.get(), event).addParamExtend(WebEvent.EVENT_SOURCE, eventSource));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void init(YMP owner) throws Exception {
if (!__inited) {
//
_LOG.info("Initializing ymate-platform-cache-" + VERSION);
//
__owner = owner;
__owner.getEvents().registerEvent(CacheEvent.class);
__moduleCfg = new DefaultCacheModuleCfg(owner);
__moduleCfg.getCacheEventListener().init(this);
__cacheProvider = __moduleCfg.getCacheProvider();
__cacheProvider.init(this);
//
__inited = true;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyElementPut(String cacheName, Object key, Object value) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_PUT)
.addParamExtend("cacheName", cacheName)
.addParamExtend("key", key)
.addParamExtend("value", value));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void notifyElementUpdated(String cacheName, Object key, Object value) {
__owner.getOwner().getEvents().fireEvent(new CacheEvent(__owner, CacheEvent.EVENT.ELEMENT_UPDATED)
.addParamExtend("cacheName", cacheName)
.addParamExtend("key", key)
.addParamExtend("value", value));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
protected void __doLogWrite(LogLevel level, LogInfo content) {
__logger.log(__parseLogLevel(level), content.toString());
// 日志写入后触发异步事件
__owner.getOwner().getEvents().fireEvent(new LogEvent(this, LogEvent.EVENT.LOG_WRITE_IN)
.addParamExtend(LogEvent.LOG_LEVEL, level)
.addParamExtend(LogEvent.LOG_INFO, content));
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public <T> T findFirst(SQL sql, IResultSetHandler<T> handler) throws Exception {
String _selectSql = __dialect.buildPagedQuerySQL(sql.getSQL(), 1, 1);
IQueryOperator<T> _opt = new DefaultQueryOperator<T>(_selectSql, this.__connectionHolder, handler);
for (Object _param : sql.params().params()) {
_opt.addParameter(_param);
}
SessionEventContext _eventContext = new SessionEventContext(_opt, Type.OPT.QUERY);
if (__sessionEvent != null) {
__sessionEvent.onQueryBefore(_eventContext);
}
_opt.execute();
if (__sessionEvent != null) {
__sessionEvent.onQueryAfter(_eventContext);
}
//
__owner.getOwner().getEvents().fireEvent(new DatabaseEvent(__owner, DatabaseEvent.EVENT.QUERY_AFTER).setEventSource(_eventContext));
//
return _opt.getResultSet().isEmpty() ? null : _opt.getResultSet().get(0);
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public long count(SQL sql) throws Exception {
String _sql = ExpressionUtils.bind("SELECT count(*) FROM (${sql}) c_t").set("sql", sql.getSQL()).getResult();
IQueryOperator<Object[]> _opt = new DefaultQueryOperator<Object[]>(_sql, this.getConnectionHolder(), IResultSetHandler.ARRAY);
for (Object _param : sql.params().params()) {
_opt.addParameter(_param);
}
SessionEventContext _eventContext = new SessionEventContext(_opt, Type.OPT.QUERY);
if (__sessionEvent != null) {
__sessionEvent.onQueryBefore(_eventContext);
}
_opt.execute();
if (__sessionEvent != null) {
__sessionEvent.onQueryAfter(_eventContext);
}
//
__owner.getOwner().getEvents().fireEvent(new DatabaseEvent(__owner, DatabaseEvent.EVENT.QUERY_AFTER).setEventSource(_eventContext));
//
return BlurObject.bind(((Object[]) _opt.getResultSet().get(0)[0])[1]).toLongValue();
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public int executeForUpdate(SQL sql) throws Exception {
IUpdateOperator _opt = new DefaultUpdateOperator(sql.getSQL(), this.getConnectionHolder());
for (Object _param : sql.params().params()) {
_opt.addParameter(_param);
}
SessionEventContext _eventContext = new SessionEventContext(_opt, Type.OPT.UPDATE);
if (__sessionEvent != null) {
__sessionEvent.onUpdateBefore(_eventContext);
}
_opt.execute();
if (__sessionEvent != null) {
__sessionEvent.onUpdateAfter(_eventContext);
}
//
__owner.getOwner().getEvents().fireEvent(new DatabaseEvent(__owner, DatabaseEvent.EVENT.UPDATE_AFTER).setEventSource(_eventContext));
//
return _opt.getEffectCounts();
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public <T> IResultSet<T> find(SQL sql, IResultSetHandler<T> handler) throws Exception {
IQueryOperator<T> _opt = new DefaultQueryOperator<T>(sql.getSQL(), this.__connectionHolder, handler);
for (Object _param : sql.params().params()) {
_opt.addParameter(_param);
}
SessionEventContext _eventContext = new SessionEventContext(_opt, Type.OPT.QUERY);
if (__sessionEvent != null) {
__sessionEvent.onQueryBefore(_eventContext);
}
_opt.execute();
if (__sessionEvent != null) {
__sessionEvent.onQueryAfter(_eventContext);
}
//
__owner.getOwner().getEvents().fireEvent(new DatabaseEvent(__owner, DatabaseEvent.EVENT.QUERY_AFTER).setEventSource(_eventContext));
//
return new DefaultResultSet<T>(_opt.getResultSet());
}
内容来源于网络,如有侵权,请联系作者删除!