@@ -0,0 +1,1377 @@
+/**%0A * Illustrates a simple map then filter in Java%0A */%0Apackage com.oreilly.learningsparkexamples.java;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport org.apache.commons.lang.StringUtils;%0A%0Aimport org.apache.spark.api.java.JavaRDD;%0Aimport org.apache.spark.api.java.JavaSparkContext;%0Aimport org.apache.spark.api.java.function.Function;%0Aimport org.apache.spark.streaming.api.java.JavaDStream;%0Aimport org.apache.spark.streaming.api.java.JavaStreamingContext;%0Aimport org.apache.spark.streaming.Duration;%0A%0Apublic class StreamingLogInput %7B%0A  public static void main(String%5B%5D args) throws Exception %7B%0A%09%09String master = args%5B0%5D;%0A%09%09JavaSparkContext sc = new JavaSparkContext(%0A      master, %22StreamingLogInput%22, System.getenv(%22SPARK_HOME%22), System.getenv(%22JARS%22));%0A    // Create a StreamingContext with a 1 second batch size%0A    JavaStreamingContext jssc = new JavaStreamingContext(sc, new Duration(1000));%0A    // Create a DStream from all the input on port 7777%0A    JavaDStream%3CString%3E lines = jssc.socketTextStream(%22localhost%22, 7777);%0A    // Filter our DStream for lines with %22error%22%0A    JavaDStream%3CString%3E errorLines = lines.filter(new Function%3CString, Boolean%3E() %7B%0A        public Boolean call(String line) %7B%0A          return line.contains(%22error%22);%0A        %7D%7D);%0A    // Print out the lines with errors, which causes this DStream to be evaluated%0A    errorLines.print();%0A%09%7D%0A%7D%0A

Add simple streaming log input example