org.yx.rpc.RpcActions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sumk Show documentation
Show all versions of sumk Show documentation
A quick developing framewort for internet company
/**
* Copyright (C) 2016 - 2030 youtongluan.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yx.rpc;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.yx.annotation.spec.SoaSpec;
import org.yx.annotation.spec.Specs;
import org.yx.common.action.ActInfoUtil;
import org.yx.conf.AppInfo;
import org.yx.main.SumkServer;
import org.yx.util.StringUtil;
public final class RpcActions {
private static Map> pojoMap = new ConcurrentHashMap<>();
private static Map actMap = new ConcurrentHashMap<>();
public static Class> getArgType(String method) {
String m = getArgClassName(method);
return pojoMap.get(m);
}
private static String getArgClassName(String method) {
int k = method.lastIndexOf('.');
return method.substring(0, k) + "_" + method.substring(k + 1);
}
public static RpcActionNode getActionNode(String soaName) {
return actMap.get(soaName);
}
public static void putActNode(String soaName, RpcActionNode actInfo) {
actMap.putIfAbsent(soaName, actInfo);
}
public static Set soaSet() {
return actMap.keySet();
}
public static List publishSoaSet() {
List list = new ArrayList<>(actMap.size());
for (Map.Entry entry : actMap.entrySet()) {
String api = entry.getKey();
if (needPublish(api, entry.getValue())) {
list.add(api);
}
}
return list;
}
static boolean needPublish(String api, RpcActionNode node) {
return AppInfo.getBoolean("sumk.rpc.publish.".concat(api), node.publish());
}
public static List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy