id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
124,500 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/LargeRecordHandler.java | LargeRecordHandler.close | public void close() throws IOException {
// we go on closing and deleting files in the presence of failures.
// we remember the first exception to occur and re-throw it later
Throwable ex = null;
synchronized (this) {
if (closed) {
return;
}
closed = true;
// close the writers
i... | java | public void close() throws IOException {
// we go on closing and deleting files in the presence of failures.
// we remember the first exception to occur and re-throw it later
Throwable ex = null;
synchronized (this) {
if (closed) {
return;
}
closed = true;
// close the writers
i... | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// we go on closing and deleting files in the presence of failures.",
"// we remember the first exception to occur and re-throw it later",
"Throwable",
"ex",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
... | Closes all structures and deletes all temporary files.
Even in the presence of failures, this method will try and continue closing
files and deleting temporary files.
@throws IOException Thrown if an error occurred while closing/deleting the files. | [
"Closes",
"all",
"structures",
"and",
"deletes",
"all",
"temporary",
"files",
".",
"Even",
"in",
"the",
"presence",
"of",
"failures",
"this",
"method",
"will",
"try",
"and",
"continue",
"closing",
"files",
"and",
"deleting",
"temporary",
"files",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/LargeRecordHandler.java#L280-L373 |
124,501 | apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java | UnsortedGrouping.aggregate | private AggregateOperator<T> aggregate(Aggregations agg, int field, String callLocationName) {
return new AggregateOperator<T>(this, agg, field, callLocationName);
} | java | private AggregateOperator<T> aggregate(Aggregations agg, int field, String callLocationName) {
return new AggregateOperator<T>(this, agg, field, callLocationName);
} | [
"private",
"AggregateOperator",
"<",
"T",
">",
"aggregate",
"(",
"Aggregations",
"agg",
",",
"int",
"field",
",",
"String",
"callLocationName",
")",
"{",
"return",
"new",
"AggregateOperator",
"<",
"T",
">",
"(",
"this",
",",
"agg",
",",
"field",
",",
"call... | private helper that allows to set a different call location name | [
"private",
"helper",
"that",
"allows",
"to",
"set",
"a",
"different",
"call",
"location",
"name"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java#L92-L94 |
124,502 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.resetOverflowBuckets | public ArrayList<MemorySegment> resetOverflowBuckets() {
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
ArrayList<MemorySegment> result = new ArrayList<MemorySegment>(this.overflowSegments.length);
for(int i = 0; i < this.overflowSegments.length; i++) {
if(this.overflowSegments[i] != null) {
... | java | public ArrayList<MemorySegment> resetOverflowBuckets() {
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
ArrayList<MemorySegment> result = new ArrayList<MemorySegment>(this.overflowSegments.length);
for(int i = 0; i < this.overflowSegments.length; i++) {
if(this.overflowSegments[i] != null) {
... | [
"public",
"ArrayList",
"<",
"MemorySegment",
">",
"resetOverflowBuckets",
"(",
")",
"{",
"this",
".",
"numOverflowSegments",
"=",
"0",
";",
"this",
".",
"nextOverflowBucket",
"=",
"0",
";",
"ArrayList",
"<",
"MemorySegment",
">",
"result",
"=",
"new",
"ArrayLi... | resets overflow bucket counters and returns freed memory and should only be used for resizing
@return freed memory segments | [
"resets",
"overflow",
"bucket",
"counters",
"and",
"returns",
"freed",
"memory",
"and",
"should",
"only",
"be",
"used",
"for",
"resizing"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L176-L188 |
124,503 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.appendRecord | public final long appendRecord(T record) throws IOException {
long pointer = this.writeView.getCurrentPointer();
try {
this.serializer.serialize(record, this.writeView);
this.recordCounter++;
return pointer;
} catch (EOFException e) {
// we ran out of pages.
// first, reset the pages and then we n... | java | public final long appendRecord(T record) throws IOException {
long pointer = this.writeView.getCurrentPointer();
try {
this.serializer.serialize(record, this.writeView);
this.recordCounter++;
return pointer;
} catch (EOFException e) {
// we ran out of pages.
// first, reset the pages and then we n... | [
"public",
"final",
"long",
"appendRecord",
"(",
"T",
"record",
")",
"throws",
"IOException",
"{",
"long",
"pointer",
"=",
"this",
".",
"writeView",
".",
"getCurrentPointer",
"(",
")",
";",
"try",
"{",
"this",
".",
"serializer",
".",
"serialize",
"(",
"reco... | Inserts the given object into the current buffer. This method returns a pointer that
can be used to address the written record in this partition.
@param record The object to be written to the partition.
@return A pointer to the object in the partition.
@throws IOException Thrown when the write failed. | [
"Inserts",
"the",
"given",
"object",
"into",
"the",
"current",
"buffer",
".",
"This",
"method",
"returns",
"a",
"pointer",
"that",
"can",
"be",
"used",
"to",
"address",
"the",
"written",
"record",
"in",
"this",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L216-L232 |
124,504 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.overwriteRecordAt | @Deprecated
public void overwriteRecordAt(long pointer, T record) throws IOException {
long tmpPointer = this.writeView.getCurrentPointer();
this.writeView.resetTo(pointer);
this.serializer.serialize(record, this.writeView);
this.writeView.resetTo(tmpPointer);
} | java | @Deprecated
public void overwriteRecordAt(long pointer, T record) throws IOException {
long tmpPointer = this.writeView.getCurrentPointer();
this.writeView.resetTo(pointer);
this.serializer.serialize(record, this.writeView);
this.writeView.resetTo(tmpPointer);
} | [
"@",
"Deprecated",
"public",
"void",
"overwriteRecordAt",
"(",
"long",
"pointer",
",",
"T",
"record",
")",
"throws",
"IOException",
"{",
"long",
"tmpPointer",
"=",
"this",
".",
"writeView",
".",
"getCurrentPointer",
"(",
")",
";",
"this",
".",
"writeView",
"... | UNSAFE!! overwrites record
causes inconsistency or data loss for overwriting everything but records of the exact same size
@param pointer pointer to start of record
@param record record to overwrite old one with
@throws IOException
@deprecated Don't use this, overwrites record and causes inconsistency or data loss for... | [
"UNSAFE!!",
"overwrites",
"record",
"causes",
"inconsistency",
"or",
"data",
"loss",
"for",
"overwriting",
"everything",
"but",
"records",
"of",
"the",
"exact",
"same",
"size"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L254-L260 |
124,505 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.allocateSegments | public void allocateSegments(int numberOfSegments) {
while (getBlockCount() < numberOfSegments) {
MemorySegment next = this.availableMemory.nextSegment();
if (next != null) {
this.partitionPages.add(next);
} else {
return;
}
}
} | java | public void allocateSegments(int numberOfSegments) {
while (getBlockCount() < numberOfSegments) {
MemorySegment next = this.availableMemory.nextSegment();
if (next != null) {
this.partitionPages.add(next);
} else {
return;
}
}
} | [
"public",
"void",
"allocateSegments",
"(",
"int",
"numberOfSegments",
")",
"{",
"while",
"(",
"getBlockCount",
"(",
")",
"<",
"numberOfSegments",
")",
"{",
"MemorySegment",
"next",
"=",
"this",
".",
"availableMemory",
".",
"nextSegment",
"(",
")",
";",
"if",
... | attempts to allocate specified number of segments and should only be used by compaction partition
fails silently if not enough segments are available since next compaction could still succeed
@param numberOfSegments allocation count | [
"attempts",
"to",
"allocate",
"specified",
"number",
"of",
"segments",
"and",
"should",
"only",
"be",
"used",
"by",
"compaction",
"partition",
"fails",
"silently",
"if",
"not",
"enough",
"segments",
"are",
"available",
"since",
"next",
"compaction",
"could",
"st... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L285-L294 |
124,506 | apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java | BinaryInMemorySortBuffer.createBuffer | public static BinaryInMemorySortBuffer createBuffer(
NormalizedKeyComputer normalizedKeyComputer,
AbstractRowSerializer<BaseRow> inputSerializer,
BinaryRowSerializer serializer,
RecordComparator comparator,
List<MemorySegment> memory) throws IOException {
checkArgument(memory.size() >= MIN_REQUIRED_BUF... | java | public static BinaryInMemorySortBuffer createBuffer(
NormalizedKeyComputer normalizedKeyComputer,
AbstractRowSerializer<BaseRow> inputSerializer,
BinaryRowSerializer serializer,
RecordComparator comparator,
List<MemorySegment> memory) throws IOException {
checkArgument(memory.size() >= MIN_REQUIRED_BUF... | [
"public",
"static",
"BinaryInMemorySortBuffer",
"createBuffer",
"(",
"NormalizedKeyComputer",
"normalizedKeyComputer",
",",
"AbstractRowSerializer",
"<",
"BaseRow",
">",
"inputSerializer",
",",
"BinaryRowSerializer",
"serializer",
",",
"RecordComparator",
"comparator",
",",
"... | Create a memory sorter in `insert` way. | [
"Create",
"a",
"memory",
"sorter",
"in",
"insert",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java#L57-L71 |
124,507 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializer.java | SpanningRecordSerializer.serializeRecord | @Override
public void serializeRecord(T record) throws IOException {
if (CHECKED) {
if (dataBuffer.hasRemaining()) {
throw new IllegalStateException("Pending serialization of previous record.");
}
}
serializationBuffer.clear();
lengthBuffer.clear();
// write data and length
record.write(seriali... | java | @Override
public void serializeRecord(T record) throws IOException {
if (CHECKED) {
if (dataBuffer.hasRemaining()) {
throw new IllegalStateException("Pending serialization of previous record.");
}
}
serializationBuffer.clear();
lengthBuffer.clear();
// write data and length
record.write(seriali... | [
"@",
"Override",
"public",
"void",
"serializeRecord",
"(",
"T",
"record",
")",
"throws",
"IOException",
"{",
"if",
"(",
"CHECKED",
")",
"{",
"if",
"(",
"dataBuffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"... | Serializes the complete record to an intermediate data serialization buffer.
@param record the record to serialize | [
"Serializes",
"the",
"complete",
"record",
"to",
"an",
"intermediate",
"data",
"serialization",
"buffer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializer.java#L66-L84 |
124,508 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializer.java | SpanningRecordSerializer.copyToBufferBuilder | @Override
public SerializationResult copyToBufferBuilder(BufferBuilder targetBuffer) {
targetBuffer.append(lengthBuffer);
targetBuffer.append(dataBuffer);
targetBuffer.commit();
return getSerializationResult(targetBuffer);
} | java | @Override
public SerializationResult copyToBufferBuilder(BufferBuilder targetBuffer) {
targetBuffer.append(lengthBuffer);
targetBuffer.append(dataBuffer);
targetBuffer.commit();
return getSerializationResult(targetBuffer);
} | [
"@",
"Override",
"public",
"SerializationResult",
"copyToBufferBuilder",
"(",
"BufferBuilder",
"targetBuffer",
")",
"{",
"targetBuffer",
".",
"append",
"(",
"lengthBuffer",
")",
";",
"targetBuffer",
".",
"append",
"(",
"dataBuffer",
")",
";",
"targetBuffer",
".",
... | Copies an intermediate data serialization buffer into the target BufferBuilder.
@param targetBuffer the target BufferBuilder to copy to
@return how much information was written to the target buffer and
whether this buffer is full | [
"Copies",
"an",
"intermediate",
"data",
"serialization",
"buffer",
"into",
"the",
"target",
"BufferBuilder",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpanningRecordSerializer.java#L93-L100 |
124,509 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestQueue.java | PartitionRequestQueue.enqueueAvailableReader | private void enqueueAvailableReader(final NetworkSequenceViewReader reader) throws Exception {
if (reader.isRegisteredAsAvailable() || !reader.isAvailable()) {
return;
}
// Queue an available reader for consumption. If the queue is empty,
// we try trigger the actual write. Otherwise this will be handled by
... | java | private void enqueueAvailableReader(final NetworkSequenceViewReader reader) throws Exception {
if (reader.isRegisteredAsAvailable() || !reader.isAvailable()) {
return;
}
// Queue an available reader for consumption. If the queue is empty,
// we try trigger the actual write. Otherwise this will be handled by
... | [
"private",
"void",
"enqueueAvailableReader",
"(",
"final",
"NetworkSequenceViewReader",
"reader",
")",
"throws",
"Exception",
"{",
"if",
"(",
"reader",
".",
"isRegisteredAsAvailable",
"(",
")",
"||",
"!",
"reader",
".",
"isAvailable",
"(",
")",
")",
"{",
"return... | Try to enqueue the reader once receiving credit notification from the consumer or receiving
non-empty reader notification from the producer.
<p>NOTE: Only one thread would trigger the actual enqueue after checking the reader's
availability, so there is no race condition here. | [
"Try",
"to",
"enqueue",
"the",
"reader",
"once",
"receiving",
"credit",
"notification",
"from",
"the",
"consumer",
"or",
"receiving",
"non",
"-",
"empty",
"reader",
"notification",
"from",
"the",
"producer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestQueue.java#L100-L113 |
124,510 | apache/flink | flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java | RMQSink.invoke | @Override
public void invoke(IN value) {
try {
byte[] msg = schema.serialize(value);
if (publishOptions == null) {
channel.basicPublish("", queueName, null, msg);
} else {
boolean mandatory = publishOptions.computeMandatory(value);
boolean immediate = publishOptions.computeImmediate(value);
... | java | @Override
public void invoke(IN value) {
try {
byte[] msg = schema.serialize(value);
if (publishOptions == null) {
channel.basicPublish("", queueName, null, msg);
} else {
boolean mandatory = publishOptions.computeMandatory(value);
boolean immediate = publishOptions.computeImmediate(value);
... | [
"@",
"Override",
"public",
"void",
"invoke",
"(",
"IN",
"value",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"msg",
"=",
"schema",
".",
"serialize",
"(",
"value",
")",
";",
"if",
"(",
"publishOptions",
"==",
"null",
")",
"{",
"channel",
".",
"basicPublis... | Called when new data arrives to the sink, and forwards it to RMQ.
@param value
The incoming data | [
"Called",
"when",
"new",
"data",
"arrives",
"to",
"the",
"sink",
"and",
"forwards",
"it",
"to",
"RMQ",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java#L164-L192 |
124,511 | apache/flink | flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java | ScalaCsvOutputFormat.setInputType | @Override
public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
if (!type.isTupleType()) {
throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() +
" can only be used to write tuple data sets.");
}
} | java | @Override
public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
if (!type.isTupleType()) {
throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() +
" can only be used to write tuple data sets.");
}
} | [
"@",
"Override",
"public",
"void",
"setInputType",
"(",
"TypeInformation",
"<",
"?",
">",
"type",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isTupleType",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidProgramException",
... | The purpose of this method is solely to check whether the data type to be processed
is in fact a tuple type. | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"solely",
"to",
"check",
"whether",
"the",
"data",
"type",
"to",
"be",
"processed",
"is",
"in",
"fact",
"a",
"tuple",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java#L223-L229 |
124,512 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.begin | public static <X> Pattern<X, X> begin(final String name) {
return new Pattern<>(name, null, ConsumingStrategy.STRICT, AfterMatchSkipStrategy.noSkip());
} | java | public static <X> Pattern<X, X> begin(final String name) {
return new Pattern<>(name, null, ConsumingStrategy.STRICT, AfterMatchSkipStrategy.noSkip());
} | [
"public",
"static",
"<",
"X",
">",
"Pattern",
"<",
"X",
",",
"X",
">",
"begin",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Pattern",
"<>",
"(",
"name",
",",
"null",
",",
"ConsumingStrategy",
".",
"STRICT",
",",
"AfterMatchSkipStrategy",
... | Starts a new pattern sequence. The provided name is the one of the initial pattern
of the new sequence. Furthermore, the base type of the event sequence is set.
@param name The name of starting pattern of the new pattern sequence
@param <X> Base type of the event pattern
@return The first pattern of a pattern sequence | [
"Starts",
"a",
"new",
"pattern",
"sequence",
".",
"The",
"provided",
"name",
"is",
"the",
"one",
"of",
"the",
"initial",
"pattern",
"of",
"the",
"new",
"sequence",
".",
"Furthermore",
"the",
"base",
"type",
"of",
"the",
"event",
"sequence",
"is",
"set",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L128-L130 |
124,513 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.subtype | public <S extends F> Pattern<T, S> subtype(final Class<S> subtypeClass) {
Preconditions.checkNotNull(subtypeClass, "The class cannot be null.");
if (condition == null) {
this.condition = new SubtypeCondition<F>(subtypeClass);
} else {
this.condition = new RichAndCondition<>(condition, new SubtypeCondition<... | java | public <S extends F> Pattern<T, S> subtype(final Class<S> subtypeClass) {
Preconditions.checkNotNull(subtypeClass, "The class cannot be null.");
if (condition == null) {
this.condition = new SubtypeCondition<F>(subtypeClass);
} else {
this.condition = new RichAndCondition<>(condition, new SubtypeCondition<... | [
"public",
"<",
"S",
"extends",
"F",
">",
"Pattern",
"<",
"T",
",",
"S",
">",
"subtype",
"(",
"final",
"Class",
"<",
"S",
">",
"subtypeClass",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"subtypeClass",
",",
"\"The class cannot be null.\"",
")",
";... | Applies a subtype constraint on the current pattern. This means that an event has
to be of the given subtype in order to be matched.
@param subtypeClass Class of the subtype
@param <S> Type of the subtype
@return The same pattern with the new subtype constraint | [
"Applies",
"a",
"subtype",
"constraint",
"on",
"the",
"current",
"pattern",
".",
"This",
"means",
"that",
"an",
"event",
"has",
"to",
"be",
"of",
"the",
"given",
"subtype",
"in",
"order",
"to",
"be",
"matched",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L198-L211 |
124,514 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.until | public Pattern<T, F> until(IterativeCondition<F> untilCondition) {
Preconditions.checkNotNull(untilCondition, "The condition cannot be null");
if (this.untilCondition != null) {
throw new MalformedPatternException("Only one until condition can be applied.");
}
if (!quantifier.hasProperty(Quantifier.Quantif... | java | public Pattern<T, F> until(IterativeCondition<F> untilCondition) {
Preconditions.checkNotNull(untilCondition, "The condition cannot be null");
if (this.untilCondition != null) {
throw new MalformedPatternException("Only one until condition can be applied.");
}
if (!quantifier.hasProperty(Quantifier.Quantif... | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"until",
"(",
"IterativeCondition",
"<",
"F",
">",
"untilCondition",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"untilCondition",
",",
"\"The condition cannot be null\"",
")",
";",
"if",
"(",
"this",
".",... | Applies a stop condition for a looping state. It allows cleaning the underlying state.
@param untilCondition a condition an event has to satisfy to stop collecting events into looping state
@return The same pattern with applied untilCondition | [
"Applies",
"a",
"stop",
"condition",
"for",
"a",
"looping",
"state",
".",
"It",
"allows",
"cleaning",
"the",
"underlying",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L219-L234 |
124,515 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.within | public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime;
}
return this;
} | java | public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime;
}
return this;
} | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"within",
"(",
"Time",
"windowTime",
")",
"{",
"if",
"(",
"windowTime",
"!=",
"null",
")",
"{",
"this",
".",
"windowTime",
"=",
"windowTime",
";",
"}",
"return",
"this",
";",
"}"
] | Defines the maximum time interval in which a matching pattern has to be completed in
order to be considered valid. This interval corresponds to the maximum time gap between first
and the last event.
@param windowTime Time of the matching window
@return The same pattern operator with the new window length | [
"Defines",
"the",
"maximum",
"time",
"interval",
"in",
"which",
"a",
"matching",
"pattern",
"has",
"to",
"be",
"completed",
"in",
"order",
"to",
"be",
"considered",
"valid",
".",
"This",
"interval",
"corresponds",
"to",
"the",
"maximum",
"time",
"gap",
"betw... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L244-L250 |
124,516 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.next | public Pattern<T, T> next(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | java | public Pattern<T, T> next(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | [
"public",
"Pattern",
"<",
"T",
",",
"T",
">",
"next",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Pattern",
"<>",
"(",
"name",
",",
"this",
",",
"ConsumingStrategy",
".",
"STRICT",
",",
"afterMatchSkipStrategy",
")",
";",
"}"
] | Appends a new pattern to the existing one. The new pattern enforces strict
temporal contiguity. This means that the whole pattern sequence matches only
if an event which matches this pattern directly follows the preceding matching
event. Thus, there cannot be any events in between two matching events.
@param name Name... | [
"Appends",
"a",
"new",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"strict",
"temporal",
"contiguity",
".",
"This",
"means",
"that",
"the",
"whole",
"pattern",
"sequence",
"matches",
"only",
"if",
"an",
"event",
"whic... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L261-L263 |
124,517 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.notNext | public Pattern<T, T> notNext(final String name) {
if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) {
throw new UnsupportedOperationException(
"Specifying a pattern with an optional path to NOT condition is not supported yet. " +
"You can simulate such pattern with two independent patte... | java | public Pattern<T, T> notNext(final String name) {
if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) {
throw new UnsupportedOperationException(
"Specifying a pattern with an optional path to NOT condition is not supported yet. " +
"You can simulate such pattern with two independent patte... | [
"public",
"Pattern",
"<",
"T",
",",
"T",
">",
"notNext",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"quantifier",
".",
"hasProperty",
"(",
"Quantifier",
".",
"QuantifierProperty",
".",
"OPTIONAL",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperat... | Appends a new pattern to the existing one. The new pattern enforces that there is no event matching this pattern
right after the preceding matched event.
@param name Name of the new pattern
@return A new pattern which is appended to this one | [
"Appends",
"a",
"new",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"that",
"there",
"is",
"no",
"event",
"matching",
"this",
"pattern",
"right",
"after",
"the",
"preceding",
"matched",
"event",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L272-L280 |
124,518 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.notFollowedBy | public Pattern<T, T> notFollowedBy(final String name) {
if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) {
throw new UnsupportedOperationException(
"Specifying a pattern with an optional path to NOT condition is not supported yet. " +
"You can simulate such pattern with two independent... | java | public Pattern<T, T> notFollowedBy(final String name) {
if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) {
throw new UnsupportedOperationException(
"Specifying a pattern with an optional path to NOT condition is not supported yet. " +
"You can simulate such pattern with two independent... | [
"public",
"Pattern",
"<",
"T",
",",
"T",
">",
"notFollowedBy",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"quantifier",
".",
"hasProperty",
"(",
"Quantifier",
".",
"QuantifierProperty",
".",
"OPTIONAL",
")",
")",
"{",
"throw",
"new",
"Unsupported... | Appends a new pattern to the existing one. The new pattern enforces that there is no event matching this pattern
between the preceding pattern and succeeding this one.
<p><b>NOTE:</b> There has to be other pattern after this one.
@param name Name of the new pattern
@return A new pattern which is appended to this one | [
"Appends",
"a",
"new",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"that",
"there",
"is",
"no",
"event",
"matching",
"this",
"pattern",
"between",
"the",
"preceding",
"pattern",
"and",
"succeeding",
"this",
"one",
"."... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L303-L311 |
124,519 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.times | public Pattern<T, F> times(int times) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
Preconditions.checkArgument(times > 0, "You should give a positive number greater than 0.");
this.quantifier = Quantifier.times(quantifier.getConsumingStrategy());
this.times = Times.of(times);
return this;
} | java | public Pattern<T, F> times(int times) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
Preconditions.checkArgument(times > 0, "You should give a positive number greater than 0.");
this.quantifier = Quantifier.times(quantifier.getConsumingStrategy());
this.times = Times.of(times);
return this;
} | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"times",
"(",
"int",
"times",
")",
"{",
"checkIfNoNotPattern",
"(",
")",
";",
"checkIfQuantifierApplied",
"(",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"times",
">",
"0",
",",
"\"You should give a po... | Specifies exact number of times that this pattern should be matched.
@param times number of times matching event must appear
@return The same pattern with number of times applied
@throws MalformedPatternException if the quantifier is not applicable to this pattern. | [
"Specifies",
"exact",
"number",
"of",
"times",
"that",
"this",
"pattern",
"should",
"be",
"matched",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L381-L388 |
124,520 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.times | public Pattern<T, F> times(int from, int to) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
this.quantifier = Quantifier.times(quantifier.getConsumingStrategy());
if (from == 0) {
this.quantifier.optional();
from = 1;
}
this.times = Times.of(from, to);
return this;
} | java | public Pattern<T, F> times(int from, int to) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
this.quantifier = Quantifier.times(quantifier.getConsumingStrategy());
if (from == 0) {
this.quantifier.optional();
from = 1;
}
this.times = Times.of(from, to);
return this;
} | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"times",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkIfNoNotPattern",
"(",
")",
";",
"checkIfQuantifierApplied",
"(",
")",
";",
"this",
".",
"quantifier",
"=",
"Quantifier",
".",
"times",
"(",
"qu... | Specifies that the pattern can occur between from and to times.
@param from number of times matching event must appear at least
@param to number of times matching event must appear at most
@return The same pattern with the number of times range applied
@throws MalformedPatternException if the quantifier is not applic... | [
"Specifies",
"that",
"the",
"pattern",
"can",
"occur",
"between",
"from",
"and",
"to",
"times",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L399-L409 |
124,521 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.timesOrMore | public Pattern<T, F> timesOrMore(int times) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy());
this.times = Times.of(times);
return this;
} | java | public Pattern<T, F> timesOrMore(int times) {
checkIfNoNotPattern();
checkIfQuantifierApplied();
this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy());
this.times = Times.of(times);
return this;
} | [
"public",
"Pattern",
"<",
"T",
",",
"F",
">",
"timesOrMore",
"(",
"int",
"times",
")",
"{",
"checkIfNoNotPattern",
"(",
")",
";",
"checkIfQuantifierApplied",
"(",
")",
";",
"this",
".",
"quantifier",
"=",
"Quantifier",
".",
"looping",
"(",
"quantifier",
".... | Specifies that this pattern can occur the specified times at least.
This means at least the specified times and at most infinite number of events can
be matched to this pattern.
@return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied.
@throws MalformedPatternException if the qu... | [
"Specifies",
"that",
"this",
"pattern",
"can",
"occur",
"the",
"specified",
"times",
"at",
"least",
".",
"This",
"means",
"at",
"least",
"the",
"specified",
"times",
"and",
"at",
"most",
"infinite",
"number",
"of",
"events",
"can",
"be",
"matched",
"to",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L419-L425 |
124,522 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.begin | public static <T, F extends T> GroupPattern<T, F> begin(final Pattern<T, F> group, final AfterMatchSkipStrategy afterMatchSkipStrategy) {
return new GroupPattern<>(null, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | java | public static <T, F extends T> GroupPattern<T, F> begin(final Pattern<T, F> group, final AfterMatchSkipStrategy afterMatchSkipStrategy) {
return new GroupPattern<>(null, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | [
"public",
"static",
"<",
"T",
",",
"F",
"extends",
"T",
">",
"GroupPattern",
"<",
"T",
",",
"F",
">",
"begin",
"(",
"final",
"Pattern",
"<",
"T",
",",
"F",
">",
"group",
",",
"final",
"AfterMatchSkipStrategy",
"afterMatchSkipStrategy",
")",
"{",
"return"... | Starts a new pattern sequence. The provided pattern is the initial pattern
of the new sequence.
@param group the pattern to begin with
@param afterMatchSkipStrategy the {@link AfterMatchSkipStrategy.SkipStrategy} to use after each match.
@return The first pattern of a pattern sequence | [
"Starts",
"a",
"new",
"pattern",
"sequence",
".",
"The",
"provided",
"pattern",
"is",
"the",
"initial",
"pattern",
"of",
"the",
"new",
"sequence",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L493-L495 |
124,523 | apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.next | public GroupPattern<T, F> next(Pattern<T, F> group) {
return new GroupPattern<>(this, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | java | public GroupPattern<T, F> next(Pattern<T, F> group) {
return new GroupPattern<>(this, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | [
"public",
"GroupPattern",
"<",
"T",
",",
"F",
">",
"next",
"(",
"Pattern",
"<",
"T",
",",
"F",
">",
"group",
")",
"{",
"return",
"new",
"GroupPattern",
"<>",
"(",
"this",
",",
"group",
",",
"ConsumingStrategy",
".",
"STRICT",
",",
"afterMatchSkipStrategy... | Appends a new group pattern to the existing one. The new pattern enforces strict
temporal contiguity. This means that the whole pattern sequence matches only
if an event which matches this pattern directly follows the preceding matching
event. Thus, there cannot be any events in between two matching events.
@param gro... | [
"Appends",
"a",
"new",
"group",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"strict",
"temporal",
"contiguity",
".",
"This",
"means",
"that",
"the",
"whole",
"pattern",
"sequence",
"matches",
"only",
"if",
"an",
"even... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L541-L543 |
124,524 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.replace | public void replace(String pathInZooKeeper, int expectedVersion, T state) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
checkNotNull(state, "State");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> oldStateHandle = get(path, false);
RetrievableStateHan... | java | public void replace(String pathInZooKeeper, int expectedVersion, T state) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
checkNotNull(state, "State");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> oldStateHandle = get(path, false);
RetrievableStateHan... | [
"public",
"void",
"replace",
"(",
"String",
"pathInZooKeeper",
",",
"int",
"expectedVersion",
",",
"T",
"state",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"pathInZooKeeper",
",",
"\"Path in ZooKeeper\"",
")",
";",
"checkNotNull",
"(",
"state",
",",
"... | Replaces a state handle in ZooKeeper and discards the old state handle.
@param pathInZooKeeper Destination path in ZooKeeper (expected to exist and start with a '/')
@param expectedVersion Expected version of the node to replace
@param state The new state to replace the old one
@throws Exception If a ZooKeep... | [
"Replaces",
"a",
"state",
"handle",
"in",
"ZooKeeper",
"and",
"discards",
"the",
"old",
"state",
"handle",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L179-L210 |
124,525 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.getAllPaths | public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList();
} else {
try {
return client.getChildren().forPath(path);
} catch (KeeperException.NoNode... | java | public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList();
} else {
try {
return client.getChildren().forPath(path);
} catch (KeeperException.NoNode... | [
"public",
"Collection",
"<",
"String",
">",
"getAllPaths",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"path",
"=",
"\"/\"",
";",
"while",
"(",
"true",
")",
"{",
"Stat",
"stat",
"=",
"client",
".",
"checkExists",
"(",
")",
".",
"forPath",
... | Return a list of all valid paths for state handles.
@return List of valid state handle paths in ZooKeeper
@throws Exception if a ZooKeeper operation fails | [
"Return",
"a",
"list",
"of",
"all",
"valid",
"paths",
"for",
"state",
"handles",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L253-L269 |
124,526 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.getAllAndLock | @SuppressWarnings("unchecked")
public List<Tuple2<RetrievableStateHandle<T>, String>> getAllAndLock() throws Exception {
final List<Tuple2<RetrievableStateHandle<T>, String>> stateHandles = new ArrayList<>();
boolean success = false;
retry:
while (!success) {
stateHandles.clear();
Stat stat = client.c... | java | @SuppressWarnings("unchecked")
public List<Tuple2<RetrievableStateHandle<T>, String>> getAllAndLock() throws Exception {
final List<Tuple2<RetrievableStateHandle<T>, String>> stateHandles = new ArrayList<>();
boolean success = false;
retry:
while (!success) {
stateHandles.clear();
Stat stat = client.c... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"Tuple2",
"<",
"RetrievableStateHandle",
"<",
"T",
">",
",",
"String",
">",
">",
"getAllAndLock",
"(",
")",
"throws",
"Exception",
"{",
"final",
"List",
"<",
"Tuple2",
"<",
"Retrievab... | Gets all available state handles from ZooKeeper and locks the respective state nodes.
<p>If there is a concurrent modification, the operation is retried until it succeeds.
@return All state handles from ZooKeeper.
@throws Exception If a ZooKeeper or state handle operation fails | [
"Gets",
"all",
"available",
"state",
"handles",
"from",
"ZooKeeper",
"and",
"locks",
"the",
"respective",
"state",
"nodes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L279-L321 |
124,527 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.releaseAndTryRemoveAll | public void releaseAndTryRemoveAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child : children) {
try {
releaseAndTryRemove('/' + child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
i... | java | public void releaseAndTryRemoveAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child : children) {
try {
releaseAndTryRemove('/' + child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
i... | [
"public",
"void",
"releaseAndTryRemoveAll",
"(",
")",
"throws",
"Exception",
"{",
"Collection",
"<",
"String",
">",
"children",
"=",
"getAllPaths",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"for",
"(",
"String",
"child",
":",
"children",
")"... | Releases all lock nodes of this ZooKeeperStateHandleStores and tries to remove all state nodes which
are not locked anymore.
<p>The delete operation is executed asynchronously
@throws Exception if the delete operation fails | [
"Releases",
"all",
"lock",
"nodes",
"of",
"this",
"ZooKeeperStateHandleStores",
"and",
"tries",
"to",
"remove",
"all",
"state",
"nodes",
"which",
"are",
"not",
"locked",
"anymore",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L369-L385 |
124,528 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.release | public void release(String pathInZooKeeper) throws Exception {
final String path = normalizePath(pathInZooKeeper);
try {
client.delete().forPath(getLockPath(path));
} catch (KeeperException.NoNodeException ignored) {
// we have never locked this node
} catch (Exception e) {
throw new Exception("Could ... | java | public void release(String pathInZooKeeper) throws Exception {
final String path = normalizePath(pathInZooKeeper);
try {
client.delete().forPath(getLockPath(path));
} catch (KeeperException.NoNodeException ignored) {
// we have never locked this node
} catch (Exception e) {
throw new Exception("Could ... | [
"public",
"void",
"release",
"(",
"String",
"pathInZooKeeper",
")",
"throws",
"Exception",
"{",
"final",
"String",
"path",
"=",
"normalizePath",
"(",
"pathInZooKeeper",
")",
";",
"try",
"{",
"client",
".",
"delete",
"(",
")",
".",
"forPath",
"(",
"getLockPat... | Releases the lock from the node under the given ZooKeeper path. If no lock exists, then nothing happens.
@param pathInZooKeeper Path describing the ZooKeeper node
@throws Exception if the delete operation of the lock node fails | [
"Releases",
"the",
"lock",
"from",
"the",
"node",
"under",
"the",
"given",
"ZooKeeper",
"path",
".",
"If",
"no",
"lock",
"exists",
"then",
"nothing",
"happens",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L393-L403 |
124,529 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.releaseAll | public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
thro... | java | public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
thro... | [
"public",
"void",
"releaseAll",
"(",
")",
"throws",
"Exception",
"{",
"Collection",
"<",
"String",
">",
"children",
"=",
"getAllPaths",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"for",
"(",
"String",
"child",
":",
"children",
")",
"{",
"... | Releases all lock nodes of this ZooKeeperStateHandleStore.
@throws Exception if the delete operation of a lock file fails | [
"Releases",
"all",
"lock",
"nodes",
"of",
"this",
"ZooKeeperStateHandleStore",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L410-L426 |
124,530 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.deleteChildren | public void deleteChildren() throws Exception {
final String path = "/" + client.getNamespace();
LOG.info("Removing {} from ZooKeeper", path);
ZKPaths.deleteChildren(client.getZookeeperClient().getZooKeeper(), path, true);
} | java | public void deleteChildren() throws Exception {
final String path = "/" + client.getNamespace();
LOG.info("Removing {} from ZooKeeper", path);
ZKPaths.deleteChildren(client.getZookeeperClient().getZooKeeper(), path, true);
} | [
"public",
"void",
"deleteChildren",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"path",
"=",
"\"/\"",
"+",
"client",
".",
"getNamespace",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Removing {} from ZooKeeper\"",
",",
"path",
")",
";",
"ZKPaths",... | Recursively deletes all children.
@throws Exception ZK errors | [
"Recursively",
"deletes",
"all",
"children",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L433-L437 |
124,531 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.get | @SuppressWarnings("unchecked")
private RetrievableStateHandle<T> get(String pathInZooKeeper, boolean lock) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
if (lock) {
// try to lock the node
try {
client.create().withMode(Crea... | java | @SuppressWarnings("unchecked")
private RetrievableStateHandle<T> get(String pathInZooKeeper, boolean lock) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
if (lock) {
// try to lock the node
try {
client.create().withMode(Crea... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"RetrievableStateHandle",
"<",
"T",
">",
"get",
"(",
"String",
"pathInZooKeeper",
",",
"boolean",
"lock",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"pathInZooKeeper",
",",
"\"Path in ZooKeepe... | Gets a state handle from ZooKeeper and optionally locks it.
@param pathInZooKeeper Path in ZooKeeper to get the state handle from
@param lock True if we should lock the node; otherwise false
@return The state handle
@throws IOException Thrown if the method failed to deserialize the stored state handle
@throws Exceptio... | [
"Gets",
"a",
"state",
"handle",
"from",
"ZooKeeper",
"and",
"optionally",
"locks",
"it",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L466-L504 |
124,532 | apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BitSet.java | BitSet.set | public void set(int index) {
Preconditions.checkArgument(index < bitLength && index >= 0);
int byteIndex = (index & BYTE_POSITION_MASK) >>> 3;
byte current = memorySegment.get(offset + byteIndex);
current |= (1 << (index & BYTE_INDEX_MASK));
memorySegment.put(offset + byteIndex, current);
} | java | public void set(int index) {
Preconditions.checkArgument(index < bitLength && index >= 0);
int byteIndex = (index & BYTE_POSITION_MASK) >>> 3;
byte current = memorySegment.get(offset + byteIndex);
current |= (1 << (index & BYTE_INDEX_MASK));
memorySegment.put(offset + byteIndex, current);
} | [
"public",
"void",
"set",
"(",
"int",
"index",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"index",
"<",
"bitLength",
"&&",
"index",
">=",
"0",
")",
";",
"int",
"byteIndex",
"=",
"(",
"index",
"&",
"BYTE_POSITION_MASK",
")",
">>>",
"3",
";",
"... | Sets the bit at specified index.
@param index - position | [
"Sets",
"the",
"bit",
"at",
"specified",
"index",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BitSet.java#L58-L65 |
124,533 | apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java | PythonCoGroup.coGroup | @Override
public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception {
streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out);
} | java | @Override
public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception {
streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out);
} | [
"@",
"Override",
"public",
"final",
"void",
"coGroup",
"(",
"Iterable",
"<",
"IN1",
">",
"first",
",",
"Iterable",
"<",
"IN2",
">",
"second",
",",
"Collector",
"<",
"OUT",
">",
"out",
")",
"throws",
"Exception",
"{",
"streamer",
".",
"streamBufferWithGroup... | Calls the external python function.
@param first
@param second
@param out collector
@throws IOException | [
"Calls",
"the",
"external",
"python",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java#L65-L68 |
124,534 | apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java | RocksDBNativeMetricMonitor.registerColumnFamily | void registerColumnFamily(String columnFamilyName, ColumnFamilyHandle handle) {
MetricGroup group = metricGroup.addGroup(columnFamilyName);
for (String property : options.getProperties()) {
RocksDBNativeMetricView gauge = new RocksDBNativeMetricView(handle, property);
group.gauge(property, gauge);
}
} | java | void registerColumnFamily(String columnFamilyName, ColumnFamilyHandle handle) {
MetricGroup group = metricGroup.addGroup(columnFamilyName);
for (String property : options.getProperties()) {
RocksDBNativeMetricView gauge = new RocksDBNativeMetricView(handle, property);
group.gauge(property, gauge);
}
} | [
"void",
"registerColumnFamily",
"(",
"String",
"columnFamilyName",
",",
"ColumnFamilyHandle",
"handle",
")",
"{",
"MetricGroup",
"group",
"=",
"metricGroup",
".",
"addGroup",
"(",
"columnFamilyName",
")",
";",
"for",
"(",
"String",
"property",
":",
"options",
".",... | Register gauges to pull native metrics for the column family.
@param columnFamilyName group name for the new gauges
@param handle native handle to the column family | [
"Register",
"gauges",
"to",
"pull",
"native",
"metrics",
"for",
"the",
"column",
"family",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java#L73-L80 |
124,535 | apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java | RocksDBNativeMetricMonitor.setProperty | private void setProperty(ColumnFamilyHandle handle, String property, RocksDBNativeMetricView metricView) {
if (metricView.isClosed()) {
return;
}
try {
synchronized (lock) {
if (rocksDB != null) {
long value = rocksDB.getLongProperty(handle, property);
metricView.setValue(value);
}
}
... | java | private void setProperty(ColumnFamilyHandle handle, String property, RocksDBNativeMetricView metricView) {
if (metricView.isClosed()) {
return;
}
try {
synchronized (lock) {
if (rocksDB != null) {
long value = rocksDB.getLongProperty(handle, property);
metricView.setValue(value);
}
}
... | [
"private",
"void",
"setProperty",
"(",
"ColumnFamilyHandle",
"handle",
",",
"String",
"property",
",",
"RocksDBNativeMetricView",
"metricView",
")",
"{",
"if",
"(",
"metricView",
".",
"isClosed",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"synchronize... | Updates the value of metricView if the reference is still valid. | [
"Updates",
"the",
"value",
"of",
"metricView",
"if",
"the",
"reference",
"is",
"still",
"valid",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java#L85-L100 |
124,536 | looly/hutool | hutool-script/src/main/java/cn/hutool/script/ScriptRuntimeException.java | ScriptRuntimeException.getMessage | @Override
public String getMessage() {
String ret = super.getMessage();
if (fileName != null) {
ret += (" in " + fileName);
if (lineNumber != -1) {
ret += " at line number " + lineNumber;
}
if (columnNumber != -1) {
ret += " at column number " + columnNumber;
}
}
return r... | java | @Override
public String getMessage() {
String ret = super.getMessage();
if (fileName != null) {
ret += (" in " + fileName);
if (lineNumber != -1) {
ret += " at line number " + lineNumber;
}
if (columnNumber != -1) {
ret += " at column number " + columnNumber;
}
}
return r... | [
"@",
"Override",
"public",
"String",
"getMessage",
"(",
")",
"{",
"String",
"ret",
"=",
"super",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"fileName",
"!=",
"null",
")",
"{",
"ret",
"+=",
"(",
"\" in \"",
"+",
"fileName",
")",
";",
"if",
"(",
"l... | Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known.
@return The error message. | [
"Returns",
"a",
"message",
"containing",
"the",
"String",
"passed",
"to",
"a",
"constructor",
"as",
"well",
"as",
"line",
"and",
"column",
"numbers",
"and",
"filename",
"if",
"any",
"of",
"these",
"are",
"known",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-script/src/main/java/cn/hutool/script/ScriptRuntimeException.java#L83-L98 |
124,537 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.bernstein | public static int bernstein(String key) {
int hash = 0;
int i;
for (i = 0; i < key.length(); ++i) {
hash = 33 * hash + key.charAt(i);
}
return hash;
} | java | public static int bernstein(String key) {
int hash = 0;
int i;
for (i = 0; i < key.length(); ++i) {
hash = 33 * hash + key.charAt(i);
}
return hash;
} | [
"public",
"static",
"int",
"bernstein",
"(",
"String",
"key",
")",
"{",
"int",
"hash",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"hash",
"=",
"33",
"*... | Bernstein's hash
@param key 输入字节数组
@return 结果hash | [
"Bernstein",
"s",
"hash"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L73-L80 |
124,538 | looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONTokener.java | JSONTokener.nextTo | public String nextTo(String delimiters) throws JSONException {
char c;
StringBuilder sb = new StringBuilder();
for (;;) {
c = this.next();
if (delimiters.indexOf(c) >= 0 || c == 0 || c == '\n' || c == '\r') {
if (c != 0) {
this.back();
}
return sb.toString().trim();
}
sb.append(c);
... | java | public String nextTo(String delimiters) throws JSONException {
char c;
StringBuilder sb = new StringBuilder();
for (;;) {
c = this.next();
if (delimiters.indexOf(c) >= 0 || c == 0 || c == '\n' || c == '\r') {
if (c != 0) {
this.back();
}
return sb.toString().trim();
}
sb.append(c);
... | [
"public",
"String",
"nextTo",
"(",
"String",
"delimiters",
")",
"throws",
"JSONException",
"{",
"char",
"c",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"c",
"=",
"this",
".",
"next",
"(",
"... | Get the text up but not including one of the specified delimiter characters or the end of line, whichever comes first.
@param delimiters A set of delimiter characters.
@return A string, trimmed. | [
"Get",
"the",
"text",
"up",
"but",
"not",
"including",
"one",
"of",
"the",
"specified",
"delimiter",
"characters",
"or",
"the",
"end",
"of",
"line",
"whichever",
"comes",
"first",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONTokener.java#L277-L290 |
124,539 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/NumberWordFormater.java | NumberWordFormater.transThree | private static String transThree(String s) {
String value = "";
if (s.startsWith("0")) {// 是否小於100
value = transTwo(s.substring(1));
} else if (s.substring(1).equals("00")) {// 是否被100整除
value = parseFirst(s.substring(0, 1)) + " HUNDRED";
} else {
value = parseFirst(s.substring(0, 1)) + " HUNDRED... | java | private static String transThree(String s) {
String value = "";
if (s.startsWith("0")) {// 是否小於100
value = transTwo(s.substring(1));
} else if (s.substring(1).equals("00")) {// 是否被100整除
value = parseFirst(s.substring(0, 1)) + " HUNDRED";
} else {
value = parseFirst(s.substring(0, 1)) + " HUNDRED... | [
"private",
"static",
"String",
"transThree",
"(",
"String",
"s",
")",
"{",
"String",
"value",
"=",
"\"\"",
";",
"if",
"(",
"s",
".",
"startsWith",
"(",
"\"0\"",
")",
")",
"{",
"// 是否小於100\r",
"value",
"=",
"transTwo",
"(",
"s",
".",
"substring",
"(",
... | s.length = 3 | [
"s",
".",
"length",
"=",
"3"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/NumberWordFormater.java#L132-L142 |
124,540 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.appendDigits | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | java | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | [
"private",
"static",
"void",
"appendDigits",
"(",
"final",
"Appendable",
"buffer",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"(",
"value",
"/",
"10",
"+",
"'",
"'",
")",
")",
";",
... | Appends two digits to the given buffer.
@param buffer the buffer to append to.
@param value the value to append digits from. | [
"Appends",
"two",
"digits",
"to",
"the",
"given",
"buffer",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L413-L416 |
124,541 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.appendFullDigits | private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less... | java | private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less... | [
"private",
"static",
"void",
"appendFullDigits",
"(",
"final",
"Appendable",
"buffer",
",",
"int",
"value",
",",
"int",
"minFieldWidth",
")",
"throws",
"IOException",
"{",
"// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array",
"//... | Appends all digits to the given buffer.
@param buffer the buffer to append to.
@param value the value to append digits from. | [
"Appends",
"all",
"digits",
"to",
"the",
"given",
"buffer",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L426-L490 |
124,542 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.readObject | private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
final Calendar definingCalendar = Calendar.getInstance(timeZone, locale);
init(definingCalendar);
} | java | private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
final Calendar definingCalendar = Calendar.getInstance(timeZone, locale);
init(definingCalendar);
} | [
"private",
"void",
"readObject",
"(",
"final",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"final",
"Calendar",
"definingCalendar",
"=",
"Calendar",
".",
"getInstance",
... | Create the object after serialization. This implementation reinitializes the transient properties.
@param in ObjectInputStream from which the object is being deserialized.
@throws IOException if there is an IO issue.
@throws ClassNotFoundException if a class cannot be found. | [
"Create",
"the",
"object",
"after",
"serialization",
".",
"This",
"implementation",
"reinitializes",
"the",
"transient",
"properties",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L216-L221 |
124,543 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.appendDisplayNames | private static Map<String, Integer> appendDisplayNames(final Calendar cal, final Locale locale, final int field, final StringBuilder regex) {
final Map<String, Integer> values = new HashMap<>();
final Map<String, Integer> displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale);
final TreeSet<Strin... | java | private static Map<String, Integer> appendDisplayNames(final Calendar cal, final Locale locale, final int field, final StringBuilder regex) {
final Map<String, Integer> values = new HashMap<>();
final Map<String, Integer> displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale);
final TreeSet<Strin... | [
"private",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"appendDisplayNames",
"(",
"final",
"Calendar",
"cal",
",",
"final",
"Locale",
"locale",
",",
"final",
"int",
"field",
",",
"final",
"StringBuilder",
"regex",
")",
"{",
"final",
"Map",
"<",
"S... | Get the short and long values displayed for a field
@param cal The calendar to obtain the short and long values
@param locale The locale of display names
@param field The field of interest
@param regex The regular expression to build
@return The map of string display names to field values | [
"Get",
"the",
"short",
"and",
"long",
"values",
"displayed",
"for",
"a",
"field"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L305-L320 |
124,544 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.getStrategy | private Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {
switch (f) {
default:
throw new IllegalArgumentException("Format '" + f + "' not supported");
case 'D':
return DAY_OF_YEAR_STRATEGY;
case 'E':
return getLocaleSpecificStrategy(Calendar.DAY_OF_WEEK, defi... | java | private Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {
switch (f) {
default:
throw new IllegalArgumentException("Format '" + f + "' not supported");
case 'D':
return DAY_OF_YEAR_STRATEGY;
case 'E':
return getLocaleSpecificStrategy(Calendar.DAY_OF_WEEK, defi... | [
"private",
"Strategy",
"getStrategy",
"(",
"final",
"char",
"f",
",",
"final",
"int",
"width",
",",
"final",
"Calendar",
"definingCalendar",
")",
"{",
"switch",
"(",
"f",
")",
"{",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Format '\""... | Obtain a Strategy given a field from a SimpleDateFormat pattern
@param formatField A sub-sequence of the SimpleDateFormat pattern
@param definingCalendar The calendar to obtain the short and long values
@return The Strategy that will handle parsing for the field | [
"Obtain",
"a",
"Strategy",
"given",
"a",
"field",
"from",
"a",
"SimpleDateFormat",
"pattern"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L396-L447 |
124,545 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.getCache | private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
synchronized (caches) {
if (caches[field] == null) {
caches[field] = new ConcurrentHashMap<>(3);
}
return caches[field];
}
} | java | private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
synchronized (caches) {
if (caches[field] == null) {
caches[field] = new ConcurrentHashMap<>(3);
}
return caches[field];
}
} | [
"private",
"static",
"ConcurrentMap",
"<",
"Locale",
",",
"Strategy",
">",
"getCache",
"(",
"final",
"int",
"field",
")",
"{",
"synchronized",
"(",
"caches",
")",
"{",
"if",
"(",
"caches",
"[",
"field",
"]",
"==",
"null",
")",
"{",
"caches",
"[",
"fiel... | Get a cache of Strategies for a particular field
@param field The Calendar field
@return a cache of Locale to Strategy | [
"Get",
"a",
"cache",
"of",
"Strategies",
"for",
"a",
"particular",
"field"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L458-L465 |
124,546 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.getLocaleSpecificStrategy | private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
final ConcurrentMap<Locale, Strategy> cache = getCache(field);
Strategy strategy = cache.get(locale);
if (strategy == null) {
strategy = field == Calendar.ZONE_OFFSET ? new TimeZoneStrategy(locale) : new CaseInsensit... | java | private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
final ConcurrentMap<Locale, Strategy> cache = getCache(field);
Strategy strategy = cache.get(locale);
if (strategy == null) {
strategy = field == Calendar.ZONE_OFFSET ? new TimeZoneStrategy(locale) : new CaseInsensit... | [
"private",
"Strategy",
"getLocaleSpecificStrategy",
"(",
"final",
"int",
"field",
",",
"final",
"Calendar",
"definingCalendar",
")",
"{",
"final",
"ConcurrentMap",
"<",
"Locale",
",",
"Strategy",
">",
"cache",
"=",
"getCache",
"(",
"field",
")",
";",
"Strategy",... | Construct a Strategy that parses a Text field
@param field The Calendar field
@param definingCalendar The calendar to obtain the short and long values
@return a TextStrategy for the field and Locale | [
"Construct",
"a",
"Strategy",
"that",
"parses",
"a",
"Text",
"field"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L474-L485 |
124,547 | looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java | FormatCache.getDateTimeInstance | private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
if (locale == null) {
locale = Locale.getDefault();
}
final String pattern = getPatternForStyle(dateStyle, timeStyle, locale);
return getInstance(pattern, timeZone, locale);
} | java | private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
if (locale == null) {
locale = Locale.getDefault();
}
final String pattern = getPatternForStyle(dateStyle, timeStyle, locale);
return getInstance(pattern, timeZone, locale);
} | [
"private",
"F",
"getDateTimeInstance",
"(",
"final",
"Integer",
"dateStyle",
",",
"final",
"Integer",
"timeStyle",
",",
"final",
"TimeZone",
"timeZone",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
"==",
"null",
")",
"{",
"locale",
"=",
"Locale",
... | This must remain private, see LANG-884 | [
"This",
"must",
"remain",
"private",
"see",
"LANG",
"-",
"884"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java#L94-L100 |
124,548 | looly/hutool | hutool-json/src/main/java/cn/hutool/json/XMLTokener.java | XMLTokener.nextMeta | public Object nextMeta() throws JSONException {
char c;
char q;
do {
c = next();
} while (Character.isWhitespace(c));
switch (c) {
case 0:
throw syntaxError("Misshaped meta tag");
case '<':
return XML.LT;
case '>':
return XML.GT;
case '/':
return XML.SLASH;
case '=':
retu... | java | public Object nextMeta() throws JSONException {
char c;
char q;
do {
c = next();
} while (Character.isWhitespace(c));
switch (c) {
case 0:
throw syntaxError("Misshaped meta tag");
case '<':
return XML.LT;
case '>':
return XML.GT;
case '/':
return XML.SLASH;
case '=':
retu... | [
"public",
"Object",
"nextMeta",
"(",
")",
"throws",
"JSONException",
"{",
"char",
"c",
";",
"char",
"q",
";",
"do",
"{",
"c",
"=",
"next",
"(",
")",
";",
"}",
"while",
"(",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
")",
";",
"switch",
"(",
... | Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures.
@return Syntax characters (<code>< > / = ! ?</code>) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are.
@throws JSONException 字符串中属性未关闭或XML... | [
"Returns",
"the",
"next",
"XML",
"meta",
"token",
".",
"This",
"is",
"used",
"for",
"skipping",
"over",
"<",
";",
"!",
"...",
">",
";",
"and",
"<",
";",
"?",
"...",
"?>",
";",
"structures",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java#L121-L175 |
124,549 | looly/hutool | hutool-json/src/main/java/cn/hutool/json/XMLTokener.java | XMLTokener.skipPast | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the to string. If we reach an early end, bail.
*/
for (i = ... | java | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the to string. If we reach an early end, bail.
*/
for (i = ... | [
"public",
"boolean",
"skipPast",
"(",
"String",
"to",
")",
"throws",
"JSONException",
"{",
"boolean",
"b",
";",
"char",
"c",
";",
"int",
"i",
";",
"int",
"j",
";",
"int",
"offset",
"=",
"0",
";",
"int",
"length",
"=",
"to",
".",
"length",
"(",
")",... | Skip characters until past the requested string. If it is not found, we are left at the end of the source with a result of false.
@param to A string to skip past.
@return 是否成功skip
@throws JSONException JSON异常 | [
"Skip",
"characters",
"until",
"past",
"the",
"requested",
"string",
".",
"If",
"it",
"is",
"not",
"found",
"we",
"are",
"left",
"at",
"the",
"end",
"of",
"the",
"source",
"with",
"a",
"result",
"of",
"false",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java#L266-L327 |
124,550 | looly/hutool | hutool-http/src/main/java/cn/hutool/http/HTMLFilter.java | HTMLFilter.filter | public String filter(final String input) {
reset();
String s = input;
debug("************************************************");
debug(" INPUT: " + input);
s = escapeComments(s);
debug(" escapeComments: " + s);
s = balanceHTML(s);
debug(" balanceHTML: " + s);
s... | java | public String filter(final String input) {
reset();
String s = input;
debug("************************************************");
debug(" INPUT: " + input);
s = escapeComments(s);
debug(" escapeComments: " + s);
s = balanceHTML(s);
debug(" balanceHTML: " + s);
s... | [
"public",
"String",
"filter",
"(",
"final",
"String",
"input",
")",
"{",
"reset",
"(",
")",
";",
"String",
"s",
"=",
"input",
";",
"debug",
"(",
"\"************************************************\"",
")",
";",
"debug",
"(",
"\" INPUT: \"",
"+",
"in... | given a user submitted input String, filter out any invalid or restricted html.
@param input text (i.e. submitted by a user) than may contain html
@return "clean" version of input, with only valid, whitelisted html elements allowed | [
"given",
"a",
"user",
"submitted",
"input",
"String",
"filter",
"out",
"any",
"invalid",
"or",
"restricted",
"html",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HTMLFilter.java#L211-L235 |
124,551 | networknt/light-4j | dump/src/main/java/com/networknt/dump/QueryParametersDumper.java | QueryParametersDumper.dumpRequest | @Override
public void dumpRequest(Map<String, Object> result) {
exchange.getQueryParameters().forEach((k, v) -> {
if (config.getRequestFilteredQueryParameters().contains(k)) {
//mask query parameter value
String queryParameterValue = config.isMaskEnabled() ? Mask.... | java | @Override
public void dumpRequest(Map<String, Object> result) {
exchange.getQueryParameters().forEach((k, v) -> {
if (config.getRequestFilteredQueryParameters().contains(k)) {
//mask query parameter value
String queryParameterValue = config.isMaskEnabled() ? Mask.... | [
"@",
"Override",
"public",
"void",
"dumpRequest",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"exchange",
".",
"getQueryParameters",
"(",
")",
".",
"forEach",
"(",
"(",
"k",
",",
"v",
")",
"->",
"{",
"if",
"(",
"config",
".",
... | impl of dumping request query parameter to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"request",
"query",
"parameter",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/QueryParametersDumper.java#L39-L49 |
124,552 | networknt/light-4j | dump/src/main/java/com/networknt/dump/QueryParametersDumper.java | QueryParametersDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.queryParametersMap.size() > 0) {
result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.queryParametersMap.size() > 0) {
result.put(DumpConstants.QUERY_PARAMETERS, queryParametersMap);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"this",
".",
"queryParametersMap",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"put",
"(",
"DumpConstants... | put queryParametersMap to result.
@param result a Map you want to put dumping info to. | [
"put",
"queryParametersMap",
"to",
"result",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/QueryParametersDumper.java#L55-L60 |
124,553 | networknt/light-4j | email-sender/src/main/java/com/networknt/email/EmailSender.java | EmailSender.sendMail | public void sendMail (String to, String subject, String content) throws MessagingException {
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port", emailConfg.getPort());
... | java | public void sendMail (String to, String subject, String content) throws MessagingException {
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port", emailConfg.getPort());
... | [
"public",
"void",
"sendMail",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"content",
")",
"throws",
"MessagingException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".",
"put",
"(",
"\"mail.smtp.user\"",
"... | Send email with a string content.
@param to destination email address
@param subject email subject
@param content email content
@throws MessagingException message exception | [
"Send",
"email",
"with",
"a",
"string",
"content",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/email-sender/src/main/java/com/networknt/email/EmailSender.java#L61-L86 |
124,554 | networknt/light-4j | email-sender/src/main/java/com/networknt/email/EmailSender.java | EmailSender.sendMailWithAttachment | public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port"... | java | public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{
Properties props = new Properties();
props.put("mail.smtp.user", emailConfg.getUser());
props.put("mail.smtp.host", emailConfg.getHost());
props.put("mail.smtp.port"... | [
"public",
"void",
"sendMailWithAttachment",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"content",
",",
"String",
"filename",
")",
"throws",
"MessagingException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
"... | Send email with a string content and attachment
@param to destination eamil address
@param subject email subject
@param content email content
@param filename attachment filename
@throws MessagingException messaging exception | [
"Send",
"email",
"with",
"a",
"string",
"content",
"and",
"attachment"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/email-sender/src/main/java/com/networknt/email/EmailSender.java#L97-L141 |
124,555 | networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.handleSingletonClass | private static void handleSingletonClass(String key, String value) throws Exception {
Object object = handleValue(value);
if(key.contains(",")) {
String[] interfaces = key.split(",");
for (String anInterface : interfaces) {
serviceMap.put(anInterface, object);
... | java | private static void handleSingletonClass(String key, String value) throws Exception {
Object object = handleValue(value);
if(key.contains(",")) {
String[] interfaces = key.split(",");
for (String anInterface : interfaces) {
serviceMap.put(anInterface, object);
... | [
"private",
"static",
"void",
"handleSingletonClass",
"(",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"Object",
"object",
"=",
"handleValue",
"(",
"value",
")",
";",
"if",
"(",
"key",
".",
"contains",
"(",
"\",\"",
")",
")",
... | For each singleton definition, create object with the initializer class and method,
and push it into the service map with the key of the class name.
@param key String class name of the object that needs to be initialized
@param value String class name of initializer class and method separated by "::"
@throws Exception... | [
"For",
"each",
"singleton",
"definition",
"create",
"object",
"with",
"the",
"initializer",
"class",
"and",
"method",
"and",
"push",
"it",
"into",
"the",
"service",
"map",
"with",
"the",
"key",
"of",
"the",
"class",
"name",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L178-L188 |
124,556 | networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.handleSingletonList | private static void handleSingletonList(String key, List<Object> value) throws Exception {
List<String> interfaceClasses = new ArrayList();
if(key.contains(",")) {
String[] interfaces = key.split(",");
interfaceClasses.addAll(Arrays.asList(interfaces));
} else {
... | java | private static void handleSingletonList(String key, List<Object> value) throws Exception {
List<String> interfaceClasses = new ArrayList();
if(key.contains(",")) {
String[] interfaces = key.split(",");
interfaceClasses.addAll(Arrays.asList(interfaces));
} else {
... | [
"private",
"static",
"void",
"handleSingletonList",
"(",
"String",
"key",
",",
"List",
"<",
"Object",
">",
"value",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"interfaceClasses",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"key",
... | For each singleton definition, create object for the interface with the implementation class,
and push it into the service map with key and implemented object.
@param key String interface or multiple interface separated by ","
@param value List of implementations of interface(s) defined in the key
@throws Exception exc... | [
"For",
"each",
"singleton",
"definition",
"create",
"object",
"for",
"the",
"interface",
"with",
"the",
"implementation",
"class",
"and",
"push",
"it",
"into",
"the",
"service",
"map",
"with",
"key",
"and",
"implemented",
"object",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L210-L225 |
124,557 | networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.getBean | public static <T> T getBean(Class<T> interfaceClass, Class typeClass) {
Object object = serviceMap.get(interfaceClass.getName() + "<" + typeClass.getName() + ">");
if(object == null) return null;
if(object instanceof Object[]) {
return (T)Array.get(object, 0);
} else {
... | java | public static <T> T getBean(Class<T> interfaceClass, Class typeClass) {
Object object = serviceMap.get(interfaceClass.getName() + "<" + typeClass.getName() + ">");
if(object == null) return null;
if(object instanceof Object[]) {
return (T)Array.get(object, 0);
} else {
... | [
"public",
"static",
"<",
"T",
">",
"T",
"getBean",
"(",
"Class",
"<",
"T",
">",
"interfaceClass",
",",
"Class",
"typeClass",
")",
"{",
"Object",
"object",
"=",
"serviceMap",
".",
"get",
"(",
"interfaceClass",
".",
"getName",
"(",
")",
"+",
"\"<\"",
"+"... | Get a cached singleton object from service map by interface class and generic type class.
The serviceMap is constructed from service.yml which defines interface and generic type
to implementation mapping.
@param interfaceClass Interface class
@param <T> class type
@param typeClass Generic type class
@return The implem... | [
"Get",
"a",
"cached",
"singleton",
"object",
"from",
"service",
"map",
"by",
"interface",
"class",
"and",
"generic",
"type",
"class",
".",
"The",
"serviceMap",
"is",
"constructed",
"from",
"service",
".",
"yml",
"which",
"defines",
"interface",
"and",
"generic... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L282-L290 |
124,558 | networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.getBeans | public static <T> T[] getBeans(Class<T> interfaceClass) {
Object object = serviceMap.get(interfaceClass.getName());
if(object == null) return null;
if(object instanceof Object[]) {
return (T[])object;
} else {
Object array = Array.newInstance(interfaceClass, 1);
... | java | public static <T> T[] getBeans(Class<T> interfaceClass) {
Object object = serviceMap.get(interfaceClass.getName());
if(object == null) return null;
if(object instanceof Object[]) {
return (T[])object;
} else {
Object array = Array.newInstance(interfaceClass, 1);
... | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"getBeans",
"(",
"Class",
"<",
"T",
">",
"interfaceClass",
")",
"{",
"Object",
"object",
"=",
"serviceMap",
".",
"get",
"(",
"interfaceClass",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"object",
... | Get a list of cached singleton objects from service map by interface class. If there
is only one object in the serviceMap, then construct the list with this only object.
@param interfaceClass Interface class
@param <T> class type
@return The array of implementation objects | [
"Get",
"a",
"list",
"of",
"cached",
"singleton",
"objects",
"from",
"service",
"map",
"by",
"interface",
"class",
".",
"If",
"there",
"is",
"only",
"one",
"object",
"in",
"the",
"serviceMap",
"then",
"construct",
"the",
"list",
"with",
"this",
"only",
"obj... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L321-L331 |
124,559 | networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java | ByteArrayBuffer.toByteArray | public byte[] toByteArray() {
final byte[] b = new byte[this.len];
if (this.len > 0) {
System.arraycopy(this.array, 0, b, 0, this.len);
}
return b;
} | java | public byte[] toByteArray() {
final byte[] b = new byte[this.len];
if (this.len > 0) {
System.arraycopy(this.array, 0, b, 0, this.len);
}
return b;
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"this",
".",
"len",
"]",
";",
"if",
"(",
"this",
".",
"len",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"this",
".",
... | Converts the content of this buffer to an array of bytes.
@return byte array | [
"Converts",
"the",
"content",
"of",
"this",
"buffer",
"to",
"an",
"array",
"of",
"bytes",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java#L178-L184 |
124,560 | networknt/light-4j | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.getLastPathSegment | public String getLastPathSegment() {
if (StringUtils.isBlank(path)) {
return StringUtils.EMPTY;
}
String segment = path;
segment = StringUtils.substringAfterLast(segment, "/");
return segment;
} | java | public String getLastPathSegment() {
if (StringUtils.isBlank(path)) {
return StringUtils.EMPTY;
}
String segment = path;
segment = StringUtils.substringAfterLast(segment, "/");
return segment;
} | [
"public",
"String",
"getLastPathSegment",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"path",
")",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"String",
"segment",
"=",
"path",
";",
"segment",
"=",
"StringUtils",
".",
"su... | Gets the last URL path segment without the query string.
If there are segment to return,
an empty string will be returned instead.
@return the last URL path segment | [
"Gets",
"the",
"last",
"URL",
"path",
"segment",
"without",
"the",
"query",
"string",
".",
"If",
"there",
"are",
"segment",
"to",
"return",
"an",
"empty",
"string",
"will",
"be",
"returned",
"instead",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L257-L264 |
124,561 | networknt/light-4j | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.isPortDefault | public boolean isPortDefault() {
return (PROTOCOL_HTTPS.equalsIgnoreCase(protocol)
&& port == DEFAULT_HTTPS_PORT)
|| (PROTOCOL_HTTP.equalsIgnoreCase(protocol)
&& port == DEFAULT_HTTP_PORT);
} | java | public boolean isPortDefault() {
return (PROTOCOL_HTTPS.equalsIgnoreCase(protocol)
&& port == DEFAULT_HTTPS_PORT)
|| (PROTOCOL_HTTP.equalsIgnoreCase(protocol)
&& port == DEFAULT_HTTP_PORT);
} | [
"public",
"boolean",
"isPortDefault",
"(",
")",
"{",
"return",
"(",
"PROTOCOL_HTTPS",
".",
"equalsIgnoreCase",
"(",
"protocol",
")",
"&&",
"port",
"==",
"DEFAULT_HTTPS_PORT",
")",
"||",
"(",
"PROTOCOL_HTTP",
".",
"equalsIgnoreCase",
"(",
"protocol",
")",
"&&",
... | Whether this URL uses the default port for the protocol. The default
port is 80 for "http" protocol, and 443 for "https". Other protocols
are not supported and this method will always return false
for them.
@return <code>true</code> if the URL is using the default port.
@since 1.8.0 | [
"Whether",
"this",
"URL",
"uses",
"the",
"default",
"port",
"for",
"the",
"protocol",
".",
"The",
"default",
"port",
"is",
"80",
"for",
"http",
"protocol",
"and",
"443",
"for",
"https",
".",
"Other",
"protocols",
"are",
"not",
"supported",
"and",
"this",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L399-L404 |
124,562 | networknt/light-4j | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.toAbsolute | public static String toAbsolute(String baseURL, String relativeURL) {
String relURL = relativeURL;
// Relative to protocol
if (relURL.startsWith("//")) {
return StringUtils.substringBefore(baseURL, "//") + "//"
+ StringUtils.substringAfter(relURL, "//");
}... | java | public static String toAbsolute(String baseURL, String relativeURL) {
String relURL = relativeURL;
// Relative to protocol
if (relURL.startsWith("//")) {
return StringUtils.substringBefore(baseURL, "//") + "//"
+ StringUtils.substringAfter(relURL, "//");
}... | [
"public",
"static",
"String",
"toAbsolute",
"(",
"String",
"baseURL",
",",
"String",
"relativeURL",
")",
"{",
"String",
"relURL",
"=",
"relativeURL",
";",
"// Relative to protocol",
"if",
"(",
"relURL",
".",
"startsWith",
"(",
"\"//\"",
")",
")",
"{",
"return"... | Converts a relative URL to an absolute one, based on the supplied
base URL. The base URL is assumed to be a valid URL. Behavior
is unexpected when base URL is invalid.
@param baseURL URL to the reference is relative to
@param relativeURL the relative URL portion to transform to absolute
@return absolute URL
@since 1.8.... | [
"Converts",
"a",
"relative",
"URL",
"to",
"an",
"absolute",
"one",
"based",
"on",
"the",
"supplied",
"base",
"URL",
".",
"The",
"base",
"URL",
"is",
"assumed",
"to",
"be",
"a",
"valid",
"URL",
".",
"Behavior",
"is",
"unexpected",
"when",
"base",
"URL",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L471-L504 |
124,563 | networknt/light-4j | utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java | CodeVerifierUtil.generateRandomCodeVerifier | public static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes) {
byte[] randomBytes = new byte[entropyBytes];
entropySource.nextBytes(randomBytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(randomBytes);
} | java | public static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes) {
byte[] randomBytes = new byte[entropyBytes];
entropySource.nextBytes(randomBytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(randomBytes);
} | [
"public",
"static",
"String",
"generateRandomCodeVerifier",
"(",
"SecureRandom",
"entropySource",
",",
"int",
"entropyBytes",
")",
"{",
"byte",
"[",
"]",
"randomBytes",
"=",
"new",
"byte",
"[",
"entropyBytes",
"]",
";",
"entropySource",
".",
"nextBytes",
"(",
"r... | Generates a random code verifier string using the provided entropy source and the specified
number of bytes of entropy.
@param entropySource entropy source
@param entropyBytes entropy bytes
@return String generated code verifier | [
"Generates",
"a",
"random",
"code",
"verifier",
"string",
"using",
"the",
"provided",
"entropy",
"source",
"and",
"the",
"specified",
"number",
"of",
"bytes",
"of",
"entropy",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java#L117-L121 |
124,564 | networknt/light-4j | resource/src/main/java/com/networknt/resource/ResourceHelpers.java | ResourceHelpers.addProvidersToPathHandler | public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) {
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
if (pathResourcePro... | java | public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) {
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
if (pathResourcePro... | [
"public",
"static",
"void",
"addProvidersToPathHandler",
"(",
"PathResourceProvider",
"[",
"]",
"pathResourceProviders",
",",
"PathHandler",
"pathHandler",
")",
"{",
"if",
"(",
"pathResourceProviders",
"!=",
"null",
"&&",
"pathResourceProviders",
".",
"length",
">",
"... | Helper to add given PathResourceProviders to a PathHandler.
@param pathResourceProviders List of instances of classes implementing PathResourceProvider.
@param pathHandler The handler that will have these handlers added to it. | [
"Helper",
"to",
"add",
"given",
"PathResourceProviders",
"to",
"a",
"PathHandler",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L38-L48 |
124,565 | networknt/light-4j | resource/src/main/java/com/networknt/resource/ResourceHelpers.java | ResourceHelpers.getPredicatedHandlers | public static List<PredicatedHandler> getPredicatedHandlers(PredicatedHandlersProvider[] predicatedHandlersProviders) {
List<PredicatedHandler> predicatedHandlers = new ArrayList<>();
if (predicatedHandlersProviders != null && predicatedHandlersProviders.length > 0) {
for (PredicatedHandlers... | java | public static List<PredicatedHandler> getPredicatedHandlers(PredicatedHandlersProvider[] predicatedHandlersProviders) {
List<PredicatedHandler> predicatedHandlers = new ArrayList<>();
if (predicatedHandlersProviders != null && predicatedHandlersProviders.length > 0) {
for (PredicatedHandlers... | [
"public",
"static",
"List",
"<",
"PredicatedHandler",
">",
"getPredicatedHandlers",
"(",
"PredicatedHandlersProvider",
"[",
"]",
"predicatedHandlersProviders",
")",
"{",
"List",
"<",
"PredicatedHandler",
">",
"predicatedHandlers",
"=",
"new",
"ArrayList",
"<>",
"(",
"... | Helper for retrieving all PredicatedHandlers from the given list of PredicatedHandlersProviders.
@param predicatedHandlersProviders The list of PredicatedHandlersProviders that will be checked for retrieval of PredicatedHandlers.
@return The list of PredicatedHandlers | [
"Helper",
"for",
"retrieving",
"all",
"PredicatedHandlers",
"from",
"the",
"given",
"list",
"of",
"PredicatedHandlersProviders",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L56-L64 |
124,566 | networknt/light-4j | resource/src/main/java/com/networknt/resource/ResourceHelpers.java | ResourceHelpers.isResourcePath | public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) {
boolean isResourcePath = false;
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
... | java | public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) {
boolean isResourcePath = false;
if (pathResourceProviders != null && pathResourceProviders.length > 0) {
for (PathResourceProvider pathResourceProvider : pathResourceProviders) {
... | [
"public",
"static",
"boolean",
"isResourcePath",
"(",
"String",
"requestPath",
",",
"PathResourceProvider",
"[",
"]",
"pathResourceProviders",
")",
"{",
"boolean",
"isResourcePath",
"=",
"false",
";",
"if",
"(",
"pathResourceProviders",
"!=",
"null",
"&&",
"pathReso... | Helper to check if a given requestPath could resolve to a PathResourceProvider.
@param requestPath The client request path.
@param pathResourceProviders The list of PathResourceProviders that could potentially resolve this path.
@return true if the path could resolve, false otherwise. | [
"Helper",
"to",
"check",
"if",
"a",
"given",
"requestPath",
"could",
"resolve",
"to",
"a",
"PathResourceProvider",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L72-L83 |
124,567 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.getTokenResult | public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) {
final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>();
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final... | java | public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) {
final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>();
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final... | [
"public",
"static",
"Result",
"<",
"TokenResponse",
">",
"getTokenResult",
"(",
"TokenRequest",
"tokenRequest",
",",
"String",
"envTag",
")",
"{",
"final",
"AtomicReference",
"<",
"Result",
"<",
"TokenResponse",
">",
">",
"reference",
"=",
"new",
"AtomicReference"... | Get an access token from the token service. A Result of TokenResponse will be returned if the invocation is successfully.
Otherwise, a Result of Status will be returned.
@param tokenRequest token request constructed from the client.yml token section.
@param envTag the environment tag from the server.yml for service lo... | [
"Get",
"an",
"access",
"token",
"from",
"the",
"token",
"service",
".",
"A",
"Result",
"of",
"TokenResponse",
"will",
"be",
"returned",
"if",
"the",
"invocation",
"is",
"successfully",
".",
"Otherwise",
"a",
"Result",
"of",
"Status",
"will",
"be",
"returned"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L105-L142 |
124,568 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.getKey | public static String getKey(KeyRequest keyRequest, String envTag) throws ClientException {
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final ClientConnection connection;
try {
if(keyRequest.getServerUrl() != null) ... | java | public static String getKey(KeyRequest keyRequest, String envTag) throws ClientException {
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final ClientConnection connection;
try {
if(keyRequest.getServerUrl() != null) ... | [
"public",
"static",
"String",
"getKey",
"(",
"KeyRequest",
"keyRequest",
",",
"String",
"envTag",
")",
"throws",
"ClientException",
"{",
"final",
"Http2Client",
"client",
"=",
"Http2Client",
".",
"getInstance",
"(",
")",
";",
"final",
"CountDownLatch",
"latch",
... | Get the certificate from key distribution service of OAuth 2.0 provider with the kid.
@param keyRequest One of the sub classes to get the key for access token or sign token.
@param envTag the environment tag from the server.yml for the cluster lookup.
@return String of the certificate
@throws ClientException throw exc... | [
"Get",
"the",
"certificate",
"from",
"key",
"distribution",
"service",
"of",
"OAuth",
"2",
".",
"0",
"provider",
"with",
"the",
"kid",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L386-L423 |
124,569 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.renewCCTokenSync | private static Result<Jwt> renewCCTokenSync(final Jwt jwt) {
// Already expired, try to renew getCCTokenSynchronously but let requests use the old token.
logger.trace("In renew window and token is already expired.");
//the token can be renew when it's not on renewing or current time is lager tha... | java | private static Result<Jwt> renewCCTokenSync(final Jwt jwt) {
// Already expired, try to renew getCCTokenSynchronously but let requests use the old token.
logger.trace("In renew window and token is already expired.");
//the token can be renew when it's not on renewing or current time is lager tha... | [
"private",
"static",
"Result",
"<",
"Jwt",
">",
"renewCCTokenSync",
"(",
"final",
"Jwt",
"jwt",
")",
"{",
"// Already expired, try to renew getCCTokenSynchronously but let requests use the old token.",
"logger",
".",
"trace",
"(",
"\"In renew window and token is already expired.\... | renew Client Credential token synchronously.
When success will renew the Jwt jwt passed in.
When fail will return Status code so that can be handled by caller.
@param jwt the jwt you want to renew
@return Jwt when success, it will be the same object as the jwt you passed in; return Status when fail; | [
"renew",
"Client",
"Credential",
"token",
"synchronously",
".",
"When",
"success",
"will",
"renew",
"the",
"Jwt",
"jwt",
"passed",
"in",
".",
"When",
"fail",
"will",
"return",
"Status",
"code",
"so",
"that",
"can",
"be",
"handled",
"by",
"caller",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L593-L609 |
124,570 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.renewCCTokenAsync | private static void renewCCTokenAsync(final Jwt jwt) {
// Not expired yet, try to renew async but let requests use the old token.
logger.trace("In renew window but token is not expired yet.");
if(!jwt.isRenewing() || System.currentTimeMillis() > jwt.getEarlyRetryTimeout()) {
jwt.setR... | java | private static void renewCCTokenAsync(final Jwt jwt) {
// Not expired yet, try to renew async but let requests use the old token.
logger.trace("In renew window but token is not expired yet.");
if(!jwt.isRenewing() || System.currentTimeMillis() > jwt.getEarlyRetryTimeout()) {
jwt.setR... | [
"private",
"static",
"void",
"renewCCTokenAsync",
"(",
"final",
"Jwt",
"jwt",
")",
"{",
"// Not expired yet, try to renew async but let requests use the old token.",
"logger",
".",
"trace",
"(",
"\"In renew window but token is not expired yet.\"",
")",
";",
"if",
"(",
"!",
... | renew the given Jwt jwt asynchronously.
When fail, it will swallow the exception, so no need return type to be handled by caller.
@param jwt the jwt you want to renew | [
"renew",
"the",
"given",
"Jwt",
"jwt",
"asynchronously",
".",
"When",
"fail",
"it",
"will",
"swallow",
"the",
"exception",
"so",
"no",
"need",
"return",
"type",
"to",
"be",
"handled",
"by",
"caller",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L616-L637 |
124,571 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.getCCTokenRemotely | private static Result<Jwt> getCCTokenRemotely(final Jwt jwt) {
TokenRequest tokenRequest = new ClientCredentialsRequest();
//scopes at this point is may not be set yet when issuing a new token.
setScope(tokenRequest, jwt);
Result<TokenResponse> result = OauthHelper.getTokenResult(tokenRe... | java | private static Result<Jwt> getCCTokenRemotely(final Jwt jwt) {
TokenRequest tokenRequest = new ClientCredentialsRequest();
//scopes at this point is may not be set yet when issuing a new token.
setScope(tokenRequest, jwt);
Result<TokenResponse> result = OauthHelper.getTokenResult(tokenRe... | [
"private",
"static",
"Result",
"<",
"Jwt",
">",
"getCCTokenRemotely",
"(",
"final",
"Jwt",
"jwt",
")",
"{",
"TokenRequest",
"tokenRequest",
"=",
"new",
"ClientCredentialsRequest",
"(",
")",
";",
"//scopes at this point is may not be set yet when issuing a new token.",
"se... | get Client Credential token from auth server
@param jwt the jwt you want to renew
@return Jwt when success, it will be the same object as the jwt you passed in; return Status when fail; | [
"get",
"Client",
"Credential",
"token",
"from",
"auth",
"server"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L644-L662 |
124,572 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.escapeXml | private static String escapeXml (String nonEscapedXmlStr) {
StringBuilder escapedXML = new StringBuilder();
for (int i = 0; i < nonEscapedXmlStr.length(); i++) {
char c = nonEscapedXmlStr.charAt(i);
switch (c) {
case '<':
escapedXML.append("<... | java | private static String escapeXml (String nonEscapedXmlStr) {
StringBuilder escapedXML = new StringBuilder();
for (int i = 0; i < nonEscapedXmlStr.length(); i++) {
char c = nonEscapedXmlStr.charAt(i);
switch (c) {
case '<':
escapedXML.append("<... | [
"private",
"static",
"String",
"escapeXml",
"(",
"String",
"nonEscapedXmlStr",
")",
"{",
"StringBuilder",
"escapedXML",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nonEscapedXmlStr",
".",
"length",
"(",
")"... | Instead of including a large library just for escaping xml, using this util.
it should be used in very rare cases because the server should not return xml format message
@param nonEscapedXmlStr | [
"Instead",
"of",
"including",
"a",
"large",
"library",
"just",
"for",
"escaping",
"xml",
"using",
"this",
"util",
".",
"it",
"should",
"be",
"used",
"in",
"very",
"rare",
"cases",
"because",
"the",
"server",
"should",
"not",
"return",
"xml",
"format",
"mes... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L704-L733 |
124,573 | networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.adjustNoChunkedEncoding | public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) {
String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING);
if(transferEncodingStri... | java | public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) {
String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING);
if(transferEncodingStri... | [
"public",
"static",
"void",
"adjustNoChunkedEncoding",
"(",
"ClientRequest",
"request",
",",
"String",
"requestBody",
")",
"{",
"String",
"fixedLengthString",
"=",
"request",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
"Headers",
".",
"CONTENT_LENGTH",... | this method is to support sending a server which doesn't support chunked transfer encoding. | [
"this",
"method",
"is",
"to",
"support",
"sending",
"a",
"server",
"which",
"doesn",
"t",
"support",
"chunked",
"transfer",
"encoding",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L736-L751 |
124,574 | networknt/light-4j | body/src/main/java/com/networknt/body/BodyHandler.java | BodyHandler.attachFormDataBody | private void attachFormDataBody(final HttpServerExchange exchange) throws IOException {
Object data;
FormParserFactory formParserFactory = FormParserFactory.builder().build();
FormDataParser parser = formParserFactory.createParser(exchange);
if (parser != null) {
FormData for... | java | private void attachFormDataBody(final HttpServerExchange exchange) throws IOException {
Object data;
FormParserFactory formParserFactory = FormParserFactory.builder().build();
FormDataParser parser = formParserFactory.createParser(exchange);
if (parser != null) {
FormData for... | [
"private",
"void",
"attachFormDataBody",
"(",
"final",
"HttpServerExchange",
"exchange",
")",
"throws",
"IOException",
"{",
"Object",
"data",
";",
"FormParserFactory",
"formParserFactory",
"=",
"FormParserFactory",
".",
"builder",
"(",
")",
".",
"build",
"(",
")",
... | Method used to parse the body into FormData and attach it into exchange
@param exchange exchange to be attached
@throws IOException | [
"Method",
"used",
"to",
"parse",
"the",
"body",
"into",
"FormData",
"and",
"attach",
"it",
"into",
"exchange"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/body/src/main/java/com/networknt/body/BodyHandler.java#L125-L134 |
124,575 | networknt/light-4j | body/src/main/java/com/networknt/body/BodyHandler.java | BodyHandler.attachJsonBody | private void attachJsonBody(final HttpServerExchange exchange, String string) throws IOException {
Object body;
if (string != null) {
string = string.trim();
if (string.startsWith("{")) {
body = Config.getInstance().getMapper().readValue(string, new TypeReference<... | java | private void attachJsonBody(final HttpServerExchange exchange, String string) throws IOException {
Object body;
if (string != null) {
string = string.trim();
if (string.startsWith("{")) {
body = Config.getInstance().getMapper().readValue(string, new TypeReference<... | [
"private",
"void",
"attachJsonBody",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"String",
"string",
")",
"throws",
"IOException",
"{",
"Object",
"body",
";",
"if",
"(",
"string",
"!=",
"null",
")",
"{",
"string",
"=",
"string",
".",
"trim",
"(",
... | Method used to parse the body into a Map or a List and attach it into exchange
@param exchange exchange to be attached
@param string unparsed request body
@throws IOException | [
"Method",
"used",
"to",
"parse",
"the",
"body",
"into",
"a",
"Map",
"or",
"a",
"List",
"and",
"attach",
"it",
"into",
"exchange"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/body/src/main/java/com/networknt/body/BodyHandler.java#L143-L160 |
124,576 | networknt/light-4j | mask/src/main/java/com/networknt/mask/Mask.java | Mask.maskString | public static String maskString(String input, String key) {
String output = input;
Map<String, Object> stringConfig = (Map<String, Object>) config.get(MASK_TYPE_STRING);
if (stringConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) stringConfig.get(key);
... | java | public static String maskString(String input, String key) {
String output = input;
Map<String, Object> stringConfig = (Map<String, Object>) config.get(MASK_TYPE_STRING);
if (stringConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) stringConfig.get(key);
... | [
"public",
"static",
"String",
"maskString",
"(",
"String",
"input",
",",
"String",
"key",
")",
"{",
"String",
"output",
"=",
"input",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"stringConfig",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")"... | Mask the input string with a list of patterns indexed by key in string section in mask.json
This is usually used to mask header values, query parameters and uri parameters
@param input String The source of the string that needs to be masked
@param key String The key that maps to a list of patterns for masking in con... | [
"Mask",
"the",
"input",
"string",
"with",
"a",
"list",
"of",
"patterns",
"indexed",
"by",
"key",
"in",
"string",
"section",
"in",
"mask",
".",
"json",
"This",
"is",
"usually",
"used",
"to",
"mask",
"header",
"values",
"query",
"parameters",
"and",
"uri",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/mask/src/main/java/com/networknt/mask/Mask.java#L65-L78 |
124,577 | networknt/light-4j | mask/src/main/java/com/networknt/mask/Mask.java | Mask.maskJson | public static String maskJson(String input, String key) {
DocumentContext ctx = JsonPath.parse(input);
return maskJson(ctx, key);
} | java | public static String maskJson(String input, String key) {
DocumentContext ctx = JsonPath.parse(input);
return maskJson(ctx, key);
} | [
"public",
"static",
"String",
"maskJson",
"(",
"String",
"input",
",",
"String",
"key",
")",
"{",
"DocumentContext",
"ctx",
"=",
"JsonPath",
".",
"parse",
"(",
"input",
")",
";",
"return",
"maskJson",
"(",
"ctx",
",",
"key",
")",
";",
"}"
] | Replace values in JSON using json path
@param input String The source of the string that needs to be masked
@param key String The key maps to a list of json path for masking
@return String Masked result | [
"Replace",
"values",
"in",
"JSON",
"using",
"json",
"path"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/mask/src/main/java/com/networknt/mask/Mask.java#L142-L145 |
124,578 | networknt/light-4j | client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java | TokenParser.skipWhiteSpace | public void skipWhiteSpace(final CharSequence buf, final ParserCursor cursor) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
int pos = cursor.getPos();
final int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
for (in... | java | public void skipWhiteSpace(final CharSequence buf, final ParserCursor cursor) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
int pos = cursor.getPos();
final int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
for (in... | [
"public",
"void",
"skipWhiteSpace",
"(",
"final",
"CharSequence",
"buf",
",",
"final",
"ParserCursor",
"cursor",
")",
"{",
"Args",
".",
"notNull",
"(",
"buf",
",",
"\"Char sequence\"",
")",
";",
"Args",
".",
"notNull",
"(",
"cursor",
",",
"\"Parser cursor\"",
... | Skips semantically insignificant whitespace characters and moves the cursor to the closest
non-whitespace character.
@param buf buffer with the sequence of chars to be parsed
@param cursor defines the bounds and current position of the buffer | [
"Skips",
"semantically",
"insignificant",
"whitespace",
"characters",
"and",
"moves",
"the",
"cursor",
"to",
"the",
"closest",
"non",
"-",
"whitespace",
"character",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java#L138-L152 |
124,579 | networknt/light-4j | client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java | TokenParser.copyContent | public void copyContent(final CharSequence buf, final ParserCursor cursor, final BitSet delimiters,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
int pos = cursor.getPos();
fi... | java | public void copyContent(final CharSequence buf, final ParserCursor cursor, final BitSet delimiters,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
int pos = cursor.getPos();
fi... | [
"public",
"void",
"copyContent",
"(",
"final",
"CharSequence",
"buf",
",",
"final",
"ParserCursor",
"cursor",
",",
"final",
"BitSet",
"delimiters",
",",
"final",
"StringBuilder",
"dst",
")",
"{",
"Args",
".",
"notNull",
"(",
"buf",
",",
"\"Char sequence\"",
")... | Transfers content into the destination buffer until a whitespace character or any of
the given delimiters is encountered.
@param buf buffer with the sequence of chars to be parsed
@param cursor defines the bounds and current position of the buffer
@param delimiters set of delimiting characters. Can be {@code null} if ... | [
"Transfers",
"content",
"into",
"the",
"destination",
"buffer",
"until",
"a",
"whitespace",
"character",
"or",
"any",
"of",
"the",
"given",
"delimiters",
"is",
"encountered",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java#L164-L181 |
124,580 | networknt/light-4j | client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java | TokenParser.copyQuotedContent | public void copyQuotedContent(final CharSequence buf, final ParserCursor cursor,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
if (cursor.atEnd()) {
return;
}
... | java | public void copyQuotedContent(final CharSequence buf, final ParserCursor cursor,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
if (cursor.atEnd()) {
return;
}
... | [
"public",
"void",
"copyQuotedContent",
"(",
"final",
"CharSequence",
"buf",
",",
"final",
"ParserCursor",
"cursor",
",",
"final",
"StringBuilder",
"dst",
")",
"{",
"Args",
".",
"notNull",
"(",
"buf",
",",
"\"Char sequence\"",
")",
";",
"Args",
".",
"notNull",
... | Transfers content enclosed with quote marks into the destination buffer.
@param buf buffer with the sequence of chars to be parsed
@param cursor defines the bounds and current position of the buffer
@param dst destination buffer | [
"Transfers",
"content",
"enclosed",
"with",
"quote",
"marks",
"into",
"the",
"destination",
"buffer",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java#L220-L259 |
124,581 | networknt/light-4j | dump/src/main/java/com/networknt/dump/DumpHelper.java | DumpHelper.logResult | static void logResult(Map<String, Object> result, DumpConfig config) {
Consumer<String> loggerFunc = getLoggerFuncBasedOnLevel(config.getLogLevel());
if(config.isUseJson()) {
logResultUsingJson(result, loggerFunc);
} else {
int startLevel = -1;
StringBuilder s... | java | static void logResult(Map<String, Object> result, DumpConfig config) {
Consumer<String> loggerFunc = getLoggerFuncBasedOnLevel(config.getLogLevel());
if(config.isUseJson()) {
logResultUsingJson(result, loggerFunc);
} else {
int startLevel = -1;
StringBuilder s... | [
"static",
"void",
"logResult",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
",",
"DumpConfig",
"config",
")",
"{",
"Consumer",
"<",
"String",
">",
"loggerFunc",
"=",
"getLoggerFuncBasedOnLevel",
"(",
"config",
".",
"getLogLevel",
"(",
")",
")",
... | A help method to log result pojo
@param result the map contains info that needs to be logged | [
"A",
"help",
"method",
"to",
"log",
"result",
"pojo"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumpHelper.java#L39-L49 |
124,582 | networknt/light-4j | dump/src/main/java/com/networknt/dump/DumpHelper.java | DumpHelper._logResult | private static <T> void _logResult(T result, int level, int indentSize, StringBuilder info) {
if(result instanceof Map) {
level += 1;
int finalLevel = level;
((Map)result).forEach((k, v) -> {
info.append("\n");
info.append(getTabBasedOnLevel(fi... | java | private static <T> void _logResult(T result, int level, int indentSize, StringBuilder info) {
if(result instanceof Map) {
level += 1;
int finalLevel = level;
((Map)result).forEach((k, v) -> {
info.append("\n");
info.append(getTabBasedOnLevel(fi... | [
"private",
"static",
"<",
"T",
">",
"void",
"_logResult",
"(",
"T",
"result",
",",
"int",
"level",
",",
"int",
"indentSize",
",",
"StringBuilder",
"info",
")",
"{",
"if",
"(",
"result",
"instanceof",
"Map",
")",
"{",
"level",
"+=",
"1",
";",
"int",
"... | this method actually append result to result string | [
"this",
"method",
"actually",
"append",
"result",
"to",
"result",
"string"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumpHelper.java#L54-L77 |
124,583 | networknt/light-4j | dump/src/main/java/com/networknt/dump/DumpHelper.java | DumpHelper.getTabBasedOnLevel | private static String getTabBasedOnLevel(int level, int indentSize) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < level; i ++) {
for(int j = 0; j < indentSize; j++) {
sb.append(" ");
}
}
return sb.toString();
} | java | private static String getTabBasedOnLevel(int level, int indentSize) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < level; i ++) {
for(int j = 0; j < indentSize; j++) {
sb.append(" ");
}
}
return sb.toString();
} | [
"private",
"static",
"String",
"getTabBasedOnLevel",
"(",
"int",
"level",
",",
"int",
"indentSize",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"level",
";",
"i",
"++",
... | calculate indent for formatting
@return " " string of empty spaces | [
"calculate",
"indent",
"for",
"formatting"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumpHelper.java#L101-L109 |
124,584 | networknt/light-4j | registry/src/main/java/com/networknt/registry/support/AbstractRegistry.java | AbstractRegistry.removeUnnecessaryParmas | private URL removeUnnecessaryParmas(URL url) {
url.getParameters().remove(URLParamType.codec.getName());
return url;
} | java | private URL removeUnnecessaryParmas(URL url) {
url.getParameters().remove(URLParamType.codec.getName());
return url;
} | [
"private",
"URL",
"removeUnnecessaryParmas",
"(",
"URL",
"url",
")",
"{",
"url",
".",
"getParameters",
"(",
")",
".",
"remove",
"(",
"URLParamType",
".",
"codec",
".",
"getName",
"(",
")",
")",
";",
"return",
"url",
";",
"}"
] | client doesn't need to know codec.
@param url a URL object | [
"client",
"doesn",
"t",
"need",
"to",
"know",
"codec",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/registry/src/main/java/com/networknt/registry/support/AbstractRegistry.java#L264-L267 |
124,585 | networknt/light-4j | dump/src/main/java/com/networknt/dump/StatusCodeDumper.java | StatusCodeDumper.dumpResponse | @Override
public void dumpResponse(Map<String, Object> result) {
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | java | @Override
public void dumpResponse(Map<String, Object> result) {
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpResponse",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"this",
".",
"statusCodeResult",
"=",
"String",
".",
"valueOf",
"(",
"exchange",
".",
"getStatusCode",
"(",
")",
")",
";",
"this",
".",
... | impl of dumping response status code to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"response",
"status",
"code",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L38-L42 |
124,586 | networknt/light-4j | dump/src/main/java/com/networknt/dump/StatusCodeDumper.java | StatusCodeDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.statusCodeResult)) {
result.put(DumpConstants.STATUS_CODE, this.statusCodeResult);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.statusCodeResult)) {
result.put(DumpConstants.STATUS_CODE, this.statusCodeResult);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"this",
".",
"statusCodeResult",
")",
")",
"{",
"result",
".",
"put",
"(",
"DumpCo... | put this.statusCodeResult to result
@param result a Map you want to put dumping info to. | [
"put",
"this",
".",
"statusCodeResult",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L48-L53 |
124,587 | networknt/light-4j | utility/src/main/java/com/networknt/utility/Util.java | Util.getUUID | public static String getUUID() {
UUID id = UUID.randomUUID();
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(id.getMostSignificantBits());
bb.putLong(id.getLeastSignificantBits());
return Base64.encodeBase64URLSafeString(bb.array());
} | java | public static String getUUID() {
UUID id = UUID.randomUUID();
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(id.getMostSignificantBits());
bb.putLong(id.getLeastSignificantBits());
return Base64.encodeBase64URLSafeString(bb.array());
} | [
"public",
"static",
"String",
"getUUID",
"(",
")",
"{",
"UUID",
"id",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
";",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"new",
"byte",
"[",
"16",
"]",
")",
";",
"bb",
".",
"putLong",
"(",
"id",
... | Generate UUID across the entire app and it is used for correlationId.
@return String correlationId | [
"Generate",
"UUID",
"across",
"the",
"entire",
"app",
"and",
"it",
"is",
"used",
"for",
"correlationId",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/Util.java#L52-L58 |
124,588 | networknt/light-4j | utility/src/main/java/com/networknt/utility/Util.java | Util.quote | public static String quote(final String value) {
if (value == null) {
return null;
}
String result = value;
if (!result.startsWith("\"")) {
result = "\"" + result;
}
if (!result.endsWith("\"")) {
result = result + "\"";
}
... | java | public static String quote(final String value) {
if (value == null) {
return null;
}
String result = value;
if (!result.startsWith("\"")) {
result = "\"" + result;
}
if (!result.endsWith("\"")) {
result = result + "\"";
}
... | [
"public",
"static",
"String",
"quote",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"result",
"=",
"value",
";",
"if",
"(",
"!",
"result",
".",
"startsWith",
"(",
"\"\\\"... | Quote the given string if needed
@param value The value to quote (e.g. bob)
@return The quoted string (e.g. "bob") | [
"Quote",
"the",
"given",
"string",
"if",
"needed"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/Util.java#L66-L78 |
124,589 | networknt/light-4j | cluster/src/main/java/com/networknt/cluster/LightCluster.java | LightCluster.serviceToUrl | @Override
public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) {
URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey);
if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url);
// construct a url in str... | java | @Override
public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) {
URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey);
if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url);
// construct a url in str... | [
"@",
"Override",
"public",
"String",
"serviceToUrl",
"(",
"String",
"protocol",
",",
"String",
"serviceId",
",",
"String",
"tag",
",",
"String",
"requestKey",
")",
"{",
"URL",
"url",
"=",
"loadBalance",
".",
"select",
"(",
"discovery",
"(",
"protocol",
",",
... | Implement serviceToUrl with client side service discovery.
@param protocol String
@param serviceId String
@param requestKey String
@return String | [
"Implement",
"serviceToUrl",
"with",
"client",
"side",
"service",
"discovery",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/cluster/src/main/java/com/networknt/cluster/LightCluster.java#L62-L68 |
124,590 | networknt/light-4j | info/src/main/java/com/networknt/info/ServerInfoGetHandler.java | ServerInfoGetHandler.getServerTlsFingerPrint | private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on serve... | java | private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on serve... | [
"private",
"String",
"getServerTlsFingerPrint",
"(",
")",
"{",
"String",
"fingerPrint",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"serverConfig",
"=",
"Config",
".",
"getInstance",
"(",
")",
".",
"getJsonMapConfigNoCache",
"(",
"\"server\"",
... | We can get it from server module but we don't want mutual dependency. So
get it from config and keystore directly
@return String TLS server certificate finger print | [
"We",
"can",
"get",
"it",
"from",
"server",
"module",
"but",
"we",
"don",
"t",
"want",
"mutual",
"dependency",
".",
"So",
"get",
"it",
"from",
"config",
"and",
"keystore",
"directly"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/info/src/main/java/com/networknt/info/ServerInfoGetHandler.java#L156-L178 |
124,591 | networknt/light-4j | client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java | ClientX509ExtendedTrustManager.doCustomServerIdentityCheck | private void doCustomServerIdentityCheck(X509Certificate cert) throws CertificateException{
if (EndpointIdentificationAlgorithm.APIS == identityAlg) {
APINameChecker.verifyAndThrow(trustedNameSet, cert);
}
} | java | private void doCustomServerIdentityCheck(X509Certificate cert) throws CertificateException{
if (EndpointIdentificationAlgorithm.APIS == identityAlg) {
APINameChecker.verifyAndThrow(trustedNameSet, cert);
}
} | [
"private",
"void",
"doCustomServerIdentityCheck",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"EndpointIdentificationAlgorithm",
".",
"APIS",
"==",
"identityAlg",
")",
"{",
"APINameChecker",
".",
"verifyAndThrow",
"(",
"trusted... | check server identify as per tls.trustedNames in client.yml.
Notes: this method should only be applied to verify server certificates on the client side.
@param cert
@throws CertificateException | [
"check",
"server",
"identify",
"as",
"per",
"tls",
".",
"trustedNames",
"in",
"client",
".",
"yml",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java#L144-L148 |
124,592 | networknt/light-4j | client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java | ClientX509ExtendedTrustManager.checkIdentity | private void checkIdentity(SSLSession session, X509Certificate cert) throws CertificateException {
if (session == null) {
throw new CertificateException("No handshake session");
}
if (EndpointIdentificationAlgorithm.HTTPS == identityAlg) {
String hostname = session.getPeerHost();
APINameChecker.verifyAn... | java | private void checkIdentity(SSLSession session, X509Certificate cert) throws CertificateException {
if (session == null) {
throw new CertificateException("No handshake session");
}
if (EndpointIdentificationAlgorithm.HTTPS == identityAlg) {
String hostname = session.getPeerHost();
APINameChecker.verifyAn... | [
"private",
"void",
"checkIdentity",
"(",
"SSLSession",
"session",
",",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"No handshake session\"",
")",
... | check server identify against hostnames. This method is used to enhance X509TrustManager to provide standard identity check.
This method can be applied to both clients and servers.
@param session
@param cert
@throws CertificateException | [
"check",
"server",
"identify",
"against",
"hostnames",
".",
"This",
"method",
"is",
"used",
"to",
"enhance",
"X509TrustManager",
"to",
"provide",
"standard",
"identity",
"check",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java#L175-L184 |
124,593 | networknt/light-4j | client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java | ClientX509ExtendedTrustManager.decorate | public static TrustManager[] decorate(TrustManager[] trustManagers, TLSConfig tlsConfig) {
if (null!=trustManagers && trustManagers.length>0) {
TrustManager[] decoratedTrustManagers = new TrustManager[trustManagers.length];
for (int i=0; i<trustManagers.length; ++i) {
TrustManager trustManager = trustMa... | java | public static TrustManager[] decorate(TrustManager[] trustManagers, TLSConfig tlsConfig) {
if (null!=trustManagers && trustManagers.length>0) {
TrustManager[] decoratedTrustManagers = new TrustManager[trustManagers.length];
for (int i=0; i<trustManagers.length; ++i) {
TrustManager trustManager = trustMa... | [
"public",
"static",
"TrustManager",
"[",
"]",
"decorate",
"(",
"TrustManager",
"[",
"]",
"trustManagers",
",",
"TLSConfig",
"tlsConfig",
")",
"{",
"if",
"(",
"null",
"!=",
"trustManagers",
"&&",
"trustManagers",
".",
"length",
">",
"0",
")",
"{",
"TrustManag... | This method converts existing X509TrustManagers to ClientX509ExtendedTrustManagers.
@param trustManagers
@param tlsConfig
@return | [
"This",
"method",
"converts",
"existing",
"X509TrustManagers",
"to",
"ClientX509ExtendedTrustManagers",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/ClientX509ExtendedTrustManager.java#L193-L211 |
124,594 | networknt/light-4j | dump/src/main/java/com/networknt/dump/UrlDumper.java | UrlDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.url)) {
result.put(DumpConstants.URL, this.url);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.url)) {
result.put(DumpConstants.URL, this.url);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"this",
".",
"url",
")",
")",
"{",
"result",
".",
"put",
"(",
"DumpConstants",
"... | put this.url to result
@param result a Map you want to put dumping info to. | [
"put",
"this",
".",
"url",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/UrlDumper.java#L48-L53 |
124,595 | networknt/light-4j | header/src/main/java/com/networknt/header/HeaderHandler.java | HeaderHandler.handleRequest | @Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
// handle request header
Map<String, Object> requestHeaderMap = (Map<String, Object>)config.get(REQUEST);
if(requestHeaderMap != null) {
List<String> requestHeaderRemove = (List<String>)req... | java | @Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
// handle request header
Map<String, Object> requestHeaderMap = (Map<String, Object>)config.get(REQUEST);
if(requestHeaderMap != null) {
List<String> requestHeaderRemove = (List<String>)req... | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"HttpServerExchange",
"exchange",
")",
"throws",
"Exception",
"{",
"// handle request header",
"Map",
"<",
"String",
",",
"Object",
">",
"requestHeaderMap",
"=",
"(",
"Map",
"<",
"String",
",",
"O... | Check iterate the configuration on both request and response section and update
headers accordingly.
@param exchange HttpServerExchange
@throws Exception Exception | [
"Check",
"iterate",
"the",
"configuration",
"on",
"both",
"request",
"and",
"response",
"section",
"and",
"update",
"headers",
"accordingly",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/header/src/main/java/com/networknt/header/HeaderHandler.java#L67-L96 |
124,596 | networknt/light-4j | utility/src/main/java/com/networknt/utility/NetUtils.java | NetUtils.getHostName | public static String getHostName(SocketAddress socketAddress) {
if (socketAddress == null) {
return null;
}
if (socketAddress instanceof InetSocketAddress) {
InetAddress addr = ((InetSocketAddress) socketAddress).getAddress();
if(addr != null){
... | java | public static String getHostName(SocketAddress socketAddress) {
if (socketAddress == null) {
return null;
}
if (socketAddress instanceof InetSocketAddress) {
InetAddress addr = ((InetSocketAddress) socketAddress).getAddress();
if(addr != null){
... | [
"public",
"static",
"String",
"getHostName",
"(",
"SocketAddress",
"socketAddress",
")",
"{",
"if",
"(",
"socketAddress",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"socketAddress",
"instanceof",
"InetSocketAddress",
")",
"{",
"InetAddress",
... | return ip to avoid lookup dns | [
"return",
"ip",
"to",
"avoid",
"lookup",
"dns"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NetUtils.java#L174-L187 |
124,597 | networknt/light-4j | config/src/main/java/com/networknt/config/CentralizedManagement.java | CentralizedManagement.mergeObject | public static Object mergeObject(Object config, Class clazz) {
merge(config);
return convertMapToObj((Map<String, Object>) config, clazz);
} | java | public static Object mergeObject(Object config, Class clazz) {
merge(config);
return convertMapToObj((Map<String, Object>) config, clazz);
} | [
"public",
"static",
"Object",
"mergeObject",
"(",
"Object",
"config",
",",
"Class",
"clazz",
")",
"{",
"merge",
"(",
"config",
")",
";",
"return",
"convertMapToObj",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"config",
",",
"clazz",
")",
... | Merge map config with values generated by ConfigInjection.class and return mapping object | [
"Merge",
"map",
"config",
"with",
"values",
"generated",
"by",
"ConfigInjection",
".",
"class",
"and",
"return",
"mapping",
"object"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/CentralizedManagement.java#L42-L45 |
124,598 | networknt/light-4j | config/src/main/java/com/networknt/config/CentralizedManagement.java | CentralizedManagement.merge | private static void merge(Object m1) {
if (m1 instanceof Map) {
Iterator<Object> fieldNames = ((Map<Object, Object>) m1).keySet().iterator();
String fieldName = null;
while (fieldNames.hasNext()) {
fieldName = String.valueOf(fieldNames.next());
... | java | private static void merge(Object m1) {
if (m1 instanceof Map) {
Iterator<Object> fieldNames = ((Map<Object, Object>) m1).keySet().iterator();
String fieldName = null;
while (fieldNames.hasNext()) {
fieldName = String.valueOf(fieldNames.next());
... | [
"private",
"static",
"void",
"merge",
"(",
"Object",
"m1",
")",
"{",
"if",
"(",
"m1",
"instanceof",
"Map",
")",
"{",
"Iterator",
"<",
"Object",
">",
"fieldNames",
"=",
"(",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"m1",
")",
".",
"keySet... | Search the config map recursively, expand List and Map level by level util no further expand | [
"Search",
"the",
"config",
"map",
"recursively",
"expand",
"List",
"and",
"Map",
"level",
"by",
"level",
"util",
"no",
"further",
"expand"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/CentralizedManagement.java#L47-L78 |
124,599 | networknt/light-4j | config/src/main/java/com/networknt/config/CentralizedManagement.java | CentralizedManagement.convertMapToObj | private static Object convertMapToObj(Map<String, Object> map, Class clazz) {
ObjectMapper mapper = new ObjectMapper();
Object obj = mapper.convertValue(map, clazz);
return obj;
} | java | private static Object convertMapToObj(Map<String, Object> map, Class clazz) {
ObjectMapper mapper = new ObjectMapper();
Object obj = mapper.convertValue(map, clazz);
return obj;
} | [
"private",
"static",
"Object",
"convertMapToObj",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"Class",
"clazz",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"Object",
"obj",
"=",
"mapper",
".",
"convertValue... | Method used to convert map to object based on the reference class provided | [
"Method",
"used",
"to",
"convert",
"map",
"to",
"object",
"based",
"on",
"the",
"reference",
"class",
"provided"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/CentralizedManagement.java#L81-L85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.