repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/utils/Base64.java
Base64.decode
@SuppressWarnings("StatementWithEmptyBody") public static byte[] decode(final String input) { ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes()); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { while (decodeChunk(out, in)) { // do nothing } } catch (IOException ex) { throw new RuntimeException(ex); } return out.toByteArray(); }
java
@SuppressWarnings("StatementWithEmptyBody") public static byte[] decode(final String input) { ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes()); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { while (decodeChunk(out, in)) { // do nothing } } catch (IOException ex) { throw new RuntimeException(ex); } return out.toByteArray(); }
[ "@", "SuppressWarnings", "(", "\"StatementWithEmptyBody\"", ")", "public", "static", "byte", "[", "]", "decode", "(", "final", "String", "input", ")", "{", "ByteArrayInputStream", "in", "=", "new", "ByteArrayInputStream", "(", "input", ".", "getBytes", "(", ")",...
Decode a Base64 encoded string @param input The string to decode @return The data string
[ "Decode", "a", "Base64", "encoded", "string" ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/Base64.java#L73-L86
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleSnappyCompression
private void handleSnappyCompression(final ChannelHandlerContext ctx, final BinaryMemcacheRequest r) { if (!(r instanceof FullBinaryMemcacheRequest)) { // we only need to handle requests which send content return; } FullBinaryMemcacheRequest request = (FullBinaryMemcacheRequest) r; int uncompressedLength = request.content().readableBytes(); // don't bother compressing if below the min compression size if (uncompressedLength < minCompressionSize || uncompressedLength == 0) { return; } ByteBuf compressedContent; try { compressedContent = tryCompress(request.content()); } catch (Exception ex) { throw new RuntimeException("Could not snappy-compress value.", ex); } if (compressedContent != null) { // compressed is smaller, so adapt and apply new content request.setDataType((byte)(request.getDataType() | DATATYPE_SNAPPY)); request.setContent(compressedContent); request.setTotalBodyLength( request.getExtrasLength() + request.getKeyLength() + compressedContent.readableBytes() ); } }
java
private void handleSnappyCompression(final ChannelHandlerContext ctx, final BinaryMemcacheRequest r) { if (!(r instanceof FullBinaryMemcacheRequest)) { // we only need to handle requests which send content return; } FullBinaryMemcacheRequest request = (FullBinaryMemcacheRequest) r; int uncompressedLength = request.content().readableBytes(); // don't bother compressing if below the min compression size if (uncompressedLength < minCompressionSize || uncompressedLength == 0) { return; } ByteBuf compressedContent; try { compressedContent = tryCompress(request.content()); } catch (Exception ex) { throw new RuntimeException("Could not snappy-compress value.", ex); } if (compressedContent != null) { // compressed is smaller, so adapt and apply new content request.setDataType((byte)(request.getDataType() | DATATYPE_SNAPPY)); request.setContent(compressedContent); request.setTotalBodyLength( request.getExtrasLength() + request.getKeyLength() + compressedContent.readableBytes() ); } }
[ "private", "void", "handleSnappyCompression", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "BinaryMemcacheRequest", "r", ")", "{", "if", "(", "!", "(", "r", "instanceof", "FullBinaryMemcacheRequest", ")", ")", "{", "// we only need to handle requests whic...
Helper method which performs snappy compression on the request path. Note that even if we compress and switch out the content, we are not releasing the original buffer! This is happening on the decode side and we still need to keep in mind that a NMVB could be returned and the original msg needs to be re-sent.
[ "Helper", "method", "which", "performs", "snappy", "compression", "on", "the", "request", "path", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L323-L354
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleSnappyDecompression
private void handleSnappyDecompression(final ChannelHandlerContext ctx, final FullBinaryMemcacheResponse response) { ByteBuf decompressed; if (response.content().readableBytes() > 0) { // we need to copy it on-heap... byte[] compressed = Unpooled.copiedBuffer(response.content()).array(); try { decompressed = Unpooled.wrappedBuffer(Snappy.uncompress(compressed, 0, compressed.length)); } catch (Exception ex) { throw new RuntimeException("Could not decode snappy-compressed value.", ex); } } else { decompressed = Unpooled.buffer(0); } response.content().release(); response.setContent(decompressed); response.setTotalBodyLength( response.getExtrasLength() + response.getKeyLength() + decompressed.readableBytes() ); response.setDataType((byte) (response.getDataType() & ~DATATYPE_SNAPPY)); }
java
private void handleSnappyDecompression(final ChannelHandlerContext ctx, final FullBinaryMemcacheResponse response) { ByteBuf decompressed; if (response.content().readableBytes() > 0) { // we need to copy it on-heap... byte[] compressed = Unpooled.copiedBuffer(response.content()).array(); try { decompressed = Unpooled.wrappedBuffer(Snappy.uncompress(compressed, 0, compressed.length)); } catch (Exception ex) { throw new RuntimeException("Could not decode snappy-compressed value.", ex); } } else { decompressed = Unpooled.buffer(0); } response.content().release(); response.setContent(decompressed); response.setTotalBodyLength( response.getExtrasLength() + response.getKeyLength() + decompressed.readableBytes() ); response.setDataType((byte) (response.getDataType() & ~DATATYPE_SNAPPY)); }
[ "private", "void", "handleSnappyDecompression", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "FullBinaryMemcacheResponse", "response", ")", "{", "ByteBuf", "decompressed", ";", "if", "(", "response", ".", "content", "(", ")", ".", "readableBytes", "("...
Helper method which performs decompression for snappy compressed values.
[ "Helper", "method", "which", "performs", "decompression", "for", "snappy", "compressed", "values", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L389-L412
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.parseServerDurationFromFrame
static long parseServerDurationFromFrame(final ByteBuf frame) { while(frame.readableBytes() > 0) { byte control = frame.readByte(); byte id = (byte) (control & 0xF0); byte len = (byte) (control & 0x0F); if (id == FRAMING_EXTRAS_TRACING) { return Math.round(Math.pow(frame.readUnsignedShort(), 1.74) / 2); } else { frame.skipBytes(len); } } return 0; }
java
static long parseServerDurationFromFrame(final ByteBuf frame) { while(frame.readableBytes() > 0) { byte control = frame.readByte(); byte id = (byte) (control & 0xF0); byte len = (byte) (control & 0x0F); if (id == FRAMING_EXTRAS_TRACING) { return Math.round(Math.pow(frame.readUnsignedShort(), 1.74) / 2); } else { frame.skipBytes(len); } } return 0; }
[ "static", "long", "parseServerDurationFromFrame", "(", "final", "ByteBuf", "frame", ")", "{", "while", "(", "frame", ".", "readableBytes", "(", ")", ">", "0", ")", "{", "byte", "control", "=", "frame", ".", "readByte", "(", ")", ";", "byte", "id", "=", ...
Parses the server duration from the frame. It reads through the byte stream looking for the tracing frame and if found extracts the info. If a different frame is found it is just skipped. Per algorithm, the found server duration is round up/down using the {@link Math#round(float)} function and has microsecond precision. @param frame the extras frame to parse @return the extracted duration, 0 if not found.
[ "Parses", "the", "server", "duration", "from", "the", "frame", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1092-L1104
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleCommonResponseMessages
private static CouchbaseResponse handleCommonResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ResponseStatus status, boolean seqOnMutation) { CouchbaseResponse response = null; ByteBuf content = msg.content(); long cas = msg.getCAS(); short statusCode = msg.getStatus(); String bucket = request.bucket(); if (request instanceof GetRequest || request instanceof ReplicaGetRequest) { int flags = msg.getExtrasLength() > 0 ? msg.getExtras().getInt(0) : 0; response = new GetResponse(status, statusCode, cas, flags, bucket, content, request); } else if (request instanceof GetBucketConfigRequest) { response = new GetBucketConfigResponse(status, statusCode, bucket, content, ((GetBucketConfigRequest) request).hostname()); } else if (request instanceof InsertRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new InsertResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof UpsertRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new UpsertResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof ReplaceRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new ReplaceResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof RemoveRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new RemoveResponse(status, statusCode, cas, bucket, content, descr, request); } return response; }
java
private static CouchbaseResponse handleCommonResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ResponseStatus status, boolean seqOnMutation) { CouchbaseResponse response = null; ByteBuf content = msg.content(); long cas = msg.getCAS(); short statusCode = msg.getStatus(); String bucket = request.bucket(); if (request instanceof GetRequest || request instanceof ReplicaGetRequest) { int flags = msg.getExtrasLength() > 0 ? msg.getExtras().getInt(0) : 0; response = new GetResponse(status, statusCode, cas, flags, bucket, content, request); } else if (request instanceof GetBucketConfigRequest) { response = new GetBucketConfigResponse(status, statusCode, bucket, content, ((GetBucketConfigRequest) request).hostname()); } else if (request instanceof InsertRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new InsertResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof UpsertRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new UpsertResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof ReplaceRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new ReplaceResponse(status, statusCode, cas, bucket, content, descr, request); } else if (request instanceof RemoveRequest) { MutationToken descr = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); response = new RemoveResponse(status, statusCode, cas, bucket, content, descr, request); } return response; }
[ "private", "static", "CouchbaseResponse", "handleCommonResponseMessages", "(", "BinaryRequest", "request", ",", "FullBinaryMemcacheResponse", "msg", ",", "ResponseStatus", "status", ",", "boolean", "seqOnMutation", ")", "{", "CouchbaseResponse", "response", "=", "null", "...
Helper method to decode all common response messages. @param request the current request. @param msg the current response message. @param status the response status code. @return the decoded response or null if none did match.
[ "Helper", "method", "to", "decode", "all", "common", "response", "messages", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1114-L1143
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleSubdocumentResponseMessages
private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) { if (!(request instanceof BinarySubdocRequest)) return null; BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request; long cas = msg.getCAS(); short statusCode = msg.getStatus(); String bucket = request.bucket(); MutationToken mutationToken = null; if (msg.getExtrasLength() > 0) { mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); } ByteBuf fragment; if (msg.content() != null && msg.content().readableBytes() > 0) { fragment = msg.content(); } else if (msg.content() != null) { msg.content().release(); fragment = Unpooled.EMPTY_BUFFER; } else { fragment = Unpooled.EMPTY_BUFFER; } return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken); }
java
private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) { if (!(request instanceof BinarySubdocRequest)) return null; BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request; long cas = msg.getCAS(); short statusCode = msg.getStatus(); String bucket = request.bucket(); MutationToken mutationToken = null; if (msg.getExtrasLength() > 0) { mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition()); } ByteBuf fragment; if (msg.content() != null && msg.content().readableBytes() > 0) { fragment = msg.content(); } else if (msg.content() != null) { msg.content().release(); fragment = Unpooled.EMPTY_BUFFER; } else { fragment = Unpooled.EMPTY_BUFFER; } return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken); }
[ "private", "static", "CouchbaseResponse", "handleSubdocumentResponseMessages", "(", "BinaryRequest", "request", ",", "FullBinaryMemcacheResponse", "msg", ",", "ChannelHandlerContext", "ctx", ",", "ResponseStatus", "status", ",", "boolean", "seqOnMutation", ")", "{", "if", ...
Helper method to decode all simple subdocument response messages. @param request the current request. @param msg the current response message. @param ctx the handler context. @param status the response status code. @return the decoded response or null if none did match.
[ "Helper", "method", "to", "decode", "all", "simple", "subdocument", "response", "messages", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1154-L1179
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleSubdocumentMultiLookupResponseMessages
private static CouchbaseResponse handleSubdocumentMultiLookupResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status) { if (!(request instanceof BinarySubdocMultiLookupRequest)) return null; BinarySubdocMultiLookupRequest subdocRequest = (BinarySubdocMultiLookupRequest) request; short statusCode = msg.getStatus(); long cas = msg.getCAS(); String bucket = request.bucket(); ByteBuf body = msg.content(); List<MultiResult<Lookup>> responses; if (status.isSuccess() || ResponseStatus.SUBDOC_MULTI_PATH_FAILURE.equals(status)) { long bodyLength = body.readableBytes(); List<LookupCommand> commands = subdocRequest.commands(); responses = new ArrayList<MultiResult<Lookup>>(commands.size()); for (LookupCommand cmd : commands) { if (msg.content().readableBytes() < 6) { body.release(); throw new IllegalStateException("Expected " + commands.size() + " lookup responses, only got " + responses.size() + ", total of " + bodyLength + " bytes"); } short cmdStatus = body.readShort(); int valueLength = body.readInt(); ByteBuf value = ctx.alloc().buffer(valueLength, valueLength); value.writeBytes(body, valueLength); responses.add(MultiResult.create(cmdStatus, ResponseStatusConverter.fromBinary(cmdStatus), cmd.path(), cmd.lookup(), value)); } } else { responses = Collections.emptyList(); } body.release(); return new MultiLookupResponse(status, statusCode, bucket, responses, subdocRequest, cas); }
java
private static CouchbaseResponse handleSubdocumentMultiLookupResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status) { if (!(request instanceof BinarySubdocMultiLookupRequest)) return null; BinarySubdocMultiLookupRequest subdocRequest = (BinarySubdocMultiLookupRequest) request; short statusCode = msg.getStatus(); long cas = msg.getCAS(); String bucket = request.bucket(); ByteBuf body = msg.content(); List<MultiResult<Lookup>> responses; if (status.isSuccess() || ResponseStatus.SUBDOC_MULTI_PATH_FAILURE.equals(status)) { long bodyLength = body.readableBytes(); List<LookupCommand> commands = subdocRequest.commands(); responses = new ArrayList<MultiResult<Lookup>>(commands.size()); for (LookupCommand cmd : commands) { if (msg.content().readableBytes() < 6) { body.release(); throw new IllegalStateException("Expected " + commands.size() + " lookup responses, only got " + responses.size() + ", total of " + bodyLength + " bytes"); } short cmdStatus = body.readShort(); int valueLength = body.readInt(); ByteBuf value = ctx.alloc().buffer(valueLength, valueLength); value.writeBytes(body, valueLength); responses.add(MultiResult.create(cmdStatus, ResponseStatusConverter.fromBinary(cmdStatus), cmd.path(), cmd.lookup(), value)); } } else { responses = Collections.emptyList(); } body.release(); return new MultiLookupResponse(status, statusCode, bucket, responses, subdocRequest, cas); }
[ "private", "static", "CouchbaseResponse", "handleSubdocumentMultiLookupResponseMessages", "(", "BinaryRequest", "request", ",", "FullBinaryMemcacheResponse", "msg", ",", "ChannelHandlerContext", "ctx", ",", "ResponseStatus", "status", ")", "{", "if", "(", "!", "(", "reque...
Helper method to decode all multi lookup response messages. @param request the current request. @param msg the current response message. @param ctx the handler context. @param status the response status code. @return the decoded response or null if it wasn't a subdocument multi lookup.
[ "Helper", "method", "to", "decode", "all", "multi", "lookup", "response", "messages", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1190-L1226
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.contentFromWriteRequest
private static ByteBuf contentFromWriteRequest(BinaryRequest request) { ByteBuf content = null; if (request instanceof BinaryStoreRequest) { content = ((BinaryStoreRequest) request).content(); } else if (request instanceof AppendRequest) { content = ((AppendRequest) request).content(); } else if (request instanceof PrependRequest) { content = ((PrependRequest) request).content(); } else if (request instanceof BinarySubdocRequest) { content = ((BinarySubdocRequest) request).content(); } else if (request instanceof BinarySubdocMultiLookupRequest) { content = ((BinarySubdocMultiLookupRequest) request).content(); } else if (request instanceof BinarySubdocMultiMutationRequest) { content = ((BinarySubdocMultiMutationRequest) request).content(); } return content; }
java
private static ByteBuf contentFromWriteRequest(BinaryRequest request) { ByteBuf content = null; if (request instanceof BinaryStoreRequest) { content = ((BinaryStoreRequest) request).content(); } else if (request instanceof AppendRequest) { content = ((AppendRequest) request).content(); } else if (request instanceof PrependRequest) { content = ((PrependRequest) request).content(); } else if (request instanceof BinarySubdocRequest) { content = ((BinarySubdocRequest) request).content(); } else if (request instanceof BinarySubdocMultiLookupRequest) { content = ((BinarySubdocMultiLookupRequest) request).content(); } else if (request instanceof BinarySubdocMultiMutationRequest) { content = ((BinarySubdocMultiMutationRequest) request).content(); } return content; }
[ "private", "static", "ByteBuf", "contentFromWriteRequest", "(", "BinaryRequest", "request", ")", "{", "ByteBuf", "content", "=", "null", ";", "if", "(", "request", "instanceof", "BinaryStoreRequest", ")", "{", "content", "=", "(", "(", "BinaryStoreRequest", ")", ...
Helper method to extract the content from requests.
[ "Helper", "method", "to", "extract", "the", "content", "from", "requests", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1459-L1475
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.sideEffectRequestToCancel
@Override protected void sideEffectRequestToCancel(final BinaryRequest request) { super.sideEffectRequestToCancel(request); if (request instanceof BinaryStoreRequest) { ((BinaryStoreRequest) request).content().release(); } else if (request instanceof AppendRequest) { ((AppendRequest) request).content().release(); } else if (request instanceof PrependRequest) { ((PrependRequest) request).content().release(); } }
java
@Override protected void sideEffectRequestToCancel(final BinaryRequest request) { super.sideEffectRequestToCancel(request); if (request instanceof BinaryStoreRequest) { ((BinaryStoreRequest) request).content().release(); } else if (request instanceof AppendRequest) { ((AppendRequest) request).content().release(); } else if (request instanceof PrependRequest) { ((PrependRequest) request).content().release(); } }
[ "@", "Override", "protected", "void", "sideEffectRequestToCancel", "(", "final", "BinaryRequest", "request", ")", "{", "super", ".", "sideEffectRequestToCancel", "(", "request", ")", ";", "if", "(", "request", "instanceof", "BinaryStoreRequest", ")", "{", "(", "("...
Releasing the content of requests that are to be cancelled. @param request the request to side effect on.
[ "Releasing", "the", "content", "of", "requests", "that", "are", "to", "be", "cancelled", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1511-L1522
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java
AbstractDynamicService.createEndpoint
protected Endpoint createEndpoint() { return endpointFactory.create(hostname, bucket, username, password, port, ctx); }
java
protected Endpoint createEndpoint() { return endpointFactory.create(hostname, bucket, username, password, port, ctx); }
[ "protected", "Endpoint", "createEndpoint", "(", ")", "{", "return", "endpointFactory", ".", "create", "(", "hostname", ",", "bucket", ",", "username", ",", "password", ",", "port", ",", "ctx", ")", ";", "}" ]
Helper method to create a new endpoint. @return the endpoint to create.
[ "Helper", "method", "to", "create", "a", "new", "endpoint", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java#L179-L181
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java
AbstractDynamicService.whenState
protected static void whenState(final Endpoint endpoint, final LifecycleState wanted, Action1<LifecycleState> then) { endpoint .states() .filter(new Func1<LifecycleState, Boolean>() { @Override public Boolean call(LifecycleState state) { return state == wanted; } }) .take(1) .subscribe(then); }
java
protected static void whenState(final Endpoint endpoint, final LifecycleState wanted, Action1<LifecycleState> then) { endpoint .states() .filter(new Func1<LifecycleState, Boolean>() { @Override public Boolean call(LifecycleState state) { return state == wanted; } }) .take(1) .subscribe(then); }
[ "protected", "static", "void", "whenState", "(", "final", "Endpoint", "endpoint", ",", "final", "LifecycleState", "wanted", ",", "Action1", "<", "LifecycleState", ">", "then", ")", "{", "endpoint", ".", "states", "(", ")", ".", "filter", "(", "new", "Func1",...
Waits until the endpoint goes into the given state, calls the action and then unsubscribes. @param endpoint the endpoint to monitor. @param wanted the wanted state. @param then the action to execute when the state is reached.
[ "Waits", "until", "the", "endpoint", "goes", "into", "the", "given", "state", "calls", "the", "action", "and", "then", "unsubscribes", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java#L219-L230
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/AbstractSubdocRequest.java
AbstractSubdocRequest.cleanUpAndThrow
protected void cleanUpAndThrow(RuntimeException e) { if (content != null && content.refCnt() > 0) { content.release(); } throw e; }
java
protected void cleanUpAndThrow(RuntimeException e) { if (content != null && content.refCnt() > 0) { content.release(); } throw e; }
[ "protected", "void", "cleanUpAndThrow", "(", "RuntimeException", "e", ")", "{", "if", "(", "content", "!=", "null", "&&", "content", ".", "refCnt", "(", ")", ">", "0", ")", "{", "content", ".", "release", "(", ")", ";", "}", "throw", "e", ";", "}" ]
Utility method to ensure good cleanup when throwing an exception from a constructor. Cleans the content composite buffer by releasing it before throwing the exception.
[ "Utility", "method", "to", "ensure", "good", "cleanup", "when", "throwing", "an", "exception", "from", "a", "constructor", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/AbstractSubdocRequest.java#L104-L109
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/state/AbstractStateMachine.java
AbstractStateMachine.transitionState
protected void transitionState(final S newState) { if (newState != currentState) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("State (" + getClass().getSimpleName() + ") " + currentState + " -> " + newState); } currentState = newState; observable.onNext(newState); } }
java
protected void transitionState(final S newState) { if (newState != currentState) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("State (" + getClass().getSimpleName() + ") " + currentState + " -> " + newState); } currentState = newState; observable.onNext(newState); } }
[ "protected", "void", "transitionState", "(", "final", "S", "newState", ")", "{", "if", "(", "newState", "!=", "currentState", ")", "{", "if", "(", "LOGGER", ".", "isTraceEnabled", "(", ")", ")", "{", "LOGGER", ".", "trace", "(", "\"State (\"", "+", "getC...
Transition into a new state. This method is intentionally not public, because the subclass should only be responsible for the actual transitions, the other components only react on those transitions eventually. @param newState the states to transition into.
[ "Transition", "into", "a", "new", "state", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/state/AbstractStateMachine.java#L87-L95
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/PooledService.java
PooledService.ensureMinimum
private void ensureMinimum() { int belowMin = minEndpoints - endpoints.size(); if (belowMin > 0) { LOGGER.debug(logIdent(hostname, this) + "Service is {} below minimum, filling up.", belowMin); synchronized (epMutex) { for (int i = 0; i < belowMin; i++) { Endpoint endpoint = endpointFactory.create(hostname, bucket, username, password, port, ctx); endpoints.add(endpoint); endpointStates.register(endpoint, endpoint); endpoint.connect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { /* ignored on purpose */ } @Override public void onError(Throwable e) { LOGGER.warn(logIdent(hostname, PooledService.this) + "Got an error while connecting endpoint!", e); } @Override public void onNext(LifecycleState state) { /* ignored on purpose */ } }); } LOGGER.debug(logIdent(hostname, PooledService.this) + "New number of endpoints is {}", endpoints.size()); } } }
java
private void ensureMinimum() { int belowMin = minEndpoints - endpoints.size(); if (belowMin > 0) { LOGGER.debug(logIdent(hostname, this) + "Service is {} below minimum, filling up.", belowMin); synchronized (epMutex) { for (int i = 0; i < belowMin; i++) { Endpoint endpoint = endpointFactory.create(hostname, bucket, username, password, port, ctx); endpoints.add(endpoint); endpointStates.register(endpoint, endpoint); endpoint.connect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { /* ignored on purpose */ } @Override public void onError(Throwable e) { LOGGER.warn(logIdent(hostname, PooledService.this) + "Got an error while connecting endpoint!", e); } @Override public void onNext(LifecycleState state) { /* ignored on purpose */ } }); } LOGGER.debug(logIdent(hostname, PooledService.this) + "New number of endpoints is {}", endpoints.size()); } } }
[ "private", "void", "ensureMinimum", "(", ")", "{", "int", "belowMin", "=", "minEndpoints", "-", "endpoints", ".", "size", "(", ")", ";", "if", "(", "belowMin", ">", "0", ")", "{", "LOGGER", ".", "debug", "(", "logIdent", "(", "hostname", ",", "this", ...
Helper method to ensure a minimum number of endpoints is enabled.
[ "Helper", "method", "to", "ensure", "a", "minimum", "number", "of", "endpoints", "is", "enabled", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L185-L214
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/PooledService.java
PooledService.maybeOpenAndSend
private void maybeOpenAndSend(final CouchbaseRequest request) { LOGGER.debug(logIdent(hostname, PooledService.this) + "Need to open a new Endpoint (current size {})", endpoints.size()); final Endpoint endpoint = endpointFactory.create( hostname, bucket, username, password, port, ctx ); synchronized (epMutex) { endpoints.add(endpoint); endpointStates.register(endpoint, endpoint); } final Subscription subscription = whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() { @Override public void call(LifecycleState lifecycleState) { if (disconnect) { RetryHelper.retryOrCancel(env, request, responseBuffer); } else { endpoint.send(request); endpoint.send(SignalFlush.INSTANCE); } } } ); endpoint.connect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { // ignored on purpose } @Override public void onError(Throwable e) { unsubscribeAndRetry(subscription, request); } @Override public void onNext(LifecycleState state) { if (state == LifecycleState.DISCONNECTING || state == LifecycleState.DISCONNECTED) { unsubscribeAndRetry(subscription, request); } } }); }
java
private void maybeOpenAndSend(final CouchbaseRequest request) { LOGGER.debug(logIdent(hostname, PooledService.this) + "Need to open a new Endpoint (current size {})", endpoints.size()); final Endpoint endpoint = endpointFactory.create( hostname, bucket, username, password, port, ctx ); synchronized (epMutex) { endpoints.add(endpoint); endpointStates.register(endpoint, endpoint); } final Subscription subscription = whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() { @Override public void call(LifecycleState lifecycleState) { if (disconnect) { RetryHelper.retryOrCancel(env, request, responseBuffer); } else { endpoint.send(request); endpoint.send(SignalFlush.INSTANCE); } } } ); endpoint.connect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { // ignored on purpose } @Override public void onError(Throwable e) { unsubscribeAndRetry(subscription, request); } @Override public void onNext(LifecycleState state) { if (state == LifecycleState.DISCONNECTING || state == LifecycleState.DISCONNECTED) { unsubscribeAndRetry(subscription, request); } } }); }
[ "private", "void", "maybeOpenAndSend", "(", "final", "CouchbaseRequest", "request", ")", "{", "LOGGER", ".", "debug", "(", "logIdent", "(", "hostname", ",", "PooledService", ".", "this", ")", "+", "\"Need to open a new Endpoint (current size {})\"", ",", "endpoints", ...
Helper method to try and open new endpoints as needed and correctly integrate them into the state of the service.
[ "Helper", "method", "to", "try", "and", "open", "new", "endpoints", "as", "needed", "and", "correctly", "integrate", "them", "into", "the", "state", "of", "the", "service", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L347-L392
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/PooledService.java
PooledService.unsubscribeAndRetry
private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) { if (subscription != null && !subscription.isUnsubscribed()) { subscription.unsubscribe(); } RetryHelper.retryOrCancel(env, request, responseBuffer); }
java
private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) { if (subscription != null && !subscription.isUnsubscribed()) { subscription.unsubscribe(); } RetryHelper.retryOrCancel(env, request, responseBuffer); }
[ "private", "void", "unsubscribeAndRetry", "(", "final", "Subscription", "subscription", ",", "final", "CouchbaseRequest", "request", ")", "{", "if", "(", "subscription", "!=", "null", "&&", "!", "subscription", ".", "isUnsubscribed", "(", ")", ")", "{", "subscri...
Helper method to unsubscribe from the subscription and send the request into retry.
[ "Helper", "method", "to", "unsubscribe", "from", "the", "subscription", "and", "send", "the", "request", "into", "retry", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L397-L402
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/PooledService.java
PooledService.sendFlush
private void sendFlush(final SignalFlush signalFlush) { for (Endpoint endpoint : endpoints) { if (endpoint != null) { endpoint.send(signalFlush); } } }
java
private void sendFlush(final SignalFlush signalFlush) { for (Endpoint endpoint : endpoints) { if (endpoint != null) { endpoint.send(signalFlush); } } }
[ "private", "void", "sendFlush", "(", "final", "SignalFlush", "signalFlush", ")", "{", "for", "(", "Endpoint", "endpoint", ":", "endpoints", ")", "{", "if", "(", "endpoint", "!=", "null", ")", "{", "endpoint", ".", "send", "(", "signalFlush", ")", ";", "}...
Helper method to send the flush signal to all endpoints. @param signalFlush the flush signal to propagate.
[ "Helper", "method", "to", "send", "the", "flush", "signal", "to", "all", "endpoints", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L409-L415
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java
AbstractBinaryMemcacheDecoder.channelInactive
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); if (currentMessage != null && currentMessage.getExtras() != null) { if (currentMessage.getExtras().refCnt() > 0) { currentMessage.getExtras().release(); } } if (currentMessage != null && currentMessage.getFramingExtras() != null) { if (currentMessage.getFramingExtras().refCnt() > 0) { currentMessage.getFramingExtras().release(); } } resetDecoder(); }
java
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); if (currentMessage != null && currentMessage.getExtras() != null) { if (currentMessage.getExtras().refCnt() > 0) { currentMessage.getExtras().release(); } } if (currentMessage != null && currentMessage.getFramingExtras() != null) { if (currentMessage.getFramingExtras().refCnt() > 0) { currentMessage.getFramingExtras().release(); } } resetDecoder(); }
[ "@", "Override", "public", "void", "channelInactive", "(", "ChannelHandlerContext", "ctx", ")", "throws", "Exception", "{", "super", ".", "channelInactive", "(", "ctx", ")", ";", "if", "(", "currentMessage", "!=", "null", "&&", "currentMessage", ".", "getExtras"...
When the channel goes inactive, release all frames to prevent data leaks. @param ctx handler context @throws Exception if something goes wrong during channel inactive notification.
[ "When", "the", "channel", "goes", "inactive", "release", "all", "frames", "to", "prevent", "data", "leaks", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java#L224-L241
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/state/AbstractStateZipper.java
AbstractStateZipper.transitionStateThroughZipper
private void transitionStateThroughZipper() { Collection<S> currentStates = states.values(); if (currentStates.isEmpty()) { transitionState(initialState); } else { transitionState(zipWith(currentStates)); } }
java
private void transitionStateThroughZipper() { Collection<S> currentStates = states.values(); if (currentStates.isEmpty()) { transitionState(initialState); } else { transitionState(zipWith(currentStates)); } }
[ "private", "void", "transitionStateThroughZipper", "(", ")", "{", "Collection", "<", "S", ">", "currentStates", "=", "states", ".", "values", "(", ")", ";", "if", "(", "currentStates", ".", "isEmpty", "(", ")", ")", "{", "transitionState", "(", "initialState...
Ask the zip function to compute the states and then transition the state of the zipper. When no registrations are available, the zipper immediately transitions into the initial state without asking the zip function for a computation.
[ "Ask", "the", "zip", "function", "to", "compute", "the", "states", "and", "then", "transition", "the", "state", "of", "the", "zipper", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/state/AbstractStateZipper.java#L116-L123
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java
ThresholdLogReporter.report
public void report(final ThresholdLogSpan span) { if (isOverThreshold(span)) { if (!overThresholdQueue.offer(span)) { LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span); } } }
java
public void report(final ThresholdLogSpan span) { if (isOverThreshold(span)) { if (!overThresholdQueue.offer(span)) { LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span); } } }
[ "public", "void", "report", "(", "final", "ThresholdLogSpan", "span", ")", "{", "if", "(", "isOverThreshold", "(", "span", ")", ")", "{", "if", "(", "!", "overThresholdQueue", ".", "offer", "(", "span", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Co...
Reports the given span, but it doesn't have to be a potential slow. This method, based on its configuration, will figure out if the given span is indeed eligible for being part in the log. @param span the span to report.
[ "Reports", "the", "given", "span", "but", "it", "doesn", "t", "have", "to", "be", "a", "potential", "slow", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java#L147-L153
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java
ThresholdLogReporter.isOverThreshold
private boolean isOverThreshold(final ThresholdLogSpan span) { String service = (String) span.tag(Tags.PEER_SERVICE.getKey()); if (SERVICE_KV.equals(service)) { return span.durationMicros() >= kvThreshold; } else if (SERVICE_N1QL.equals(service)) { return span.durationMicros() >= n1qlThreshold; } else if (SERVICE_VIEW.equals(service)) { return span.durationMicros() >= viewThreshold; } else if (SERVICE_FTS.equals(service)) { return span.durationMicros() >= ftsThreshold; } else if (SERVICE_ANALYTICS.equals(service)) { return span.durationMicros() >= analyticsThreshold; } else { return false; } }
java
private boolean isOverThreshold(final ThresholdLogSpan span) { String service = (String) span.tag(Tags.PEER_SERVICE.getKey()); if (SERVICE_KV.equals(service)) { return span.durationMicros() >= kvThreshold; } else if (SERVICE_N1QL.equals(service)) { return span.durationMicros() >= n1qlThreshold; } else if (SERVICE_VIEW.equals(service)) { return span.durationMicros() >= viewThreshold; } else if (SERVICE_FTS.equals(service)) { return span.durationMicros() >= ftsThreshold; } else if (SERVICE_ANALYTICS.equals(service)) { return span.durationMicros() >= analyticsThreshold; } else { return false; } }
[ "private", "boolean", "isOverThreshold", "(", "final", "ThresholdLogSpan", "span", ")", "{", "String", "service", "=", "(", "String", ")", "span", ".", "tag", "(", "Tags", ".", "PEER_SERVICE", ".", "getKey", "(", ")", ")", ";", "if", "(", "SERVICE_KV", "...
Checks if the given span is over the threshold and eligible for being reported. @param span the span to check. @return true if it is, false otherwise.
[ "Checks", "if", "the", "given", "span", "is", "over", "the", "threshold", "and", "eligible", "for", "being", "reported", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java#L162-L177
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.calculateNodeId
private static int calculateNodeId(int partitionId, BinaryRequest request, CouchbaseBucketConfig config) { boolean useFastForward = request.retryCount() > 0 && config.hasFastForwardMap(); if (request instanceof ReplicaGetRequest) { return config.nodeIndexForReplica(partitionId, ((ReplicaGetRequest) request).replica() - 1, useFastForward); } else if (request instanceof ObserveRequest && ((ObserveRequest) request).replica() > 0) { return config.nodeIndexForReplica(partitionId, ((ObserveRequest) request).replica() - 1, useFastForward); } else if (request instanceof ObserveSeqnoRequest && ((ObserveSeqnoRequest) request).replica() > 0) { return config.nodeIndexForReplica(partitionId, ((ObserveSeqnoRequest) request).replica() - 1, useFastForward); } else { return config.nodeIndexForMaster(partitionId, useFastForward); } }
java
private static int calculateNodeId(int partitionId, BinaryRequest request, CouchbaseBucketConfig config) { boolean useFastForward = request.retryCount() > 0 && config.hasFastForwardMap(); if (request instanceof ReplicaGetRequest) { return config.nodeIndexForReplica(partitionId, ((ReplicaGetRequest) request).replica() - 1, useFastForward); } else if (request instanceof ObserveRequest && ((ObserveRequest) request).replica() > 0) { return config.nodeIndexForReplica(partitionId, ((ObserveRequest) request).replica() - 1, useFastForward); } else if (request instanceof ObserveSeqnoRequest && ((ObserveSeqnoRequest) request).replica() > 0) { return config.nodeIndexForReplica(partitionId, ((ObserveSeqnoRequest) request).replica() - 1, useFastForward); } else { return config.nodeIndexForMaster(partitionId, useFastForward); } }
[ "private", "static", "int", "calculateNodeId", "(", "int", "partitionId", ",", "BinaryRequest", "request", ",", "CouchbaseBucketConfig", "config", ")", "{", "boolean", "useFastForward", "=", "request", ".", "retryCount", "(", ")", ">", "0", "&&", "config", ".", ...
Helper method to calculate the node if for the given partition and request type. @param partitionId the partition id. @param request the request used. @param config the current bucket configuration. @return the calculated node id.
[ "Helper", "method", "to", "calculate", "the", "node", "if", "for", "the", "given", "partition", "and", "request", "type", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L161-L173
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.errorObservables
private static void errorObservables(int nodeId, BinaryRequest request, String name, CoreEnvironment env, RingBuffer<ResponseEvent> responseBuffer) { if (nodeId == DefaultCouchbaseBucketConfig.PARTITION_NOT_EXISTENT) { if (request instanceof ReplicaGetRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ReplicaGetRequest) request).replica() + " not configured for bucket " + name, null)); return; } else if (request instanceof ObserveRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ObserveRequest) request).replica() + " not configured for bucket " + name, ((ObserveRequest) request).cas())); return; } else if (request instanceof ObserveSeqnoRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ObserveSeqnoRequest) request).replica() + " not configured for bucket " + name, ((ObserveSeqnoRequest) request).cas())); return; } RetryHelper.retryOrCancel(env, request, responseBuffer); return; } if (nodeId == -1) { if (request instanceof ObserveRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ObserveRequest) request).replica() + " not available for bucket " + name, ((ObserveRequest) request).cas())); return; } else if (request instanceof ReplicaGetRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ReplicaGetRequest) request).replica() + " not available for bucket " + name, null)); return; } else if (request instanceof ObserveSeqnoRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ObserveSeqnoRequest) request).replica() + " not available for bucket " + name, ((ObserveSeqnoRequest) request).cas())); return; } RetryHelper.retryOrCancel(env, request, responseBuffer); return; } throw new IllegalStateException("Unknown NodeId: " + nodeId + ", request: " + request); }
java
private static void errorObservables(int nodeId, BinaryRequest request, String name, CoreEnvironment env, RingBuffer<ResponseEvent> responseBuffer) { if (nodeId == DefaultCouchbaseBucketConfig.PARTITION_NOT_EXISTENT) { if (request instanceof ReplicaGetRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ReplicaGetRequest) request).replica() + " not configured for bucket " + name, null)); return; } else if (request instanceof ObserveRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ObserveRequest) request).replica() + " not configured for bucket " + name, ((ObserveRequest) request).cas())); return; } else if (request instanceof ObserveSeqnoRequest) { request.observable().onError(new ReplicaNotConfiguredException("Replica number " + ((ObserveSeqnoRequest) request).replica() + " not configured for bucket " + name, ((ObserveSeqnoRequest) request).cas())); return; } RetryHelper.retryOrCancel(env, request, responseBuffer); return; } if (nodeId == -1) { if (request instanceof ObserveRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ObserveRequest) request).replica() + " not available for bucket " + name, ((ObserveRequest) request).cas())); return; } else if (request instanceof ReplicaGetRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ReplicaGetRequest) request).replica() + " not available for bucket " + name, null)); return; } else if (request instanceof ObserveSeqnoRequest) { request.observable().onError(new ReplicaNotAvailableException("Replica number " + ((ObserveSeqnoRequest) request).replica() + " not available for bucket " + name, ((ObserveSeqnoRequest) request).cas())); return; } RetryHelper.retryOrCancel(env, request, responseBuffer); return; } throw new IllegalStateException("Unknown NodeId: " + nodeId + ", request: " + request); }
[ "private", "static", "void", "errorObservables", "(", "int", "nodeId", ",", "BinaryRequest", "request", ",", "String", "name", ",", "CoreEnvironment", "env", ",", "RingBuffer", "<", "ResponseEvent", ">", "responseBuffer", ")", "{", "if", "(", "nodeId", "==", "...
Fail observables because the partitions do not match up. If the replica is not even available in the configuration (identified by a -2 node index), it is clear that this replica is not configured. If a -1 is returned it is configured, but currently not available (not enough nodes in the cluster, for example if a node is seen down, after a failover, or during rebalance. Replica partitions in general take longer to heal than active partitions, since they are sacrificed for application availability. @param nodeId the current node id of the partition @param request the request to error @param name the name of the bucket
[ "Fail", "observables", "because", "the", "partitions", "do", "not", "match", "up", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L188-L230
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.partitionForKey
private static int partitionForKey(byte[] key, int numPartitions) { CRC32 crc32 = new CRC32(); crc32.update(key); long rv = (crc32.getValue() >> 16) & 0x7fff; return (int) rv &numPartitions - 1; }
java
private static int partitionForKey(byte[] key, int numPartitions) { CRC32 crc32 = new CRC32(); crc32.update(key); long rv = (crc32.getValue() >> 16) & 0x7fff; return (int) rv &numPartitions - 1; }
[ "private", "static", "int", "partitionForKey", "(", "byte", "[", "]", "key", ",", "int", "numPartitions", ")", "{", "CRC32", "crc32", "=", "new", "CRC32", "(", ")", ";", "crc32", ".", "update", "(", "key", ")", ";", "long", "rv", "=", "(", "crc32", ...
Calculate the vbucket for the given key. @param key the key to calculate from. @param numPartitions the number of partitions in the bucket. @return the calculated partition.
[ "Calculate", "the", "vbucket", "for", "the", "given", "key", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L239-L244
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.handleNotEqualNodeSizes
private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) { if (configNodeSize != actualNodeSize) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling", actualNodeSize, configNodeSize); } return true; } return false; }
java
private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) { if (configNodeSize != actualNodeSize) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling", actualNodeSize, configNodeSize); } return true; } return false; }
[ "private", "static", "boolean", "handleNotEqualNodeSizes", "(", "int", "configNodeSize", ",", "int", "actualNodeSize", ")", "{", "if", "(", "configNodeSize", "!=", "actualNodeSize", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG...
Helper method to handle potentially different node sizes in the actual list and in the config. @return true if they are not equal, false if they are.
[ "Helper", "method", "to", "handle", "potentially", "different", "node", "sizes", "in", "the", "actual", "list", "and", "in", "the", "config", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L283-L292
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.keyIsValid
private static boolean keyIsValid(final BinaryRequest request) { if (request.keyBytes() == null || request.keyBytes().length < MIN_KEY_BYTES) { request.observable().onError(new IllegalArgumentException("The Document ID must not be null or empty.")); return false; } if (request.keyBytes().length > MAX_KEY_BYTES) { request.observable().onError(new IllegalArgumentException( "The Document ID must not be longer than 250 bytes.")); return false; } return true; }
java
private static boolean keyIsValid(final BinaryRequest request) { if (request.keyBytes() == null || request.keyBytes().length < MIN_KEY_BYTES) { request.observable().onError(new IllegalArgumentException("The Document ID must not be null or empty.")); return false; } if (request.keyBytes().length > MAX_KEY_BYTES) { request.observable().onError(new IllegalArgumentException( "The Document ID must not be longer than 250 bytes.")); return false; } return true; }
[ "private", "static", "boolean", "keyIsValid", "(", "final", "BinaryRequest", "request", ")", "{", "if", "(", "request", ".", "keyBytes", "(", ")", "==", "null", "||", "request", ".", "keyBytes", "(", ")", ".", "length", "<", "MIN_KEY_BYTES", ")", "{", "r...
Helper method to check if the given request key is valid. If false is returned, the request observable is already failed. @param request the request to extract and validate the key from. @return true if valid, false otherwise.
[ "Helper", "method", "to", "check", "if", "the", "given", "request", "key", "is", "valid", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L302-L315
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/logging/JdkLogger.java
JdkLogger.debug
@Override public void debug(String msg) { if (logger.isLoggable(Level.FINE)) { log(SELF, Level.FINE, msg, null); } }
java
@Override public void debug(String msg) { if (logger.isLoggable(Level.FINE)) { log(SELF, Level.FINE, msg, null); } }
[ "@", "Override", "public", "void", "debug", "(", "String", "msg", ")", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", "(", "SELF", ",", "Level", ".", "FINE", ",", "msg", ",", "null", ")", ";", "}", ...
Log a message object at level FINE. @param msg - the message object to be logged
[ "Log", "a", "message", "object", "at", "level", "FINE", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/logging/JdkLogger.java#L197-L202
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/CouchbaseNode.java
CouchbaseNode.signalConnected
private void signalConnected() { if (alternate != null) { LOGGER.info("Connected to Node {} ({})", system(hostname.nameAndAddress()), system(alternate.nameAndAddress())); } else { LOGGER.info("Connected to Node {}", system(hostname.nameAndAddress())); } if (eventBus != null && eventBus.hasSubscribers()) { eventBus.publish(new NodeConnectedEvent(hostname)); } }
java
private void signalConnected() { if (alternate != null) { LOGGER.info("Connected to Node {} ({})", system(hostname.nameAndAddress()), system(alternate.nameAndAddress())); } else { LOGGER.info("Connected to Node {}", system(hostname.nameAndAddress())); } if (eventBus != null && eventBus.hasSubscribers()) { eventBus.publish(new NodeConnectedEvent(hostname)); } }
[ "private", "void", "signalConnected", "(", ")", "{", "if", "(", "alternate", "!=", "null", ")", "{", "LOGGER", ".", "info", "(", "\"Connected to Node {} ({})\"", ",", "system", "(", "hostname", ".", "nameAndAddress", "(", ")", ")", ",", "system", "(", "alt...
Log that this node is now connected and also inform all susbcribers on the event bus.
[ "Log", "that", "this", "node", "is", "now", "connected", "and", "also", "inform", "all", "susbcribers", "on", "the", "event", "bus", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/CouchbaseNode.java#L209-L219
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/CouchbaseNode.java
CouchbaseNode.signalDisconnected
private void signalDisconnected() { if (alternate != null) { LOGGER.info("Disconnected from Node {} ({})", system(hostname.nameAndAddress()), system(alternate.nameAndAddress())); } else { LOGGER.info("Disconnected from Node {}", system(hostname.nameAndAddress())); } if (eventBus != null && eventBus.hasSubscribers()) { eventBus.publish(new NodeDisconnectedEvent(hostname)); } }
java
private void signalDisconnected() { if (alternate != null) { LOGGER.info("Disconnected from Node {} ({})", system(hostname.nameAndAddress()), system(alternate.nameAndAddress())); } else { LOGGER.info("Disconnected from Node {}", system(hostname.nameAndAddress())); } if (eventBus != null && eventBus.hasSubscribers()) { eventBus.publish(new NodeDisconnectedEvent(hostname)); } }
[ "private", "void", "signalDisconnected", "(", ")", "{", "if", "(", "alternate", "!=", "null", ")", "{", "LOGGER", ".", "info", "(", "\"Disconnected from Node {} ({})\"", ",", "system", "(", "hostname", ".", "nameAndAddress", "(", ")", ")", ",", "system", "("...
Log that this node is now disconnected and also inform all susbcribers on the event bus.
[ "Log", "that", "this", "node", "is", "now", "disconnected", "and", "also", "inform", "all", "susbcribers", "on", "the", "event", "bus", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/CouchbaseNode.java#L224-L234
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/utils/Buffers.java
Buffers.wrapColdWithAutoRelease
public static <T> Observable<T> wrapColdWithAutoRelease(final Observable<T> source) { return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { source.subscribe(new Subscriber<T>() { @Override public void onCompleted() { if (!subscriber.isUnsubscribed()) { subscriber.onCompleted(); } } @Override public void onError(Throwable e) { if(!subscriber.isUnsubscribed()) { subscriber.onError(e); } } @Override public void onNext(T t) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(t); } else { ReferenceCountUtil.release(t); } } }); } }); }
java
public static <T> Observable<T> wrapColdWithAutoRelease(final Observable<T> source) { return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { source.subscribe(new Subscriber<T>() { @Override public void onCompleted() { if (!subscriber.isUnsubscribed()) { subscriber.onCompleted(); } } @Override public void onError(Throwable e) { if(!subscriber.isUnsubscribed()) { subscriber.onError(e); } } @Override public void onNext(T t) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(t); } else { ReferenceCountUtil.release(t); } } }); } }); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "wrapColdWithAutoRelease", "(", "final", "Observable", "<", "T", ">", "source", ")", "{", "return", "Observable", ".", "create", "(", "new", "Observable", ".", "OnSubscribe", "<", "T", ">", ...
Wrap an observable and free a reference counted item if unsubscribed in the meantime. This can and should be used if a hot observable is used as the source but it is not guaranteed that there will always be a subscriber that consumes the reference counted item. If an item is emitted by the source observable and no subscriber is attached (because it unsubscribed) the item will be freed. Note that also non reference counted items can be passed in, but there is no impact other than making it cold (in which case defer could be used). It is very important that if subscribed, the caller needs to release the reference counted item. It wil only be released on behalf of the caller when unsubscribed. @param source the source observable to wrap. @return the wrapped cold observable with refcnt release logic.
[ "Wrap", "an", "observable", "and", "free", "a", "reference", "counted", "item", "if", "unsubscribed", "in", "the", "meantime", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/Buffers.java#L62-L92
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/DefaultPortInfo.java
DefaultPortInfo.extractPorts
static void extractPorts(final Map<String, Integer> input, final Map<ServiceType, Integer> ports, final Map<ServiceType, Integer> sslPorts) { for (Map.Entry<String, Integer> entry : input.entrySet()) { String service = entry.getKey(); int port = entry.getValue(); if (service.equals("mgmt")) { ports.put(ServiceType.CONFIG, port); } else if (service.equals("capi")) { ports.put(ServiceType.VIEW, port); } else if (service.equals("kv")) { ports.put(ServiceType.BINARY, port); } else if (service.equals("kvSSL")) { sslPorts.put(ServiceType.BINARY, port); } else if (service.equals("capiSSL")) { sslPorts.put(ServiceType.VIEW, port); } else if (service.equals("mgmtSSL")) { sslPorts.put(ServiceType.CONFIG, port); } else if (service.equals("n1ql")) { ports.put(ServiceType.QUERY, port); } else if (service.equals("n1qlSSL")) { sslPorts.put(ServiceType.QUERY, port); } else if (service.equals("fts")) { ports.put(ServiceType.SEARCH, port); } else if (service.equals("ftsSSL")) { sslPorts.put(ServiceType.SEARCH, port); } else if (service.equals("cbas")) { ports.put(ServiceType.ANALYTICS, port); } else if (service.equals("cbasSSL")) { sslPorts.put(ServiceType.ANALYTICS, port); } } }
java
static void extractPorts(final Map<String, Integer> input, final Map<ServiceType, Integer> ports, final Map<ServiceType, Integer> sslPorts) { for (Map.Entry<String, Integer> entry : input.entrySet()) { String service = entry.getKey(); int port = entry.getValue(); if (service.equals("mgmt")) { ports.put(ServiceType.CONFIG, port); } else if (service.equals("capi")) { ports.put(ServiceType.VIEW, port); } else if (service.equals("kv")) { ports.put(ServiceType.BINARY, port); } else if (service.equals("kvSSL")) { sslPorts.put(ServiceType.BINARY, port); } else if (service.equals("capiSSL")) { sslPorts.put(ServiceType.VIEW, port); } else if (service.equals("mgmtSSL")) { sslPorts.put(ServiceType.CONFIG, port); } else if (service.equals("n1ql")) { ports.put(ServiceType.QUERY, port); } else if (service.equals("n1qlSSL")) { sslPorts.put(ServiceType.QUERY, port); } else if (service.equals("fts")) { ports.put(ServiceType.SEARCH, port); } else if (service.equals("ftsSSL")) { sslPorts.put(ServiceType.SEARCH, port); } else if (service.equals("cbas")) { ports.put(ServiceType.ANALYTICS, port); } else if (service.equals("cbasSSL")) { sslPorts.put(ServiceType.ANALYTICS, port); } } }
[ "static", "void", "extractPorts", "(", "final", "Map", "<", "String", ",", "Integer", ">", "input", ",", "final", "Map", "<", "ServiceType", ",", "Integer", ">", "ports", ",", "final", "Map", "<", "ServiceType", ",", "Integer", ">", "sslPorts", ")", "{",...
Helper method to extract ports from the raw services port mapping. @param input the raw input ports @param ports the output direct ports @param sslPorts the output ssl ports
[ "Helper", "method", "to", "extract", "ports", "from", "the", "raw", "services", "port", "mapping", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultPortInfo.java#L68-L99
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/ResponseStatusDetails.java
ResponseStatusDetails.stringify
public static String stringify(final ResponseStatus status, final ResponseStatusDetails details) { String result = status.toString(); if (details != null) { result = result + " (Context: " + details.context() + ", Reference: " + details.reference() + ")"; } return result; }
java
public static String stringify(final ResponseStatus status, final ResponseStatusDetails details) { String result = status.toString(); if (details != null) { result = result + " (Context: " + details.context() + ", Reference: " + details.reference() + ")"; } return result; }
[ "public", "static", "String", "stringify", "(", "final", "ResponseStatus", "status", ",", "final", "ResponseStatusDetails", "details", ")", "{", "String", "result", "=", "status", ".", "toString", "(", ")", ";", "if", "(", "details", "!=", "null", ")", "{", ...
Stringify the status details and the status in a best effort manner.
[ "Stringify", "the", "status", "details", "and", "the", "status", "in", "a", "best", "effort", "manner", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/ResponseStatusDetails.java#L110-L116
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/utils/ConnectionString.java
ConnectionString.tryResolveHosts
static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) { List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>(); for (InetSocketAddress node : hosts) { try { node.getAddress().getHostAddress(); resolvableHosts.add(node); } catch (NullPointerException ex) { LOGGER.error("Unable to resolve address " + node.toString()); } } return resolvableHosts; }
java
static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) { List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>(); for (InetSocketAddress node : hosts) { try { node.getAddress().getHostAddress(); resolvableHosts.add(node); } catch (NullPointerException ex) { LOGGER.error("Unable to resolve address " + node.toString()); } } return resolvableHosts; }
[ "static", "List", "<", "InetSocketAddress", ">", "tryResolveHosts", "(", "final", "List", "<", "InetSocketAddress", ">", "hosts", ")", "{", "List", "<", "InetSocketAddress", ">", "resolvableHosts", "=", "new", "ArrayList", "<", "InetSocketAddress", ">", "(", ")"...
Make sure the address is resolvable
[ "Make", "sure", "the", "address", "is", "resolvable" ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/ConnectionString.java#L135-L146
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/service/AbstractLazyService.java
AbstractLazyService.sendAndFlushWhenConnected
private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) { whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() { @Override public void call(LifecycleState lifecycleState) { endpoint.send(request); endpoint.send(SignalFlush.INSTANCE); } }); }
java
private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) { whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() { @Override public void call(LifecycleState lifecycleState) { endpoint.send(request); endpoint.send(SignalFlush.INSTANCE); } }); }
[ "private", "static", "void", "sendAndFlushWhenConnected", "(", "final", "Endpoint", "endpoint", ",", "final", "CouchbaseRequest", "request", ")", "{", "whenState", "(", "endpoint", ",", "LifecycleState", ".", "CONNECTED", ",", "new", "Action1", "<", "LifecycleState"...
Helper method to send the request and also a flush afterwards. @param endpoint the endpoint to send the reques to. @param request the reques to send.
[ "Helper", "method", "to", "send", "the", "request", "and", "also", "a", "flush", "afterwards", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractLazyService.java#L98-L106
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java
AbstractLoader.loadConfig
public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket, final String password) { LOGGER.debug("Loading Config for bucket {}", bucket); return loadConfig(seedNode, bucket, bucket, password); }
java
public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket, final String password) { LOGGER.debug("Loading Config for bucket {}", bucket); return loadConfig(seedNode, bucket, bucket, password); }
[ "public", "Observable", "<", "Tuple2", "<", "LoaderType", ",", "BucketConfig", ">", ">", "loadConfig", "(", "final", "NetworkAddress", "seedNode", ",", "final", "String", "bucket", ",", "final", "String", "password", ")", "{", "LOGGER", ".", "debug", "(", "\...
Initiate the config loading process. @param seedNode the seed node. @param bucket the name of the bucket. @param password the password of the bucket. @return a valid {@link BucketConfig}.
[ "Initiate", "the", "config", "loading", "process", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java#L121-L125
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java
AbstractLoader.replaceHostWildcard
protected String replaceHostWildcard(String input, NetworkAddress hostname) { return input.replace("$HOST", hostname.address()); }
java
protected String replaceHostWildcard(String input, NetworkAddress hostname) { return input.replace("$HOST", hostname.address()); }
[ "protected", "String", "replaceHostWildcard", "(", "String", "input", ",", "NetworkAddress", "hostname", ")", "{", "return", "input", ".", "replace", "(", "\"$HOST\"", ",", "hostname", ".", "address", "(", ")", ")", ";", "}" ]
Replaces the host wildcard from an incoming config with a proper hostname. @param input the input config. @param hostname the hostname to replace it with. @return a replaced configuration.
[ "Replaces", "the", "host", "wildcard", "from", "an", "incoming", "config", "with", "a", "proper", "hostname", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java#L237-L239
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/event/system/NodeConnectedEvent.java
NodeConnectedEvent.host
public InetAddress host() { try { return InetAddress.getByName(host.address()); } catch (UnknownHostException e) { throw new IllegalStateException(e); } }
java
public InetAddress host() { try { return InetAddress.getByName(host.address()); } catch (UnknownHostException e) { throw new IllegalStateException(e); } }
[ "public", "InetAddress", "host", "(", ")", "{", "try", "{", "return", "InetAddress", ".", "getByName", "(", "host", ".", "address", "(", ")", ")", ";", "}", "catch", "(", "UnknownHostException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", ...
The host address of the connected node. @return the inet address of the connected node.
[ "The", "host", "address", "of", "the", "connected", "node", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/event/system/NodeConnectedEvent.java#L51-L57
train
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueErrorMapHandler.java
KeyValueErrorMapHandler.errorMapRequest
private FullBinaryMemcacheRequest errorMapRequest() { LOGGER.debug("Requesting error map in version {}", MAP_VERSION); ByteBuf content = Unpooled.buffer(2).writeShort(MAP_VERSION); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest( new byte[] {}, Unpooled.EMPTY_BUFFER, content ); request.setOpcode(GET_ERROR_MAP_CMD); request.setTotalBodyLength(content.readableBytes()); return request; }
java
private FullBinaryMemcacheRequest errorMapRequest() { LOGGER.debug("Requesting error map in version {}", MAP_VERSION); ByteBuf content = Unpooled.buffer(2).writeShort(MAP_VERSION); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest( new byte[] {}, Unpooled.EMPTY_BUFFER, content ); request.setOpcode(GET_ERROR_MAP_CMD); request.setTotalBodyLength(content.readableBytes()); return request; }
[ "private", "FullBinaryMemcacheRequest", "errorMapRequest", "(", ")", "{", "LOGGER", ".", "debug", "(", "\"Requesting error map in version {}\"", ",", "MAP_VERSION", ")", ";", "ByteBuf", "content", "=", "Unpooled", ".", "buffer", "(", "2", ")", ".", "writeShort", "...
Creates the request to load the error map.
[ "Creates", "the", "request", "to", "load", "the", "error", "map", "." ]
97f0427112c2168fee1d6499904f5fa0e24c6797
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueErrorMapHandler.java#L94-L103
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.getStreamingProfile
public ApiResponse getStreamingProfile(String name, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Arrays.asList("streaming_profiles", name); return callApi(HttpMethod.GET, uri, ObjectUtils.emptyMap(), options); }
java
public ApiResponse getStreamingProfile(String name, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Arrays.asList("streaming_profiles", name); return callApi(HttpMethod.GET, uri, ObjectUtils.emptyMap(), options); }
[ "public", "ApiResponse", "getStreamingProfile", "(", "String", "name", ",", "Map", "options", ")", "throws", "Exception", "{", "if", "(", "options", "==", "null", ")", "options", "=", "ObjectUtils", ".", "emptyMap", "(", ")", ";", "List", "<", "String", ">...
Get a streaming profile information @param name the name of the profile to fetch @param options additional options @return a streaming profile @throws Exception an exception
[ "Get", "a", "streaming", "profile", "information" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L380-L387
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.listStreamingProfiles
public ApiResponse listStreamingProfiles(Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Collections.singletonList("streaming_profiles"); return callApi(HttpMethod.GET, uri, ObjectUtils.emptyMap(), options); }
java
public ApiResponse listStreamingProfiles(Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Collections.singletonList("streaming_profiles"); return callApi(HttpMethod.GET, uri, ObjectUtils.emptyMap(), options); }
[ "public", "ApiResponse", "listStreamingProfiles", "(", "Map", "options", ")", "throws", "Exception", "{", "if", "(", "options", "==", "null", ")", "options", "=", "ObjectUtils", ".", "emptyMap", "(", ")", ";", "List", "<", "String", ">", "uri", "=", "Colle...
List Streaming profiles @param options additional options @return a list of all streaming profiles defined for the current cloud @throws Exception an exception
[ "List", "Streaming", "profiles" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L402-L408
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.deleteStreamingProfile
public ApiResponse deleteStreamingProfile(String name, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Arrays.asList("streaming_profiles", name); return callApi(HttpMethod.DELETE, uri, ObjectUtils.emptyMap(), options); }
java
public ApiResponse deleteStreamingProfile(String name, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<String> uri = Arrays.asList("streaming_profiles", name); return callApi(HttpMethod.DELETE, uri, ObjectUtils.emptyMap(), options); }
[ "public", "ApiResponse", "deleteStreamingProfile", "(", "String", "name", ",", "Map", "options", ")", "throws", "Exception", "{", "if", "(", "options", "==", "null", ")", "options", "=", "ObjectUtils", ".", "emptyMap", "(", ")", ";", "List", "<", "String", ...
Delete a streaming profile information. Predefined profiles are restored to the default setting. @param name the name of the profile to delete @param options additional options @return a streaming profile @throws Exception an exception
[ "Delete", "a", "streaming", "profile", "information", ".", "Predefined", "profiles", "are", "restored", "to", "the", "default", "setting", "." ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L424-L431
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.updateResourcesAccessModeByPrefix
public ApiResponse updateResourcesAccessModeByPrefix(String accessMode, String prefix, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "prefix", prefix, options); }
java
public ApiResponse updateResourcesAccessModeByPrefix(String accessMode, String prefix, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "prefix", prefix, options); }
[ "public", "ApiResponse", "updateResourcesAccessModeByPrefix", "(", "String", "accessMode", ",", "String", "prefix", ",", "Map", "options", ")", "throws", "Exception", "{", "return", "updateResourcesAccessMode", "(", "accessMode", ",", "\"prefix\"", ",", "prefix", ",",...
Update access mode of one or more resources by prefix @param accessMode The new access mode, "public" or "authenticated" @param prefix The prefix by which to filter applicable resources @param options additional options <ul> <li>resource_type - (default "image") - the type of resources to modify</li> <li>max_results - optional - the maximum resources to process in a single invocation</li> <li>next_cursor - optional - provided by a previous call to the method</li> </ul> @return a map of the returned values <ul> <li>updated - an array of resources</li> <li>next_cursor - optional - provided if more resources can be processed</li> </ul> @throws ApiException an API exception
[ "Update", "access", "mode", "of", "one", "or", "more", "resources", "by", "prefix" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L496-L498
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.updateResourcesAccessModeByTag
public ApiResponse updateResourcesAccessModeByTag(String accessMode, String tag, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "tag", tag, options); }
java
public ApiResponse updateResourcesAccessModeByTag(String accessMode, String tag, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "tag", tag, options); }
[ "public", "ApiResponse", "updateResourcesAccessModeByTag", "(", "String", "accessMode", ",", "String", "tag", ",", "Map", "options", ")", "throws", "Exception", "{", "return", "updateResourcesAccessMode", "(", "accessMode", ",", "\"tag\"", ",", "tag", ",", "options"...
Update access mode of one or more resources by tag @param accessMode The new access mode, "public" or "authenticated" @param tag The tag by which to filter applicable resources @param options additional options <ul> <li>resource_type - (default "image") - the type of resources to modify</li> <li>max_results - optional - the maximum resources to process in a single invocation</li> <li>next_cursor - optional - provided by a previous call to the method</li> </ul> @return a map of the returned values <ul> <li>updated - an array of resources</li> <li>next_cursor - optional - provided if more resources can be processed</li> </ul> @throws ApiException an API exception
[ "Update", "access", "mode", "of", "one", "or", "more", "resources", "by", "tag" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L518-L520
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.updateResourcesAccessModeByIds
public ApiResponse updateResourcesAccessModeByIds(String accessMode, Iterable<String> publicIds, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "public_ids", publicIds, options); }
java
public ApiResponse updateResourcesAccessModeByIds(String accessMode, Iterable<String> publicIds, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "public_ids", publicIds, options); }
[ "public", "ApiResponse", "updateResourcesAccessModeByIds", "(", "String", "accessMode", ",", "Iterable", "<", "String", ">", "publicIds", ",", "Map", "options", ")", "throws", "Exception", "{", "return", "updateResourcesAccessMode", "(", "accessMode", ",", "\"public_i...
Update access mode of one or more resources by publicIds @param accessMode The new access mode, "public" or "authenticated" @param publicIds A list of public ids of resources to be updated @param options additional options <ul> <li>resource_type - (default "image") - the type of resources to modify</li> <li>max_results - optional - the maximum resources to process in a single invocation</li> <li>next_cursor - optional - provided by a previous call to the method</li> </ul> @return a map of the returned values <ul> <li>updated - an array of resources</li> <li>next_cursor - optional - provided if more resources can be processed</li> </ul> @throws ApiException an API exception
[ "Update", "access", "mode", "of", "one", "or", "more", "resources", "by", "publicIds" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L540-L542
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/AuthToken.java
AuthToken.generate
public String generate(String url) { long expiration = this.expiration; if (expiration == 0) { if (duration > 0) { final long start = startTime > 0 ? startTime : Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() / 1000L; expiration = start + duration; } else { throw new IllegalArgumentException("Must provide either expiration or duration"); } } ArrayList<String> tokenParts = new ArrayList<String>(); if (ip != null) { tokenParts.add("ip=" + ip); } if (startTime > 0) { tokenParts.add("st=" + startTime); } tokenParts.add("exp=" + expiration); if (acl != null) { tokenParts.add("acl=" + escapeToLower(acl)); } ArrayList<String> toSign = new ArrayList<String>(tokenParts); if (url != null && acl == null) { toSign.add("url=" + escapeToLower(url)); } String auth = digest(StringUtils.join(toSign, "~")); tokenParts.add("hmac=" + auth); return tokenName + "=" + StringUtils.join(tokenParts, "~"); }
java
public String generate(String url) { long expiration = this.expiration; if (expiration == 0) { if (duration > 0) { final long start = startTime > 0 ? startTime : Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() / 1000L; expiration = start + duration; } else { throw new IllegalArgumentException("Must provide either expiration or duration"); } } ArrayList<String> tokenParts = new ArrayList<String>(); if (ip != null) { tokenParts.add("ip=" + ip); } if (startTime > 0) { tokenParts.add("st=" + startTime); } tokenParts.add("exp=" + expiration); if (acl != null) { tokenParts.add("acl=" + escapeToLower(acl)); } ArrayList<String> toSign = new ArrayList<String>(tokenParts); if (url != null && acl == null) { toSign.add("url=" + escapeToLower(url)); } String auth = digest(StringUtils.join(toSign, "~")); tokenParts.add("hmac=" + auth); return tokenName + "=" + StringUtils.join(tokenParts, "~"); }
[ "public", "String", "generate", "(", "String", "url", ")", "{", "long", "expiration", "=", "this", ".", "expiration", ";", "if", "(", "expiration", "==", "0", ")", "{", "if", "(", "duration", ">", "0", ")", "{", "final", "long", "start", "=", "startT...
Generate a URL token for the given URL. @param url the URL to be authorized @return a URL token
[ "Generate", "a", "URL", "token", "for", "the", "given", "URL", "." ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/AuthToken.java#L144-L173
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/AuthToken.java
AuthToken.escapeToLower
private String escapeToLower(String url) { String encodedUrl = StringUtils.urlEncode(url, UNSAFE_URL_CHARS_PATTERN, Charset.forName("UTF-8")); return encodedUrl; }
java
private String escapeToLower(String url) { String encodedUrl = StringUtils.urlEncode(url, UNSAFE_URL_CHARS_PATTERN, Charset.forName("UTF-8")); return encodedUrl; }
[ "private", "String", "escapeToLower", "(", "String", "url", ")", "{", "String", "encodedUrl", "=", "StringUtils", ".", "urlEncode", "(", "url", ",", "UNSAFE_URL_CHARS_PATTERN", ",", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ";", "return", "encoded...
Escape url using lowercase hex code @param url a url string @return escaped url
[ "Escape", "url", "using", "lowercase", "hex", "code" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/AuthToken.java#L181-L184
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/AuthToken.java
AuthToken.copy
public AuthToken copy() { final AuthToken authToken = new AuthToken(key); authToken.tokenName = tokenName; authToken.startTime = startTime; authToken.expiration = expiration; authToken.ip = ip; authToken.acl = acl; authToken.duration = duration; return authToken; }
java
public AuthToken copy() { final AuthToken authToken = new AuthToken(key); authToken.tokenName = tokenName; authToken.startTime = startTime; authToken.expiration = expiration; authToken.ip = ip; authToken.acl = acl; authToken.duration = duration; return authToken; }
[ "public", "AuthToken", "copy", "(", ")", "{", "final", "AuthToken", "authToken", "=", "new", "AuthToken", "(", "key", ")", ";", "authToken", ".", "tokenName", "=", "tokenName", ";", "authToken", ".", "startTime", "=", "startTime", ";", "authToken", ".", "e...
Create a copy of this AuthToken @return a new AuthToken object
[ "Create", "a", "copy", "of", "this", "AuthToken" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/AuthToken.java#L191-L200
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/transformation/BaseExpression.java
BaseExpression.normalize
public static String normalize(Object expression) { if (expression == null) { return null; } // If it's a number it's not an expression if (expression instanceof Number){ return String.valueOf(expression); } String replacement; String conditionStr = StringUtils.mergeToSingleUnderscore(String.valueOf(expression)); Matcher matcher = PATTERN.matcher(conditionStr); StringBuffer result = new StringBuffer(conditionStr.length()); while (matcher.find()) { if (OPERATORS.containsKey(matcher.group())) { replacement = (String) OPERATORS.get(matcher.group()); } else if (PREDEFINED_VARS.containsKey(matcher.group())) { replacement = (String) PREDEFINED_VARS.get(matcher.group()); } else { replacement = matcher.group(); } matcher.appendReplacement(result, replacement); } matcher.appendTail(result); return result.toString(); }
java
public static String normalize(Object expression) { if (expression == null) { return null; } // If it's a number it's not an expression if (expression instanceof Number){ return String.valueOf(expression); } String replacement; String conditionStr = StringUtils.mergeToSingleUnderscore(String.valueOf(expression)); Matcher matcher = PATTERN.matcher(conditionStr); StringBuffer result = new StringBuffer(conditionStr.length()); while (matcher.find()) { if (OPERATORS.containsKey(matcher.group())) { replacement = (String) OPERATORS.get(matcher.group()); } else if (PREDEFINED_VARS.containsKey(matcher.group())) { replacement = (String) PREDEFINED_VARS.get(matcher.group()); } else { replacement = matcher.group(); } matcher.appendReplacement(result, replacement); } matcher.appendTail(result); return result.toString(); }
[ "public", "static", "String", "normalize", "(", "Object", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "return", "null", ";", "}", "// If it's a number it's not an expression", "if", "(", "expression", "instanceof", "Number", ")", "{"...
Normalize an expression string, replace "nice names" with their coded values and spaces with "_". @param expression an expression @return a parsed expression
[ "Normalize", "an", "expression", "string", "replace", "nice", "names", "with", "their", "coded", "values", "and", "spaces", "with", "_", "." ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/transformation/BaseExpression.java#L66-L92
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.join
public static String join(List<String> list, String separator) { if (list == null) { return null; } return join(list.toArray(), separator, 0, list.size()); }
java
public static String join(List<String> list, String separator) { if (list == null) { return null; } return join(list.toArray(), separator, 0, list.size()); }
[ "public", "static", "String", "join", "(", "List", "<", "String", ">", "list", ",", "String", "separator", ")", "{", "if", "(", "list", "==", "null", ")", "{", "return", "null", ";", "}", "return", "join", "(", "list", ".", "toArray", "(", ")", ","...
Join a list of Strings @param list strings to join @param separator the separator to insert between the strings @return a string made of the strings in list separated by separator
[ "Join", "a", "list", "of", "Strings" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L22-L28
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.join
public static String join(Collection<String> collection, String separator) { if (collection == null) { return null; } return join(collection.toArray(new String[collection.size()]), separator, 0, collection.size()); }
java
public static String join(Collection<String> collection, String separator) { if (collection == null) { return null; } return join(collection.toArray(new String[collection.size()]), separator, 0, collection.size()); }
[ "public", "static", "String", "join", "(", "Collection", "<", "String", ">", "collection", ",", "String", "separator", ")", "{", "if", "(", "collection", "==", "null", ")", "{", "return", "null", ";", "}", "return", "join", "(", "collection", ".", "toArr...
Join a collection of Strings @param collection strings to join @param separator the separator to insert between the strings @return a string made of the strings in collection separated by separator
[ "Join", "a", "collection", "of", "Strings" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L51-L56
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.encodeHexString
public static String encodeHexString(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
java
public static String encodeHexString(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
[ "public", "static", "String", "encodeHexString", "(", "byte", "[", "]", "bytes", ")", "{", "char", "[", "]", "hexChars", "=", "new", "char", "[", "bytes", ".", "length", "*", "2", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bytes"...
Convert an array of bytes to a string of hex values @param bytes bytes to convert @return a string of hex values.
[ "Convert", "an", "array", "of", "bytes", "to", "a", "string", "of", "hex", "values" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L101-L109
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.read
public static String read(InputStream in) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) != -1) { baos.write(buffer, 0, length); } return new String(baos.toByteArray()); }
java
public static String read(InputStream in) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) != -1) { baos.write(buffer, 0, length); } return new String(baos.toByteArray()); }
[ "public", "static", "String", "read", "(", "InputStream", "in", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1024", "]", ";", "...
Read the entire input stream in 1KB chunks @param in input stream to read from @return a String generated from the input stream @throws IOException thrown by the input stream
[ "Read", "the", "entire", "input", "stream", "in", "1KB", "chunks" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L201-L209
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.replaceIfFirstChar
public static String replaceIfFirstChar(String s, char c, String replacement) { return s.charAt(0) == c ? replacement + s.substring(1) : s; }
java
public static String replaceIfFirstChar(String s, char c, String replacement) { return s.charAt(0) == c ? replacement + s.substring(1) : s; }
[ "public", "static", "String", "replaceIfFirstChar", "(", "String", "s", ",", "char", "c", ",", "String", "replacement", ")", "{", "return", "s", ".", "charAt", "(", "0", ")", "==", "c", "?", "replacement", "+", "s", ".", "substring", "(", "1", ")", "...
Replaces the char c in the string S, if it's the first character in the string. @param s The string to search @param c The character to replace @param replacement The string to replace the character in S @return The string with the character replaced (or the original string if the char is not found)
[ "Replaces", "the", "char", "c", "in", "the", "string", "S", "if", "it", "s", "the", "first", "character", "in", "the", "string", "." ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L305-L307
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.removeStartingChars
public static String removeStartingChars(String s, char c) { int lastToRemove = -1; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == c) { lastToRemove = i; continue; } if (s.charAt(i) != c) { break; } } if (lastToRemove < 0) return s; return s.substring(lastToRemove + 1); }
java
public static String removeStartingChars(String s, char c) { int lastToRemove = -1; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == c) { lastToRemove = i; continue; } if (s.charAt(i) != c) { break; } } if (lastToRemove < 0) return s; return s.substring(lastToRemove + 1); }
[ "public", "static", "String", "removeStartingChars", "(", "String", "s", ",", "char", "c", ")", "{", "int", "lastToRemove", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", ...
Remove all consecutive chars c from the beginning of the string @param s String to process @param c Char to search for @return The string stripped from the starting chars.
[ "Remove", "all", "consecutive", "chars", "c", "from", "the", "beginning", "of", "the", "string" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L325-L340
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/ObjectUtils.java
ObjectUtils.toISO8601
public static String toISO8601(Date date){ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.format(date); }
java
public static String toISO8601(Date date){ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.format(date); }
[ "public", "static", "String", "toISO8601", "(", "Date", "date", ")", "{", "DateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd'T'HH:mm:ssXXX\"", ",", "Locale", ".", "US", ")", ";", "dateFormat", ".", "setTimeZone", "(", "TimeZone", ".",...
Formats a Date as an ISO-8601 string representation. @param date Date to format @return The date formatted as ISO-8601 string
[ "Formats", "a", "Date", "as", "an", "ISO", "-", "8601", "string", "representation", "." ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/ObjectUtils.java#L19-L23
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Transformation.java
Transformation.isValidAttrValue
private boolean isValidAttrValue(String value) { final float parseFloat; try { parseFloat = Float.parseFloat(value); } catch (NumberFormatException e) { return false; } return parseFloat >= 1; }
java
private boolean isValidAttrValue(String value) { final float parseFloat; try { parseFloat = Float.parseFloat(value); } catch (NumberFormatException e) { return false; } return parseFloat >= 1; }
[ "private", "boolean", "isValidAttrValue", "(", "String", "value", ")", "{", "final", "float", "parseFloat", ";", "try", "{", "parseFloat", "=", "Float", ".", "parseFloat", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "...
Check if the value is a float >= 1 @param value @return true if the value is a float >= 1
[ "Check", "if", "the", "value", "is", "a", "float", ">", "=", "1" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Transformation.java#L762-L770
train
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/AccessControlRule.java
AccessControlRule.anonymous
public static AccessControlRule anonymous(Date start, Date end){ return new AccessControlRule(AccessType.anonymous, start, end); }
java
public static AccessControlRule anonymous(Date start, Date end){ return new AccessControlRule(AccessType.anonymous, start, end); }
[ "public", "static", "AccessControlRule", "anonymous", "(", "Date", "start", ",", "Date", "end", ")", "{", "return", "new", "AccessControlRule", "(", "AccessType", ".", "anonymous", ",", "start", ",", "end", ")", ";", "}" ]
Construct a new anonymous access rule @param start The start date for the rule @param end The end date for the rule @return The access rule instance
[ "Construct", "a", "new", "anonymous", "access", "rule" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/AccessControlRule.java#L45-L47
train
cloudinary/cloudinary_java
cloudinary-http43/src/main/java/com/cloudinary/http43/ApiStrategy.java
ApiStrategy.prepareRequest
private HttpUriRequest prepareRequest(HttpMethod method, String apiUrl, Map<String, ?> params, Map options) throws URISyntaxException, UnsupportedEncodingException { URI apiUri; HttpRequestBase request; String contentType = ObjectUtils.asString(options.get("content_type"), "urlencoded"); URIBuilder apiUrlBuilder = new URIBuilder(apiUrl); HashMap<String,Object> unboxedParams = new HashMap<String,Object>(params); if (method == HttpMethod.GET) { apiUrlBuilder.setParameters(prepareParams(params)); apiUri = apiUrlBuilder.build(); request = new HttpGet(apiUri); } else { apiUri = apiUrlBuilder.build(); switch (method) { case PUT: request = new HttpPut(apiUri); break; case DELETE: //uses HttpPost instead of HttpDelete unboxedParams.put("_method","delete"); //continue with POST case POST: request = new HttpPost(apiUri); break; default: throw new IllegalArgumentException("Unknown HTTP method"); } if (contentType.equals("json")) { JSONObject asJSON = ObjectUtils.toJSON(unboxedParams); StringEntity requestEntity = new StringEntity(asJSON.toString(), ContentType.APPLICATION_JSON); ((HttpEntityEnclosingRequestBase) request).setEntity(requestEntity); } else { ((HttpEntityEnclosingRequestBase) request).setEntity(new UrlEncodedFormEntity(prepareParams(unboxedParams), Consts.UTF_8)); } } setTimeouts(request, options); return request; }
java
private HttpUriRequest prepareRequest(HttpMethod method, String apiUrl, Map<String, ?> params, Map options) throws URISyntaxException, UnsupportedEncodingException { URI apiUri; HttpRequestBase request; String contentType = ObjectUtils.asString(options.get("content_type"), "urlencoded"); URIBuilder apiUrlBuilder = new URIBuilder(apiUrl); HashMap<String,Object> unboxedParams = new HashMap<String,Object>(params); if (method == HttpMethod.GET) { apiUrlBuilder.setParameters(prepareParams(params)); apiUri = apiUrlBuilder.build(); request = new HttpGet(apiUri); } else { apiUri = apiUrlBuilder.build(); switch (method) { case PUT: request = new HttpPut(apiUri); break; case DELETE: //uses HttpPost instead of HttpDelete unboxedParams.put("_method","delete"); //continue with POST case POST: request = new HttpPost(apiUri); break; default: throw new IllegalArgumentException("Unknown HTTP method"); } if (contentType.equals("json")) { JSONObject asJSON = ObjectUtils.toJSON(unboxedParams); StringEntity requestEntity = new StringEntity(asJSON.toString(), ContentType.APPLICATION_JSON); ((HttpEntityEnclosingRequestBase) request).setEntity(requestEntity); } else { ((HttpEntityEnclosingRequestBase) request).setEntity(new UrlEncodedFormEntity(prepareParams(unboxedParams), Consts.UTF_8)); } } setTimeouts(request, options); return request; }
[ "private", "HttpUriRequest", "prepareRequest", "(", "HttpMethod", "method", ",", "String", "apiUrl", ",", "Map", "<", "String", ",", "?", ">", "params", ",", "Map", "options", ")", "throws", "URISyntaxException", ",", "UnsupportedEncodingException", "{", "URI", ...
Prepare a request with the URL and parameters based on the HTTP method used @param method the HTTP method: GET, PUT, POST, DELETE @param apiUrl the cloudinary API URI @param params the parameters to pass to the server @return an HTTP request @throws URISyntaxException @throws UnsupportedEncodingException
[ "Prepare", "a", "request", "with", "the", "URL", "and", "parameters", "based", "on", "the", "HTTP", "method", "used" ]
58ee1823180da2dea6a2eb7e5cf00d5a760f8aef
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-http43/src/main/java/com/cloudinary/http43/ApiStrategy.java#L141-L179
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestClient.java
RestClient.isStatusCodeOK
private boolean isStatusCodeOK(Response response, String uri) { if (response.getStatus() == Status.OK.getStatusCode() || response.getStatus() == Status.CREATED.getStatusCode()) { return true; } else if (response.getStatus() == Status.UNAUTHORIZED.getStatusCode()) { throw new NotAuthorizedException("UNAUTHORIZED: Your credentials are wrong. " + "Please check your username/password or the secret key.", response); } else if (response.getStatus() == Status.CONFLICT.getStatusCode() || response.getStatus() == Status.NOT_FOUND.getStatusCode() || response.getStatus() == Status.FORBIDDEN.getStatusCode() || response.getStatus() == Status.BAD_REQUEST.getStatusCode()) { ErrorResponse errorResponse = response.readEntity(ErrorResponse.class); throw new ClientErrorException(errorResponse.toString(), response); } else { throw new WebApplicationException("Unsupported status", response); } }
java
private boolean isStatusCodeOK(Response response, String uri) { if (response.getStatus() == Status.OK.getStatusCode() || response.getStatus() == Status.CREATED.getStatusCode()) { return true; } else if (response.getStatus() == Status.UNAUTHORIZED.getStatusCode()) { throw new NotAuthorizedException("UNAUTHORIZED: Your credentials are wrong. " + "Please check your username/password or the secret key.", response); } else if (response.getStatus() == Status.CONFLICT.getStatusCode() || response.getStatus() == Status.NOT_FOUND.getStatusCode() || response.getStatus() == Status.FORBIDDEN.getStatusCode() || response.getStatus() == Status.BAD_REQUEST.getStatusCode()) { ErrorResponse errorResponse = response.readEntity(ErrorResponse.class); throw new ClientErrorException(errorResponse.toString(), response); } else { throw new WebApplicationException("Unsupported status", response); } }
[ "private", "boolean", "isStatusCodeOK", "(", "Response", "response", ",", "String", "uri", ")", "{", "if", "(", "response", ".", "getStatus", "(", ")", "==", "Status", ".", "OK", ".", "getStatusCode", "(", ")", "||", "response", ".", "getStatus", "(", ")...
Checks if is status code ok. @param response the response @param uri the uri @return true, if is status code ok
[ "Checks", "if", "is", "status", "code", "ok", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestClient.java#L180-L196
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestClient.java
RestClient.createWebTarget
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) { WebTarget webTarget; try { URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath); Client client = createRestClient(); webTarget = client.target(u); if (queryParams != null && !queryParams.isEmpty()) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue()); webTarget = webTarget.queryParam(entry.getKey(), entry.getValue()); } } } } catch (Exception e) { throw new IllegalArgumentException("Something went wrong by creating the client: " + e); } return webTarget; }
java
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) { WebTarget webTarget; try { URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath); Client client = createRestClient(); webTarget = client.target(u); if (queryParams != null && !queryParams.isEmpty()) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue()); webTarget = webTarget.queryParam(entry.getKey(), entry.getValue()); } } } } catch (Exception e) { throw new IllegalArgumentException("Something went wrong by creating the client: " + e); } return webTarget; }
[ "private", "WebTarget", "createWebTarget", "(", "String", "restPath", ",", "Map", "<", "String", ",", "String", ">", "queryParams", ")", "{", "WebTarget", "webTarget", ";", "try", "{", "URI", "u", "=", "new", "URI", "(", "this", ".", "baseURI", "+", "\"/...
Creates the web target. @param restPath the rest path @param queryParams the query params @return the web target
[ "Creates", "the", "web", "target", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestClient.java#L207-L228
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestClient.java
RestClient.createRestClient
private Client createRestClient() throws KeyManagementException, NoSuchAlgorithmException { ClientConfig clientConfig = new ClientConfig(); // Set connection timeout if (this.connectionTimeout != 0) { clientConfig.property(ClientProperties.CONNECT_TIMEOUT, this.connectionTimeout); clientConfig.property(ClientProperties.READ_TIMEOUT, this.connectionTimeout); } clientConfig.register(MoxyJsonFeature.class).register(MoxyXmlFeature.class).register(createMoxyJsonResolver()); Client client = null; if (this.baseURI.startsWith("https")) { client = createSLLClient(clientConfig); } else { client = ClientBuilder.newClient(clientConfig); } return client; }
java
private Client createRestClient() throws KeyManagementException, NoSuchAlgorithmException { ClientConfig clientConfig = new ClientConfig(); // Set connection timeout if (this.connectionTimeout != 0) { clientConfig.property(ClientProperties.CONNECT_TIMEOUT, this.connectionTimeout); clientConfig.property(ClientProperties.READ_TIMEOUT, this.connectionTimeout); } clientConfig.register(MoxyJsonFeature.class).register(MoxyXmlFeature.class).register(createMoxyJsonResolver()); Client client = null; if (this.baseURI.startsWith("https")) { client = createSLLClient(clientConfig); } else { client = ClientBuilder.newClient(clientConfig); } return client; }
[ "private", "Client", "createRestClient", "(", ")", "throws", "KeyManagementException", ",", "NoSuchAlgorithmException", "{", "ClientConfig", "clientConfig", "=", "new", "ClientConfig", "(", ")", ";", "// Set connection timeout", "if", "(", "this", ".", "connectionTimeou...
Creater rest client. @return the client @throws KeyManagementException the key management exception @throws NoSuchAlgorithmException the no such algorithm exception
[ "Creater", "rest", "client", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestClient.java#L253-L272
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestClient.java
RestClient.createSLLClient
private Client createSLLClient(ClientConfig clientConfig) throws KeyManagementException, NoSuchAlgorithmException { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); ClientBuilder.newClient(clientConfig); Client client = ClientBuilder.newBuilder() .sslContext(sc) .hostnameVerifier(new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { return true; } }) .withConfig(clientConfig).build(); return client; }
java
private Client createSLLClient(ClientConfig clientConfig) throws KeyManagementException, NoSuchAlgorithmException { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); ClientBuilder.newClient(clientConfig); Client client = ClientBuilder.newBuilder() .sslContext(sc) .hostnameVerifier(new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { return true; } }) .withConfig(clientConfig).build(); return client; }
[ "private", "Client", "createSLLClient", "(", "ClientConfig", "clientConfig", ")", "throws", "KeyManagementException", ",", "NoSuchAlgorithmException", "{", "TrustManager", "[", "]", "trustAllCerts", "=", "new", "TrustManager", "[", "]", "{", "new", "X509TrustManager", ...
Creates the sll client. @param clientConfig the client config @return the client config @throws KeyManagementException the key management exception @throws NoSuchAlgorithmException the no such algorithm exception
[ "Creates", "the", "sll", "client", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestClient.java#L292-L322
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getUser
public UserEntity getUser(String username) { UserEntity userEntity = restClient.get("users/" + username, UserEntity.class, new HashMap<String, String>()); return userEntity; }
java
public UserEntity getUser(String username) { UserEntity userEntity = restClient.get("users/" + username, UserEntity.class, new HashMap<String, String>()); return userEntity; }
[ "public", "UserEntity", "getUser", "(", "String", "username", ")", "{", "UserEntity", "userEntity", "=", "restClient", ".", "get", "(", "\"users/\"", "+", "username", ",", "UserEntity", ".", "class", ",", "new", "HashMap", "<", "String", ",", "String", ">", ...
Gets the user. @param username the username @return the user
[ "Gets", "the", "user", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L125-L128
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.createUser
public Response createUser(UserEntity userEntity) { return restClient.post("users", userEntity, new HashMap<String, String>()); }
java
public Response createUser(UserEntity userEntity) { return restClient.post("users", userEntity, new HashMap<String, String>()); }
[ "public", "Response", "createUser", "(", "UserEntity", "userEntity", ")", "{", "return", "restClient", ".", "post", "(", "\"users\"", ",", "userEntity", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Creates the user. @param userEntity the user entity @return the response
[ "Creates", "the", "user", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L137-L139
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteUser
public Response deleteUser(String username) { return restClient.delete("users/" + username, new HashMap<String, String>()); }
java
public Response deleteUser(String username) { return restClient.delete("users/" + username, new HashMap<String, String>()); }
[ "public", "Response", "deleteUser", "(", "String", "username", ")", "{", "return", "restClient", ".", "delete", "(", "\"users/\"", "+", "username", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Delete user. @param username the username @return the response
[ "Delete", "user", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L159-L161
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getChatRooms
public MUCRoomEntities getChatRooms(Map<String, String> queryParams) { return restClient.get("chatrooms", MUCRoomEntities.class, queryParams); }
java
public MUCRoomEntities getChatRooms(Map<String, String> queryParams) { return restClient.get("chatrooms", MUCRoomEntities.class, queryParams); }
[ "public", "MUCRoomEntities", "getChatRooms", "(", "Map", "<", "String", ",", "String", ">", "queryParams", ")", "{", "return", "restClient", ".", "get", "(", "\"chatrooms\"", ",", "MUCRoomEntities", ".", "class", ",", "queryParams", ")", ";", "}" ]
Gets the chat rooms. @param queryParams the query params @return the chat rooms
[ "Gets", "the", "chat", "rooms", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L179-L181
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getChatRoom
public MUCRoomEntity getChatRoom(String roomName) { return restClient.get("chatrooms/" + roomName, MUCRoomEntity.class, new HashMap<String, String>()); }
java
public MUCRoomEntity getChatRoom(String roomName) { return restClient.get("chatrooms/" + roomName, MUCRoomEntity.class, new HashMap<String, String>()); }
[ "public", "MUCRoomEntity", "getChatRoom", "(", "String", "roomName", ")", "{", "return", "restClient", ".", "get", "(", "\"chatrooms/\"", "+", "roomName", ",", "MUCRoomEntity", ".", "class", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")",...
Gets the chat room. @param roomName the room name @return the chat room
[ "Gets", "the", "chat", "room", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L190-L192
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.createChatRoom
public Response createChatRoom(MUCRoomEntity chatRoom) { return restClient.post("chatrooms", chatRoom, new HashMap<String, String>()); }
java
public Response createChatRoom(MUCRoomEntity chatRoom) { return restClient.post("chatrooms", chatRoom, new HashMap<String, String>()); }
[ "public", "Response", "createChatRoom", "(", "MUCRoomEntity", "chatRoom", ")", "{", "return", "restClient", ".", "post", "(", "\"chatrooms\"", ",", "chatRoom", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Creates the chat room. @param chatRoom the chat room @return the response
[ "Creates", "the", "chat", "room", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L201-L203
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.updateChatRoom
public Response updateChatRoom(MUCRoomEntity chatRoom) { return restClient.put("chatrooms/" + chatRoom.getRoomName(), chatRoom, new HashMap<String, String>()); }
java
public Response updateChatRoom(MUCRoomEntity chatRoom) { return restClient.put("chatrooms/" + chatRoom.getRoomName(), chatRoom, new HashMap<String, String>()); }
[ "public", "Response", "updateChatRoom", "(", "MUCRoomEntity", "chatRoom", ")", "{", "return", "restClient", ".", "put", "(", "\"chatrooms/\"", "+", "chatRoom", ".", "getRoomName", "(", ")", ",", "chatRoom", ",", "new", "HashMap", "<", "String", ",", "String", ...
Update chat room. @param chatRoom the chat room @return the response
[ "Update", "chat", "room", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L212-L214
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteChatRoom
public Response deleteChatRoom(String roomName) { return restClient.delete("chatrooms/" + roomName, new HashMap<String, String>()); }
java
public Response deleteChatRoom(String roomName) { return restClient.delete("chatrooms/" + roomName, new HashMap<String, String>()); }
[ "public", "Response", "deleteChatRoom", "(", "String", "roomName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Delete chat room. @param roomName the room name @return the response
[ "Delete", "chat", "room", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L223-L225
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getChatRoomParticipants
public ParticipantEntities getChatRoomParticipants(String roomName) { return restClient.get("chatrooms/" + roomName + "/participants", ParticipantEntities.class, new HashMap<String, String>()); }
java
public ParticipantEntities getChatRoomParticipants(String roomName) { return restClient.get("chatrooms/" + roomName + "/participants", ParticipantEntities.class, new HashMap<String, String>()); }
[ "public", "ParticipantEntities", "getChatRoomParticipants", "(", "String", "roomName", ")", "{", "return", "restClient", ".", "get", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/participants\"", ",", "ParticipantEntities", ".", "class", ",", "new", "HashMap", "<...
Gets the chat room participants. @param roomName the room name @return the chat room participants
[ "Gets", "the", "chat", "room", "participants", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L234-L237
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteOwner
public Response deleteOwner(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/owners/" + jid, new HashMap<String, String>()); }
java
public Response deleteOwner(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/owners/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteOwner", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/owners/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "String...
Delete owner from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "owner", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L261-L264
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteAdmin
public Response deleteAdmin(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/admins/" + jid, new HashMap<String, String>()); }
java
public Response deleteAdmin(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/admins/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteAdmin", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/admins/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "String...
Delete admin from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "admin", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L288-L291
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteMember
public Response deleteMember(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
java
public Response deleteMember(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteMember", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/members/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "Stri...
Delete member from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "member", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L315-L318
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addOutcast
public Response addOutcast(String roomName, String jid) { return restClient.post("chatrooms/" + roomName + "/outcasts/" + jid, null, new HashMap<String, String>()); }
java
public Response addOutcast(String roomName, String jid) { return restClient.post("chatrooms/" + roomName + "/outcasts/" + jid, null, new HashMap<String, String>()); }
[ "public", "Response", "addOutcast", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "post", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/outcasts/\"", "+", "jid", ",", "null", ",", "new", "HashMap", "<", "String", ...
Adds the outcast. @param roomName the room name @param jid the jid @return the response
[ "Adds", "the", "outcast", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L329-L331
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteOutcast
public Response deleteOutcast(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/outcasts/" + jid, new HashMap<String, String>()); }
java
public Response deleteOutcast(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/outcasts/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteOutcast", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/outcasts/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "St...
Delete outcast from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "outcast", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L342-L345
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteOwnerGroup
public Response deleteOwnerGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/owners/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteOwnerGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/owners/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteOwnerGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/owners/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "St...
Delete owner group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "owner", "group", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L369-L372
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteAdminGroup
public Response deleteAdminGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/admins/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteAdminGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/admins/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteAdminGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/admins/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "St...
Delete admin group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "admin", "group", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L396-L399
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteMemberGroup
public Response deleteMemberGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/members/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteMemberGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/members/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteMemberGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/members/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "...
Delete member group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "member", "group", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L423-L426
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addOutcastGroup
public Response addOutcastGroup(String roomName, String groupName) { return restClient.post("chatrooms/" + roomName + "/outcasts/group/" + groupName, null, new HashMap<String, String>()); }
java
public Response addOutcastGroup(String roomName, String groupName) { return restClient.post("chatrooms/" + roomName + "/outcasts/group/" + groupName, null, new HashMap<String, String>()); }
[ "public", "Response", "addOutcastGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "post", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/outcasts/group/\"", "+", "groupName", ",", "null", ",", "new", "HashMa...
Adds the group outcast. @param roomName the room name @param groupName the groupName @return the response
[ "Adds", "the", "group", "outcast", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L437-L439
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteOutcastGroup
public Response deleteOutcastGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/outcasts/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteOutcastGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/outcasts/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteOutcastGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/outcasts/group/\"", "+", "groupName", ",", "new", "HashMap", "<", ...
Delete outcast group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "outcast", "group", "from", "chatroom", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L450-L453
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getSessions
public SessionEntities getSessions() { SessionEntities sessionEntities = restClient.get("sessions", SessionEntities.class, new HashMap<String, String>()); return sessionEntities; }
java
public SessionEntities getSessions() { SessionEntities sessionEntities = restClient.get("sessions", SessionEntities.class, new HashMap<String, String>()); return sessionEntities; }
[ "public", "SessionEntities", "getSessions", "(", ")", "{", "SessionEntities", "sessionEntities", "=", "restClient", ".", "get", "(", "\"sessions\"", ",", "SessionEntities", ".", "class", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ...
Gets the sessions. @return the sessions
[ "Gets", "the", "sessions", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L461-L465
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteSessions
public Response deleteSessions(String username) { return restClient.delete("sessions/" + username, new HashMap<String, String>()); }
java
public Response deleteSessions(String username) { return restClient.delete("sessions/" + username, new HashMap<String, String>()); }
[ "public", "Response", "deleteSessions", "(", "String", "username", ")", "{", "return", "restClient", ".", "delete", "(", "\"sessions/\"", "+", "username", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Close all user sessions. @param username the username @return the response
[ "Close", "all", "user", "sessions", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L486-L488
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getUserGroups
public UserGroupsEntity getUserGroups(String username) { return restClient.get("users/" + username + "/groups", UserGroupsEntity.class, new HashMap<String, String>()); }
java
public UserGroupsEntity getUserGroups(String username) { return restClient.get("users/" + username + "/groups", UserGroupsEntity.class, new HashMap<String, String>()); }
[ "public", "UserGroupsEntity", "getUserGroups", "(", "String", "username", ")", "{", "return", "restClient", ".", "get", "(", "\"users/\"", "+", "username", "+", "\"/groups\"", ",", "UserGroupsEntity", ".", "class", ",", "new", "HashMap", "<", "String", ",", "S...
Gets the user groups. @param username the username @return the user groups
[ "Gets", "the", "user", "groups", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L497-L500
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addUserToGroups
public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) { return restClient.post("users/" + username + "/groups/", userGroupsEntity, new HashMap<String, String>()); }
java
public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) { return restClient.post("users/" + username + "/groups/", userGroupsEntity, new HashMap<String, String>()); }
[ "public", "Response", "addUserToGroups", "(", "String", "username", ",", "UserGroupsEntity", "userGroupsEntity", ")", "{", "return", "restClient", ".", "post", "(", "\"users/\"", "+", "username", "+", "\"/groups/\"", ",", "userGroupsEntity", ",", "new", "HashMap", ...
Adds the user to groups. @param username the username @param userGroupsEntity the user groups entity @return the response
[ "Adds", "the", "user", "to", "groups", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L511-L514
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addUserToGroup
public Response addUserToGroup(String username, String groupName) { return restClient.post("users/" + username + "/groups/"+ groupName, null, new HashMap<String, String>()); }
java
public Response addUserToGroup(String username, String groupName) { return restClient.post("users/" + username + "/groups/"+ groupName, null, new HashMap<String, String>()); }
[ "public", "Response", "addUserToGroup", "(", "String", "username", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "post", "(", "\"users/\"", "+", "username", "+", "\"/groups/\"", "+", "groupName", ",", "null", ",", "new", "HashMap", "<", ...
Adds the user to group. @param username the username @param groupName the group name @return the response
[ "Adds", "the", "user", "to", "group", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L523-L526
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteUserFromGroup
public Response deleteUserFromGroup(String username, String groupName) { return restClient.delete("users/" + username + "/groups/" + groupName, new HashMap<String, String>()); }
java
public Response deleteUserFromGroup(String username, String groupName) { return restClient.delete("users/" + username + "/groups/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteUserFromGroup", "(", "String", "username", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"users/\"", "+", "username", "+", "\"/groups/\"", "+", "groupName", ",", "new", "HashMap", "<", "String", ...
Delete user from group. @param username the username @param groupName the group name @return the response
[ "Delete", "user", "from", "group", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L535-L538
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.lockoutUser
public Response lockoutUser(String username) { return restClient.post("lockouts/" + username, null, new HashMap<String, String>()); }
java
public Response lockoutUser(String username) { return restClient.post("lockouts/" + username, null, new HashMap<String, String>()); }
[ "public", "Response", "lockoutUser", "(", "String", "username", ")", "{", "return", "restClient", ".", "post", "(", "\"lockouts/\"", "+", "username", ",", "null", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Lockout user. @param username the username @return the response
[ "Lockout", "user", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L548-L550
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.unlockUser
public Response unlockUser(String username) { return restClient.delete("lockouts/" + username, new HashMap<String, String>()); }
java
public Response unlockUser(String username) { return restClient.delete("lockouts/" + username, new HashMap<String, String>()); }
[ "public", "Response", "unlockUser", "(", "String", "username", ")", "{", "return", "restClient", ".", "delete", "(", "\"lockouts/\"", "+", "username", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Unlock user. @param username the username @return the response
[ "Unlock", "user", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L559-L561
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getSystemProperty
public SystemProperty getSystemProperty(String propertyName) { return restClient.get("system/properties/" + propertyName, SystemProperty.class, new HashMap<String, String>()); }
java
public SystemProperty getSystemProperty(String propertyName) { return restClient.get("system/properties/" + propertyName, SystemProperty.class, new HashMap<String, String>()); }
[ "public", "SystemProperty", "getSystemProperty", "(", "String", "propertyName", ")", "{", "return", "restClient", ".", "get", "(", "\"system/properties/\"", "+", "propertyName", ",", "SystemProperty", ".", "class", ",", "new", "HashMap", "<", "String", ",", "Strin...
Gets the system property. @param propertyName the property name @return the system property
[ "Gets", "the", "system", "property", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L580-L583
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.createSystemProperty
public Response createSystemProperty(SystemProperty property) { return restClient.post("system/properties", property, new HashMap<String, String>()); }
java
public Response createSystemProperty(SystemProperty property) { return restClient.post("system/properties", property, new HashMap<String, String>()); }
[ "public", "Response", "createSystemProperty", "(", "SystemProperty", "property", ")", "{", "return", "restClient", ".", "post", "(", "\"system/properties\"", ",", "property", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Creates the system property. @param property the property @return the response
[ "Creates", "the", "system", "property", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L592-L594
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.updateSystemProperty
public Response updateSystemProperty(SystemProperty property) { return restClient.put("system/properties/" + property.getKey(), property, new HashMap<String, String>()); }
java
public Response updateSystemProperty(SystemProperty property) { return restClient.put("system/properties/" + property.getKey(), property, new HashMap<String, String>()); }
[ "public", "Response", "updateSystemProperty", "(", "SystemProperty", "property", ")", "{", "return", "restClient", ".", "put", "(", "\"system/properties/\"", "+", "property", ".", "getKey", "(", ")", ",", "property", ",", "new", "HashMap", "<", "String", ",", ...
Update system property. @param property the property @return the response
[ "Update", "system", "property", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L603-L605
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteSystemProperty
public Response deleteSystemProperty(String propertyName) { return restClient.delete("system/properties/" + propertyName, new HashMap<String, String>()); }
java
public Response deleteSystemProperty(String propertyName) { return restClient.delete("system/properties/" + propertyName, new HashMap<String, String>()); }
[ "public", "Response", "deleteSystemProperty", "(", "String", "propertyName", ")", "{", "return", "restClient", ".", "delete", "(", "\"system/properties/\"", "+", "propertyName", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ...
Delete system property. @param propertyName the property name @return the response
[ "Delete", "system", "property", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L614-L616
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getGroup
public GroupEntity getGroup(String groupName) { return restClient.get("groups/" + groupName, GroupEntity.class, new HashMap<String, String>()); }
java
public GroupEntity getGroup(String groupName) { return restClient.get("groups/" + groupName, GroupEntity.class, new HashMap<String, String>()); }
[ "public", "GroupEntity", "getGroup", "(", "String", "groupName", ")", "{", "return", "restClient", ".", "get", "(", "\"groups/\"", "+", "groupName", ",", "GroupEntity", ".", "class", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ...
Gets the group. @param groupName the group name @return the group
[ "Gets", "the", "group", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L634-L636
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.updateGroup
public Response updateGroup(GroupEntity group) { return restClient.put("groups/" + group.getName(), group, new HashMap<String, String>()); }
java
public Response updateGroup(GroupEntity group) { return restClient.put("groups/" + group.getName(), group, new HashMap<String, String>()); }
[ "public", "Response", "updateGroup", "(", "GroupEntity", "group", ")", "{", "return", "restClient", ".", "put", "(", "\"groups/\"", "+", "group", ".", "getName", "(", ")", ",", "group", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ...
Update group. @param group the group @return the response
[ "Update", "group", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L656-L658
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteGroup
public Response deleteGroup(String groupName) { return restClient.delete("groups/" + groupName, new HashMap<String, String>()); }
java
public Response deleteGroup(String groupName) { return restClient.delete("groups/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteGroup", "(", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"groups/\"", "+", "groupName", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Delete group. @param groupName the group name @return the response
[ "Delete", "group", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L667-L669
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.getRoster
public RosterEntities getRoster(String username) { return restClient.get("users/" + username + "/roster", RosterEntities.class, new HashMap<String, String>()); }
java
public RosterEntities getRoster(String username) { return restClient.get("users/" + username + "/roster", RosterEntities.class, new HashMap<String, String>()); }
[ "public", "RosterEntities", "getRoster", "(", "String", "username", ")", "{", "return", "restClient", ".", "get", "(", "\"users/\"", "+", "username", "+", "\"/roster\"", ",", "RosterEntities", ".", "class", ",", "new", "HashMap", "<", "String", ",", "String", ...
Gets the roster. @param username the username @return the roster
[ "Gets", "the", "roster", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L678-L680
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addRosterEntry
public Response addRosterEntry(String username, RosterItemEntity rosterItemEntity) { return restClient.post("users/" + username + "/roster", rosterItemEntity, new HashMap<String, String>()); }
java
public Response addRosterEntry(String username, RosterItemEntity rosterItemEntity) { return restClient.post("users/" + username + "/roster", rosterItemEntity, new HashMap<String, String>()); }
[ "public", "Response", "addRosterEntry", "(", "String", "username", ",", "RosterItemEntity", "rosterItemEntity", ")", "{", "return", "restClient", ".", "post", "(", "\"users/\"", "+", "username", "+", "\"/roster\"", ",", "rosterItemEntity", ",", "new", "HashMap", "...
Adds the roster entry. @param username the username @param rosterItemEntity the roster item entity @return the response
[ "Adds", "the", "roster", "entry", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L691-L693
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.updateRosterEntry
public Response updateRosterEntry(String username, RosterItemEntity rosterItemEntity) { return restClient.put("users/" + username + "/roster/" + rosterItemEntity.getJid(), rosterItemEntity, new HashMap<String, String>()); }
java
public Response updateRosterEntry(String username, RosterItemEntity rosterItemEntity) { return restClient.put("users/" + username + "/roster/" + rosterItemEntity.getJid(), rosterItemEntity, new HashMap<String, String>()); }
[ "public", "Response", "updateRosterEntry", "(", "String", "username", ",", "RosterItemEntity", "rosterItemEntity", ")", "{", "return", "restClient", ".", "put", "(", "\"users/\"", "+", "username", "+", "\"/roster/\"", "+", "rosterItemEntity", ".", "getJid", "(", "...
Update roster entry. @param username the username @param rosterItemEntity the roster item entity @return the response
[ "Update", "roster", "entry", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L704-L707
train
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteRosterEntry
public Response deleteRosterEntry(String username, String jid) { return restClient.delete("users/" + username + "/roster/" + jid, new HashMap<String, String>()); }
java
public Response deleteRosterEntry(String username, String jid) { return restClient.delete("users/" + username + "/roster/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteRosterEntry", "(", "String", "username", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"users/\"", "+", "username", "+", "\"/roster/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "Stri...
Delete roster entry. @param username the username @param jid the jid @return the response
[ "Delete", "roster", "entry", "." ]
fd544dd770ec2ababa47fef51579522ddce09f05
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L718-L720
train