private static RDDProcessor newProcessor ( String streamProcType ) throws Exception { streamProcType = streamProcType . trim ( ) ; if ( "twitter-to-solr" . equals ( streamProcType ) ) return new TwitterToSolrStreamProcessor ( ) ; else if ( "word-count" . equals ( streamProcType ) ) return new WordCount ( ) ; else if ( "term-vectors" . equals ( streamProcType ) ) return new ReadTermVectors ( ) ; else if ( "docfilter" . equals ( streamProcType ) ) return new DocumentFilteringStreamProcessor ( ) ; else if ( "hdfs-to-solr" . equals ( streamProcType ) ) return new HdfsToSolrRDDProcessor ( ) ; else if ( "logs2solr" . equals ( streamProcType ) ) return new Logs2SolrRDDProcessor ( ) ; else if ( "query-solr-benchmark" . equals ( streamProcType ) ) return new QueryBenchmark ( ) ; else if ( "kmeans-anomaly" . equals ( streamProcType ) ) return new KMeansAnomaly ( ) ; else if ( "eventsim" . equals ( streamProcType ) ) return new EventsimIndexer ( ) ; // If you add a built-in RDDProcessor to this class, add it here to avoid // classpath scanning for ( Class < RDDProcessor > next : findProcessorClassesInPackage ( "com.lucidworks.spark" ) ) { RDDProcessor streamProc = next . newInstance ( ) ; if ( streamProcType . equals ( streamProc . getName ( ) ) ) return streamProc ; } System . err . println ( "\n\n " + streamProcType + " not supported! Please check your command-line arguments and re-try. \n\n" ) ; System . exit ( 1 ) ; return null ; // won't get here }
Creates an instance of the requested tool using classpath scanning if necessary