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
14,800
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/RoundRobin.java
RoundRobin.next
public V next() { Collection<? extends V> collection = this.collection; V offset = this.offset; if (offset != null) { boolean accept = false; for (V element : collection) { if (element == offset) { accept = true; c...
java
public V next() { Collection<? extends V> collection = this.collection; V offset = this.offset; if (offset != null) { boolean accept = false; for (V element : collection) { if (element == offset) { accept = true; c...
[ "public", "V", "next", "(", ")", "{", "Collection", "<", "?", "extends", "V", ">", "collection", "=", "this", ".", "collection", ";", "V", "offset", "=", "this", ".", "offset", ";", "if", "(", "offset", "!=", "null", ")", "{", "boolean", "accept", ...
Returns the next item. @return the next item
[ "Returns", "the", "next", "item", "." ]
b6de74e384dea112e3656684ca3f50cdfd6c8e0d
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RoundRobin.java#L64-L84
14,801
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactory.java
InvocationProxyFactory.addInterface
public void addInterface(Class<?> ifc) { LettuceAssert.notNull(ifc, "Interface type must not be null"); LettuceAssert.isTrue(ifc.isInterface(), "Type must be an interface"); this.interfaces.add(ifc); }
java
public void addInterface(Class<?> ifc) { LettuceAssert.notNull(ifc, "Interface type must not be null"); LettuceAssert.isTrue(ifc.isInterface(), "Type must be an interface"); this.interfaces.add(ifc); }
[ "public", "void", "addInterface", "(", "Class", "<", "?", ">", "ifc", ")", "{", "LettuceAssert", ".", "notNull", "(", "ifc", ",", "\"Interface type must not be null\"", ")", ";", "LettuceAssert", ".", "isTrue", "(", "ifc", ".", "isInterface", "(", ")", ",", ...
Add a interface type that should be implemented by the resulting invocation proxy. @param ifc must not be {@literal null} and must be an interface type.
[ "Add", "a", "interface", "type", "that", "should", "be", "implemented", "by", "the", "resulting", "invocation", "proxy", "." ]
b6de74e384dea112e3656684ca3f50cdfd6c8e0d
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactory.java#L68-L74
14,802
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/ReactiveTypeAdapters.java
ReactiveTypeAdapters.registerIn
static void registerIn(ConversionService conversionService) { LettuceAssert.notNull(conversionService, "ConversionService must not be null!"); if (ReactiveTypes.isAvailable(ReactiveLibrary.PROJECT_REACTOR)) { if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA1)) { conve...
java
static void registerIn(ConversionService conversionService) { LettuceAssert.notNull(conversionService, "ConversionService must not be null!"); if (ReactiveTypes.isAvailable(ReactiveLibrary.PROJECT_REACTOR)) { if (ReactiveTypes.isAvailable(ReactiveLibrary.RXJAVA1)) { conve...
[ "static", "void", "registerIn", "(", "ConversionService", "conversionService", ")", "{", "LettuceAssert", ".", "notNull", "(", "conversionService", ",", "\"ConversionService must not be null!\"", ")", ";", "if", "(", "ReactiveTypes", ".", "isAvailable", "(", "ReactiveLi...
Register adapters in the conversion service. @param conversionService
[ "Register", "adapters", "in", "the", "conversion", "service", "." ]
b6de74e384dea112e3656684ca3f50cdfd6c8e0d
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/ReactiveTypeAdapters.java#L46-L108
14,803
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/Consumer.java
Consumer.from
public static <K> Consumer<K> from(K group, K name) { LettuceAssert.notNull(group, "Group must not be null"); LettuceAssert.notNull(name, "Name must not be null"); return new Consumer<>(group, name); }
java
public static <K> Consumer<K> from(K group, K name) { LettuceAssert.notNull(group, "Group must not be null"); LettuceAssert.notNull(name, "Name must not be null"); return new Consumer<>(group, name); }
[ "public", "static", "<", "K", ">", "Consumer", "<", "K", ">", "from", "(", "K", "group", ",", "K", "name", ")", "{", "LettuceAssert", ".", "notNull", "(", "group", ",", "\"Group must not be null\"", ")", ";", "LettuceAssert", ".", "notNull", "(", "name",...
Create a new consumer. @param group name of the consumer group, must not be {@literal null} or empty. @param name name of the consumer, must not be {@literal null} or empty. @return the consumer {@link Consumer} object.
[ "Create", "a", "new", "consumer", "." ]
b6de74e384dea112e3656684ca3f50cdfd6c8e0d
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/Consumer.java#L47-L53
14,804
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putSize
@TargetApi(21) public Bundler putSize(String key, Size value) { bundle.putSize(key, value); return this; }
java
@TargetApi(21) public Bundler putSize(String key, Size value) { bundle.putSize(key, value); return this; }
[ "@", "TargetApi", "(", "21", ")", "public", "Bundler", "putSize", "(", "String", "key", ",", "Size", "value", ")", "{", "bundle", ".", "putSize", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Size value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Size object, or null @return this
[ "Inserts", "a", "Size", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
712e81a92f1e12a3c33dcbda03d813e0162e8589
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L153-L157
14,805
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putSizeF
@TargetApi(21) public Bundler putSizeF(String key, SizeF value) { bundle.putSizeF(key, value); return this; }
java
@TargetApi(21) public Bundler putSizeF(String key, SizeF value) { bundle.putSizeF(key, value); return this; }
[ "@", "TargetApi", "(", "21", ")", "public", "Bundler", "putSizeF", "(", "String", "key", ",", "SizeF", "value", ")", "{", "bundle", ".", "putSizeF", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a SizeF value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a SizeF object, or null @return this
[ "Inserts", "a", "SizeF", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
712e81a92f1e12a3c33dcbda03d813e0162e8589
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L167-L171
14,806
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.into
public <T extends Fragment> T into(T fragment) { fragment.setArguments(get()); return fragment; }
java
public <T extends Fragment> T into(T fragment) { fragment.setArguments(get()); return fragment; }
[ "public", "<", "T", "extends", "Fragment", ">", "T", "into", "(", "T", "fragment", ")", "{", "fragment", ".", "setArguments", "(", "get", "(", ")", ")", ";", "return", "fragment", ";", "}" ]
Set the argument of Fragment. @param fragment a fragment @return a fragment
[ "Set", "the", "argument", "of", "Fragment", "." ]
712e81a92f1e12a3c33dcbda03d813e0162e8589
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L515-L518
14,807
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/shared/rest/documentation/generator/Generator.java
Generator.cleanRoute
private String cleanRoute(String route) { if (!route.startsWith("/")) { route = "/" + route; } if (route.endsWith("/")) { route = route.substring(0, route.length() - 1); } return route; }
java
private String cleanRoute(String route) { if (!route.startsWith("/")) { route = "/" + route; } if (route.endsWith("/")) { route = route.substring(0, route.length() - 1); } return route; }
[ "private", "String", "cleanRoute", "(", "String", "route", ")", "{", "if", "(", "!", "route", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "route", "=", "\"/\"", "+", "route", ";", "}", "if", "(", "route", ".", "endsWith", "(", "\"/\"", ")", ")"...
Leading slash but no trailing.
[ "Leading", "slash", "but", "no", "trailing", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/shared/rest/documentation/generator/Generator.java#L369-L379
14,808
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/shared/buffers/RawMessageEvent.java
RawMessageEvent.getMessageId
public UUID getMessageId() { final ByteBuffer wrap = ByteBuffer.wrap(messageIdBytes); return new UUID(wrap.asLongBuffer().get(0), wrap.asLongBuffer().get(1)); }
java
public UUID getMessageId() { final ByteBuffer wrap = ByteBuffer.wrap(messageIdBytes); return new UUID(wrap.asLongBuffer().get(0), wrap.asLongBuffer().get(1)); }
[ "public", "UUID", "getMessageId", "(", ")", "{", "final", "ByteBuffer", "wrap", "=", "ByteBuffer", ".", "wrap", "(", "messageIdBytes", ")", ";", "return", "new", "UUID", "(", "wrap", ".", "asLongBuffer", "(", ")", ".", "get", "(", "0", ")", ",", "wrap"...
performance doesn't matter, it's only being called during tracing
[ "performance", "doesn", "t", "matter", "it", "s", "only", "being", "called", "during", "tracing" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/shared/buffers/RawMessageEvent.java#L83-L86
14,809
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/parser/PipelineRuleParser.java
PipelineRuleParser.parseRule
public Rule parseRule(String id, String rule, boolean silent, PipelineClassloader ruleClassLoader) throws ParseException { final ParseContext parseContext = new ParseContext(silent); final SyntaxErrorListener errorListener = new SyntaxErrorListener(parseContext); final RuleLangLexer lexer = new...
java
public Rule parseRule(String id, String rule, boolean silent, PipelineClassloader ruleClassLoader) throws ParseException { final ParseContext parseContext = new ParseContext(silent); final SyntaxErrorListener errorListener = new SyntaxErrorListener(parseContext); final RuleLangLexer lexer = new...
[ "public", "Rule", "parseRule", "(", "String", "id", ",", "String", "rule", ",", "boolean", "silent", ",", "PipelineClassloader", "ruleClassLoader", ")", "throws", "ParseException", "{", "final", "ParseContext", "parseContext", "=", "new", "ParseContext", "(", "sil...
Parses the given rule source and optionally generates a Java class for it if the classloader is not null. @param id the id of the rule, necessary to generate code @param rule rule source code @param silent don't emit status messages during parsing @param ruleClassLoader the classloader to load the generated code into ...
[ "Parses", "the", "given", "rule", "source", "and", "optionally", "generates", "a", "Java", "class", "for", "it", "if", "the", "classloader", "is", "not", "null", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/parser/PipelineRuleParser.java#L147-L188
14,810
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java
PipelineInterpreter.process
public Messages process(Messages messages, InterpreterListener interpreterListener, State state) { interpreterListener.startProcessing(); // message id + stream id final Set<Tuple2<String, String>> processingBlacklist = Sets.newHashSet(); final List<Message> toProcess = Lists.newArrayLi...
java
public Messages process(Messages messages, InterpreterListener interpreterListener, State state) { interpreterListener.startProcessing(); // message id + stream id final Set<Tuple2<String, String>> processingBlacklist = Sets.newHashSet(); final List<Message> toProcess = Lists.newArrayLi...
[ "public", "Messages", "process", "(", "Messages", "messages", ",", "InterpreterListener", "interpreterListener", ",", "State", "state", ")", "{", "interpreterListener", ".", "startProcessing", "(", ")", ";", "// message id + stream id", "final", "Set", "<", "Tuple2", ...
Evaluates all pipelines that apply to the given messages, based on the current stream routing of the messages. The processing loops on each single message (passed in or created by pipelines) until the set of streams does not change anymore. No cycle detection is performed. @param messages the messages to p...
[ "Evaluates", "all", "pipelines", "that", "apply", "to", "the", "given", "messages", "based", "on", "the", "current", "stream", "routing", "of", "the", "messages", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java#L117-L168
14,811
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java
PipelineInterpreter.processForPipelines
public List<Message> processForPipelines(Message message, Set<String> pipelineIds, InterpreterListener interpreterListener, State state) { final Map<String, Pipeline> currentPip...
java
public List<Message> processForPipelines(Message message, Set<String> pipelineIds, InterpreterListener interpreterListener, State state) { final Map<String, Pipeline> currentPip...
[ "public", "List", "<", "Message", ">", "processForPipelines", "(", "Message", "message", ",", "Set", "<", "String", ">", "pipelineIds", ",", "InterpreterListener", "interpreterListener", ",", "State", "state", ")", "{", "final", "Map", "<", "String", ",", "Pip...
Given a set of pipeline ids, process the given message according to the passed state. This method returns the list of messages produced by the configuration in state, it does not look at the database or any other external resource besides what is being passed as parameters. This can be used to simulate pipelines with...
[ "Given", "a", "set", "of", "pipeline", "ids", "process", "the", "given", "message", "according", "to", "the", "passed", "state", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java#L233-L244
14,812
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/streams/StreamRouterEngine.java
StreamRouterEngine.match
public List<Stream> match(Message message) { final Set<Stream> result = Sets.newHashSet(); final Set<Stream> blackList = Sets.newHashSet(); for (final Rule rule : rulesList) { if (blackList.contains(rule.getStream())) { continue; } final Stre...
java
public List<Stream> match(Message message) { final Set<Stream> result = Sets.newHashSet(); final Set<Stream> blackList = Sets.newHashSet(); for (final Rule rule : rulesList) { if (blackList.contains(rule.getStream())) { continue; } final Stre...
[ "public", "List", "<", "Stream", ">", "match", "(", "Message", "message", ")", "{", "final", "Set", "<", "Stream", ">", "result", "=", "Sets", ".", "newHashSet", "(", ")", ";", "final", "Set", "<", "Stream", ">", "blackList", "=", "Sets", ".", "newHa...
Returns a list of matching streams for the given message. @param message the message @return the list of matching streams
[ "Returns", "a", "list", "of", "matching", "streams", "for", "the", "given", "message", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/streams/StreamRouterEngine.java#L164-L233
14,813
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Stage.java
Stage.registerMetrics
public void registerMetrics(MetricRegistry metricRegistry, String pipelineId) { meterName = name(Pipeline.class, pipelineId, "stage", String.valueOf(stage()), "executed"); executed = metricRegistry.meter(meterName); }
java
public void registerMetrics(MetricRegistry metricRegistry, String pipelineId) { meterName = name(Pipeline.class, pipelineId, "stage", String.valueOf(stage()), "executed"); executed = metricRegistry.meter(meterName); }
[ "public", "void", "registerMetrics", "(", "MetricRegistry", "metricRegistry", ",", "String", "pipelineId", ")", "{", "meterName", "=", "name", "(", "Pipeline", ".", "class", ",", "pipelineId", ",", "\"stage\"", ",", "String", ".", "valueOf", "(", "stage", "(",...
Register the metrics attached to this stage. @param metricRegistry the registry to add the metrics to
[ "Register", "the", "metrics", "attached", "to", "this", "stage", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Stage.java#L65-L68
14,814
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Version.java
Version.greaterMinor
@Deprecated public boolean greaterMinor(Version other) { return other.major < this.major || other.major == this.major && other.minor < this.minor; }
java
@Deprecated public boolean greaterMinor(Version other) { return other.major < this.major || other.major == this.major && other.minor < this.minor; }
[ "@", "Deprecated", "public", "boolean", "greaterMinor", "(", "Version", "other", ")", "{", "return", "other", ".", "major", "<", "this", ".", "major", "||", "other", ".", "major", "==", "this", ".", "major", "&&", "other", ".", "minor", "<", "this", "....
Check if this version is higher than the passed other version. Only taking major and minor version number in account. @param other {@link Version} to compare
[ "Check", "if", "this", "version", "is", "higher", "than", "the", "passed", "other", "version", ".", "Only", "taking", "major", "and", "minor", "version", "number", "in", "account", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Version.java#L272-L275
14,815
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/shared/utilities/ByteBufferUtils.java
ByteBufferUtils.readBytes
public static byte[] readBytes(ByteBuffer buffer, int offset, int size) { final byte[] dest = new byte[size]; buffer.get(dest, offset, size); return dest; }
java
public static byte[] readBytes(ByteBuffer buffer, int offset, int size) { final byte[] dest = new byte[size]; buffer.get(dest, offset, size); return dest; }
[ "public", "static", "byte", "[", "]", "readBytes", "(", "ByteBuffer", "buffer", ",", "int", "offset", ",", "int", "size", ")", "{", "final", "byte", "[", "]", "dest", "=", "new", "byte", "[", "size", "]", ";", "buffer", ".", "get", "(", "dest", ","...
Read a byte array from the given offset and size in the buffer This will <em>consume</em> the given {@link ByteBuffer}.
[ "Read", "a", "byte", "array", "from", "the", "given", "offset", "and", "size", "in", "the", "buffer" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/shared/utilities/ByteBufferUtils.java#L36-L40
14,816
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/utilities/ConfigurationMapConverter.java
ConfigurationMapConverter.convertValues
public static Map<String, Object> convertValues(final Map<String, Object> data, final ConfigurationRequest configurationRequest) throws ValidationException { final Map<String, Object> configuration = Maps.newHashMapWithExpectedSize(data.size()); final Map<String, Map<String, Object>> configurationFields...
java
public static Map<String, Object> convertValues(final Map<String, Object> data, final ConfigurationRequest configurationRequest) throws ValidationException { final Map<String, Object> configuration = Maps.newHashMapWithExpectedSize(data.size()); final Map<String, Map<String, Object>> configurationFields...
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "convertValues", "(", "final", "Map", "<", "String", ",", "Object", ">", "data", ",", "final", "ConfigurationRequest", "configurationRequest", ")", "throws", "ValidationException", "{", "final", "Map"...
Converts the values in the map to the requested types. This has been copied from the Graylog web interface and should be removed once we have better configuration objects.
[ "Converts", "the", "values", "in", "the", "map", "to", "the", "requested", "types", ".", "This", "has", "been", "copied", "from", "the", "Graylog", "web", "interface", "and", "should", "be", "removed", "once", "we", "have", "better", "configuration", "object...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/utilities/ConfigurationMapConverter.java#L33-L83
14,817
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/searches/Searches.java
Searches.extractStreamId
public static Optional<String> extractStreamId(String filter) { if (isNullOrEmpty(filter)) { return Optional.empty(); } final Matcher streamIdMatcher = filterStreamIdPattern.matcher(filter); if (streamIdMatcher.find()) { return Optional.of(streamIdMatcher.group(2)...
java
public static Optional<String> extractStreamId(String filter) { if (isNullOrEmpty(filter)) { return Optional.empty(); } final Matcher streamIdMatcher = filterStreamIdPattern.matcher(filter); if (streamIdMatcher.find()) { return Optional.of(streamIdMatcher.group(2)...
[ "public", "static", "Optional", "<", "String", ">", "extractStreamId", "(", "String", "filter", ")", "{", "if", "(", "isNullOrEmpty", "(", "filter", ")", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "final", "Matcher", "streamIdMatcher...
Extracts the last stream id from the filter string passed as part of the elasticsearch query. This is used later to pass to possibly existing message decorators for stream-specific configurations. The assumption is that usually (when listing/searching messages for a stream) only a single stream filter is passed. When ...
[ "Extracts", "the", "last", "stream", "id", "from", "the", "filter", "string", "passed", "as", "part", "of", "the", "elasticsearch", "query", ".", "This", "is", "used", "later", "to", "pass", "to", "possibly", "existing", "message", "decorators", "for", "stre...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/searches/Searches.java#L880-L889
14,818
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Rule.java
Rule.invokableCopy
public Rule invokableCopy(FunctionRegistry functionRegistry) { final Builder builder = toBuilder(); final Class<? extends GeneratedRule> ruleClass = generatedRuleClass(); if (ruleClass != null) { try { //noinspection unchecked final Set<Constructor> co...
java
public Rule invokableCopy(FunctionRegistry functionRegistry) { final Builder builder = toBuilder(); final Class<? extends GeneratedRule> ruleClass = generatedRuleClass(); if (ruleClass != null) { try { //noinspection unchecked final Set<Constructor> co...
[ "public", "Rule", "invokableCopy", "(", "FunctionRegistry", "functionRegistry", ")", "{", "final", "Builder", "builder", "=", "toBuilder", "(", ")", ";", "final", "Class", "<", "?", "extends", "GeneratedRule", ">", "ruleClass", "=", "generatedRuleClass", "(", ")...
Creates a copy of this Rule with a new instance of the generated rule class if present. This prevents sharing instances across threads, which is not supported for performance reasons. Otherwise the generated code would need to be thread safe, adding to the runtime overhead. Instead we buy speed by spending more memory...
[ "Creates", "a", "copy", "of", "this", "Rule", "with", "a", "new", "instance", "of", "the", "generated", "rule", "class", "if", "present", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Rule.java#L178-L193
14,819
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePoller.java
IndexFieldTypePoller.pollIndex
public Optional<IndexFieldTypesDTO> pollIndex(final String indexName, final String indexSetId) { final GetMapping getMapping = new GetMapping.Builder() .addIndex(indexName) .build(); final JestResult result; try (final Timer.Context ignored = pollTimer.time()) { ...
java
public Optional<IndexFieldTypesDTO> pollIndex(final String indexName, final String indexSetId) { final GetMapping getMapping = new GetMapping.Builder() .addIndex(indexName) .build(); final JestResult result; try (final Timer.Context ignored = pollTimer.time()) { ...
[ "public", "Optional", "<", "IndexFieldTypesDTO", ">", "pollIndex", "(", "final", "String", "indexName", ",", "final", "String", "indexSetId", ")", "{", "final", "GetMapping", "getMapping", "=", "new", "GetMapping", ".", "Builder", "(", ")", ".", "addIndex", "(...
Returns the index field types for the given index. @param indexName index name to poll types for @param indexSetId index set ID of the given index @return the polled index field type data for the given index
[ "Returns", "the", "index", "field", "types", "for", "the", "given", "index", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePoller.java#L95-L134
14,820
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseHeader
public static NetFlowV9Header parseHeader(ByteBuf bb) { final int version = bb.readUnsignedShort(); if (version != 9) { throw new InvalidFlowVersionException(version); } final int count = bb.readUnsignedShort(); final long sysUptime = bb.readUnsignedInt(); fi...
java
public static NetFlowV9Header parseHeader(ByteBuf bb) { final int version = bb.readUnsignedShort(); if (version != 9) { throw new InvalidFlowVersionException(version); } final int count = bb.readUnsignedShort(); final long sysUptime = bb.readUnsignedInt(); fi...
[ "public", "static", "NetFlowV9Header", "parseHeader", "(", "ByteBuf", "bb", ")", "{", "final", "int", "version", "=", "bb", ".", "readUnsignedShort", "(", ")", ";", "if", "(", "version", "!=", "9", ")", "{", "throw", "new", "InvalidFlowVersionException", "("...
Flow Header Format <pre> | 0-1 | version | ...
[ "Flow", "Header", "Format" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L95-L108
14,821
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseTemplates
public static List<NetFlowV9Template> parseTemplates(ByteBuf bb, NetFlowV9FieldTypeRegistry typeRegistry) { final ImmutableList.Builder<NetFlowV9Template> templates = ImmutableList.builder(); int len = bb.readUnsignedShort(); int p = 4; // flow set id and length field itself while (p < ...
java
public static List<NetFlowV9Template> parseTemplates(ByteBuf bb, NetFlowV9FieldTypeRegistry typeRegistry) { final ImmutableList.Builder<NetFlowV9Template> templates = ImmutableList.builder(); int len = bb.readUnsignedShort(); int p = 4; // flow set id and length field itself while (p < ...
[ "public", "static", "List", "<", "NetFlowV9Template", ">", "parseTemplates", "(", "ByteBuf", "bb", ",", "NetFlowV9FieldTypeRegistry", "typeRegistry", ")", "{", "final", "ImmutableList", ".", "Builder", "<", "NetFlowV9Template", ">", "templates", "=", "ImmutableList", ...
Template FlowSet Format <pre> | FIELD | DESCRIPTION ...
[ "Template", "FlowSet", "Format" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L124-L136
14,822
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseTemplatesShallow
public static List<Map.Entry<Integer, byte[]>> parseTemplatesShallow(ByteBuf bb) { final ImmutableList.Builder<Map.Entry<Integer, byte[]>> templates = ImmutableList.builder(); int len = bb.readUnsignedShort(); int p = 4; // flow set id and length field itself while (p < len) { ...
java
public static List<Map.Entry<Integer, byte[]>> parseTemplatesShallow(ByteBuf bb) { final ImmutableList.Builder<Map.Entry<Integer, byte[]>> templates = ImmutableList.builder(); int len = bb.readUnsignedShort(); int p = 4; // flow set id and length field itself while (p < len) { ...
[ "public", "static", "List", "<", "Map", ".", "Entry", "<", "Integer", ",", "byte", "[", "]", ">", ">", "parseTemplatesShallow", "(", "ByteBuf", "bb", ")", "{", "final", "ImmutableList", ".", "Builder", "<", "Map", ".", "Entry", "<", "Integer", ",", "by...
Like above, but only retrieves the bytes and template ids
[ "Like", "above", "but", "only", "retrieves", "the", "bytes", "and", "template", "ids" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L163-L185
14,823
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseOptionTemplate
public static NetFlowV9OptionTemplate parseOptionTemplate(ByteBuf bb, NetFlowV9FieldTypeRegistry typeRegistry) { int length = bb.readUnsignedShort(); final int templateId = bb.readUnsignedShort(); int optionScopeLength = bb.readUnsignedShort(); int optionLength = bb.readUnsignedShort();...
java
public static NetFlowV9OptionTemplate parseOptionTemplate(ByteBuf bb, NetFlowV9FieldTypeRegistry typeRegistry) { int length = bb.readUnsignedShort(); final int templateId = bb.readUnsignedShort(); int optionScopeLength = bb.readUnsignedShort(); int optionLength = bb.readUnsignedShort();...
[ "public", "static", "NetFlowV9OptionTemplate", "parseOptionTemplate", "(", "ByteBuf", "bb", ",", "NetFlowV9FieldTypeRegistry", "typeRegistry", ")", "{", "int", "length", "=", "bb", ".", "readUnsignedShort", "(", ")", ";", "final", "int", "templateId", "=", "bb", "...
Options Template Format <pre> | FIELD | DESCRIPTION ...
[ "Options", "Template", "Format" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L212-L249
14,824
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseRecords
public static List<NetFlowV9BaseRecord> parseRecords(ByteBuf bb, Map<Integer, NetFlowV9Template> cache, NetFlowV9OptionTemplate optionTemplate) { List<NetFlowV9BaseRecord> records = new ArrayList<>(); int flowSetId = bb.readUnsignedShort(); int length = bb.readUnsignedShort(); int end = ...
java
public static List<NetFlowV9BaseRecord> parseRecords(ByteBuf bb, Map<Integer, NetFlowV9Template> cache, NetFlowV9OptionTemplate optionTemplate) { List<NetFlowV9BaseRecord> records = new ArrayList<>(); int flowSetId = bb.readUnsignedShort(); int length = bb.readUnsignedShort(); int end = ...
[ "public", "static", "List", "<", "NetFlowV9BaseRecord", ">", "parseRecords", "(", "ByteBuf", "bb", ",", "Map", "<", "Integer", ",", "NetFlowV9Template", ">", "cache", ",", "NetFlowV9OptionTemplate", "optionTemplate", ")", "{", "List", "<", "NetFlowV9BaseRecord", "...
Data FlowSet Format <pre> | FIELD | DESCRIPTION ...
[ "Data", "FlowSet", "Format" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L296-L356
14,825
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java
NetFlowV9Parser.parseRecordShallow
public static Integer parseRecordShallow(ByteBuf bb) { final int start = bb.readerIndex(); int usedTemplateId = bb.readUnsignedShort(); int length = bb.readUnsignedShort(); int end = bb.readerIndex() - 4 + length; bb.readerIndex(end); return usedTemplateId; }
java
public static Integer parseRecordShallow(ByteBuf bb) { final int start = bb.readerIndex(); int usedTemplateId = bb.readUnsignedShort(); int length = bb.readUnsignedShort(); int end = bb.readerIndex() - 4 + length; bb.readerIndex(end); return usedTemplateId; }
[ "public", "static", "Integer", "parseRecordShallow", "(", "ByteBuf", "bb", ")", "{", "final", "int", "start", "=", "bb", ".", "readerIndex", "(", ")", ";", "int", "usedTemplateId", "=", "bb", ".", "readUnsignedShort", "(", ")", ";", "int", "length", "=", ...
like above, but contains all records for the template id as raw bytes
[ "like", "above", "but", "contains", "all", "records", "for", "the", "template", "id", "as", "raw", "bytes" ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/netflow/v9/NetFlowV9Parser.java#L359-L366
14,826
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/migrations/V20170607164210_MigrateReopenedIndicesToAliases.java
V20170607164210_MigrateReopenedIndicesToAliases.upgrade
@Override public void upgrade() { this.indexSetService.findAll() .stream() .map(mongoIndexSetFactory::create) .flatMap(indexSet -> getReopenedIndices(indexSet).stream()) .map(indexName -> { LOG.debug("Marking index {} to be reopened using alias.", indexName); ...
java
@Override public void upgrade() { this.indexSetService.findAll() .stream() .map(mongoIndexSetFactory::create) .flatMap(indexSet -> getReopenedIndices(indexSet).stream()) .map(indexName -> { LOG.debug("Marking index {} to be reopened using alias.", indexName); ...
[ "@", "Override", "public", "void", "upgrade", "(", ")", "{", "this", ".", "indexSetService", ".", "findAll", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "mongoIndexSetFactory", "::", "create", ")", ".", "flatMap", "(", "indexSet", "->", "getReope...
Create aliases for legacy reopened indices.
[ "Create", "aliases", "for", "legacy", "reopened", "indices", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/migrations/V20170607164210_MigrateReopenedIndicesToAliases.java#L74-L82
14,827
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/alerts/AbstractAlertCondition.java
AbstractAlertCondition.buildQueryFilter
protected String buildQueryFilter(String streamId, String query) { checkArgument(streamId != null, "streamId parameter cannot be null"); final String trimmedStreamId = streamId.trim(); checkArgument(!trimmedStreamId.isEmpty(), "streamId parameter cannot be empty"); final StringBuilder...
java
protected String buildQueryFilter(String streamId, String query) { checkArgument(streamId != null, "streamId parameter cannot be null"); final String trimmedStreamId = streamId.trim(); checkArgument(!trimmedStreamId.isEmpty(), "streamId parameter cannot be empty"); final StringBuilder...
[ "protected", "String", "buildQueryFilter", "(", "String", "streamId", ",", "String", "query", ")", "{", "checkArgument", "(", "streamId", "!=", "null", ",", "\"streamId parameter cannot be null\"", ")", ";", "final", "String", "trimmedStreamId", "=", "streamId", "."...
Combines the given stream ID and query string into a single filter string. @param streamId the stream ID @param query the query string (might be null or empty) @return the combined filter string
[ "Combines", "the", "given", "stream", "ID", "and", "query", "string", "into", "a", "single", "filter", "string", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/alerts/AbstractAlertCondition.java#L170-L187
14,828
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/inputs/syslog/tcp/SyslogOctetCountFrameDecoder.java
SyslogOctetCountFrameDecoder.findFrameSizeValueLength
private int findFrameSizeValueLength(final ByteBuf buffer) { final int readerIndex = buffer.readerIndex(); int index = buffer.forEachByte(BYTE_PROCESSOR); if (index >= 0) { return index - readerIndex; } else { return -1; } }
java
private int findFrameSizeValueLength(final ByteBuf buffer) { final int readerIndex = buffer.readerIndex(); int index = buffer.forEachByte(BYTE_PROCESSOR); if (index >= 0) { return index - readerIndex; } else { return -1; } }
[ "private", "int", "findFrameSizeValueLength", "(", "final", "ByteBuf", "buffer", ")", "{", "final", "int", "readerIndex", "=", "buffer", ".", "readerIndex", "(", ")", ";", "int", "index", "=", "buffer", ".", "forEachByte", "(", "BYTE_PROCESSOR", ")", ";", "i...
Find the byte length of the frame length value. @param buffer The channel buffer @return The length of the frame length value
[ "Find", "the", "byte", "length", "of", "the", "frame", "length", "value", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/syslog/tcp/SyslogOctetCountFrameDecoder.java#L70-L79
14,829
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/database/MongoConnectionImpl.java
MongoConnectionImpl.connect
@Override public synchronized Mongo connect() { if (m == null) { final String dbName = mongoClientURI.getDatabase(); if (isNullOrEmpty(dbName)) { LOG.error("The MongoDB database name must not be null or empty (mongodb_uri was: {})", mongoClientURI); th...
java
@Override public synchronized Mongo connect() { if (m == null) { final String dbName = mongoClientURI.getDatabase(); if (isNullOrEmpty(dbName)) { LOG.error("The MongoDB database name must not be null or empty (mongodb_uri was: {})", mongoClientURI); th...
[ "@", "Override", "public", "synchronized", "Mongo", "connect", "(", ")", "{", "if", "(", "m", "==", "null", ")", "{", "final", "String", "dbName", "=", "mongoClientURI", ".", "getDatabase", "(", ")", ";", "if", "(", "isNullOrEmpty", "(", "dbName", ")", ...
Connect the instance.
[ "Connect", "the", "instance", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/database/MongoConnectionImpl.java#L67-L100
14,830
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/database/PaginatedDbService.java
PaginatedDbService.getSortBuilder
protected DBSort.SortBuilder getSortBuilder(String order, String field) { DBSort.SortBuilder sortBuilder; if ("desc".equalsIgnoreCase(order)) { sortBuilder = DBSort.desc(field); } else { sortBuilder = DBSort.asc(field); } return sortBuilder; }
java
protected DBSort.SortBuilder getSortBuilder(String order, String field) { DBSort.SortBuilder sortBuilder; if ("desc".equalsIgnoreCase(order)) { sortBuilder = DBSort.desc(field); } else { sortBuilder = DBSort.asc(field); } return sortBuilder; }
[ "protected", "DBSort", ".", "SortBuilder", "getSortBuilder", "(", "String", "order", ",", "String", "field", ")", "{", "DBSort", ".", "SortBuilder", "sortBuilder", ";", "if", "(", "\"desc\"", ".", "equalsIgnoreCase", "(", "order", ")", ")", "{", "sortBuilder",...
Returns a sort builder for the given order and field name. @param order the order. either "asc" or "desc" @param field the field to sort on @return the sort builder
[ "Returns", "a", "sort", "builder", "for", "the", "given", "order", "and", "field", "name", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/database/PaginatedDbService.java#L226-L234
14,831
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/lookup/adapters/DnsLookupDataAdapter.java
DnsLookupDataAdapter.assignMinimumTTL
private void assignMinimumTTL(List<? extends DnsAnswer> dnsAnswers, LookupResult.Builder builder) { if (config.hasOverrideTTL()) { builder.cacheTTL(config.getCacheTTLOverrideMillis()); } else { // Deduce minimum TTL on all TXT records. A TTL will always be returned by DNS server...
java
private void assignMinimumTTL(List<? extends DnsAnswer> dnsAnswers, LookupResult.Builder builder) { if (config.hasOverrideTTL()) { builder.cacheTTL(config.getCacheTTLOverrideMillis()); } else { // Deduce minimum TTL on all TXT records. A TTL will always be returned by DNS server...
[ "private", "void", "assignMinimumTTL", "(", "List", "<", "?", "extends", "DnsAnswer", ">", "dnsAnswers", ",", "LookupResult", ".", "Builder", "builder", ")", "{", "if", "(", "config", ".", "hasOverrideTTL", "(", ")", ")", "{", "builder", ".", "cacheTTL", "...
Assigns the minimum TTL found in the supplied DnsAnswers. The minimum makes sense, because this is the least amount of time that at least one of the records is valid for.
[ "Assigns", "the", "minimum", "TTL", "found", "in", "the", "supplied", "DnsAnswers", ".", "The", "minimum", "makes", "sense", "because", "this", "is", "the", "least", "amount", "of", "time", "that", "at", "least", "one", "of", "the", "records", "is", "valid...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/lookup/adapters/DnsLookupDataAdapter.java#L373-L383
14,832
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/contentpacks/ContentPackInstallationPersistenceService.java
ContentPackInstallationPersistenceService.countInstallationOfEntityById
public long countInstallationOfEntityById(ModelId entityId) { final String field = String.format(Locale.ROOT, "%s.%s", ContentPackInstallation.FIELD_ENTITIES, NativeEntityDescriptor.FIELD_META_ID); return dbCollection.getCount(DBQuery.is(field, entityId)); }
java
public long countInstallationOfEntityById(ModelId entityId) { final String field = String.format(Locale.ROOT, "%s.%s", ContentPackInstallation.FIELD_ENTITIES, NativeEntityDescriptor.FIELD_META_ID); return dbCollection.getCount(DBQuery.is(field, entityId)); }
[ "public", "long", "countInstallationOfEntityById", "(", "ModelId", "entityId", ")", "{", "final", "String", "field", "=", "String", ".", "format", "(", "Locale", ".", "ROOT", ",", "\"%s.%s\"", ",", "ContentPackInstallation", ".", "FIELD_ENTITIES", ",", "NativeEnti...
Returns the number of installations the given content pack entity ID is used in. @param entityId the native entity ID @return number of installations
[ "Returns", "the", "number", "of", "installations", "the", "given", "content", "pack", "entity", "ID", "is", "used", "in", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/contentpacks/ContentPackInstallationPersistenceService.java#L139-L143
14,833
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Message.java
Message.addStream
public void addStream(Stream stream) { indexSets.add(stream.getIndexSet()); if (streams.add(stream)) { sizeCounter.inc(8); if (LOG.isTraceEnabled()) { LOG.trace("[Message size update][{}] stream added: {}", getId(), sizeCounter.getCount()); } }...
java
public void addStream(Stream stream) { indexSets.add(stream.getIndexSet()); if (streams.add(stream)) { sizeCounter.inc(8); if (LOG.isTraceEnabled()) { LOG.trace("[Message size update][{}] stream added: {}", getId(), sizeCounter.getCount()); } }...
[ "public", "void", "addStream", "(", "Stream", "stream", ")", "{", "indexSets", ".", "add", "(", "stream", ".", "getIndexSet", "(", ")", ")", ";", "if", "(", "streams", ".", "add", "(", "stream", ")", ")", "{", "sizeCounter", ".", "inc", "(", "8", "...
Assign the given stream to this message. @param stream the stream to route this message into
[ "Assign", "the", "given", "stream", "to", "this", "message", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Message.java#L567-L575
14,834
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Message.java
Message.removeStream
public boolean removeStream(Stream stream) { final boolean removed = streams.remove(stream); if (removed) { indexSets.clear(); for (Stream s : streams) { indexSets.add(s.getIndexSet()); } sizeCounter.dec(8); if (LOG.isTraceEnab...
java
public boolean removeStream(Stream stream) { final boolean removed = streams.remove(stream); if (removed) { indexSets.clear(); for (Stream s : streams) { indexSets.add(s.getIndexSet()); } sizeCounter.dec(8); if (LOG.isTraceEnab...
[ "public", "boolean", "removeStream", "(", "Stream", "stream", ")", "{", "final", "boolean", "removed", "=", "streams", ".", "remove", "(", "stream", ")", ";", "if", "(", "removed", ")", "{", "indexSets", ".", "clear", "(", ")", ";", "for", "(", "Stream...
Remove the stream assignment from this message. @param stream the stream assignment to remove this message from @return <tt>true</tt> if this message was assigned to the stream
[ "Remove", "the", "stream", "assignment", "from", "this", "message", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Message.java#L592-L607
14,835
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/searches/timeranges/TimeRanges.java
TimeRanges.toSeconds
public static int toSeconds(TimeRange timeRange) { if (timeRange.getFrom() == null || timeRange.getTo() == null) { return 0; } try { return Seconds.secondsBetween(timeRange.getFrom(), timeRange.getTo()).getSeconds(); } catch (IllegalArgumentException e) { ...
java
public static int toSeconds(TimeRange timeRange) { if (timeRange.getFrom() == null || timeRange.getTo() == null) { return 0; } try { return Seconds.secondsBetween(timeRange.getFrom(), timeRange.getTo()).getSeconds(); } catch (IllegalArgumentException e) { ...
[ "public", "static", "int", "toSeconds", "(", "TimeRange", "timeRange", ")", "{", "if", "(", "timeRange", ".", "getFrom", "(", ")", "==", "null", "||", "timeRange", ".", "getTo", "(", ")", "==", "null", ")", "{", "return", "0", ";", "}", "try", "{", ...
Calculate the number of seconds in the given time range. @param timeRange the {@link TimeRange} @return the number of seconds in the given time range or 0 if an error occurred.
[ "Calculate", "the", "number", "of", "seconds", "in", "the", "given", "time", "range", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/searches/timeranges/TimeRanges.java#L32-L42
14,836
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java
IndexFieldTypePollerPeriodical.handleIndexSetCreation
@Subscribe public void handleIndexSetCreation(final IndexSetCreatedEvent event) { final String indexSetId = event.indexSet().id(); // We are NOT using IndexSetRegistry#get(String) here because of this: https://github.com/Graylog2/graylog2-server/issues/4625 final Optional<IndexSetConfig> opt...
java
@Subscribe public void handleIndexSetCreation(final IndexSetCreatedEvent event) { final String indexSetId = event.indexSet().id(); // We are NOT using IndexSetRegistry#get(String) here because of this: https://github.com/Graylog2/graylog2-server/issues/4625 final Optional<IndexSetConfig> opt...
[ "@", "Subscribe", "public", "void", "handleIndexSetCreation", "(", "final", "IndexSetCreatedEvent", "event", ")", "{", "final", "String", "indexSetId", "=", "event", ".", "indexSet", "(", ")", ".", "id", "(", ")", ";", "// We are NOT using IndexSetRegistry#get(Strin...
Creates a new field type polling job for the newly created index set. @param event index set creation event
[ "Creates", "a", "new", "field", "type", "polling", "job", "for", "the", "newly", "created", "index", "set", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java#L138-L149
14,837
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java
IndexFieldTypePollerPeriodical.handleIndexSetDeletion
@Subscribe public void handleIndexSetDeletion(final IndexSetDeletedEvent event) { final String indexSetId = event.id(); LOG.debug("Disable field type updating for index set <{}>", indexSetId); cancel(futures.remove(indexSetId)); }
java
@Subscribe public void handleIndexSetDeletion(final IndexSetDeletedEvent event) { final String indexSetId = event.id(); LOG.debug("Disable field type updating for index set <{}>", indexSetId); cancel(futures.remove(indexSetId)); }
[ "@", "Subscribe", "public", "void", "handleIndexSetDeletion", "(", "final", "IndexSetDeletedEvent", "event", ")", "{", "final", "String", "indexSetId", "=", "event", ".", "id", "(", ")", ";", "LOG", ".", "debug", "(", "\"Disable field type updating for index set <{}...
Removes the field type polling job for the now deleted index set. @param event index set deletion event
[ "Removes", "the", "field", "type", "polling", "job", "for", "the", "now", "deleted", "index", "set", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java#L155-L161
14,838
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java
IndexFieldTypePollerPeriodical.handleIndexDeletion
@Subscribe public void handleIndexDeletion(final IndicesDeletedEvent event) { event.indices().forEach(indexName -> { LOG.debug("Removing field type information for deleted index <{}>", indexName); dbService.delete(indexName); }); }
java
@Subscribe public void handleIndexDeletion(final IndicesDeletedEvent event) { event.indices().forEach(indexName -> { LOG.debug("Removing field type information for deleted index <{}>", indexName); dbService.delete(indexName); }); }
[ "@", "Subscribe", "public", "void", "handleIndexDeletion", "(", "final", "IndicesDeletedEvent", "event", ")", "{", "event", ".", "indices", "(", ")", ".", "forEach", "(", "indexName", "->", "{", "LOG", ".", "debug", "(", "\"Removing field type information for dele...
Removes the index field type data for the deleted index. @param event index deletion event
[ "Removes", "the", "index", "field", "type", "data", "for", "the", "deleted", "index", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java#L167-L173
14,839
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java
IndexFieldTypePollerPeriodical.schedule
private void schedule(final IndexSet indexSet) { final String indexSetId = indexSet.getConfig().id(); final String indexSetTitle = indexSet.getConfig().title(); final Duration refreshInterval = indexSet.getConfig().fieldTypeRefreshInterval(); if (Duration.ZERO.equals(refreshInterval)) {...
java
private void schedule(final IndexSet indexSet) { final String indexSetId = indexSet.getConfig().id(); final String indexSetTitle = indexSet.getConfig().title(); final Duration refreshInterval = indexSet.getConfig().fieldTypeRefreshInterval(); if (Duration.ZERO.equals(refreshInterval)) {...
[ "private", "void", "schedule", "(", "final", "IndexSet", "indexSet", ")", "{", "final", "String", "indexSetId", "=", "indexSet", ".", "getConfig", "(", ")", ".", "id", "(", ")", ";", "final", "String", "indexSetTitle", "=", "indexSet", ".", "getConfig", "(...
Creates a new polling job for the given index set to keep the active write index information up to date. @param indexSet index set
[ "Creates", "a", "new", "polling", "job", "for", "the", "given", "index", "set", "to", "keep", "the", "active", "write", "index", "information", "up", "to", "date", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java#L179-L217
14,840
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/shared/plugins/PluginProperties.java
PluginProperties.fromJarFile
public static PluginProperties fromJarFile(final String filename) { final Properties properties = new Properties(); try { final JarFile jarFile = new JarFile(requireNonNull(filename)); final Optional<String> propertiesPath = getPropertiesPath(jarFile); if (properties...
java
public static PluginProperties fromJarFile(final String filename) { final Properties properties = new Properties(); try { final JarFile jarFile = new JarFile(requireNonNull(filename)); final Optional<String> propertiesPath = getPropertiesPath(jarFile); if (properties...
[ "public", "static", "PluginProperties", "fromJarFile", "(", "final", "String", "filename", ")", "{", "final", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "try", "{", "final", "JarFile", "jarFile", "=", "new", "JarFile", "(", "requireNo...
Loads the Graylog plugin properties file from the given JAR file. The path to the properties file resource inside the JAR file is stored in the "Graylog-Plugin-Properties-Path" attribute of the JAR manifest. (Example: {@code org.graylog.plugins.graylog-plugin-map-widget}) If the plugin properties file does not exist ...
[ "Loads", "the", "Graylog", "plugin", "properties", "file", "from", "the", "given", "JAR", "file", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/shared/plugins/PluginProperties.java#L58-L79
14,841
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/cluster/Cluster.java
Cluster.isConnected
public boolean isConnected() { final Health request = new Health.Builder() .local() .timeout(Ints.saturatedCast(requestTimeout.toSeconds())) .build(); try { final JestResult result = JestUtils.execute(jestClient, request, () -> "Couldn't check...
java
public boolean isConnected() { final Health request = new Health.Builder() .local() .timeout(Ints.saturatedCast(requestTimeout.toSeconds())) .build(); try { final JestResult result = JestUtils.execute(jestClient, request, () -> "Couldn't check...
[ "public", "boolean", "isConnected", "(", ")", "{", "final", "Health", "request", "=", "new", "Health", ".", "Builder", "(", ")", ".", "local", "(", ")", ".", "timeout", "(", "Ints", ".", "saturatedCast", "(", "requestTimeout", ".", "toSeconds", "(", ")",...
Check if Elasticsearch is available and that there are data nodes in the cluster. @return {@code true} if the Elasticsearch client is up and the cluster contains data nodes, {@code false} otherwise
[ "Check", "if", "Elasticsearch", "is", "available", "and", "that", "there", "are", "data", "nodes", "in", "the", "cluster", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/cluster/Cluster.java#L165-L181
14,842
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/cluster/Cluster.java
Cluster.waitForConnectedAndDeflectorHealthy
public void waitForConnectedAndDeflectorHealthy(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { LOG.debug("Waiting until the write-active index is healthy again, checking once per second."); final CountDownLatch latch = new CountDownLatch(1); final ScheduledFuture<?...
java
public void waitForConnectedAndDeflectorHealthy(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { LOG.debug("Waiting until the write-active index is healthy again, checking once per second."); final CountDownLatch latch = new CountDownLatch(1); final ScheduledFuture<?...
[ "public", "void", "waitForConnectedAndDeflectorHealthy", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "LOG", ".", "debug", "(", "\"Waiting until the write-active index is healthy again, checking once per s...
Blocks until the Elasticsearch cluster and current write index is healthy again or the given timeout fires. @param timeout the timeout value @param unit the timeout unit @throws InterruptedException @throws TimeoutException
[ "Blocks", "until", "the", "Elasticsearch", "cluster", "and", "current", "write", "index", "is", "healthy", "again", "or", "the", "given", "timeout", "fires", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/cluster/Cluster.java#L215-L235
14,843
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/system/shutdown/GracefulShutdownService.java
GracefulShutdownService.register
public void register(GracefulShutdownHook shutdownHook) { if (isShuttingDown.get()) { // Avoid any changes to the shutdown hooks set when the shutdown is already in progress throw new IllegalStateException("Couldn't register shutdown hook because shutdown is already in progress"); ...
java
public void register(GracefulShutdownHook shutdownHook) { if (isShuttingDown.get()) { // Avoid any changes to the shutdown hooks set when the shutdown is already in progress throw new IllegalStateException("Couldn't register shutdown hook because shutdown is already in progress"); ...
[ "public", "void", "register", "(", "GracefulShutdownHook", "shutdownHook", ")", "{", "if", "(", "isShuttingDown", ".", "get", "(", ")", ")", "{", "// Avoid any changes to the shutdown hooks set when the shutdown is already in progress", "throw", "new", "IllegalStateException"...
Register a shutdown hook with the service. @param shutdownHook a class that implements {@link GracefulShutdownHook} @throws IllegalStateException if the server shutdown is already in progress and the hook cannot be registered @throws NullPointerException if the shutdown hook argument is null
[ "Register", "a", "shutdown", "hook", "with", "the", "service", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/system/shutdown/GracefulShutdownService.java#L104-L110
14,844
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/web/PluginAssets.java
PluginAssets.sortedJsFiles
List<String> sortedJsFiles() { return jsFiles().stream() .sorted((file1, file2) -> { // Vendor JS scripts go first if (vendorJsFiles.contains(file1)) { return -1; } if (vendorJsFiles.contains(...
java
List<String> sortedJsFiles() { return jsFiles().stream() .sorted((file1, file2) -> { // Vendor JS scripts go first if (vendorJsFiles.contains(file1)) { return -1; } if (vendorJsFiles.contains(...
[ "List", "<", "String", ">", "sortedJsFiles", "(", ")", "{", "return", "jsFiles", "(", ")", ".", "stream", "(", ")", ".", "sorted", "(", "(", "file1", ",", "file2", ")", "->", "{", "// Vendor JS scripts go first", "if", "(", "vendorJsFiles", ".", "contain...
Sort JS files in the intended load order, so templates don't need to care about it.
[ "Sort", "JS", "files", "in", "the", "intended", "load", "order", "so", "templates", "don", "t", "need", "to", "care", "about", "it", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/web/PluginAssets.java#L102-L133
14,845
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java
Graphs.singletonDirectedGraph
public static <N> ImmutableGraph<N> singletonDirectedGraph(N node) { final MutableGraph<N> graph = GraphBuilder.directed().build(); graph.addNode(node); return ImmutableGraph.copyOf(graph); }
java
public static <N> ImmutableGraph<N> singletonDirectedGraph(N node) { final MutableGraph<N> graph = GraphBuilder.directed().build(); graph.addNode(node); return ImmutableGraph.copyOf(graph); }
[ "public", "static", "<", "N", ">", "ImmutableGraph", "<", "N", ">", "singletonDirectedGraph", "(", "N", "node", ")", "{", "final", "MutableGraph", "<", "N", ">", "graph", "=", "GraphBuilder", ".", "directed", "(", ")", ".", "build", "(", ")", ";", "gra...
Returns an immutable directed graph, containing only the specified node. @param node The single node in the returned graph @param <N> The class of the nodes @return an immutable directed graph with a single node
[ "Returns", "an", "immutable", "directed", "graph", "containing", "only", "the", "specified", "node", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java#L73-L77
14,846
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java
Graphs.singletonUndirectedGraph
public static <N> ImmutableGraph<N> singletonUndirectedGraph(N node) { final MutableGraph<N> graph = GraphBuilder.undirected().build(); graph.addNode(node); return ImmutableGraph.copyOf(graph); }
java
public static <N> ImmutableGraph<N> singletonUndirectedGraph(N node) { final MutableGraph<N> graph = GraphBuilder.undirected().build(); graph.addNode(node); return ImmutableGraph.copyOf(graph); }
[ "public", "static", "<", "N", ">", "ImmutableGraph", "<", "N", ">", "singletonUndirectedGraph", "(", "N", "node", ")", "{", "final", "MutableGraph", "<", "N", ">", "graph", "=", "GraphBuilder", ".", "undirected", "(", ")", ".", "build", "(", ")", ";", ...
Returns an immutable undirected graph, containing only the specified node. @param node The single node in the returned graph @param <N> The class of the nodes @return an immutable undirected graph with a single node
[ "Returns", "an", "immutable", "undirected", "graph", "containing", "only", "the", "specified", "node", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java#L86-L90
14,847
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java
Graphs.singletonGraph
public static <N> ImmutableGraph<N> singletonGraph(Graph<N> graph, N node) { final MutableGraph<N> mutableGraph = GraphBuilder.from(graph).build(); mutableGraph.addNode(node); return ImmutableGraph.copyOf(mutableGraph); }
java
public static <N> ImmutableGraph<N> singletonGraph(Graph<N> graph, N node) { final MutableGraph<N> mutableGraph = GraphBuilder.from(graph).build(); mutableGraph.addNode(node); return ImmutableGraph.copyOf(mutableGraph); }
[ "public", "static", "<", "N", ">", "ImmutableGraph", "<", "N", ">", "singletonGraph", "(", "Graph", "<", "N", ">", "graph", ",", "N", "node", ")", "{", "final", "MutableGraph", "<", "N", ">", "mutableGraph", "=", "GraphBuilder", ".", "from", "(", "grap...
Returns an immutable graph, containing only the specified node. @param graph The graph to use as template for the created graph @param node The single node in the returned graph @param <N> The class of the nodes @return an immutable graph with a single node @see GraphBuilder#from(Graph)
[ "Returns", "an", "immutable", "graph", "containing", "only", "the", "specified", "node", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java#L101-L105
14,848
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java
Graphs.merge
public static <N> void merge(MutableGraph<N> graph1, Graph<N> graph2) { for (N node : graph2.nodes()) { graph1.addNode(node); } for (EndpointPair<N> edge : graph2.edges()) { graph1.putEdge(edge.nodeU(), edge.nodeV()); } }
java
public static <N> void merge(MutableGraph<N> graph1, Graph<N> graph2) { for (N node : graph2.nodes()) { graph1.addNode(node); } for (EndpointPair<N> edge : graph2.edges()) { graph1.putEdge(edge.nodeU(), edge.nodeV()); } }
[ "public", "static", "<", "N", ">", "void", "merge", "(", "MutableGraph", "<", "N", ">", "graph1", ",", "Graph", "<", "N", ">", "graph2", ")", "{", "for", "(", "N", "node", ":", "graph2", ".", "nodes", "(", ")", ")", "{", "graph1", ".", "addNode",...
Merge all nodes and edges of two graphs. @param graph1 A {@link MutableGraph} into which all nodes and edges of {@literal graph2} will be merged @param graph2 The {@link Graph} whose nodes and edges will be merged into {@literal graph1} @param <N> The class of the nodes
[ "Merge", "all", "nodes", "and", "edges", "of", "two", "graphs", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/utilities/Graphs.java#L114-L121
14,849
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java
LdapConnector.normalizedDn
@Nullable private String normalizedDn(String dn) { if (isNullOrEmpty(dn)) { return dn; } else { try { return new Dn(dn).getNormName(); } catch (LdapInvalidDnException e) { LOG.debug("Invalid DN", e); return dn; ...
java
@Nullable private String normalizedDn(String dn) { if (isNullOrEmpty(dn)) { return dn; } else { try { return new Dn(dn).getNormName(); } catch (LdapInvalidDnException e) { LOG.debug("Invalid DN", e); return dn; ...
[ "@", "Nullable", "private", "String", "normalizedDn", "(", "String", "dn", ")", "{", "if", "(", "isNullOrEmpty", "(", "dn", ")", ")", "{", "return", "dn", ";", "}", "else", "{", "try", "{", "return", "new", "Dn", "(", "dn", ")", ".", "getNormName", ...
When the given string is a DN, the method ensures that the DN gets normalized so it can be used in string comparison. If the string is not a DN, the method just returns it. Examples: String is a DN: input = "cn=John Doe, ou=groups, ou=system" output = "cn=John Doe,ou=groups,ou=system" String is not a DN: input = ...
[ "When", "the", "given", "string", "is", "a", "DN", "the", "method", "ensures", "that", "the", "DN", "gets", "normalized", "so", "it", "can", "be", "used", "in", "string", "comparison", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/security/ldap/LdapConnector.java#L325-L337
14,850
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/inputs/converters/NumericConverter.java
NumericConverter.convert
@Override public Object convert(String value) { if (value == null || value.isEmpty()) { return value; } Object result = Ints.tryParse(value); if (result != null) { return result; } result = Longs.tryParse(value); if (result != null)...
java
@Override public Object convert(String value) { if (value == null || value.isEmpty()) { return value; } Object result = Ints.tryParse(value); if (result != null) { return result; } result = Longs.tryParse(value); if (result != null)...
[ "@", "Override", "public", "Object", "convert", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ")", ")", "{", "return", "value", ";", "}", "Object", "result", "=", "Ints", ".", "tryParse", "(",...
Attempts to convert the provided string value to a numeric type, trying Integer, Long and Double in order until successful.
[ "Attempts", "to", "convert", "the", "provided", "string", "value", "to", "a", "numeric", "type", "trying", "Integer", "Long", "and", "Double", "in", "order", "until", "successful", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/converters/NumericConverter.java#L39-L64
14,851
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java
GELFMessage.getJSON
public String getJSON(long maxBytes) { try { switch (getGELFType()) { case ZLIB: return Tools.decompressZlib(payload, maxBytes); case GZIP: return Tools.decompressGzip(payload, maxBytes); case UNCOMPRESSED: ...
java
public String getJSON(long maxBytes) { try { switch (getGELFType()) { case ZLIB: return Tools.decompressZlib(payload, maxBytes); case GZIP: return Tools.decompressGzip(payload, maxBytes); case UNCOMPRESSED: ...
[ "public", "String", "getJSON", "(", "long", "maxBytes", ")", "{", "try", "{", "switch", "(", "getGELFType", "(", ")", ")", "{", "case", "ZLIB", ":", "return", "Tools", ".", "decompressZlib", "(", "payload", ",", "maxBytes", ")", ";", "case", "GZIP", ":...
Return the JSON payload of the GELF message. @param maxBytes The maximum number of bytes to read from a compressed GELF payload. {@code -1} means unlimited. @return The extracted JSON payload of the GELF message. @see Tools#decompressGzip(byte[], long) @see Tools#decompressZlib(byte[], long)
[ "Return", "the", "JSON", "payload", "of", "the", "GELF", "message", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java#L70-L89
14,852
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/MongoFieldTypeLookup.java
MongoFieldTypeLookup.get
@Override public Map<String, FieldTypes> get(final Collection<String> fieldNames, Collection<String> indexNames) { // Shortcut - if we don't select any fields we don't have to do any database query if (fieldNames.isEmpty()) { return Collections.emptyMap(); } // We have t...
java
@Override public Map<String, FieldTypes> get(final Collection<String> fieldNames, Collection<String> indexNames) { // Shortcut - if we don't select any fields we don't have to do any database query if (fieldNames.isEmpty()) { return Collections.emptyMap(); } // We have t...
[ "@", "Override", "public", "Map", "<", "String", ",", "FieldTypes", ">", "get", "(", "final", "Collection", "<", "String", ">", "fieldNames", ",", "Collection", "<", "String", ">", "indexNames", ")", "{", "// Shortcut - if we don't select any fields we don't have to...
Returns a map of field names to the corresponding field types. @param fieldNames a collection of field names to get the types for @param indexNames a collection of index names to filter the results @return map of field names to field type objects
[ "Returns", "a", "map", "of", "field", "names", "to", "the", "corresponding", "field", "types", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/MongoFieldTypeLookup.java#L77-L169
14,853
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/FieldTypeMapper.java
FieldTypeMapper.mapType
public Optional<FieldTypes.Type> mapType(String typeName) { return Optional.ofNullable(TYPE_MAP.get(typeName)); }
java
public Optional<FieldTypes.Type> mapType(String typeName) { return Optional.ofNullable(TYPE_MAP.get(typeName)); }
[ "public", "Optional", "<", "FieldTypes", ".", "Type", ">", "mapType", "(", "String", "typeName", ")", "{", "return", "Optional", ".", "ofNullable", "(", "TYPE_MAP", ".", "get", "(", "typeName", ")", ")", ";", "}" ]
Map the given Elasticsearch field type to a Graylog type. @param typeName Elasticsearch type name @return the Graylog type object
[ "Map", "the", "given", "Elasticsearch", "field", "type", "to", "a", "Graylog", "type", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/FieldTypeMapper.java#L78-L80
14,854
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/inputs/codecs/GelfChunkAggregator.java
GelfChunkAggregator.checkForCompletion
@Nullable private ByteBuf checkForCompletion(GELFMessage gelfMessage) { if (!chunks.isEmpty() && log.isDebugEnabled()) { log.debug("Dumping GELF chunk map [chunks for {} messages]:\n{}", chunks.size(), humanReadableChunkMap()); } final GELFMessageChunk chunk = new GELFMessageChun...
java
@Nullable private ByteBuf checkForCompletion(GELFMessage gelfMessage) { if (!chunks.isEmpty() && log.isDebugEnabled()) { log.debug("Dumping GELF chunk map [chunks for {} messages]:\n{}", chunks.size(), humanReadableChunkMap()); } final GELFMessageChunk chunk = new GELFMessageChun...
[ "@", "Nullable", "private", "ByteBuf", "checkForCompletion", "(", "GELFMessage", "gelfMessage", ")", "{", "if", "(", "!", "chunks", ".", "isEmpty", "(", ")", "&&", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Dumping GELF ...
Checks whether the presented gelf message chunk completes the incoming raw message and returns it if it does. If the message isn't complete, it adds the chunk to the internal buffer and waits for more incoming messages. Outdated chunks are being purged regularly. @param gelfMessage the gelf message chunk @return null ...
[ "Checks", "whether", "the", "presented", "gelf", "message", "chunk", "completes", "the", "incoming", "raw", "message", "and", "returns", "it", "if", "it", "does", ".", "If", "the", "message", "isn", "t", "complete", "it", "adds", "the", "chunk", "to", "the...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/codecs/GelfChunkAggregator.java#L129-L192
14,855
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/inputs/gelf/tcp/GELFTCPInput.java
GELFTCPInput.overrideDelimiter
private static Configuration overrideDelimiter(Configuration configuration) { configuration.setBoolean(TcpTransport.CK_USE_NULL_DELIMITER, true); return configuration; }
java
private static Configuration overrideDelimiter(Configuration configuration) { configuration.setBoolean(TcpTransport.CK_USE_NULL_DELIMITER, true); return configuration; }
[ "private", "static", "Configuration", "overrideDelimiter", "(", "Configuration", "configuration", ")", "{", "configuration", ".", "setBoolean", "(", "TcpTransport", ".", "CK_USE_NULL_DELIMITER", ",", "true", ")", ";", "return", "configuration", ";", "}" ]
has been created with the wrong value.
[ "has", "been", "created", "with", "the", "wrong", "value", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/inputs/gelf/tcp/GELFTCPInput.java#L49-L53
14,856
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java
DnsClient.decodeDnsRecord
private static ADnsAnswer decodeDnsRecord(DnsRecord dnsRecord, boolean includeIpVersion) { if (dnsRecord == null) { return null; } LOG.trace("Attempting to decode DNS record [{}]", dnsRecord); /* Read data from DNS record response. The data is a binary representation of th...
java
private static ADnsAnswer decodeDnsRecord(DnsRecord dnsRecord, boolean includeIpVersion) { if (dnsRecord == null) { return null; } LOG.trace("Attempting to decode DNS record [{}]", dnsRecord); /* Read data from DNS record response. The data is a binary representation of th...
[ "private", "static", "ADnsAnswer", "decodeDnsRecord", "(", "DnsRecord", "dnsRecord", ",", "boolean", "includeIpVersion", ")", "{", "if", "(", "dnsRecord", "==", "null", ")", "{", "return", "null", ";", "}", "LOG", ".", "trace", "(", "\"Attempting to decode DNS r...
Picks out the IP address and TTL from the answer response for each record.
[ "Picks", "out", "the", "IP", "address", "and", "TTL", "from", "the", "answer", "response", "for", "each", "record", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java#L173-L219
14,857
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/utilities/FileInfo.java
FileInfo.forPath
@NotNull public static FileInfo forPath(Path path) { try { final BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class); return FileInfo.builder() .path(path) .key(attributes.fileKey()) .size(...
java
@NotNull public static FileInfo forPath(Path path) { try { final BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class); return FileInfo.builder() .path(path) .key(attributes.fileKey()) .size(...
[ "@", "NotNull", "public", "static", "FileInfo", "forPath", "(", "Path", "path", ")", "{", "try", "{", "final", "BasicFileAttributes", "attributes", "=", "Files", ".", "readAttributes", "(", "path", ",", "BasicFileAttributes", ".", "class", ")", ";", "return", ...
Create a file info for the given path. @param path the path must exist, otherwise an IllegalArgumentException is thrown @return the file info object
[ "Create", "a", "file", "info", "for", "the", "given", "path", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/utilities/FileInfo.java#L73-L87
14,858
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/alarmcallbacks/EmailAlarmCallback.java
EmailAlarmCallback.getConfigurationRequest
private ConfigurationRequest getConfigurationRequest(Map<String, String> userNames) { ConfigurationRequest configurationRequest = new ConfigurationRequest(); configurationRequest.addField(new TextField("sender", "Sender", "[email protected]", "The sender...
java
private ConfigurationRequest getConfigurationRequest(Map<String, String> userNames) { ConfigurationRequest configurationRequest = new ConfigurationRequest(); configurationRequest.addField(new TextField("sender", "Sender", "[email protected]", "The sender...
[ "private", "ConfigurationRequest", "getConfigurationRequest", "(", "Map", "<", "String", ",", "String", ">", "userNames", ")", "{", "ConfigurationRequest", "configurationRequest", "=", "new", "ConfigurationRequest", "(", ")", ";", "configurationRequest", ".", "addField"...
I am truly sorry about this, but leaking the user list is not okay...
[ "I", "am", "truly", "sorry", "about", "this", "but", "leaking", "the", "user", "list", "is", "not", "okay", "..." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/alarmcallbacks/EmailAlarmCallback.java#L173-L210
14,859
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java
ThrottleableTransport.updateThrottleState
@Subscribe public void updateThrottleState(ThrottleState throttleState) { // Only run if throttling is enabled. if (!throttlingAllowed) { return; } // check if we are throttled final boolean throttled = determineIfThrottled(throttleState); if (currentlyThr...
java
@Subscribe public void updateThrottleState(ThrottleState throttleState) { // Only run if throttling is enabled. if (!throttlingAllowed) { return; } // check if we are throttled final boolean throttled = determineIfThrottled(throttleState); if (currentlyThr...
[ "@", "Subscribe", "public", "void", "updateThrottleState", "(", "ThrottleState", "throttleState", ")", "{", "// Only run if throttling is enabled.", "if", "(", "!", "throttlingAllowed", ")", "{", "return", ";", "}", "// check if we are throttled", "final", "boolean", "t...
Only executed if the Allow Throttling checkbox is set in the input's configuration. @param throttleState current processing system state
[ "Only", "executed", "if", "the", "Allow", "Throttling", "checkbox", "is", "set", "in", "the", "input", "s", "configuration", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java#L120-L146
14,860
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java
ThrottleableTransport.blockUntilUnthrottled
public boolean blockUntilUnthrottled(long timeout, TimeUnit unit) { // sanity: if there's no latch, don't try to access it if (blockLatch == null) { return false; } // purposely allow interrupts as a means to let the caller check if it should exit its run loop try { ...
java
public boolean blockUntilUnthrottled(long timeout, TimeUnit unit) { // sanity: if there's no latch, don't try to access it if (blockLatch == null) { return false; } // purposely allow interrupts as a means to let the caller check if it should exit its run loop try { ...
[ "public", "boolean", "blockUntilUnthrottled", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "// sanity: if there's no latch, don't try to access it", "if", "(", "blockLatch", "==", "null", ")", "{", "return", "false", ";", "}", "// purposely allow interrupt...
Blocks until the blockLatch is released or until the timeout is exceeded. @param timeout the maximum time to wait @param unit the time unit for the {@code timeout} argument. @return {@code true} if the blockLatch was released before the {@code timeout} elapsed. and {@code false} if the {@code timeout} was ex...
[ "Blocks", "until", "the", "blockLatch", "is", "released", "or", "until", "the", "timeout", "is", "exceeded", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java#L239-L250
14,861
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Tools.java
Tools.getSystemInformation
public static String getSystemInformation() { String ret = System.getProperty("java.vendor"); ret += " " + System.getProperty("java.version"); ret += " on " + System.getProperty("os.name"); ret += " " + System.getProperty("os.version"); return ret; }
java
public static String getSystemInformation() { String ret = System.getProperty("java.vendor"); ret += " " + System.getProperty("java.version"); ret += " on " + System.getProperty("os.name"); ret += " " + System.getProperty("os.version"); return ret; }
[ "public", "static", "String", "getSystemInformation", "(", ")", "{", "String", "ret", "=", "System", ".", "getProperty", "(", "\"java.vendor\"", ")", ";", "ret", "+=", "\" \"", "+", "System", ".", "getProperty", "(", "\"java.version\"", ")", ";", "ret", "+="...
Get a String containing version information of JRE, OS, ... @return Descriptive string of JRE and OS
[ "Get", "a", "String", "containing", "version", "information", "of", "JRE", "OS", "..." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L187-L193
14,862
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Tools.java
Tools.timeFormatterWithOptionalMilliseconds
public static DateTimeFormatter timeFormatterWithOptionalMilliseconds() { // This is the .SSS part DateTimeParser ms = new DateTimeFormatterBuilder() .appendLiteral(".") .appendFractionOfSecond(1, 3) .toParser(); return new DateTimeFormatterBuilde...
java
public static DateTimeFormatter timeFormatterWithOptionalMilliseconds() { // This is the .SSS part DateTimeParser ms = new DateTimeFormatterBuilder() .appendLiteral(".") .appendFractionOfSecond(1, 3) .toParser(); return new DateTimeFormatterBuilde...
[ "public", "static", "DateTimeFormatter", "timeFormatterWithOptionalMilliseconds", "(", ")", "{", "// This is the .SSS part", "DateTimeParser", "ms", "=", "new", "DateTimeFormatterBuilder", "(", ")", ".", "appendLiteral", "(", "\".\"", ")", ".", "appendFractionOfSecond", "...
Accepts our ElasticSearch time formats without milliseconds. @return A DateTimeFormatter suitable to parse an ES_DATE_FORMAT formatted string to a DateTime Object even if it contains no milliseconds.
[ "Accepts", "our", "ElasticSearch", "time", "formats", "without", "milliseconds", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L346-L357
14,863
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Tools.java
Tools.elasticSearchTimeFormatToISO8601
public static String elasticSearchTimeFormatToISO8601(String time) { try { DateTime dt = DateTime.parse(time, ES_DATE_FORMAT_FORMATTER); return getISO8601String(dt); } catch (IllegalArgumentException e) { return time; } }
java
public static String elasticSearchTimeFormatToISO8601(String time) { try { DateTime dt = DateTime.parse(time, ES_DATE_FORMAT_FORMATTER); return getISO8601String(dt); } catch (IllegalArgumentException e) { return time; } }
[ "public", "static", "String", "elasticSearchTimeFormatToISO8601", "(", "String", "time", ")", "{", "try", "{", "DateTime", "dt", "=", "DateTime", ".", "parse", "(", "time", ",", "ES_DATE_FORMAT_FORMATTER", ")", ";", "return", "getISO8601String", "(", "dt", ")", ...
Try to parse a date in ES_DATE_FORMAT format considering it is in UTC and convert it to an ISO8601 date. If an error is encountered in the process, it will return the original string.
[ "Try", "to", "parse", "a", "date", "in", "ES_DATE_FORMAT", "format", "considering", "it", "is", "in", "UTC", "and", "convert", "it", "to", "an", "ISO8601", "date", ".", "If", "an", "error", "is", "encountered", "in", "the", "process", "it", "will", "retu...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L380-L387
14,864
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Tools.java
Tools.silenceUncaughtExceptionsInThisThread
public static void silenceUncaughtExceptionsInThisThread() { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread ignored, Throwable ignored1) { } }); }
java
public static void silenceUncaughtExceptionsInThisThread() { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread ignored, Throwable ignored1) { } }); }
[ "public", "static", "void", "silenceUncaughtExceptionsInThisThread", "(", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "setUncaughtExceptionHandler", "(", "new", "Thread", ".", "UncaughtExceptionHandler", "(", ")", "{", "@", "Override", "public", "void",...
The default uncaught exception handler will print to STDERR, which we don't always want for threads. Using this utility method you can avoid writing to STDERR on a per-thread basis
[ "The", "default", "uncaught", "exception", "handler", "will", "print", "to", "STDERR", "which", "we", "don", "t", "always", "want", "for", "threads", ".", "Using", "this", "utility", "method", "you", "can", "avoid", "writing", "to", "STDERR", "on", "a", "p...
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L622-L628
14,865
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.exists
public boolean exists(String indexName) { try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build()); return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName); } catch (IOException e) { ...
java
public boolean exists(String indexName) { try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build()); return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName); } catch (IOException e) { ...
[ "public", "boolean", "exists", "(", "String", "indexName", ")", "{", "try", "{", "final", "JestResult", "result", "=", "jestClient", ".", "execute", "(", "new", "GetSettings", ".", "Builder", "(", ")", ".", "addIndex", "(", "indexName", ")", ".", "build", ...
Check if a given name is an existing index. @param indexName Name of the index to check presence for. @return {@code true} if indexName is an existing index, {@code false} if it is non-existing or an alias.
[ "Check", "if", "a", "given", "name", "is", "an", "existing", "index", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L275-L282
14,866
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.aliasExists
public boolean aliasExists(String alias) { try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(alias).build()); return result.isSucceeded() && !Iterators.contains(result.getJsonObject().fieldNames(), alias); } catch (IOException e) { ...
java
public boolean aliasExists(String alias) { try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(alias).build()); return result.isSucceeded() && !Iterators.contains(result.getJsonObject().fieldNames(), alias); } catch (IOException e) { ...
[ "public", "boolean", "aliasExists", "(", "String", "alias", ")", "{", "try", "{", "final", "JestResult", "result", "=", "jestClient", ".", "execute", "(", "new", "GetSettings", ".", "Builder", "(", ")", ".", "addIndex", "(", "alias", ")", ".", "build", "...
Check if a given name is an existing alias. @param alias Name of the alias to check presence for. @return {@code true} if alias is an existing alias, {@code false} if it is non-existing or an index.
[ "Check", "if", "a", "given", "name", "is", "an", "existing", "alias", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L290-L297
14,867
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.getIndexNamesAndAliases
@NotNull public Map<String, Set<String>> getIndexNamesAndAliases(String indexPattern) { // only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index, // not the settings or mappings final GetAliases request = new GetAliases.Builder() ...
java
@NotNull public Map<String, Set<String>> getIndexNamesAndAliases(String indexPattern) { // only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index, // not the settings or mappings final GetAliases request = new GetAliases.Builder() ...
[ "@", "NotNull", "public", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "getIndexNamesAndAliases", "(", "String", "indexPattern", ")", "{", "// only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index,", "// no...
Returns index names and their aliases. This only returns indices which actually have an alias.
[ "Returns", "index", "names", "and", "their", "aliases", ".", "This", "only", "returns", "indices", "which", "actually", "have", "an", "alias", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L302-L328
14,868
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.getIndexTemplate
public Map<String, Object> getIndexTemplate(IndexSet indexSet) { final String indexWildcard = indexSet.getIndexWildcard(); final String analyzer = indexSet.getConfig().indexAnalyzer(); return indexMappingFactory.createIndexMapping().messageTemplate(indexWildcard, analyzer); }
java
public Map<String, Object> getIndexTemplate(IndexSet indexSet) { final String indexWildcard = indexSet.getIndexWildcard(); final String analyzer = indexSet.getConfig().indexAnalyzer(); return indexMappingFactory.createIndexMapping().messageTemplate(indexWildcard, analyzer); }
[ "public", "Map", "<", "String", ",", "Object", ">", "getIndexTemplate", "(", "IndexSet", "indexSet", ")", "{", "final", "String", "indexWildcard", "=", "indexSet", ".", "getIndexWildcard", "(", ")", ";", "final", "String", "analyzer", "=", "indexSet", ".", "...
Returns the generated Elasticsearch index template for the given index set. @param indexSet the index set @return the generated index template
[ "Returns", "the", "generated", "Elasticsearch", "index", "template", "for", "the", "given", "index", "set", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L381-L386
14,869
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.indexRangeStatsOfIndex
public IndexRangeStats indexRangeStatsOfIndex(String index) { final FilterAggregationBuilder builder = AggregationBuilders.filter("agg", QueryBuilders.existsQuery(Message.FIELD_TIMESTAMP)) .subAggregation(AggregationBuilders.min("ts_min").field(Message.FIELD_TIMESTAMP)) .subAggre...
java
public IndexRangeStats indexRangeStatsOfIndex(String index) { final FilterAggregationBuilder builder = AggregationBuilders.filter("agg", QueryBuilders.existsQuery(Message.FIELD_TIMESTAMP)) .subAggregation(AggregationBuilders.min("ts_min").field(Message.FIELD_TIMESTAMP)) .subAggre...
[ "public", "IndexRangeStats", "indexRangeStatsOfIndex", "(", "String", "index", ")", "{", "final", "FilterAggregationBuilder", "builder", "=", "AggregationBuilders", ".", "filter", "(", "\"agg\"", ",", "QueryBuilders", ".", "existsQuery", "(", "Message", ".", "FIELD_TI...
Calculate min and max message timestamps in the given index. @param index Name of the index to query. @return the timestamp stats in the given index, or {@code null} if they couldn't be calculated. @see org.elasticsearch.search.aggregations.metrics.stats.Stats
[ "Calculate", "min", "and", "max", "message", "timestamps", "in", "the", "given", "index", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L715-L764
14,870
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/cluster/NodeServiceImpl.java
NodeServiceImpl.markAsAlive
@Override public void markAsAlive(Node node, boolean isMaster, String restTransportAddress) { node.getFields().put("last_seen", Tools.getUTCTimestamp()); node.getFields().put("is_master", isMaster); node.getFields().put("transport_address", restTransportAddress); try { sa...
java
@Override public void markAsAlive(Node node, boolean isMaster, String restTransportAddress) { node.getFields().put("last_seen", Tools.getUTCTimestamp()); node.getFields().put("is_master", isMaster); node.getFields().put("transport_address", restTransportAddress); try { sa...
[ "@", "Override", "public", "void", "markAsAlive", "(", "Node", "node", ",", "boolean", "isMaster", ",", "String", "restTransportAddress", ")", "{", "node", ".", "getFields", "(", ")", ".", "put", "(", "\"last_seen\"", ",", "Tools", ".", "getUTCTimestamp", "(...
Mark this node as alive and probably update some settings that may have changed since last server boot. @param isMaster @param restTransportAddress
[ "Mark", "this", "node", "as", "alive", "and", "probably", "update", "some", "settings", "that", "may", "have", "changed", "since", "last", "server", "boot", "." ]
50b565dcead6e0a372236d5c2f8530dc5726fa9b
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/cluster/NodeServiceImpl.java#L129-L139
14,871
tobato/FastDFS_Client
src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java
BytesUtil.buff2long
public static long buff2long(byte[] bs, int offset) { return (((long) (bs[offset] >= 0 ? bs[offset] : 256 + bs[offset])) << 56) | (((long) (bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1])) << 48) | (((long) (bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]...
java
public static long buff2long(byte[] bs, int offset) { return (((long) (bs[offset] >= 0 ? bs[offset] : 256 + bs[offset])) << 56) | (((long) (bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1])) << 48) | (((long) (bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]...
[ "public", "static", "long", "buff2long", "(", "byte", "[", "]", "bs", ",", "int", "offset", ")", "{", "return", "(", "(", "(", "long", ")", "(", "bs", "[", "offset", "]", ">=", "0", "?", "bs", "[", "offset", "]", ":", "256", "+", "bs", "[", "...
buff convert to long @param bs the buffer (big-endian) @param offset the start position based 0 @return long number
[ "buff", "convert", "to", "long" ]
8e3bfe712f1739028beed7f3a6b2cc4579a231e4
https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java#L42-L51
14,872
tobato/FastDFS_Client
src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java
BytesUtil.buff2int
public static int buff2int(byte[] bs, int offset) { return ((bs[offset] >= 0 ? bs[offset] : 256 + bs[offset]) << 24) | ((bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1]) << 16) | ((bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]) << 8) | (b...
java
public static int buff2int(byte[] bs, int offset) { return ((bs[offset] >= 0 ? bs[offset] : 256 + bs[offset]) << 24) | ((bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1]) << 16) | ((bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]) << 8) | (b...
[ "public", "static", "int", "buff2int", "(", "byte", "[", "]", "bs", ",", "int", "offset", ")", "{", "return", "(", "(", "bs", "[", "offset", "]", ">=", "0", "?", "bs", "[", "offset", "]", ":", "256", "+", "bs", "[", "offset", "]", ")", "<<", ...
buff convert to int @param bs the buffer (big-endian) @param offset the start position based 0 @return int number
[ "buff", "convert", "to", "int" ]
8e3bfe712f1739028beed7f3a6b2cc4579a231e4
https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java#L60-L65
14,873
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleConfig.java
SimpleConfig.parsePeriod
public static Period parsePeriod(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String originalUnitString = getUnits(s); String unitString = originalUnitString; String numberStri...
java
public static Period parsePeriod(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String originalUnitString = getUnits(s); String unitString = originalUnitString; String numberStri...
[ "public", "static", "Period", "parsePeriod", "(", "String", "input", ",", "ConfigOrigin", "originForException", ",", "String", "pathForException", ")", "{", "String", "s", "=", "ConfigImplUtil", ".", "unicodeTrim", "(", "input", ")", ";", "String", "originalUnitSt...
Parses a period string. If no units are specified in the string, it is assumed to be in days. The returned period is in days. The purpose of this function is to implement the period-related methods in the ConfigObject interface. @param input the string to parse @param originForException origin of the value being parse...
[ "Parses", "a", "period", "string", ".", "If", "no", "units", "are", "specified", "in", "the", "string", "it", "is", "assumed", "to", "be", "in", "days", ".", "The", "returned", "period", "is", "in", "days", ".", "The", "purpose", "of", "this", "functio...
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java#L621-L667
14,874
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleConfig.java
SimpleConfig.addMissing
static void addMissing(List<ConfigException.ValidationProblem> accumulator, ConfigValueType refType, Path path, ConfigOrigin origin) { addMissing(accumulator, getDesc(refType), path, origin); }
java
static void addMissing(List<ConfigException.ValidationProblem> accumulator, ConfigValueType refType, Path path, ConfigOrigin origin) { addMissing(accumulator, getDesc(refType), path, origin); }
[ "static", "void", "addMissing", "(", "List", "<", "ConfigException", ".", "ValidationProblem", ">", "accumulator", ",", "ConfigValueType", "refType", ",", "Path", "path", ",", "ConfigOrigin", "origin", ")", "{", "addMissing", "(", "accumulator", ",", "getDesc", ...
JavaBean stuff uses this
[ "JavaBean", "stuff", "uses", "this" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java#L931-L934
14,875
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleConfig.java
SimpleConfig.checkValidObject
private static void checkValidObject(Path path, AbstractConfigObject reference, AbstractConfigObject value, List<ConfigException.ValidationProblem> accumulator) { for (Map.Entry<String, ConfigValue> entry : reference.entrySet()) { String key = entry.getKey(); Pat...
java
private static void checkValidObject(Path path, AbstractConfigObject reference, AbstractConfigObject value, List<ConfigException.ValidationProblem> accumulator) { for (Map.Entry<String, ConfigValue> entry : reference.entrySet()) { String key = entry.getKey(); Pat...
[ "private", "static", "void", "checkValidObject", "(", "Path", "path", ",", "AbstractConfigObject", "reference", ",", "AbstractConfigObject", "value", ",", "List", "<", "ConfigException", ".", "ValidationProblem", ">", "accumulator", ")", "{", "for", "(", "Map", "....
path is null if we're at the root
[ "path", "is", "null", "if", "we", "re", "at", "the", "root" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java#L1002-L1021
14,876
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleConfig.java
SimpleConfig.checkValid
static void checkValid(Path path, ConfigValueType referenceType, AbstractConfigValue value, List<ConfigException.ValidationProblem> accumulator) { if (haveCompatibleTypes(referenceType, value)) { if (referenceType == ConfigValueType.LIST && value instanceof SimpleConfigObject) { ...
java
static void checkValid(Path path, ConfigValueType referenceType, AbstractConfigValue value, List<ConfigException.ValidationProblem> accumulator) { if (haveCompatibleTypes(referenceType, value)) { if (referenceType == ConfigValueType.LIST && value instanceof SimpleConfigObject) { ...
[ "static", "void", "checkValid", "(", "Path", "path", ",", "ConfigValueType", "referenceType", ",", "AbstractConfigValue", "value", ",", "List", "<", "ConfigException", ".", "ValidationProblem", ">", "accumulator", ")", "{", "if", "(", "haveCompatibleTypes", "(", "...
Used by the JavaBean-based validator
[ "Used", "by", "the", "JavaBean", "-", "based", "validator" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java#L1043-L1056
14,877
lightbend/config
config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java
SerializedConfigValue.writeOriginField
private static void writeOriginField(DataOutput out, SerializedField code, Object v) throws IOException { switch (code) { case ORIGIN_DESCRIPTION: out.writeUTF((String) v); break; case ORIGIN_LINE_NUMBER: out.writeInt((Integer) v); brea...
java
private static void writeOriginField(DataOutput out, SerializedField code, Object v) throws IOException { switch (code) { case ORIGIN_DESCRIPTION: out.writeUTF((String) v); break; case ORIGIN_LINE_NUMBER: out.writeInt((Integer) v); brea...
[ "private", "static", "void", "writeOriginField", "(", "DataOutput", "out", ",", "SerializedField", "code", ",", "Object", "v", ")", "throws", "IOException", "{", "switch", "(", "code", ")", "{", "case", "ORIGIN_DESCRIPTION", ":", "out", ".", "writeUTF", "(", ...
outer stream instead of field.data
[ "outer", "stream", "instead", "of", "field", ".", "data" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java#L168-L206
14,878
lightbend/config
config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java
SerializedConfigValue.writeOrigin
static void writeOrigin(DataOutput out, SimpleConfigOrigin origin, SimpleConfigOrigin baseOrigin) throws IOException { Map<SerializedField, Object> m; // to serialize a null origin, we write out no fields at all if (origin != null) m = origin.toFieldsDelta(baseOrigin); ...
java
static void writeOrigin(DataOutput out, SimpleConfigOrigin origin, SimpleConfigOrigin baseOrigin) throws IOException { Map<SerializedField, Object> m; // to serialize a null origin, we write out no fields at all if (origin != null) m = origin.toFieldsDelta(baseOrigin); ...
[ "static", "void", "writeOrigin", "(", "DataOutput", "out", ",", "SimpleConfigOrigin", "origin", ",", "SimpleConfigOrigin", "baseOrigin", ")", "throws", "IOException", "{", "Map", "<", "SerializedField", ",", "Object", ">", "m", ";", "// to serialize a null origin, we ...
not private because we use it to serialize ConfigException
[ "not", "private", "because", "we", "use", "it", "to", "serialize", "ConfigException" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java#L209-L224
14,879
lightbend/config
config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java
SerializedConfigValue.readOrigin
static SimpleConfigOrigin readOrigin(DataInput in, SimpleConfigOrigin baseOrigin) throws IOException { Map<SerializedField, Object> m = new EnumMap<SerializedField, Object>(SerializedField.class); while (true) { Object v = null; SerializedField field = readCode(in); ...
java
static SimpleConfigOrigin readOrigin(DataInput in, SimpleConfigOrigin baseOrigin) throws IOException { Map<SerializedField, Object> m = new EnumMap<SerializedField, Object>(SerializedField.class); while (true) { Object v = null; SerializedField field = readCode(in); ...
[ "static", "SimpleConfigOrigin", "readOrigin", "(", "DataInput", "in", ",", "SimpleConfigOrigin", "baseOrigin", ")", "throws", "IOException", "{", "Map", "<", "SerializedField", ",", "Object", ">", "m", "=", "new", "EnumMap", "<", "SerializedField", ",", "Object", ...
not private because we use it to deserialize ConfigException
[ "not", "private", "because", "we", "use", "it", "to", "deserialize", "ConfigException" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SerializedConfigValue.java#L227-L289
14,880
lightbend/config
config/src/main/java/com/typesafe/config/impl/Token.java
Token.newWithoutOrigin
static Token newWithoutOrigin(TokenType tokenType, String debugString, String tokenText) { return new Token(tokenType, null, tokenText, debugString); }
java
static Token newWithoutOrigin(TokenType tokenType, String debugString, String tokenText) { return new Token(tokenType, null, tokenText, debugString); }
[ "static", "Token", "newWithoutOrigin", "(", "TokenType", "tokenType", ",", "String", "debugString", ",", "String", "tokenText", ")", "{", "return", "new", "Token", "(", "tokenType", ",", "null", ",", "tokenText", ",", "debugString", ")", ";", "}" ]
this is used for singleton tokens like COMMA or OPEN_CURLY
[ "this", "is", "used", "for", "singleton", "tokens", "like", "COMMA", "or", "OPEN_CURLY" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/Token.java#L31-L33
14,881
lightbend/config
config/src/main/java/com/typesafe/config/impl/ResolveContext.java
ResolveContext.restrict
ResolveContext restrict(Path restrictTo) { if (restrictTo == restrictToChild) return this; else return new ResolveContext(memos, options, restrictTo, resolveStack, cycleMarkers); }
java
ResolveContext restrict(Path restrictTo) { if (restrictTo == restrictToChild) return this; else return new ResolveContext(memos, options, restrictTo, resolveStack, cycleMarkers); }
[ "ResolveContext", "restrict", "(", "Path", "restrictTo", ")", "{", "if", "(", "restrictTo", "==", "restrictToChild", ")", "return", "this", ";", "else", "return", "new", "ResolveContext", "(", "memos", ",", "options", ",", "restrictTo", ",", "resolveStack", ",...
restrictTo may be null to unrestrict
[ "restrictTo", "may", "be", "null", "to", "unrestrict" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/ResolveContext.java#L90-L95
14,882
lightbend/config
config/src/main/java/com/typesafe/config/impl/Path.java
Path.hasFunkyChars
static boolean hasFunkyChars(String s) { int length = s.length(); if (length == 0) return false; for (int i = 0; i < length; ++i) { char c = s.charAt(i); if (Character.isLetterOrDigit(c) || c == '-' || c == '_') continue; else ...
java
static boolean hasFunkyChars(String s) { int length = s.length(); if (length == 0) return false; for (int i = 0; i < length; ++i) { char c = s.charAt(i); if (Character.isLetterOrDigit(c) || c == '-' || c == '_') continue; else ...
[ "static", "boolean", "hasFunkyChars", "(", "String", "s", ")", "{", "int", "length", "=", "s", ".", "length", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ...
noise from quotes in the rendered path for average cases
[ "noise", "from", "quotes", "in", "the", "rendered", "path", "for", "average", "cases" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/Path.java#L178-L193
14,883
lightbend/config
config/src/main/java/com/typesafe/config/impl/Parseable.java
Parseable.newReader
public static Parseable newReader(Reader reader, ConfigParseOptions options) { return new ParseableReader(doNotClose(reader), options); }
java
public static Parseable newReader(Reader reader, ConfigParseOptions options) { return new ParseableReader(doNotClose(reader), options); }
[ "public", "static", "Parseable", "newReader", "(", "Reader", "reader", ",", "ConfigParseOptions", "options", ")", "{", "return", "new", "ParseableReader", "(", "doNotClose", "(", "reader", ")", ",", "options", ")", ";", "}" ]
is complete.
[ "is", "complete", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/Parseable.java#L445-L448
14,884
lightbend/config
config/src/main/java/com/typesafe/config/impl/Parseable.java
Parseable.convertResourceName
private static String convertResourceName(Class<?> klass, String resource) { if (resource.startsWith("/")) { // "absolute" resource, chop the slash return resource.substring(1); } else { String className = klass.getName(); int i = className.lastIndexOf('.'...
java
private static String convertResourceName(Class<?> klass, String resource) { if (resource.startsWith("/")) { // "absolute" resource, chop the slash return resource.substring(1); } else { String className = klass.getName(); int i = className.lastIndexOf('.'...
[ "private", "static", "String", "convertResourceName", "(", "Class", "<", "?", ">", "klass", ",", "String", "resource", ")", "{", "if", "(", "resource", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "// \"absolute\" resource, chop the slash", "return", "resourc...
use ClassLoader directly.
[ "use", "ClassLoader", "directly", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/Parseable.java#L807-L824
14,885
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleConfigObject.java
SimpleConfigObject.withOnlyPathOrNull
@Override protected SimpleConfigObject withOnlyPathOrNull(Path path) { String key = path.first(); Path next = path.remainder(); AbstractConfigValue v = value.get(key); if (next != null) { if (v != null && (v instanceof AbstractConfigObject)) { v = ((Abstr...
java
@Override protected SimpleConfigObject withOnlyPathOrNull(Path path) { String key = path.first(); Path next = path.remainder(); AbstractConfigValue v = value.get(key); if (next != null) { if (v != null && (v instanceof AbstractConfigObject)) { v = ((Abstr...
[ "@", "Override", "protected", "SimpleConfigObject", "withOnlyPathOrNull", "(", "Path", "path", ")", "{", "String", "key", "=", "path", ".", "first", "(", ")", ";", "Path", "next", "=", "path", ".", "remainder", "(", ")", ";", "AbstractConfigValue", "v", "=...
"a" object.
[ "a", "object", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleConfigObject.java#L71-L93
14,886
lightbend/config
config/src/main/java/com/typesafe/config/impl/PathParser.java
PathParser.looksUnsafeForFastParser
private static boolean looksUnsafeForFastParser(String s) { boolean lastWasDot = true; // start of path is also a "dot" int len = s.length(); if (s.isEmpty()) return true; if (s.charAt(0) == '.') return true; if (s.charAt(len - 1) == '.') retur...
java
private static boolean looksUnsafeForFastParser(String s) { boolean lastWasDot = true; // start of path is also a "dot" int len = s.length(); if (s.isEmpty()) return true; if (s.charAt(0) == '.') return true; if (s.charAt(len - 1) == '.') retur...
[ "private", "static", "boolean", "looksUnsafeForFastParser", "(", "String", "s", ")", "{", "boolean", "lastWasDot", "=", "true", ";", "// start of path is also a \"dot\"", "int", "len", "=", "s", ".", "length", "(", ")", ";", "if", "(", "s", ".", "isEmpty", "...
that might require the full parser to deal with.
[ "that", "might", "require", "the", "full", "parser", "to", "deal", "with", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/PathParser.java#L224-L256
14,887
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java
SimpleIncluder.clearForInclude
static ConfigParseOptions clearForInclude(ConfigParseOptions options) { // the class loader and includer are inherited, but not this other // stuff. return options.setSyntax(null).setOriginDescription(null).setAllowMissing(true); }
java
static ConfigParseOptions clearForInclude(ConfigParseOptions options) { // the class loader and includer are inherited, but not this other // stuff. return options.setSyntax(null).setOriginDescription(null).setAllowMissing(true); }
[ "static", "ConfigParseOptions", "clearForInclude", "(", "ConfigParseOptions", "options", ")", "{", "// the class loader and includer are inherited, but not this other", "// stuff.", "return", "options", ".", "setSyntax", "(", "null", ")", ".", "setOriginDescription", "(", "nu...
ConfigIncludeContext does this for us on its options
[ "ConfigIncludeContext", "does", "this", "for", "us", "on", "its", "options" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java#L33-L37
14,888
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java
SimpleIncluder.include
@Override public ConfigObject include(final ConfigIncludeContext context, String name) { ConfigObject obj = includeWithoutFallback(context, name); // now use the fallback includer if any and merge // its result. if (fallback != null) { return obj.withFallback(fallback.in...
java
@Override public ConfigObject include(final ConfigIncludeContext context, String name) { ConfigObject obj = includeWithoutFallback(context, name); // now use the fallback includer if any and merge // its result. if (fallback != null) { return obj.withFallback(fallback.in...
[ "@", "Override", "public", "ConfigObject", "include", "(", "final", "ConfigIncludeContext", "context", ",", "String", "name", ")", "{", "ConfigObject", "obj", "=", "includeWithoutFallback", "(", "context", ",", "name", ")", ";", "// now use the fallback includer if an...
this is the heuristic includer
[ "this", "is", "the", "heuristic", "includer" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java#L40-L51
14,889
lightbend/config
config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java
SimpleIncluder.includeWithoutFallback
static ConfigObject includeWithoutFallback(final ConfigIncludeContext context, String name) { // the heuristic is valid URL then URL, else relative to including file; // relativeTo in a file falls back to classpath inside relativeTo(). URL url; try { url = new URL(name); ...
java
static ConfigObject includeWithoutFallback(final ConfigIncludeContext context, String name) { // the heuristic is valid URL then URL, else relative to including file; // relativeTo in a file falls back to classpath inside relativeTo(). URL url; try { url = new URL(name); ...
[ "static", "ConfigObject", "includeWithoutFallback", "(", "final", "ConfigIncludeContext", "context", ",", "String", "name", ")", "{", "// the heuristic is valid URL then URL, else relative to including file;", "// relativeTo in a file falls back to classpath inside relativeTo().", "URL",...
the heuristic includer in static form
[ "the", "heuristic", "includer", "in", "static", "form" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/SimpleIncluder.java#L54-L71
14,890
lightbend/config
config/src/main/java/com/typesafe/config/ConfigException.java
ConfigException.writeObject
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); ConfigImplUtil.writeOrigin(out, origin); }
java
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); ConfigImplUtil.writeOrigin(out, origin); }
[ "private", "void", "writeObject", "(", "java", ".", "io", ".", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "out", ".", "defaultWriteObject", "(", ")", ";", "ConfigImplUtil", ".", "writeOrigin", "(", "out", ",", "origin", ")", ";", "}" ]
support it)
[ "support", "it", ")" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigException.java#L56-L59
14,891
lightbend/config
config/src/main/java/com/typesafe/config/ConfigException.java
ConfigException.setOriginField
private static <T> void setOriginField(T hasOriginField, Class<T> clazz, ConfigOrigin origin) throws IOException { // circumvent "final" Field f; try { f = clazz.getDeclaredField("origin"); } catch (NoSuchFieldException e) { throw new IOException(clazz...
java
private static <T> void setOriginField(T hasOriginField, Class<T> clazz, ConfigOrigin origin) throws IOException { // circumvent "final" Field f; try { f = clazz.getDeclaredField("origin"); } catch (NoSuchFieldException e) { throw new IOException(clazz...
[ "private", "static", "<", "T", ">", "void", "setOriginField", "(", "T", "hasOriginField", ",", "Class", "<", "T", ">", "clazz", ",", "ConfigOrigin", "origin", ")", "throws", "IOException", "{", "// circumvent \"final\"", "Field", "f", ";", "try", "{", "f", ...
For deserialization - uses reflection to set the final origin field on the object
[ "For", "deserialization", "-", "uses", "reflection", "to", "set", "the", "final", "origin", "field", "on", "the", "object" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigException.java#L62-L82
14,892
lightbend/config
config/src/main/java/com/typesafe/config/impl/AbstractConfigObject.java
AbstractConfigObject.peekAssumingResolved
protected final AbstractConfigValue peekAssumingResolved(String key, Path originalPath) { try { return attemptPeekWithPartialResolve(key); } catch (ConfigException.NotResolved e) { throw ConfigImpl.improveNotResolved(originalPath, e); } }
java
protected final AbstractConfigValue peekAssumingResolved(String key, Path originalPath) { try { return attemptPeekWithPartialResolve(key); } catch (ConfigException.NotResolved e) { throw ConfigImpl.improveNotResolved(originalPath, e); } }
[ "protected", "final", "AbstractConfigValue", "peekAssumingResolved", "(", "String", "key", ",", "Path", "originalPath", ")", "{", "try", "{", "return", "attemptPeekWithPartialResolve", "(", "key", ")", ";", "}", "catch", "(", "ConfigException", ".", "NotResolved", ...
This looks up the key with no transformation or type conversion of any kind, and returns null if the key is not present. The object must be resolved along the nodes needed to get the key or ConfigException.NotResolved will be thrown. @param key @return the unmodified raw value or null
[ "This", "looks", "up", "the", "key", "with", "no", "transformation", "or", "type", "conversion", "of", "any", "kind", "and", "returns", "null", "if", "the", "key", "is", "not", "present", ".", "The", "object", "must", "be", "resolved", "along", "the", "n...
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/AbstractConfigObject.java#L64-L70
14,893
lightbend/config
config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java
ConfigDocumentFactory.parseReader
public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parseConfigDocument(); }
java
public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parseConfigDocument(); }
[ "public", "static", "ConfigDocument", "parseReader", "(", "Reader", "reader", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newReader", "(", "reader", ",", "options", ")", ".", "parseConfigDocument", "(", ")", ";", "}" ]
Parses a Reader into a ConfigDocument instance. @param reader the reader to parse @param options parse options to control how the reader is interpreted @return the parsed configuration @throws com.typesafe.config.ConfigException on IO or parse errors
[ "Parses", "a", "Reader", "into", "a", "ConfigDocument", "instance", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L26-L28
14,894
lightbend/config
config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java
ConfigDocumentFactory.parseFile
public static ConfigDocument parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parseConfigDocument(); }
java
public static ConfigDocument parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parseConfigDocument(); }
[ "public", "static", "ConfigDocument", "parseFile", "(", "File", "file", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newFile", "(", "file", ",", "options", ")", ".", "parseConfigDocument", "(", ")", ";", "}" ]
Parses a file into a ConfigDocument instance. @param file the file to parse @param options parse options to control how the file is interpreted @return the parsed configuration @throws com.typesafe.config.ConfigException on IO or parse errors
[ "Parses", "a", "file", "into", "a", "ConfigDocument", "instance", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L54-L56
14,895
lightbend/config
config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java
ConfigDocumentFactory.parseString
public static ConfigDocument parseString(String s, ConfigParseOptions options) { return Parseable.newString(s, options).parseConfigDocument(); }
java
public static ConfigDocument parseString(String s, ConfigParseOptions options) { return Parseable.newString(s, options).parseConfigDocument(); }
[ "public", "static", "ConfigDocument", "parseString", "(", "String", "s", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newString", "(", "s", ",", "options", ")", ".", "parseConfigDocument", "(", ")", ";", "}" ]
Parses a string which should be valid HOCON or JSON. @param s string to parse @param options parse options @return the parsed configuration
[ "Parses", "a", "string", "which", "should", "be", "valid", "HOCON", "or", "JSON", "." ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L79-L81
14,896
lightbend/config
config/src/main/java/com/typesafe/config/impl/AbstractConfigValue.java
AbstractConfigValue.withFallback
@Override public AbstractConfigValue withFallback(ConfigMergeable mergeable) { if (ignoresFallbacks()) { return this; } else { ConfigValue other = ((MergeableValue) mergeable).toFallbackValue(); if (other instanceof Unmergeable) { return mergedWit...
java
@Override public AbstractConfigValue withFallback(ConfigMergeable mergeable) { if (ignoresFallbacks()) { return this; } else { ConfigValue other = ((MergeableValue) mergeable).toFallbackValue(); if (other instanceof Unmergeable) { return mergedWit...
[ "@", "Override", "public", "AbstractConfigValue", "withFallback", "(", "ConfigMergeable", "mergeable", ")", "{", "if", "(", "ignoresFallbacks", "(", ")", ")", "{", "return", "this", ";", "}", "else", "{", "ConfigValue", "other", "=", "(", "(", "MergeableValue"...
this is only overridden to change the return type
[ "this", "is", "only", "overridden", "to", "change", "the", "return", "type" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/AbstractConfigValue.java#L269-L284
14,897
lightbend/config
examples/java/simple-lib/src/main/java/simplelib/SimpleLibContext.java
SimpleLibContext.printSetting
public void printSetting(String path) { System.out.println("The setting '" + path + "' is: " + config.getString(path)); }
java
public void printSetting(String path) { System.out.println("The setting '" + path + "' is: " + config.getString(path)); }
[ "public", "void", "printSetting", "(", "String", "path", ")", "{", "System", ".", "out", ".", "println", "(", "\"The setting '\"", "+", "path", "+", "\"' is: \"", "+", "config", ".", "getString", "(", "path", ")", ")", ";", "}" ]
this is the amazing functionality provided by simple-lib
[ "this", "is", "the", "amazing", "functionality", "provided", "by", "simple", "-", "lib" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/examples/java/simple-lib/src/main/java/simplelib/SimpleLibContext.java#L31-L33
14,898
lightbend/config
config/src/main/java/com/typesafe/config/ConfigResolveOptions.java
ConfigResolveOptions.appendResolver
public ConfigResolveOptions appendResolver(ConfigResolver value) { if (value == null) { throw new ConfigException.BugOrBroken("null resolver passed to appendResolver"); } else if (value == this.resolver) { return this; } else { return new ConfigResolveOptions(...
java
public ConfigResolveOptions appendResolver(ConfigResolver value) { if (value == null) { throw new ConfigException.BugOrBroken("null resolver passed to appendResolver"); } else if (value == this.resolver) { return this; } else { return new ConfigResolveOptions(...
[ "public", "ConfigResolveOptions", "appendResolver", "(", "ConfigResolver", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "ConfigException", ".", "BugOrBroken", "(", "\"null resolver passed to appendResolver\"", ")", ";", "}", "else",...
Returns options where the given resolver used as a fallback if a reference cannot be otherwise resolved. This resolver will only be called after resolution has failed to substitute with a value from within the config itself and with any other resolvers that have been appended before this one. Multiple resolvers can be ...
[ "Returns", "options", "where", "the", "given", "resolver", "used", "as", "a", "fallback", "if", "a", "reference", "cannot", "be", "otherwise", "resolved", ".", "This", "resolver", "will", "only", "be", "called", "after", "resolution", "has", "failed", "to", ...
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigResolveOptions.java#L125-L134
14,899
lightbend/config
config/src/main/java/com/typesafe/config/impl/ResolveResult.java
ResolveResult.asObjectResult
@SuppressWarnings("unchecked") ResolveResult<AbstractConfigObject> asObjectResult() { if (!(value instanceof AbstractConfigObject)) throw new ConfigException.BugOrBroken("Expecting a resolve result to be an object, but it was " + value); Object o = this; return (ResolveResult<Abs...
java
@SuppressWarnings("unchecked") ResolveResult<AbstractConfigObject> asObjectResult() { if (!(value instanceof AbstractConfigObject)) throw new ConfigException.BugOrBroken("Expecting a resolve result to be an object, but it was " + value); Object o = this; return (ResolveResult<Abs...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "ResolveResult", "<", "AbstractConfigObject", ">", "asObjectResult", "(", ")", "{", "if", "(", "!", "(", "value", "instanceof", "AbstractConfigObject", ")", ")", "throw", "new", "ConfigException", ".", "BugOrBrok...
better option? we don't have variance
[ "better", "option?", "we", "don", "t", "have", "variance" ]
68cebfde5e861e9a5fdc75ceff366ed95e17d475
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/impl/ResolveResult.java#L20-L26