Tabnine Logo
ParserRunnerImpl.init
Code IndexAdd Tabnine to your IDE (free)

How to use
init
method
in
org.apache.metron.parsers.ParserRunnerImpl

Best Java code snippets using org.apache.metron.parsers.ParserRunnerImpl.init (Showing top 6 results out of 315)

origin: apache/metron

private List<JSONObject> doParse(List<String> messages) {
  // initialize
  HashSet<String> sensorTypes = new HashSet<>();
  sensorTypes.add(sensorType);
  ParserRunnerImpl runner = new ParserRunnerImpl(sensorTypes);
  runner.init(() -> parserConfigurations, context);
  // parse each message
  List<ParserRunnerResults<JSONObject>> results = messages
      .stream()
      .map(str -> str.getBytes())
      .map(bytes -> DEFAULT.get(emptyMap(), bytes, false, emptyMap()))
      .map(msg -> runner.execute(sensorType, msg, parserConfigurations))
      .collect(Collectors.toList());
  // aggregate both successes and errors into a list that can be returned
  List<JSONObject> successes = results
      .stream()
      .flatMap(result -> result.getMessages().stream())
      .collect(Collectors.toList());
  successCount += successes.size();
  List<JSONObject> errors = results
      .stream()
      .flatMap(result -> result.getErrors().stream())
      .map(err -> err.getJSONObject())
      .collect(Collectors.toList());
  errorCount += errors.size();
  // return a list of both successes and errors
  successes.addAll(errors);
  return successes;
}
origin: apache/metron

@Test
public void shouldThrowExceptionOnEmptyParserSupplier() {
 exception.expect(IllegalStateException.class);
 exception.expectMessage("A parser config supplier must be set before initializing the ParserRunner.");
 parserRunner.init(null, null);
}
origin: apache/metron

@Test
public void shouldThrowExceptionOnEmptyStellarContext() {
 exception.expect(IllegalStateException.class);
 exception.expectMessage("A stellar context must be set before initializing the ParserRunner.");
 parserRunner.init(() -> parserConfigurations, null);
}
origin: apache/metron

@Test
public void initShouldThrowExceptionOnMissingSensorParserConfig() {
 exception.expect(IllegalStateException.class);
 exception.expectMessage("Could not initialize parsers.  Cannot find configuration for sensor test.");
 parserRunner = new ParserRunnerImpl(new HashSet<String>() {{
  add("test");
 }});
 parserRunner.init(() -> parserConfigurations, mock(Context.class));
}
origin: apache/metron

verify(parserRunner, times(1)).init(any(Supplier.class), eq(stellarContext));
verify(yafConfig, times(1)).init();
Map<String, String> topicToSensorMap = parserBolt.getTopicToSensorMap();
origin: apache/metron

Map<String, Object> snortParserConfig = parserConfigurations.getSensorParserConfig("snort").getParserConfig();
parserRunner.init(() -> parserConfigurations, stellarContext);
org.apache.metron.parsersParserRunnerImplinit

Javadoc

Initializes MessageParsers and MessageFilters for sensor types configured in this ParserRunner. Objects are created using reflection and the MessageParser configure and init methods are called.

Popular methods of ParserRunnerImpl

  • <init>
  • execute
    Parses messages with the appropriate MessageParser based on sensor type. The resulting list of messa
  • processMessage
    Post-processes parsed messages by: * Applying field transformations defined in the sensor parser
  • applyFieldTransformations
    Applies Stellar field transformations defined in the sensor parser config.
  • getFailedValidators
  • getSensorToParserComponentMap
  • getStellarContext
  • initializeParsers
    Initializes MessageParsers and MessageFilters for sensor types configured in this ParserRunner. Obje
  • setSensorToParserComponentMap

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Join (org.hibernate.mapping)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now