Source:
public void initClusteringTask(String[] args) { logger.info("Initializing Samoa Clustering Topology"); FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG); FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG); IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0, Integer.MAX_VALUE); Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt }; StringBuilder cliString = new StringBuilder(); for (String arg : args) { logger.info(arg); cliString.append(" ").append(arg); } logger.debug("Command line string = {}"+cliString.toString()); logger.info("Command line string = " + cliString.toString()); Task task; try { task = ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions); logger.info("Successfully instantiating {}"+task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Fail to initialize the task", e); logger.info("Fail to initialize the task" + e); return; } logger.info("A"); if(task instanceof StreamingClusteringTask){ logger.info("Task is a Instance of StreamingClusteringTask"); StreamingClusteringTask t = (StreamingClusteringTask) task; t.setCepEvents(this.cepEvents); t.setSamoaClusters(this.samoaClusters); t.setNumClusters(this.numClusters); }else{ logger.info("Check Task: Not a StreamingClusteringTask"); } logger.info("Successfully Convert the Task into StreamingClusteringTask"); task.setFactory(new SimpleComponentFactory()); logger.info("Successfully Initialized Component Factory"); task.init(); logger.info("Successfully Initiated the StreamingClusteringTask"); SimpleEngine.submitTopology(task.getTopology()); logger.info("Samoa Simple Engine Started"); }

Target:
public void initClusteringTask(String[] args) { logger.info("Initializing Samoa Clustering Topology"); FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG); FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG); IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0, Integer.MAX_VALUE); Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt }; StringBuilder cliString = new StringBuilder(); for (String arg : args) { logger.info(arg); cliString.append(" ").append(arg); } logger.debug("Command line string = {}"+cliString.toString()); Task task; try { task = ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions); logger.info("Successfully instantiating {}"+task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Fail to initialize the task", e); return; } logger.info("Start extracting the Streaming Clustering Task"); if(task instanceof StreamingClusteringTask){ logger.info("Task is a Instance of StreamingClusteringTask"); StreamingClusteringTask t = (StreamingClusteringTask) task; t.setCepEvents(this.cepEvents); t.setSamoaClusters(this.samoaClusters); t.setNumClusters(this.numClusters); }else{ logger.info("Check Task: Not a StreamingClusteringTask"); } logger.info("Successfully Convert the Task into StreamingClusteringTask"); task.setFactory(new SimpleComponentFactory()); logger.info("Successfully Initialized Component Factory"); task.init(); logger.info("Successfully Initiated the StreamingClusteringTask"); SimpleEngine.submitTopology(task.getTopology()); logger.info("Samoa Simple Engine Started"); }