proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputModifyGroupInfo.java | InputModifyGroupInfo | toProtoGroupRequest | class InputModifyGroupInfo extends InputGroupBase {
private String group_id;
//ModifyGroupInfoType
private int type;
private String value;
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator))
return false;
return true;... |
if(notify_message != null && notify_message.getType() > 0) {
return WFCMessage.ModifyGroupInfoRequest.newBuilder()
.setGroupId(group_id)
.setType(type)
.setValue(value == null ? "" : value)
.addAllToLine(to_lines == null || to_lines.is... | 254 | 226 | 480 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputMuteGroupMember.java | InputMuteGroupMember | toProtoGroupRequest | class InputMuteGroupMember extends InputGroupBase {
private String group_id;
private List<String> members;
private boolean is_manager;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public List<St... |
WFCMessage.SetGroupManagerRequest.Builder addGroupBuilder = WFCMessage.SetGroupManagerRequest.newBuilder();
addGroupBuilder.setGroupId(group_id);
addGroupBuilder.addAllUserId(members);
addGroupBuilder.setType(is_manager ? 1 : 0);
if (to_lines != null) {
for (Integer... | 283 | 167 | 450 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputOutputUserInfo.java | InputOutputUserInfo | toUser | class InputOutputUserInfo {
private String userId;
private String name;
private String password;
private String displayName;
private String portrait;
private int gender;
private String mobile;
private String email;
private String address;
private String company;
private Strin... |
WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder()
.setUid(userId);
if (name != null)
newUserBuilder.setName(name);
if (displayName != null)
newUserBuilder.setDisplayName(displayName);
if (getPortrait() != null)
newUserB... | 968 | 295 | 1,263 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputQuitGroup.java | InputQuitGroup | toProtoGroupRequest | class InputQuitGroup extends InputGroupBase {
private String group_id;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUt... |
WFCMessage.QuitGroupRequest.Builder removedGroupBuilder = WFCMessage.QuitGroupRequest.newBuilder();
removedGroupBuilder.setGroupId(group_id);
if (to_lines != null) {
for (Integer line : to_lines
) {
removedGroupBuilder.addToLine(line);
}
... | 154 | 135 | 289 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputSetGroupManager.java | InputSetGroupManager | isValide | class InputSetGroupManager extends InputGroupBase {
private String group_id;
private List<String> members;
private boolean is_manager;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public List<St... |
if (StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(group_id) || members == null || members.isEmpty()) {
return false;
}
return true;
| 396 | 53 | 449 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputSetGroupMemberAlias.java | InputSetGroupMemberAlias | toProtoGroupRequest | class InputSetGroupMemberAlias extends InputGroupBase {
private String group_id;
private String memberId;
private String alias;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public boolean isVali... |
WFCMessage.ModifyGroupMemberAlias.Builder modifyAliasBuilder = WFCMessage.ModifyGroupMemberAlias.newBuilder();
modifyAliasBuilder.setGroupId(group_id);
modifyAliasBuilder.setAlias(StringUtil.isNullOrEmpty(alias)?"":alias);
modifyAliasBuilder.setMemberId(memberId);
if (to_lines ... | 226 | 181 | 407 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputSetGroupMemberExtra.java | InputSetGroupMemberExtra | toProtoGroupRequest | class InputSetGroupMemberExtra extends InputGroupBase {
private String group_id;
private String memberId;
private String extra;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public boolean isVali... |
WFCMessage.ModifyGroupMemberExtra.Builder modifyAliasBuilder = WFCMessage.ModifyGroupMemberExtra.newBuilder();
modifyAliasBuilder.setGroupId(group_id);
modifyAliasBuilder.setMemberId(memberId);
modifyAliasBuilder.setExtra(StringUtil.isNullOrEmpty(extra)?"": extra);
if (to_lines... | 222 | 178 | 400 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/InputTransferGroup.java | InputTransferGroup | toProtoGroupRequest | class InputTransferGroup extends InputGroupBase {
private String group_id;
private String new_owner;
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(new_owner))
return false;
return true;
}... |
WFCMessage.TransferGroupRequest.Builder groupBuilder = WFCMessage.TransferGroupRequest.newBuilder();
groupBuilder.setGroupId(group_id);
groupBuilder.setNewOwner(new_owner);
if (to_lines != null) {
for (Integer line : to_lines
) {
groupBuilder.add... | 227 | 143 | 370 | <methods>public non-sealed void <init>() ,public cn.wildfirechat.pojos.MessagePayload getNotify_message() ,public java.lang.String getOperator() ,public List<java.lang.Integer> getTo_lines() ,public void setNotify_message(cn.wildfirechat.pojos.MessagePayload) ,public void setOperator(java.lang.String) ,public void setT... |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/MessagePayload.java | MessagePayload | fromProtoMessageContent | class MessagePayload {
private int type;
private String searchableContent;
private String pushContent;
private String pushData;
private String content;
private String base64edData;
private int mediaType;
private String remoteMediaUrl;
private int persistFlag;
private int expireDu... |
if (protoContent == null)
return null;
MessagePayload payload = new MessagePayload();
payload.type = protoContent.getType();
payload.searchableContent = protoContent.getSearchableContent();
payload.pushContent = protoContent.getPushContent();
payload.content... | 1,119 | 282 | 1,401 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/MulticastMessageData.java | MulticastMessageData | isValide | class MulticastMessageData {
private String sender;
private int line;
private MessagePayload payload;
private List<String> targets;
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public int getLine() {
... |
if(sendMessageData == null ||
StringUtil.isNullOrEmpty(sendMessageData.getSender()) ||
sendMessageData.getPayload() == null) {
return false;
}
return true;
| 327 | 59 | 386 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/OutputCheckUserOnline.java | Session | addSession | class Session {
public String clientId;
public String userId;
public int platform;
public int status; //0 online, 1 have session offline
public long lastSeen;
public String packageName;
public Session() {
}
public Session(String clientId, String ... |
Session session = new Session(clientId, userId, platform, status, lastSeen, packageName);
sessions.add(session);
| 201 | 36 | 237 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/OutputGetChannelInfo.java | OutputMenu | fromPbInfo | class OutputMenu {
public String menuId;
public String type;
public String name;
public String key;
public String url;
public String mediaId;
public String articleId;
public String appId;
public String appPage;
public String extra;
... |
OutputMenu out = new OutputMenu();
out.menuId = channelMenuMenu.getMenuId();
out.type = channelMenuMenu.getType();
out.name = channelMenuMenu.getName();
out.key = channelMenuMenu.getKey();
out.url = channelMenuMenu.getUrl();
out.mediaI... | 418 | 234 | 652 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/OutputMessageData.java | OutputMessageData | fromProtoMessage | class OutputMessageData {
private long messageId;
private String sender;
private Conversation conv;
private MessagePayload payload;
private List<String> toUsers;
private long timestamp;
private OutputClient client;
public String getSender() {
return sender;
}
public voi... |
OutputMessageData data = new OutputMessageData();
data.messageId = protoMessage.getMessageId();
data.sender = protoMessage.getFromUser();
data.conv = new Conversation();
data.conv.setTarget(protoMessage.getConversation().getTarget());
data.conv.setType(protoMessage.getCo... | 447 | 172 | 619 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/OutputRobot.java | OutputRobot | fromUser | class OutputRobot {
private String userId;
private String name;
private String password;
private String displayName;
private String portrait;
private int gender;
private String mobile;
private String email;
private String address;
private String company;
private String social... |
userId = user.getUid();
name = user.getName();
displayName = user.getDisplayName();
portrait = user.getPortrait();
gender = user.getGender();
mobile = user.getMobile();
email = user.getEmail();
address = user.getAddress();
company = user.getCompan... | 944 | 120 | 1,064 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/SendChannelMessageData.java | SendChannelMessageData | toProtoMessage | class SendChannelMessageData {
private List<String> targets;
private int line;
private MessagePayload payload;
public List<String> getTargets() {
return targets;
}
public void setTargets(List<String> targets) {
this.targets = targets;
}
public int getLine() {
r... |
if (targets == null) {
targets = new ArrayList<>();
}
return WFCMessage.Message.newBuilder().setFromUser(channelOwner)
.setConversation(WFCMessage.Conversation.newBuilder().setType(ProtoConstants.ConversationType.ConversationType_Channel).setTarget(channelId).setLine(li... | 261 | 117 | 378 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/SendMessageData.java | SendMessageData | fromProtoMessage | class SendMessageData {
private String sender;
private Conversation conv;
private MessagePayload payload;
private List<String> toUsers;
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public Conversation g... |
SendMessageData data = new SendMessageData();
data.sender = protoMessage.getFromUser();
data.conv = new Conversation();
data.conv.setTarget(protoMessage.getConversation().getTarget());
data.conv.setType(protoMessage.getConversation().getType());
data.conv.setLine(protoMe... | 614 | 124 | 738 | <no_super_class> |
wildfirechat_im-server | im-server/common/src/main/java/cn/wildfirechat/pojos/UserSettingPojo.java | UserSettingPojo | toProtoRequest | class UserSettingPojo {
private String userId;
private int scope;
private String key;
private String value;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public int getScope() {
return scope;
... |
WFCMessage.ModifyUserSettingReq.Builder builder = WFCMessage.ModifyUserSettingReq.newBuilder();
builder.setScope(scope);
if (!StringUtil.isNullOrEmpty(key))
builder.setKey(key);
if(!StringUtil.isNullOrEmpty(value))
builder.setValue(value);
return builder... | 230 | 96 | 326 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java | ChannelServiceApi | getUserInfo | class ChannelServiceApi {
private final ChannelHttpUtils channelHttpUtils;
public ChannelServiceApi(String imurl, String channelId, String secret) {
channelHttpUtils = new ChannelHttpUtils(imurl, channelId, secret);
}
public IMResult<InputOutputUserInfo> getUserInfo(String userId) throws Excep... |
String path = APIPath.Channel_User_Info;
InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null);
return channelHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
| 1,253 | 65 | 1,318 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/ChatroomAdmin.java | ChatroomAdmin | getChatroomBlacklist | class ChatroomAdmin {
public static IMResult<OutputCreateChatroom> createChatroom(String chatroomId, String title, String desc ,String portrait, String extra, Integer state) throws Exception {
String path = APIPath.Create_Chatroom;
InputCreateChatroom input = new InputCreateChatroom();
input... |
String path = APIPath.Chatroom_GetBlacklist;
InputChatroomId input = new InputChatroomId(chatroomId);
return AdminHttpUtils.httpJsonPost(path, input, OutputChatroomBlackInfos.class);
| 969 | 62 | 1,031 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/ConferenceAdmin.java | ConferenceAdmin | rtpForward | class ConferenceAdmin {
public static IMResult<PojoConferenceInfoList> listConferences() throws Exception {
String path = APIPath.Conference_List;
return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class);
}
public static IMResult<Boolean> existsConferences(String confere... |
String path = APIPath.Conference_Rtp_Forward;
PojoConferenceRtpForwardReq req = new PojoConferenceRtpForwardReq(roomId, userId, rtpHost, audioPort, audioPt, audioSSRC, videoPort, videoPt, videoSSRC);
return AdminHttpUtils.httpJsonPost(path, req, Void.class);
| 937 | 100 | 1,037 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/GeneralAdmin.java | GeneralAdmin | getConversationTop | class GeneralAdmin {
public static IMResult<SystemSettingPojo> getSystemSetting(int id) throws Exception {
String path = APIPath.Get_System_Setting;
SystemSettingPojo input = new SystemSettingPojo();
input.id = id;
return AdminHttpUtils.httpJsonPost(path, input, SystemSettingPojo.cla... |
String key = conversationType + "-" + line + "-" + target;
IMResult<UserSettingPojo> result = getUserSetting(userId, 3, key);
IMResult<Boolean> out = new IMResult<Boolean>();
out.code = result.code;
out.msg = result.msg;
out.result = result.result != null && "1".equals(r... | 1,171 | 110 | 1,281 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java | MessageAdmin | clearConversation | class MessageAdmin {
public static IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
return sendMessage(sender, conversation, payload, null);
}
//toUsers为发送给会话中部分用户用的,正常为null,仅当需要指定群/频道/聊天室中部分接收用户时使用
public static IMResul... |
String path = APIPath.Conversation_Delete;
InputUserConversation input = new InputUserConversation();
input.userId = userId;
input.conversation = conversation;
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
| 1,767 | 71 | 1,838 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/RelationAdmin.java | RelationAdmin | setUserFriend | class RelationAdmin {
public static IMResult<Void> setUserFriend(String userId, String targetId, boolean isFriend, String extra) throws Exception {<FILL_FUNCTION_BODY>}
public static IMResult<OutputStringList> getFriendList(String userId) throws Exception {
String path = APIPath.Friend_Get_List;
... |
String path = APIPath.Friend_Update_Status;
InputUpdateFriendStatusRequest input = new InputUpdateFriendStatusRequest();
input.setUserId(userId);
input.setFriendUid(targetId);
input.setStatus(isFriend ? 0 : 1); //历史遗留问题,在IM数据库中0是好友,1是好友被删除。
input.setExtra(extra);
... | 892 | 127 | 1,019 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/SensitiveAdmin.java | SensitiveAdmin | addSensitives | class SensitiveAdmin {
public static IMResult<Void> addSensitives(List<String> sensitives) throws Exception {<FILL_FUNCTION_BODY>}
public static IMResult<Void> removeSensitives(List<String> sensitives) throws Exception {
String path = APIPath.Sensitive_Del;
InputOutputSensitiveWords input = new... |
String path = APIPath.Sensitive_Add;
InputOutputSensitiveWords input = new InputOutputSensitiveWords();
input.setWords(sensitives);
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
| 204 | 67 | 271 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/utilities/AdminHttpUtils.java | AdminHttpUtils | httpGet | class AdminHttpUtils extends JsonUtils {
private static final Logger LOG = LoggerFactory.getLogger(AdminHttpUtils.class);
public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
private static String adminUrl;
private static String adminSecret;
private static CloseableHttp... |
if (isNullOrEmpty(adminUrl) || isNullOrEmpty(adminSecret)) {
LOG.error("野火IM Server SDK必须先初始化才能使用,是不是忘记初始化了!!!!");
throw new Exception("SDK没有初始化");
}
if (isNullOrEmpty(path)) {
throw new Exception("路径缺失");
}
HttpGet get = null;
try {
... | 1,021 | 427 | 1,448 | <methods>public non-sealed void <init>() ,public static IMResult<T> fromJsonObject(java.lang.String, Class<T>) ,public static boolean isNullOrEmpty(java.lang.String) <variables>public static final com.google.gson.Gson gson |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/utilities/ChannelHttpUtils.java | ChannelHttpUtils | httpJsonPost | class ChannelHttpUtils extends JsonUtils {
private static final Logger LOG = LoggerFactory.getLogger(ChannelHttpUtils.class);
public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
private String imurl;
private String channelId;
private String channelSecret;
private f... |
if (isNullOrEmpty(imurl) || isNullOrEmpty(path)) {
LOG.error("Not init IM SDK correctly. Do you forget init it?");
throw new Exception("SDK url or secret lack!");
}
String url = imurl + path;
HttpPost post = null;
try {
int nonce = (int)(Math... | 357 | 640 | 997 | <methods>public non-sealed void <init>() ,public static IMResult<T> fromJsonObject(java.lang.String, Class<T>) ,public static boolean isNullOrEmpty(java.lang.String) <variables>public static final com.google.gson.Gson gson |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/utilities/JsonUtils.java | JsonUtils | fromJsonObject | class JsonUtils {
public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
public static <T> IMResult<T> fromJsonObject(String content, Class<T> clazz) {<FILL_FUNCTION_BODY>}
public static boolean isNullOrEmpty(String str) {
return str == null || str.isEmpty();
}
} |
TypeBuilder builder = TypeBuilder.newInstance(IMResult.class);
if (!clazz.equals(Void.class)) {
builder.addTypeParam(clazz);
}
return gson.fromJson(content, builder.build());
| 97 | 64 | 161 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/cn/wildfirechat/sdk/utilities/RobotHttpUtils.java | RobotHttpUtils | httpJsonPost | class RobotHttpUtils extends JsonUtils {
private static final Logger LOG = LoggerFactory.getLogger(RobotHttpUtils.class);
public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
private final String url;
private final String robotId;
private final String robotSecret;
p... |
if (isNullOrEmpty(url) || isNullOrEmpty(path)) {
LOG.error("Not init IM SDK correctly. Do you forget init it?");
throw new Exception("SDK url or secret lack!");
}
String url = this.url + path;
HttpPost post = null;
try {
int nonce = (int)(Mat... | 366 | 659 | 1,025 | <methods>public non-sealed void <init>() ,public static IMResult<T> fromJsonObject(java.lang.String, Class<T>) ,public static boolean isNullOrEmpty(java.lang.String) <variables>public static final com.google.gson.Gson gson |
wildfirechat_im-server | im-server/sdk/src/main/java/ikidou/reflect/TypeBuilder.java | TypeBuilder | addTypeParam | class TypeBuilder {
private final TypeBuilder parent;
private final Class raw;
private final List<Type> args = new ArrayList<>();
private TypeBuilder(Class raw, TypeBuilder parent) {
assert raw != null;
this.raw = raw;
this.parent = parent;
}
public static TypeBuilder ... |
if (type == null) {
throw new NullPointerException("addTypeParam expect not null Type");
}
args.add(type);
return this;
| 555 | 46 | 601 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/ikidou/reflect/typeimpl/ParameterizedTypeImpl.java | ParameterizedTypeImpl | toString | class ParameterizedTypeImpl implements ParameterizedType {
private final Class raw;
private final Type[] args;
private final Type owner;
public ParameterizedTypeImpl(Class raw, Type[] args, Type owner) {
this.raw = raw;
this.args = args != null ? args : new Type[0];
this.owner =... |
StringBuilder sb = new StringBuilder();
sb.append(raw.getName());
if (args.length != 0) {
sb.append('<');
for (int i = 0; i < args.length; i++) {
if (i != 0) {
sb.append(", ");
}
Type type = args[i];
... | 517 | 264 | 781 | <no_super_class> |
wildfirechat_im-server | im-server/sdk/src/main/java/ikidou/reflect/typeimpl/WildcardTypeImpl.java | WildcardTypeImpl | getTypeString | class WildcardTypeImpl implements WildcardType {
private final Class[] upper;
private final Class[] lower;
public WildcardTypeImpl(Class[] lower, Class[] upper) {
this.lower = lower != null ? lower : new Class[0];
this.upper = upper != null ? upper : new Class[0];
checkArgs();
... |
StringBuilder sb = new StringBuilder();
sb.append(prefix);
for (int i = 0; i < type.length; i++) {
if (i != 0) {
sb.append(" & ");
}
sb.append(type[i].getName());
}
return sb.toString();
| 541 | 86 | 627 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/Channels.java | Channels | getChannel | class Channels {
private static final ConcurrentHashMap<String, ManagedChannel> chs = new ConcurrentHashMap<>();
public static ManagedChannel getChannel(String target) {<FILL_FUNCTION_BODY>}
} |
ManagedChannel channel;
if ((channel = chs.get(target)) == null || channel.isShutdown() || channel.isTerminated()) {
synchronized (chs) {
if ((channel = chs.get(target)) == null || channel.isShutdown() ||
channel.isTerminated()) {
cha... | 61 | 129 | 190 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClient.java | DiscoveryClient | resetChannel | class DiscoveryClient implements Closeable, Discoverable {
private final Timer timer = new Timer("serverHeartbeat", true);
private final AtomicBoolean requireResetStub = new AtomicBoolean(false);
protected int period; //心跳周期
LinkedList<String> pdAddresses = new LinkedList<>();
ReentrantReadWriteLoc... |
readWriteLock.writeLock().lock();
try {
if (requireResetStub.get()) {
while (channel != null && !channel.shutdownNow().awaitTermination(
100, TimeUnit.MILLISECONDS)) {
continue;
}
channel = ManagedC... | 1,275 | 219 | 1,494 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/LicenseClient.java | LicenseClient | putLicense | class LicenseClient extends AbstractClient {
public LicenseClient(PDConfig config) {
super(config);
}
@Override
protected AbstractStub createStub() {
return PDGrpc.newStub(channel);
}
@Override
protected AbstractBlockingStub createBlockingStub() {
return PDGrpc.new... |
Pdpb.PutLicenseRequest request = Pdpb.PutLicenseRequest.newBuilder()
.setContent(
ByteString.copyFrom(content))
.b... | 134 | 279 | 413 | <methods>public void close() ,public static org.apache.hugegraph.pd.grpc.Pdpb.ResponseHeader newErrorHeader(int, java.lang.String) <variables>protected ManagedChannel channel,private static final ConcurrentHashMap<java.lang.String,ManagedChannel> chs,protected final non-sealed org.apache.hugegraph.pd.client.PDConfig co... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDConfig.java | PDConfig | toString | class PDConfig {
//TODO multi-server
private String serverHost = "localhost:9000";
private long grpcTimeOut = 60000; // grpc调用超时时间 10秒
// 是否接收PD异步通知
private boolean enablePDNotify = false;
private boolean enableCache = false;
private PDConfig() {
}
public static PDConfig of() ... |
return "PDConfig{" +
"serverHost='" + serverHost + '\'' +
'}';
| 431 | 30 | 461 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDPulseImpl.java | AbstractConnector | ackNotice | class AbstractConnector<N, L> implements Notifier<N>,
StreamObserver<PulseResponse> {
Listener<L> listener;
StreamObserver<PulseRequest> reqStream;
PulseType pulseType;
PulseRequest.Builder reqBuilder = PulseRequest.newBuilde... |
threadPool.execute(() -> {
// log.info("send ack: {}, ts: {}", noticeId, System.currentTimeMillis());
this.reqStream.onNext(reqBuilder.clear()
.setAckRequest(
this.ackBuil... | 443 | 113 | 556 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/PDWatchImpl.java | PartitionWatcher | onNext | class PartitionWatcher extends AbstractWatcher<PartitionEvent> {
private PartitionWatcher(Listener listener) {
super(listener,
() -> WatchCreateRequest
.newBuilder()
.setWatchType(WatchType.WATCH_TYPE_PARTITION_CHANGE)
... |
WatchPartitionResponse res = watchResponse.getPartitionResponse();
PartitionEvent event = new PartitionEvent(res.getGraph(), res.getPartitionId(),
PartitionEvent.ChangeType.grpcTypeOf(
... | 117 | 76 | 193 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/NodeEvent.java | NodeEvent | equals | class NodeEvent {
private final String graph;
private final long nodeId;
private final EventType eventType;
public NodeEvent(String graph, long nodeId, EventType eventType) {
this.graph = graph;
this.nodeId = nodeId;
this.eventType = eventType;
}
public String getGraph... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NodeEvent nodeEvent = (NodeEvent) o;
return nodeId == nodeEvent.nodeId && Objects.equals(graph,
... | 481 | 99 | 580 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/watch/PartitionEvent.java | PartitionEvent | grpcTypeOf | class PartitionEvent {
private final String graph;
private final int partitionId;
private final ChangeType changeType;
public PartitionEvent(String graph, int partitionId, ChangeType changeType) {
this.graph = graph;
this.partitionId = partitionId;
this.changeType = changeType;... |
switch (grpcType) {
case WATCH_CHANGE_TYPE_ADD:
return ADD;
case WATCH_CHANGE_TYPE_ALTER:
return ALTER;
case WATCH_CHANGE_TYPE_DEL:
return DEL;
default:
return UNK... | 414 | 84 | 498 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/HgAssert.java | HgAssert | isContains | class HgAssert {
public static void isTrue(boolean expression, String message) {
if (message == null) {
throw new IllegalArgumentException("message is null");
}
if (!expression) {
throw new IllegalArgumentException(message);
}
}
public static void i... |
if (list == null || item == null) {
return false;
}
return list.contains(item);
| 686 | 33 | 719 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/KVPair.java | KVPair | hashCode | class KVPair<K, V> implements Serializable {
/**
* Key of this <code>Pair</code>.
*/
private K key;
/**
* Value of this this <code>Pair</code>.
*/
private V value;
/**
* Creates a new pair
*
* @param key The key for this pair
* @param value The value to us... |
// name's hashCode is multiplied by an arbitrary prime number (13)
// in order to make sure there is a difference in the hashCode between
// these two parameters:
// name: a value: aa
// name: aa value: a
return key.hashCode() * 13 + (value == null ? 0 : value.hashCod... | 859 | 96 | 955 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-common/src/main/java/org/apache/hugegraph/pd/common/PartitionUtils.java | PartitionUtils | calcHashcode | class PartitionUtils {
public static final int MAX_VALUE = 0xffff;
/**
* 计算key的hashcode
*
* @param key
* @return hashcode
*/
public static int calcHashcode(byte[] key) {<FILL_FUNCTION_BODY>}
} |
final int p = 16777619;
int hash = (int) 2166136261L;
for (byte element : key) {
hash = (hash ^ element) * p;
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
hash = hash & Part... | 81 | 162 | 243 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/ConfigService.java | ConfigService | loadConfig | class ConfigService implements RaftStateListener {
private final ConfigMetaStore meta;
private PDConfig pdConfig;
public ConfigService(PDConfig config) {
this.pdConfig = config;
config.setConfigService(this);
meta = MetadataFactory.newConfigMeta(config);
}
public Metapb.PD... |
try {
Metapb.PDConfig mConfig = this.meta.getPdConfig(0);
if (mConfig == null) {
mConfig = Metapb.PDConfig.newBuilder()
.setPartitionCount(pdConfig.getInitialPartitionCount())
.setShardCoun... | 830 | 223 | 1,053 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/LogService.java | LogService | insertLog | class LogService {
public static final String GRPC = "GRPC";
public static final String REST = "REST";
public static final String TASK = "TASK";
public static final String NODE_CHANGE = "NODE_CHANGE";
public static final String PARTITION_CHANGE = "PARTITION_CHANGE";
private final LogMeta logMet... |
try {
Metapb.LogRecord logRecord = Metapb.LogRecord.newBuilder()
.setAction(action)
.setMessage(message)
.setTimestamp(System.cu... | 208 | 119 | 327 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java | PDConfig | getInitialStoreMap | class PDConfig {
@Value("${pd.cluster_id:1}")
private long clusterId; // 集群ID
@Value("${pd.patrol-interval:300}")
private long patrolInterval = 300; //巡查任务时间间隔
@Value("${pd.data-path}")
private String dataPath;
@Value("${pd.initial-store-count:3}")
private int minStoreCount;
//... |
if (initialStoreMap == null) {
initialStoreMap = new HashMap<>();
Arrays.asList(initialStoreList.split(",")).forEach(s -> {
initialStoreMap.put(s, s);
});
}
return initialStoreMap;
| 1,936 | 73 | 2,009 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/ConfigMetaStore.java | ConfigMetaStore | setPdConfig | class ConfigMetaStore extends MetadataRocksDBStore {
private final long clusterId;
public ConfigMetaStore(PDConfig pdConfig) {
super(pdConfig);
this.clusterId = pdConfig.getClusterId();
}
/**
* 更新图空间存储状态信息
*
* @param
*/
public Metapb.GraphSpace setGraphSpace(Me... |
byte[] graphSpaceKey =
MetadataKeyHelper.getPdConfigKey(String.valueOf(pdConfig.getVersion()));
Metapb.PDConfig config = Metapb.PDConfig.newBuilder(
pdConfig).setTimestamp(System.currentTimeMillis()).build();
put(graphSpaceKey, config.toByteArray());
retu... | 443 | 92 | 535 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/DiscoveryMetaStore.java | DiscoveryMetaStore | getNodes | class DiscoveryMetaStore extends MetadataRocksDBStore {
/**
* appName --> address --> registryInfo
*/
private static final String PREFIX = "REGIS-";
private static final String SPLITTER = "-";
public DiscoveryMetaStore(PDConfig pdConfig) {
super(pdConfig);
}
public void regi... |
List<NodeInfo> nodeInfos = null;
try {
StringBuilder builder = getPrefixBuilder(query.getAppName(),
query.getVersion());
nodeInfos = getInstanceListWithTTL(
NodeInfo.parser(),
builder.to... | 465 | 234 | 699 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/LogMeta.java | LogMeta | getLog | class LogMeta extends MetadataRocksDBStore {
private final PDConfig pdConfig;
public LogMeta(PDConfig pdConfig) {
super(pdConfig);
this.pdConfig = pdConfig;
}
public void insertLog(Metapb.LogRecord record) throws PDException {
byte[] storeLogKey = MetadataKeyHelper.getLogKey(r... |
byte[] keyStart = MetadataKeyHelper.getLogKeyPrefix(action, start);
byte[] keyEnd = MetadataKeyHelper.getLogKeyPrefix(action, end);
List<Metapb.LogRecord> stores = this.scanRange(Metapb.LogRecord.parser(),
keyStart, keyEnd);
return ... | 161 | 86 | 247 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataFactory.java | MetadataFactory | getStore | class MetadataFactory {
private static HgKVStore store = null;
public static HgKVStore getStore(PDConfig pdConfig) {<FILL_FUNCTION_BODY>}
public static void closeStore() {
if (store != null) {
store.close();
}
}
public static StoreInfoMeta newStoreInfoMeta(PDConfig pd... |
if (store == null) {
synchronized (MetadataFactory.class) {
if (store == null) {
HgKVStore proto = new HgKVStoreImpl();
//proto.init(pdConfig);
store = pdConfig.getRaft().isEnable() ?
new RaftKVS... | 355 | 120 | 475 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataRocksDBStore.java | MetadataRocksDBStore | remove | class MetadataRocksDBStore extends MetadataStoreBase {
HgKVStore store;
PDConfig pdConfig;
public MetadataRocksDBStore(PDConfig pdConfig) {
store = MetadataFactory.getStore(pdConfig);
this.pdConfig = pdConfig;
}
public HgKVStore getStore() {
if (store == null) {
... |
try {
return this.store.remove(key);
} catch (Exception e) {
throw new PDException(Pdpb.ErrorType.ROCKSDB_WRITE_ERROR_VALUE, e);
}
| 1,299 | 59 | 1,358 | <methods>public non-sealed void <init>() ,public abstract void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public abstract void close() throws java.io.IOException,public abstract boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List<T> getInstanceListWithTTL(Par... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/MetadataStoreBase.java | MetadataStoreBase | getInstanceListWithTTL | class MetadataStoreBase {
// public long timeout = 3; // 请求超时时间,默认三秒
public abstract byte[] getOne(byte[] key) throws PDException;
public abstract <E> E getOne(Parser<E> parser, byte[] key) throws PDException;
public abstract void put(byte[] key, byte[] value) throws PDException;
/**
* 带有... |
try {
List withTTL = this.getListWithTTL(key);
LinkedList<T> ts = new LinkedList<>();
for (int i = 0; i < withTTL.size(); i++) {
ts.add(parser.parseFrom((byte[]) withTTL.get(i)));
}
return ts;
} catch (Exception e) {
... | 706 | 129 | 835 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/QueueStore.java | QueueStore | removeItem | class QueueStore extends MetadataRocksDBStore {
QueueStore(PDConfig pdConfig) {
super(pdConfig);
}
public void addItem(Metapb.QueueItem queueItem) throws PDException {
HgAssert.isArgumentNotNull(queueItem, "queueItem");
byte[] key = MetadataKeyHelper.getQueueItemKey(queueItem.getIt... |
if (RaftEngine.getInstance().isLeader()) {
remove(MetadataKeyHelper.getQueueItemKey(itemId));
} else {
var store = getStore();
// todo: delete record via client
if (store instanceof RaftKVStore) {
((RaftKVStore) store).doRemove(MetadataKey... | 207 | 101 | 308 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/StoreInfoMeta.java | StoreInfoMeta | getStoreStats | class StoreInfoMeta extends MetadataRocksDBStore {
private final PDConfig pdConfig;
public StoreInfoMeta(PDConfig pdConfig) {
super(pdConfig);
this.pdConfig = pdConfig;
// this.timeout = pdConfig.getDiscovery().getHeartbeatOutTimes();
}
public static boolean shardGroupEquals... |
byte[] storeStatusKey = MetadataKeyHelper.getStoreStatusKey(storeId);
Metapb.StoreStats stats = getOne(Metapb.StoreStats.parser(),
storeStatusKey);
return stats;
| 1,767 | 57 | 1,824 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/meta/TaskInfoMeta.java | TaskInfoMeta | updateMovePartitionTask | class TaskInfoMeta extends MetadataRocksDBStore {
public TaskInfoMeta(PDConfig pdConfig) {
super(pdConfig);
}
/**
* 添加分区分裂任务
*/
public void addSplitTask(int groupID, Metapb.Partition partition, SplitPartition splitPartition)
throws PDException {
byte[] key = Metad... |
byte[] key = MetadataKeyHelper.getMoveTaskKey(task.getPartition().getGraphName(),
task.getMovePartition().getTargetPartition()
.getId(),
task.ge... | 1,013 | 70 | 1,083 | <methods>public void <init>(org.apache.hugegraph.pd.config.PDConfig) ,public void clearAllCache() throws org.apache.hugegraph.pd.common.PDException,public void close() ,public boolean containsKey(byte[]) throws org.apache.hugegraph.pd.common.PDException,public List#RAW getListWithTTL(byte[]) throws org.apache.hugegraph... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/KVOperation.java | KVOperation | createPutWithTTL | class KVOperation {
/**
* Put operation
*/
public static final byte PUT = 0x01;
/**
* Get operation
*/
public static final byte GET = 0x02;
public static final byte DEL = 0x03;
public static final byte REMOVE_BY_PREFIX = 0x04;
public static final byte REMOVE = 0x05;
... |
Requires.requireNonNull(key, "key");
Requires.requireNonNull(value, "value");
return new KVOperation(key, value, value, PUT_WITH_TTL,
ttl);
| 1,260 | 58 | 1,318 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcClient.java | RaftRpcClient | getGrpcAddress | class RaftRpcClient {
protected volatile RpcClient rpcClient;
private RpcOptions rpcOptions;
public synchronized boolean init(final RpcOptions rpcOptions) {
this.rpcOptions = rpcOptions;
final RaftRpcFactory factory = RpcFactoryHelper.rpcFactory();
this.rpcClient =
... |
RaftRpcProcessor.GetMemberRequest request = new RaftRpcProcessor.GetMemberRequest();
FutureClosureAdapter<RaftRpcProcessor.GetMemberResponse> response =
new FutureClosureAdapter<>();
internalCallAsyncWithRpc(JRaftUtils.getEndPoint(address), request, response);
return res... | 477 | 88 | 565 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/RaftRpcProcessor.java | RaftRpcProcessor | getGrpcAddress | class RaftRpcProcessor<T extends RaftRpcProcessor.BaseRequest> implements RpcProcessor<T> {
private final Class<?> requestClass;
private final RaftEngine raftEngine;
public RaftRpcProcessor(Class<?> requestClass, RaftEngine raftEngine) {
this.requestClass = requestClass;
this.raftEngine = ... |
GetMemberResponse rep = new GetMemberResponse();
rep.setGrpcAddress(raftEngine.getConfig().getGrpcAddress());
rep.setClusterId(raftEngine.getConfig().getClusterId());
rep.setDatePath(raftEngine.getConfig().getDataPath());
rep.setRaftAddress(raftEngine.getConfig().getAddress());
... | 677 | 139 | 816 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/raft/ZipUtils.java | ZipUtils | compress | class ZipUtils {
public static void compress(final String rootDir, final String sourceDir,
final String outputFile, final Checksum checksum) throws
IOException {<FILL_FUNCTION_BODY>}
private stati... |
try (final FileOutputStream fos = new FileOutputStream(outputFile);
final CheckedOutputStream cos = new CheckedOutputStream(fos, checksum);
final ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(cos))) {
ZipUtils.compressDirectoryToZipFile(rootDir, source... | 553 | 102 | 655 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-grpc/src/main/java/org/apache/hugegraph/pd/grpc/pulse/HgPdPulseGrpc.java | HgPdPulseMethodDescriptorSupplier | getServiceDescriptor | class HgPdPulseMethodDescriptorSupplier
extends HgPdPulseBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
HgPdPulseMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
... |
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (HgPdPulseGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(n... | 175 | 131 | 306 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-pd/hg-pd-grpc/src/main/java/org/apache/hugegraph/pd/grpc/pulse/PulseCancelRequest.java | Builder | mergeFrom | class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:PulseCancelRequest)
org.apache.hugegraph.pd.grpc.pulse.PulseCancelRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDes... |
org.apache.hugegraph.pd.grpc.pulse.PulseCancelRequest parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.apache.hugegraph.pd.grpc.pulse.PulseCancelRequest)... | 1,765 | 150 | 1,915 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java | API | parseProperties | class API {
public static final String CHARSET = "UTF-8";
public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN;
public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON;
public static final String APPLICATION_JSON_WITH_CHARSET =
APPLICATION_JSON + ";charset=" + CHARS... |
if (properties == null || properties.isEmpty()) {
return ImmutableMap.of();
}
Map<String, Object> props = null;
try {
props = JsonUtil.fromJson(properties, Map.class);
} catch (Exception ignored) {
// ignore
}
// If propertie... | 1,865 | 123 | 1,988 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java | ArthasAPI | startArthas | class ArthasAPI extends API {
@Context
private jakarta.inject.Provider<HugeConfig> configProvider;
@PUT
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@Operation(summary = "start arthas agent")
public Object startArthas() {<FILL_FUNCTION_BODY>}
} |
HugeConfig config = this.configProvider.get();
HashMap<String, String> configMap = new HashMap<>(4);
configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT));
configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT));
configMap.put("art... | 99 | 181 | 280 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java | AccessAPI | create | class AccessAPI extends API {
private static final Logger LOG = Log.logger(AccessAPI.class);
@POST
@Timed
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String create(@Context GraphManager manager,
@PathParam("gr... |
LOG.debug("Graph [{}] create access: {}", graph, jsonAccess);
checkCreatingBody(jsonAccess);
HugeGraph g = graph(manager, graph);
HugeAccess access = jsonAccess.build();
access.id(manager.authManager().createAccess(access));
return manager.serializer(g).writeAuthElement... | 1,464 | 91 | 1,555 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java | BelongAPI | list | class BelongAPI extends API {
private static final Logger LOG = Log.logger(BelongAPI.class);
@POST
@Timed
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String create(@Context GraphManager manager,
@PathParam("gr... |
LOG.debug("Graph [{}] list belongs by user {} or group {}",
graph, user, group);
E.checkArgument(user == null || group == null,
"Can't pass both user and group at the same time");
HugeGraph g = graph(manager, graph);
List<HugeBelong> belongs;
... | 1,289 | 215 | 1,504 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java | JsonGroup | build | class JsonGroup implements Checkable {
@JsonProperty("group_name")
private String name;
@JsonProperty("group_description")
private String description;
public HugeGroup build(HugeGroup group) {<FILL_FUNCTION_BODY>}
public HugeGroup build() {
HugeGroup group ... |
E.checkArgument(this.name == null || group.name().equals(this.name),
"The name of group can't be updated");
if (this.description != null) {
group.description(this.description);
}
return group;
| 201 | 69 | 270 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java | LoginAPI | login | class LoginAPI extends API {
private static final Logger LOG = Log.logger(LoginAPI.class);
@POST
@Timed
@Path("login")
@Status(Status.OK)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String login(@Context GraphManager manager, @PathParam("graph") String g... |
LOG.debug("Graph [{}] user login: {}", graph, jsonLogin);
checkCreatingBody(jsonLogin);
try {
String token = manager.authManager().loginUser(jsonLogin.name, jsonLogin.password);
HugeGraph g = graph(manager, graph);
return manager.serializer(g).writeMap(Immut... | 813 | 125 | 938 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java | JsonProject | buildAddGraph | class JsonProject implements Checkable {
@JsonProperty("project_name")
private String name;
@JsonProperty("project_graphs")
private Set<String> graphs;
@JsonProperty("project_description")
private String description;
public HugeProject build() {
Huge... |
E.checkArgument(this.name == null ||
this.name.equals(project.name()),
"The name of project can't be updated");
E.checkArgument(!CollectionUtils.isEmpty(this.graphs),
"The graphs of project can't be empty " +
... | 617 | 224 | 841 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java | JsonTarget | build | class JsonTarget implements Checkable {
@JsonProperty("target_name")
private String name;
@JsonProperty("target_graph")
private String graph;
@JsonProperty("target_url")
private String url;
@JsonProperty("target_resources") // error when List<HugeResource>
... |
E.checkArgument(this.name == null ||
target.name().equals(this.name),
"The name of target can't be updated");
E.checkArgument(this.graph == null ||
target.graph().equals(this.graph),
... | 339 | 140 | 479 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java | UserAPI | role | class UserAPI extends API {
private static final Logger LOG = Log.logger(UserAPI.class);
@POST
@Timed
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String create(@Context GraphManager manager,
@PathParam("graph"... |
LOG.debug("Graph [{}] get user role: {}", graph, id);
@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
HugeUser user = manager.authManager().getUser(IdGenerator.of(id));
return manager.authManager().rolePermission(user).toJson()... | 1,583 | 94 | 1,677 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java | CypherAPI | client | class CypherAPI extends API {
private static final Logger LOG = Log.logger(CypherAPI.class);
private static final Charset UTF8 = StandardCharsets.UTF_8;
private static final String CLIENT_CONF = "conf/remote-objects.yaml";
private final Base64.Decoder decoder = Base64.getUrlDecoder();
private final... |
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
if (auth != null && !auth.isEmpty()) {
auth = auth.split(",")[0];
}
if (auth != null) {
if (auth.startsWith(basic)) {
return this.clientViaBasic(auth);
} else if (auth... | 972 | 147 | 1,119 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java | CypherClient | equals | class CypherClient {
private static final Logger LOG = Log.logger(CypherClient.class);
private final Supplier<Configuration> configurationSupplier;
private String userName;
private String password;
private String token;
CypherClient(String userName, String password,
Supplier<C... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CypherClient that = (CypherClient) o;
return Objects.equals(userName, that.userName) &&
Objects.equals(password, that.password) &&
... | 978 | 108 | 1,086 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java | CypherManager | loadYaml | class CypherManager {
private final String configurationFile;
private YAMLConfiguration configuration;
public static CypherManager configOf(String configurationFile) {
E.checkArgument(configurationFile != null && !configurationFile.isEmpty(),
"The configurationFile paramete... |
File yamlFile = getConfigFile(configurationFile);
YAMLConfiguration yaml;
try {
Reader reader = new FileReader(yamlFile);
yaml = new YAMLConfiguration();
yaml.read(reader);
} catch (Exception e) {
throw new RuntimeException(String.format("... | 562 | 115 | 677 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java | CypherModel | dataOf | class CypherModel {
public String requestId;
public Status status = new Status();
public Result result = new Result();
public static CypherModel dataOf(String requestId, List<Object> data) {<FILL_FUNCTION_BODY>}
public static CypherModel failOf(String requestId, String message) {
CypherMo... |
CypherModel res = new CypherModel();
res.requestId = requestId;
res.status.code = 200;
res.result.data = data;
return res;
| 244 | 54 | 298 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java | AccessLogFilter | filter | class AccessLogFilter implements ContainerResponseFilter {
private static final Logger LOG = Log.logger(AccessLogFilter.class);
private static final String DELIMITER = "/";
private static final String GRAPHS = "graphs";
private static final String GREMLIN = "gremlin";
private static final String C... |
// Grab corresponding request / response info from context;
URI uri = requestContext.getUriInfo().getRequestUri();
String path = uri.getRawPath();
String method = requestContext.getMethod();
String metricsName = join(path, method);
MetricsUtil.registerCounter(join(metri... | 436 | 526 | 962 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java | CompressInterceptor | compress | class CompressInterceptor implements WriterInterceptor {
public static final String GZIP = "gzip";
private static final Logger LOG = Log.logger(CompressInterceptor.class);
// Set compress output buffer size to 4KB (about 40~600 vertices)
public static final int BUFFER_SIZE = 1024 * 4;
@Override
... |
// Get compress info from the @Compress annotation
final Compress compression = getCompressAnnotation(context);
final String encoding = compression.value();
final int buffer = compression.buffer();
// Update header
MultivaluedMap<String, Object> headers = context.getHea... | 425 | 195 | 620 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java | DecompressInterceptor | aroundReadFrom | class DecompressInterceptor implements ReaderInterceptor {
public static final String GZIP = "gzip";
@Override
public Object aroundReadFrom(ReaderInterceptorContext context)
throws IOException {<FILL_FUNCTION_BODY>}
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interfac... |
// NOTE: Currently we just support GZIP
String encoding = context.getHeaders().getFirst("Content-Encoding");
if (!GZIP.equalsIgnoreCase(encoding)) {
return context.proceed();
}
context.setInputStream(new GZIPInputStream(context.getInputStream()));
return cont... | 111 | 85 | 196 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java | UnknownExceptionMapper | formatGremlinException | class UnknownExceptionMapper extends TracedExceptionMapper
implements ExceptionMapper<Throwable> {
@Override
public Response toResponse(Throwable exception) {
if (exception instanceof MultiException &&
((MultiException) exception).getErrors().size() == 1) {
... |
Map<String, Object> map = exception.response();
String message = (String) map.get("message");
String exClassName = (String) map.get("Exception-Class");
@SuppressWarnings("unchecked")
List<String> exceptions = (List<String>) map.get("exceptions");
String stackTrace = (Str... | 372 | 268 | 640 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java | LoadDetectFilter | filter | class LoadDetectFilter implements ContainerRequestFilter {
private static final Set<String> WHITE_API_LIST = ImmutableSet.of(
"",
"apis",
"metrics",
"versions"
);
// Call gc every 30+ seconds if memory is low and request frequently
private static final R... |
if (LoadDetectFilter.isWhiteAPI(context)) {
return;
}
HugeConfig config = this.configProvider.get();
int maxWorkerThreads = config.get(ServerOptions.MAX_WORKER_THREADS);
WorkLoad load = this.loadProvider.get();
// There will be a thread doesn't work, dedica... | 337 | 375 | 712 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java | LoadReleaseFilter | filter | class LoadReleaseFilter implements ContainerResponseFilter {
@Context
private jakarta.inject.Provider<WorkLoad> loadProvider;
@Override
public void filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext) {<FILL_FUNCTION_BODY>}
} |
if (LoadDetectFilter.isWhiteAPI(requestContext)) {
return;
}
WorkLoad load = this.loadProvider.get();
load.decrementAndGet();
| 76 | 51 | 127 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java | PathFilter | filter | class PathFilter implements ContainerRequestFilter {
public static final String REQUEST_TIME = "request_time";
public static final String REQUEST_PARAMS_JSON = "request_params_json";
@Override
public void filter(ContainerRequestContext context) throws IOException {<FILL_FUNCTION_BODY>}
} |
context.setProperty(REQUEST_TIME, System.currentTimeMillis());
// TODO: temporarily comment it to fix loader bug, handle it later
/*// record the request json
String method = context.getMethod();
String requestParamsJson = "";
if (method.equals(HttpMethod.POST)) {
... | 81 | 234 | 315 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java | RedirectFilter | forwardRequest | class RedirectFilter implements ContainerRequestFilter {
private static final Logger LOG = Log.logger(RedirectFilter.class);
private static final String X_HG_REDIRECT = "x-hg-redirect";
private static volatile Client client = null;
@Context
private IterableProvider<GraphManager> managerProvider;... |
MultivaluedMap<String, String> headers = requestContext.getHeaders();
MultivaluedMap<String, Object> newHeaders = HeaderUtils.createOutbound();
if (headers != null) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
for (String value : entry.getValu... | 727 | 244 | 971 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java | StatusFilter | filter | class StatusFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext)
throws IOException {<FILL_FUNCTION_BODY>}
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
publi... |
if (responseContext.getStatus() == 200) {
for (Annotation i : responseContext.getEntityAnnotations()) {
if (i instanceof Status) {
responseContext.setStatus(((Status) i).value());
break;
}
}
}
| 122 | 72 | 194 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java | JsonElement | updateExistElement | class JsonElement implements Checkable {
@JsonProperty("id")
public Object id;
@JsonProperty("label")
public String label;
@JsonProperty("properties")
public Map<String, Object> properties;
@JsonProperty("type")
public String type;
@Override
... |
if (oldElement == null) {
return;
}
E.checkArgument(newElement != null, "The json element can't be null");
for (Map.Entry<String, UpdateStrategy> kv : strategies.entrySet()) {
String key = kv.getKey();
UpdateStrategy updateStrategy = kv.getValue();
... | 155 | 246 | 401 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java | AbstractJerseyRestClient | cleanThreadPoolExecutor | class AbstractJerseyRestClient {
/**
* Time unit: hour
*/
private static final long TTL = 24L;
/**
* Time unit: ms
*/
private static final long IDLE_TIME = 40L * 1000L;
private static final String PROPERTY_MAX_TOTAL = "maxTotal";
private static final String PROPERTY_MAX_PER_... |
this.cleanExecutor = ExecutorUtil.newScheduledThreadPool("conn-clean-worker-%d");
Number idleTimeProp = (Number) config.getProperty(PROPERTY_IDLE_TIME);
final long idleTime = idleTimeProp == null ? IDLE_TIME : idleTimeProp.longValue();
final long checkPeriod = idleTime / 2L;
thi... | 926 | 233 | 1,159 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java | GremlinAPI | post | class GremlinAPI extends GremlinQueryAPI {
private static final Histogram GREMLIN_INPUT_HISTOGRAM =
MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-input");
private static final Histogram GREMLIN_OUTPUT_HISTOGRAM =
MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-output... |
/* The following code is reserved for forwarding request */
// context.getRequestDispatcher(location).forward(request, response);
// return Response.seeOther(UriBuilder.fromUri(location).build())
// .build();
// Response.temporaryRedirect(UriBuilder.fromUri(location).build())
... | 414 | 176 | 590 | <methods>public non-sealed void <init>() ,public org.apache.hugegraph.api.gremlin.GremlinClient client() <variables>private static final Set<java.lang.String> BAD_REQUEST_EXCEPTIONS,private static final Set<java.lang.String> FORBIDDEN_REQUEST_EXCEPTIONS,private org.apache.hugegraph.api.gremlin.GremlinClient client,priv... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java | GremlinClient | doPostRequest | class GremlinClient extends AbstractJerseyRestClient {
/**
* Constructs a GremlinClient with the specified URL, timeout, maxTotal, and maxPerRoute.
*
* @param url The URL of the Gremlin server this client will interact with.
* @param timeout The timeout for the client.
* @param... |
Entity<?> body = Entity.entity(req, MediaType.APPLICATION_JSON);
return this.getWebTarget().request()
.header(HttpHeaders.AUTHORIZATION, auth)
.accept(MediaType.APPLICATION_JSON)
.acceptEncoding(CompressInterceptor.GZIP)
.post(... | 504 | 92 | 596 | <methods>public void <init>(java.lang.String, int, int, int) ,public void <init>(java.lang.String, ClientConfig) ,public void close() <variables>private static final java.lang.String CONNECTION_MANAGER,private static final long IDLE_TIME,private static final java.lang.String PROPERTY_IDLE_TIME,private static final java... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java | GremlinQueryAPI | transformResponseIfNeeded | class GremlinQueryAPI extends API {
private static final Set<String> FORBIDDEN_REQUEST_EXCEPTIONS =
ImmutableSet.of("java.lang.SecurityException", "jakarta.ws.rs.ForbiddenException");
private static final Set<String> BAD_REQUEST_EXCEPTIONS = ImmutableSet.of(
"java.lang.IllegalArgumentEx... |
MediaType mediaType = response.getMediaType();
if (mediaType != null) {
// Append charset
assert MediaType.APPLICATION_JSON_TYPE.equals(mediaType);
response.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE,
mediaType.withCha... | 449 | 346 | 795 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java | AlgorithmAPI | post | class AlgorithmAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@POST
@Timed
@Path("/{name}")
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RedirectFilter.RedirectMasterRole
public Map<String, Id> post... |
LOG.debug("Graph [{}] schedule algorithm job: {}", graph, parameters);
E.checkArgument(algorithm != null && !algorithm.isEmpty(),
"The algorithm name can't be empty");
if (parameters == null) {
parameters = ImmutableMap.of();
}
if (!AlgorithmJ... | 158 | 219 | 377 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java | ComputerAPI | post | class ComputerAPI extends API {
private static final Logger LOG = Log.logger(ComputerAPI.class);
@POST
@Timed
@Path("/{name}")
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RedirectFilter.RedirectMasterRole
public Map<String, Id> post... |
LOG.debug("Graph [{}] schedule computer job: {}", graph, parameters);
E.checkArgument(computer != null && !computer.isEmpty(),
"The computer name can't be empty");
if (parameters == null) {
parameters = ImmutableMap.of();
}
if (!ComputerJob.ch... | 159 | 236 | 395 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java | GremlinRequest | name | class GremlinRequest implements Checkable {
// See org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
@JsonProperty
private String gremlin;
@JsonProperty
private Map<String, Object> bindings = new HashMap<>();
@JsonProperty
private String language = "gre... |
// Get the first line of script as the name
String firstLine = this.gremlin.split("\r\n|\r|\n", 2)[0];
final Charset charset = Charset.forName(CHARSET);
final byte[] bytes = firstLine.getBytes(charset);
if (bytes.length <= MAX_NAME_LENGTH) {
r... | 827 | 227 | 1,054 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java | RebuildAPI | edgeLabelRebuild | class RebuildAPI extends API {
private static final Logger LOG = Log.logger(RebuildAPI.class);
@PUT
@Timed
@Path("vertexlabels/{name}")
@Status(Status.ACCEPTED)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$graph $action=index_write"})
@RedirectFilter.Redire... |
LOG.debug("Graph [{}] rebuild edge label: {}", graph, name);
HugeGraph g = graph(manager, graph);
return ImmutableMap.of("task_id",
g.schema().edgeLabel(name).rebuildIndex());
| 554 | 65 | 619 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java | TaskAPI | list | class TaskAPI extends API {
private static final Logger LOG = Log.logger(TaskAPI.class);
private static final long NO_LIMIT = -1L;
public static final String ACTION_CANCEL = "cancel";
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public Map<String, Object> list(@Context GraphManage... |
LOG.debug("Graph [{}] list tasks with status {}, ids {}, " +
"limit {}, page {}", graph, status, ids, limit, page);
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
Iterator<HugeTask<Object>> iter;
if (!ids.isEmpty()) {
E.checkArgument(st... | 889 | 433 | 1,322 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java | ProfileAPI | showAllAPIs | class ProfileAPI {
private static final String SERVICE = "hugegraph";
private static final String DOC = "https://hugegraph.apache.org/docs/";
private static final String API_DOC = DOC + "clients/";
private static final String SWAGGER_UI = "/swagger-ui/index.html";
private static String SERVER_PROF... |
if (API_PROFILES != null) {
return API_PROFILES;
}
APIProfiles apiProfiles = new APIProfiles();
for (Class<?> clazz : application.getClasses()) {
if (!isAnnotatedPathClass(clazz)) {
continue;
}
Resource resource = Resourc... | 1,369 | 306 | 1,675 | <no_super_class> |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java | VersionAPI | list | class VersionAPI extends API {
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@PermitAll
public Object list() {<FILL_FUNCTION_BODY>}
} |
Map<String, String> versions = ImmutableMap.of("version", "v1",
"core", CoreVersion.VERSION.toString(),
"gremlin", CoreVersion.GREMLIN_VERSION,
"a... | 61 | 83 | 144 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java | WhiteIpListAPI | updateWhiteIPs | class WhiteIpListAPI extends API {
private static final Logger LOG = Log.logger(WhiteIpListAPI.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
@Operation(summary = "list white ips")
public Map<String, Object> list(@Context GraphManager manager) {
... |
E.checkArgument(actionMap != null,
"Missing argument: actionMap");
Set<String> whiteIpList = manager.authManager().listWhiteIPs();
Object ipListRaw = actionMap.get("ips");
E.checkArgument(ipListRaw instanceof List,
"Invalid ips type '%s', ... | 730 | 609 | 1,339 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java | RaftAPI | setLeader | class RaftAPI extends API {
private static final Logger LOG = Log.logger(RaftAPI.class);
@GET
@Timed
@Path("list_peers")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin"})
public Map<String, List<String>> listPeers(@Context GraphManager manage... |
LOG.debug("Graph [{}] prepare to set leader to: {}",
graph, endpoint);
HugeGraph g = graph(manager, graph);
RaftGroupManager raftManager = raftGroupManager(g, group, "set_leader");
String leaderId = raftManager.setLeader(endpoint);
return ImmutableMap.of(raftM... | 1,643 | 100 | 1,743 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java | JsonEdgeLabel | convert2Builder | class JsonEdgeLabel implements Checkable {
@JsonProperty("id")
public long id;
@JsonProperty("name")
public String name;
@JsonProperty("source_label")
public String sourceLabel;
@JsonProperty("target_label")
public String targetLabel;
@JsonPropert... |
EdgeLabel.Builder builder = g.schema().edgeLabel(this.name);
if (this.id != 0) {
E.checkArgument(this.id > 0,
"Only positive number can be assign as " +
"edge label id");
E.checkArgument(g.mode() == ... | 475 | 510 | 985 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java | JsonIndexLabel | checkCreate | class JsonIndexLabel implements Checkable {
@JsonProperty("id")
public long id;
@JsonProperty("name")
public String name;
@JsonProperty("base_type")
public HugeType baseType;
@JsonProperty("base_value")
public String baseValue;
@JsonProperty("inde... |
E.checkArgumentNotNull(this.name,
"The name of index label can't be null");
E.checkArgumentNotNull(this.baseType,
"The base type of index label '%s' " +
"can't be null", this.name);
... | 786 | 232 | 1,018 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java | SchemaAPI | list | class SchemaAPI extends API {
private static final Logger LOG = Log.logger(SchemaAPI.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$graph $action=schema_read"})
public String list(@Context GraphManager manager,
@PathParam("g... |
LOG.debug("Graph [{}] list all schema", graph);
HugeGraph g = graph(manager, graph);
SchemaManager schema = g.schema();
Map<String, List<?>> schemaMap = new LinkedHashMap<>(4);
schemaMap.put("propertykeys", schema.getPropertyKeys());
schemaMap.put("vertexlabels", schem... | 115 | 153 | 268 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
apache_incubator-hugegraph | incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java | JsonVertexLabel | convert2Builder | class JsonVertexLabel implements Checkable {
@JsonProperty("id")
public long id;
@JsonProperty("name")
public String name;
@JsonProperty("id_strategy")
public IdStrategy idStrategy;
@JsonProperty("properties")
public String[] properties;
@JsonProp... |
VertexLabel.Builder builder = g.schema().vertexLabel(this.name);
if (this.id != 0) {
E.checkArgument(this.id > 0,
"Only positive number can be assign as " +
"vertex label id");
E.checkArgument(g.mode... | 421 | 458 | 879 | <methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.