com.tinkerpop.rexster.protocol.msg.MessageUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rexster-protocol Show documentation
Show all versions of rexster-protocol Show documentation
RexPro is a binary protocol for Rexster graph server.
package com.tinkerpop.rexster.protocol.msg;
import java.util.List;
import java.util.UUID;
/**
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class MessageUtil {
public static ErrorResponseMessage createErrorResponse(final byte[] request, final byte[] session,
final byte flag, final String errorMessage) {
final ErrorResponseMessage msg = new ErrorResponseMessage();
msg.Request = request;
msg.Session = session;
msg.ErrorMessage = errorMessage;
msg.Flag = flag;
return msg;
}
public static SessionResponseMessage createNewSession(byte[] request, final List languages) {
final UUID sessionKey = UUID.randomUUID();
final SessionResponseMessage responseMessage = new SessionResponseMessage();
responseMessage.setSessionAsUUID(sessionKey);
responseMessage.Request = request;
responseMessage.Flag = MessageFlag.SESSION_RESPONSE_NO_FLAG;
responseMessage.Languages = new String[languages.size()];
languages.toArray(responseMessage.Languages);
return responseMessage;
}
public static SessionResponseMessage createEmptySession(byte[] request) {
final SessionResponseMessage responseMessage = new SessionResponseMessage();
responseMessage.setSessionAsUUID(RexProMessage.EMPTY_SESSION);
responseMessage.Request = request;
responseMessage.Languages = new String[0];
responseMessage.Flag = MessageFlag.SESSION_RESPONSE_NO_FLAG;
return responseMessage;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy