@@ -0,0 +1,2123 @@
+package com.github.aureliano.evtbridge.input.standard;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0Aimport org.apache.log4j.Logger;%0A%0Aimport com.github.aureliano.evtbridge.core.agent.AbstractDataReader;%0Aimport com.github.aureliano.evtbridge.core.exception.EventBridgeException;%0A%0Apublic class StandardDataReader extends AbstractDataReader %7B%0A%0A%09private BufferedReader bufferedReader;%0A%09%0A%09private static final Logger logger = Logger.getLogger(StandardDataReader.class);%0A%09%09%0A%09public StandardDataReader() %7B%0A%09%09super();%0A%09%7D%0A%09%0A%09@Override%0A%09public void initializeResources() %7B%0A%09%09this.initialize();%0A%09%7D%0A%09%0A%09@Override%0A%09public String readLine() %7B%0A%09%09try %7B%0A%09%09%09return this.bufferedReader.readLine();%0A%09%09%7D catch (IOException ex) %7B%0A%09%09%09throw new EventBridgeException(ex);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public void finalizeResources() %7B%0A%09%09logger.debug(%22 %3E%3E%3E Flushing and closing stream reader.%22);%0A%09%09if (this.bufferedReader == null) %7B%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09try %7B%0A%09%09%09this.bufferedReader.close();%0A%09%09%09this.bufferedReader = null;%0A%09%09%7D catch (IOException ex) %7B%0A%09%09%09throw new EventBridgeException(ex);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public Map%3CString, Object%3E executionLog() %7B%0A%09%09Map%3CString, Object%3E map = new HashMap%3CString, Object%3E();%0A%09%09map.put(%22input.config.%22 + super.inputConfiguration.getConfigurationId() + %22.last.line%22, super.lineCounter);%0A%09%09%0A%09%09return map;%0A%09%7D%0A%0A%09@Override%0A%09public void loadLastExecutionLog(Properties properties) %7B %7D%0A%09%0A%09private void initialize() %7B%0A%09%09StandardInputConfig configuration = (StandardInputConfig) super.inputConfiguration;%0A%09%09%0A%09%09logger.info(%22Reading data from Standard Input.%22);%0A%09%09logger.debug(%22Data encondig: %22 + configuration.getEncoding());%0A%09%09%0A%09%09System.out.println(%22Listening standard input. Type text and then press Enter to process event or Ctrl + C to quit.%22);%0A%09%09%0A%09%09try %7B%0A%09%09%09this.bufferedReader = new BufferedReader(new InputStreamReader(System.in, configuration.getEncoding()));%0A%09%09%7D catch (UnsupportedEncodingException ex) %7B%0A%09%09%09throw new EventBridgeException(ex);%0A%09%09%7D%0A%09%7D%0A%7D

Create standard data reader.