private List<Method> receiveFileMethod(Object handler) { List<Method> methods = new ArrayList<>(); methods.add(new Method(RECEIVE_META_METHOD, "sssl", "ii", handler,"receiveFileMeta") .paramDesc(0, "filereference", "file reference to download") .paramDesc(1, "filename", "filename") .paramDesc(2, "type", "'file' or 'compressed'") .paramDesc(3, "filelength", "length in bytes of file") .returnDesc(0, "ret", "0 if success, 1 otherwise") .returnDesc(1, "session-id", "Session id to be used for this transfer")); methods.add(new Method(RECEIVE_PART_METHOD, "siix", "i", handler,"receiveFilePart") .paramDesc(0, "filereference", "file reference to download") .paramDesc(1, "session-id", "Session id to be used for this transfer") .paramDesc(2, "partid", "relative part number starting at zero") .paramDesc(3, "data", "bytes in this part") .returnDesc(0, "ret", "0 if success, 1 otherwise")); methods.add(new Method(RECEIVE_EOF_METHOD, "silis", "i", handler,"receiveFileEof") .paramDesc(0, "filereference", "file reference to download") .paramDesc(1, "session-id", "Session id to be used for this transfer") .paramDesc(2, "crc-code", "crc code (xxhash64)") .paramDesc(3, "error-code", "Error code. 0 if none") .paramDesc(4, "error-description", "Error description.") .returnDesc(0, "ret", "0 if success, 1 if crc mismatch, 2 otherwise")); return methods; }
@Override protected Method buildMethod() { Method method = new Method(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, this); method.methodDesc("Send a message bus request and get a reply back."); method.paramDesc(0, "version", "The version of the message.") .paramDesc(1, "route", "Names of additional hops to visit.") .paramDesc(2, "session", "The local session that should receive this message.") .paramDesc(3, "retryEnabled", "Whether or not this message can be resent.") .paramDesc(4, "retry", "The number of times the sending of this message has been retried.") .paramDesc(5, "timeRemaining", "The number of milliseconds until timeout.") .paramDesc(6, "protocol", "The name of the protocol that knows how to decode this message.") .paramDesc(7, "payload", "The protocol specific message payload.") .paramDesc(8, "level", "The trace level of the message."); method.returnDesc(0, "version", "The lowest version the message was serialized as.") .returnDesc(1, "retryDelay", "The retry request of the reply.") .returnDesc(2, "errorCodes", "The reply error codes.") .returnDesc(3, "errorMessages", "The reply error messages.") .returnDesc(4, "errorServices", "The reply error service names.") .returnDesc(5, "protocol", "The name of the protocol that knows how to decode this reply.") .returnDesc(6, "payload", "The protocol specific reply payload.") .returnDesc(7, "trace", "A string representation of the trace."); return method; } @Override
@Override protected Method buildMethod() { Method method = new Method(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, this); method.methodDesc("Send a message bus request and get a reply back."); method.paramDesc(0, "header_encoding", "Encoding type of header.") .paramDesc(1, "header_decodedSize", "Number of bytes after header decoding.") .paramDesc(2, "header_payload", "Slime encoded header payload.") .paramDesc(3, "body_encoding", "Encoding type of body.") .paramDesc(4, "body_decoded_ize", "Number of bytes after body decoding.") .paramDesc(5, "body_payload", "Slime encoded body payload."); method.returnDesc(0, "header_encoding", "Encoding type of header.") .returnDesc(1, "header_decoded_size", "Number of bytes after header decoding.") .returnDesc(2, "header_payload", "Slime encoded header payload.") .returnDesc(3, "body_encoding", "Encoding type of body.") .returnDesc(4, "body_encoded_size", "Number of bytes after body decoding.") .returnDesc(5, "body_payload", "Slime encoded body payload."); return method; } private static final String VERSION_F = new String("version");
.paramDesc(0, "name", "RpcServer name") .paramDesc(1, "spec", "The connection specification")); orb.addMethod(new Method("slobrok.unregisterRpcServer", "ss", "", new MethodHandler() { .paramDesc(0, "name", "RpcServer name") .paramDesc(1, "spec", "The connection specification")); .paramDesc(0, "gencnt", "generation already known by client") .paramDesc(1, "timeout", "How many milliseconds to wait for changes" + "before returning if nothing has changed (max=10000)") .returnDesc(0, "oldgen", "diff from generation already known by client")
private void declareFileDistributionMethods() { // Legacy method, needs to be the same name as used in filedistributor supervisor.addMethod(new Method("waitFor", "s", "s", this, "getFile") .methodDesc("get path to file reference") .paramDesc(0, "file reference", "file reference") .returnDesc(0, "path", "path to file")); supervisor.addMethod(new Method("filedistribution.getFile", "s", "s", this, "getFile") .methodDesc("get path to file reference") .paramDesc(0, "file reference", "file reference") .returnDesc(0, "path", "path to file")); supervisor.addMethod(new Method("filedistribution.getActiveFileReferencesStatus", "", "SD", this, "getActiveFileReferencesStatus") .methodDesc("download status for file references") .returnDesc(0, "file references", "array of file references") .returnDesc(1, "download status", "percentage downloaded of each file reference in above array")); supervisor.addMethod(new Method("filedistribution.setFileReferencesToDownload", "S", "i", this, "setFileReferencesToDownload") .methodDesc("set which file references to download") .paramDesc(0, "file references", "file reference to download") .returnDesc(0, "ret", "0 if success, 1 otherwise")); }
.paramDesc(0, "name", "RpcServer name"); orb.addMethod(m_unreg); updateTask.scheduleNow();
public void getMethodInfo(Request req) { Method method = parent.methodMap().get(req.parameters().get(0).asString()); if (method == null) { req.setError(ErrorCode.METHOD_FAILED, "No Such Method"); return; } req.returnValues().add(new StringValue(method.methodDesc())); req.returnValues().add(new StringValue(method.paramTypes())); req.returnValues().add(new StringValue(method.returnTypes())); int paramCnt = method.paramTypes().length(); int returnCnt = method.returnTypes().length(); String[] ret3_paramName = new String[paramCnt]; String[] ret4_paramDesc = new String[paramCnt]; String[] ret5_returnName = new String[returnCnt]; String[] ret6_returnDesc = new String[returnCnt]; for (int i = 0; i < paramCnt; i++) { ret3_paramName[i] = method.paramName(i); ret4_paramDesc[i] = method.paramDesc(i); } for (int i = 0; i < returnCnt; i++) { ret5_returnName[i] = method.returnName(i); ret6_returnDesc[i] = method.returnDesc(i); } req.returnValues().add(new StringArray(ret3_paramName)); req.returnValues().add(new StringArray(ret4_paramDesc)); req.returnValues().add(new StringArray(ret5_returnName)); req.returnValues().add(new StringArray(ret6_returnDesc)); } }
"getMethodInfo"); m.methodDesc("Obtain detailed information about a single method"); m.paramDesc (0, "methodName", "The method we want information about"); m.returnDesc(0, "desc", "Description of what the method does"); m.returnDesc(1, "params", "Method parameter types");
.paramDesc(0, "buildId", "Id to make sure client and server come from the same build")); addMethod(new PersistenceProviderMethod("initialize", this)); addMethod(new PersistenceProviderMethod("getPartitionStates", this, "", "IS"));