本文整理了Java中info.xiancloud.core.Handler
类的一些代码示例,展示了Handler
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler
类的具体详情如下:
包路径:info.xiancloud.core.Handler
类名称:Handler
暂无
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
handler.handle(null);
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest request, Handler<UnitResponse> handler) {
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException e) {
}
handler.handle(UnitResponse.createSuccess());
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest request, Handler<UnitResponse> handler) {
handler.handle(execute0(request));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
File file = new File(msg.getString("file"));
try {
InputStream inputStream = new FileInputStream(file);
handler.handle(UnitResponse.createSuccess(inputStream));
return;
} catch (FileNotFoundException e) {
handler.handle(UnitResponse.createException(e, "文件不存在"));
return;
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
boolean enable = msg.get("enable", boolean.class);
ENABLE_RPC.set(enable);
handler.handle(UnitResponse.createSuccess());
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest request, Handler<UnitResponse> handler) throws ExecutionException {
handler.handle(UnitResponse.createSuccess(
new JSONObject()
.fluentPut("cols", TableMetaCache.COLS.get(TABLE_NAME))
.fluentPut("idCol", TableMetaCache.ID_COL.get(TABLE_NAME))
));
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest request, Handler<UnitResponse> handler) throws ExecutionException {
handler.handle(UnitResponse.createSuccess(
new JSONObject()
.fluentPut("cols", TableMetaCache.COLS.get(TABLE_NAME))
.fluentPut("idCol", TableMetaCache.ID_COL.get(TABLE_NAME))
));
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
Object result = Redis.call(cacheConfigBean, jedis -> jedis.get(key));
if (result != null && result.toString().equals("nil"))
result = null;
handler.handle(UnitResponse.createSuccess(result));
}
代码示例来源:origin: info.xiancloud/xian-apifestOauth20
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
OAuthService.auth
.isValidToken(msg.get("access_token", String.class))
.subscribe(
token -> handler.handle(UnitResponse.createSuccess(token)),
exception -> handler.handle(UnitResponse.createException(exception)),
() -> handler.handle(UnitResponse.createUnknownError(null, "token required.")));
}
代码示例来源:origin: info.xiancloud/xian-apifestOauth20
@Override
public void execute(UnitRequest request, Handler<UnitResponse> handler) throws Exception {
OAuthService.auth.getApplicationInfo(request.getString("client_id")).subscribe(
info -> handler.handle(UnitResponse.createSuccess(info)),
exception -> handler.handle(UnitResponse.createException(exception)),
() -> handler.handle(UnitResponse.createSuccess(new JSONObject() {{
put("message", "client application don't exist");
}}))
);
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
handler.handle(UnitResponse.createSuccess(ZkLeaderElection.isLeader()));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
handler.handle(UnitResponse.createSuccess(XianConfig.get("whatever")));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
handler.handle(UnitResponse.createSuccess(msg.argJson()));
}
代码示例来源:origin: info.xiancloud/xian-ruleengine
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) {
handler.handle(UnitResponse.createSuccess(msg.argJson()));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
long size = Redis.call(cacheConfigBean, jedis -> jedis.del(key));
handler.handle(UnitResponse.createSuccess(size));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> consumer) {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try {
boolean result = Redis.call(cacheConfigBean, jedis -> jedis.exists(key));
consumer.handle(UnitResponse.createSuccess(result));
} catch (Exception e) {
consumer.handle(UnitResponse.createException(e));
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
String key = msg.getArgMap().get("key").toString();
Long index = msg.getArgMap().get("index") != null ? Long.parseLong(msg.getArgMap().get("index").toString()) : 0;
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
String element;
element = Redis.call(cacheConfigBean, (jedis) -> jedis.lindex(key, index));
if (element != null && element.equals("nil"))
element = null;
handler.handle(UnitResponse.createSuccess(element));
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
String key = msg.getArgMap().get("key").toString();
String field = msg.getArgMap().get("field").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
long length;
length = Redis.call(cacheConfigBean, jedis -> jedis.hdel(key, field));
handler.handle(UnitResponse.createSuccess(length));
}
代码示例来源:origin: info.xiancloud/xian-apifestOauth20
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
StringBuffer uriBuffer = new StringBuffer(msg.getContext().getUri());
if (null != msg.getString("client_id")) {
uriBuffer.append("?client_id=").append(msg.getString("client_id"));
}
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriBuffer.toString());
Single.just(OAuthService.getScopeService().getScopes(request)).subscribe(
message -> handler.handle(UnitResponse.createSuccess(message)),
exception -> handler.handle(UnitResponse.createException(exception))
);
}
}
代码示例来源:origin: xiancloud/xian
@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
Set<String> keys = Redis.call(cacheConfigBean, jedis -> jedis.hkeys(key));
handler.handle(UnitResponse.createSuccess(keys));
}
内容来源于网络,如有侵权,请联系作者删除!