/** * Used to add ids and templates to GreenTokenMaps * @param id long id to add to GreenTokenMap * @param templatePart1 CharSequence template to add to GreenTokenMap * @param templatePart2 CharSequence template to add to GreenTokenMap * @param templatePart3 CharSequence template to add to GreenTokenMap */ public GreenTokenMap addTemplate(long id, CharSequence templatePart1, CharSequence templatePart2, CharSequence templatePart3) { tp.setUTF8Value(templatePart1, templatePart2, templatePart3, id); return this; }
/** * Used to add ids and templates to GreenTokenMaps * @param id long id to add to GreenTokenMap * @param templatePart1 CharSequence template to add to GreenTokenMap * @param templatePart2 CharSequence template to add to GreenTokenMap */ public GreenTokenMap addTemplate(long id, CharSequence templatePart1, CharSequence templatePart2) { tp.setUTF8Value(templatePart1, templatePart2, id); return this; }
/** * Used to add ids and templates to GreenTokenMaps * @param id long id to add to GreenTokenMap * @param template CharSequence template to add to GreenTokenMap */ public GreenTokenMap add(long id, CharSequence template) { tp.setUTF8Value(template, id); return this; }
public static void addHeader(TrieParser headerParser, long value, CharSequence template) { //logger.info("building parsers for: {} {}",template,((0xFF)&value)); headerParser.setUTF8Value(template, "\r\n", value); if (HTTPSpecification.supportWrongLineFeeds) { headerParser.setUTF8Value(template, "\n", value); } }
public static TrieParser buildAddressParser() { TrieParser parser = new TrieParser(1,false); parser.setUTF8Value("%i.%i.%i.%i", 4); parser.setUTF8Value("%i.%i.%i.*", 3); parser.setUTF8Value("%i.%i.*.*", 2); parser.setUTF8Value("%i.*.*.*", 1); parser.setUTF8Value("*.*.*.*", 0); return parser; }
private static TrieParser buildCompressionEncodings() { TrieParser result = new TrieParser(); result.setUTF8Value(",", 0); result.setUTF8Value(" ", 0); result.setUTF8Value("gzip", COMPRESSOIN_GZIP); result.setUTF8Value("deflate", COMPRESSOIN_DEFLATE); return result; }
public OAuth2BearerExtractor() { buffer.initBuffers(); keyParser.setUTF8Value(typeValueKey, 1); keyParser.setUTF8Value(typeAccessKey, 2); valueParser.setUTF8Value(typeValueExpected, 3); }
private static TrieParser buildChunkMap() { TrieParser chunkMap = new TrieParser(128,true); chunkMap.setUTF8Value("%U\r\n", CHUNK_SIZE); //hex parser of U% does not require leading 0x chunkMap.setUTF8Value("%U;%b\r\n", CHUNK_SIZE_WITH_EXTENSION); return chunkMap; }
@Override public void startup() { //load log file and parse out all the telemetry snapshots... lineParser = new TrieParser(); lineParser.setUTF8Value("greenlightning: digraph gl {\n", 1); lineParser.setUTF8Value("digraph gl {\n", 1); lineParser.setUTF8Value("greenlightning: }\n", 2); lineParser.setUTF8Value("}\n", 2); lineParser.setUTF8Value("greenlightning: %b\n", 3); lineParser.setUTF8Value("%b\n", 3); reader = TrieParserReaderLocal.get(); logFileInput = Pipe.inputStream(logFile); //start // [8:RProxy] INFO com.ociweb.pronghorn.stage.scheduling.GraphManager - // 20181212215745711.dot // digraph gl { //body //stop // } }
public static TrieParser textToNumberTrieParser() { if (textToNumberParser == null) { TrieParser p = new TrieParser(8,false); //supports streaming, so false p.setUTF8Value("%i%.", 1); //p.setUTF8Value("%i%.%/%.", 1); //the above pattern can parse 234 and 234.34 and 23/45 and 23.4/56.7 //it also supports the normal capture methods for ints and decimals with no change //TrieParserReader.capturedLongField(parserReader, 0) textToNumberParser = p; } return textToNumberParser; }
public static TrieParser textToNumberTrieParser() { if (textToNumberParser == null) { TrieParser p = new TrieParser(8,false); //supports streaming, so false p.setUTF8Value("%i%.", 1); //p.setUTF8Value("%i%.%/%.", 1); //the above pattern can parse 234 and 234.34 and 23/45 and 23.4/56.7 //it also supports the normal capture methods for ints and decimals with no change //TrieParserReader.capturedLongField(parserReader, 0) textToNumberParser = p; } return textToNumberParser; }
public static TrieParser textToNumberTrieParser() { if (textToNumberParser == null) { TrieParser p = new TrieParser(8,false); //supports streaming, so false p.setUTF8Value("%i%.", 1); //p.setUTF8Value("%i%.%/%.", 1); //the above pattern can parse 234 and 234.34 and 23/45 and 23.4/56.7 //it also supports the normal capture methods for ints and decimals with no change //TrieParserReader.capturedLongField(parserReader, 0) textToNumberParser = p; } return textToNumberParser; }
@Override public void defineUnScopedTopic(String topic) { if (null == unScopedTopics) { unScopedTopics = new TrieParser(); } unScopedTopics.setUTF8Value(topic, 1); }
public static <T extends Enum<T> & TrieKeyable> TrieParser customParser(Class<T> keys) { //2 because we need 2 shorts for the number TrieParser trie = new TrieParser(256,2,false,true); for (T key: keys.getEnumConstants()) { int value = toValue(key.ordinal()); assert(value>=0); trie.setUTF8Value("\"", key.getKey(), "\"", value); } populateWithJSONTokens(trie); return trie; }
public static <T extends Enum<T> & TrieKeyable> TrieParser customParser(Class<T> keys) { //2 because we need 2 shorts for the number TrieParser trie = new TrieParser(256,2,false,true); for (T key: keys.getEnumConstants()) { int value = toValue(key.ordinal()); assert(value>=0); trie.setUTF8Value("\"", key.getKey(), "\"", value); //TODO: should we add the same key without quotes ?? } populateWithJSONTokens(trie); return trie; }
public static <T extends Enum<T> & TrieKeyable> TrieParser customParser(Class<T> keys) { //2 because we need 2 shorts for the number TrieParser trie = new TrieParser(256,2,false,true); for (T key: keys.getEnumConstants()) { int value = toValue(key.ordinal()); assert(value>=0); trie.setUTF8Value("\"", key.getKey(), "\"", value); } populateWithJSONTokens(trie); return trie; }
public void possiblePrivateTopicConsumer(PendingStageBuildable listener, CharSequence topic, int track) { assert(null!=listener.behaviorName()); //do not want to confuse all the tracks while looking for private topics, we only look at no track and first track if (track<=0) { int id = (int)TrieParserReaderLocal.get().query(possibleTopics, topic); if (-1 == id) { growPossiblePrivateTopics(); if (null==possiblePrivateBehaviors[possiblePrivateTopicsCount]) { possiblePrivateBehaviors[possiblePrivateTopicsCount] = new ArrayList<PendingStageBuildable>(); } possiblePrivateBehaviors[possiblePrivateTopicsCount].add(listener); possiblePrivateTopicsTopic[possiblePrivateTopicsCount]=topic; possibleTopics.setUTF8Value(topic, possiblePrivateTopicsCount++); } else { if (null==possiblePrivateBehaviors[id]) { possiblePrivateBehaviors[id] = new ArrayList(); } possiblePrivateBehaviors[id].add(listener); } } }
private TrieParser contentTypeTrieBuilder(HTTPContentType[] types) { int x; TrieParser typeMap = new TrieParser(4096,1,true,false,true); //TODO: set switch to turn on off the deep check skip TODO: must be shared across all instances?? if (null!=types) { x = types.length; while (--x >= 0) { //with or without the charset part on the end //Content-Type: text/html; charset=ISO-8859-1 //;charset=utf-8 or ; charset=ISO-8859-1 typeMap.setUTF8Value(types[x].contentType(),"\r\n", types[x].ordinal()); typeMap.setUTF8Value(types[x].contentType(),"; charset=%b\r\n", types[x].ordinal()); typeMap.setUTF8Value(types[x].contentType(),";charset=%b\r\n", types[x].ordinal()); typeMap.setUTF8Value(types[x].contentType(),"\n", types[x].ordinal()); //\n must be last because we prefer to have it pick \r\n typeMap.setUTF8Value(types[x].contentType(),"; charset=%b\n", types[x].ordinal()); typeMap.setUTF8Value(types[x].contentType(),";charset=%b\n", types[x].ordinal()); } } return typeMap; }
public int lookupId(CharSequence text) { //adds new one if it is not found. long idx = TrieParserReader.query(TrieParserReaderLocal.get(), parser, text); if (idx < 0) { idx = ++totalCount; int hashVal = JSONStreamParser.toValue((int)idx); parser.setUTF8Value(text, hashVal); //This pattern may cause an alt check of string capture //NOTE: this is only true for the keys parser.setUTF8Value("\"", text, "\"", hashVal); //logger.info("added token {} with value {} to parser", value, hashVal); } else { idx = JSONStreamParser.fromValue((int)idx); } return (int)idx; }
public void possiblePrivateTopicProducer(BehaviorNameable producer, String topic, int track) { //do not want to confuse all the tracks while looking for private topics, we only look at no track and first track if (track<=0) { int id = (int)TrieParserReaderLocal.get().query(possibleTopics, topic); if (-1 == id) { growPossiblePrivateTopics(); possiblePrivateCmds[possiblePrivateTopicsCount] = producer; possiblePrivateTopicsTopic[possiblePrivateTopicsCount]=topic; possiblePrivateTopicsProducerCount[possiblePrivateTopicsCount]++; possibleTopics.setUTF8Value(topic, possiblePrivateTopicsCount++); } else { //only record once for same channel and topic pair if (producer != possiblePrivateCmds[id]) { possiblePrivateCmds[id] = producer; possiblePrivateTopicsProducerCount[id]++; } } } }