@@ -0,0 +1,2915 @@
+package com.ctrip.ops.sysdev.inputs;%0A%0Aimport com.ctrip.ops.sysdev.filters.BaseFilter;%0Aimport com.ctrip.ops.sysdev.outputs.BaseOutput;%0Aimport org.apache.log4j.Logger;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.net.*;%0Aimport java.util.ArrayList;%0Aimport java.util.Enumeration;%0Aimport java.util.Map;%0A%0Apublic class Stdin extends BaseInput %7B%0A    private static final Logger logger = Logger%0A            .getLogger(Stdin.class.getName());%0A%0A    private boolean hostname;%0A    private String hostnameValue;%0A%0A    public Stdin(Map%3CString, Object%3E config, ArrayList%3CMap%3E filter,%0A                 ArrayList%3CMap%3E outputs) throws Exception %7B%0A        super(config, filter, outputs);%0A        this.prepare();%0A    %7D%0A%0A    @Override%0A    protected void prepare() %7B%0A        this.decoder = this.createDecoder();%0A        this.filterProcessors = this.createFilterProcessors();%0A        this.outputProcessors = this.createOutputProcessors();%0A%0A        if (config.containsKey(%22hostname%22)) %7B%0A            this.hostname = (boolean) config.get(%22hostname%22);%0A        %7D else %7B%0A            this.hostname = false;%0A        %7D%0A%0A        if (this.hostname == true) %7B%0A            try %7B%0A                this.hostnameValue = InetAddress.getLocalHost().getHostName();%0A            %7D catch (UnknownHostException e) %7B%0A                e.printStackTrace();%0A                logger.warn(%22failed to get hostname%22);%0A                this.hostname = false;%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void emit() %7B%0A        try %7B%0A            BufferedReader br =%0A                    new BufferedReader(new InputStreamReader(System.in));%0A%0A            String input;%0A%0A            while ((input = br.readLine()) != null) %7B%0A                try %7B%0A                    Map%3CString, Object%3E event = this.decoder%0A                            .decode(input);%0A%0A                    if (this.hostname == true) %7B%0A                        event.put(%22hostname%22, this.hostnameValue);%0A                    %7D%0A%0A                    if (this.filterProcessors != null) %7B%0A                        for (BaseFilter bf : filterProcessors) %7B%0A                            if (event == null) %7B%0A                                break;%0A                            %7D%0A                            event = bf.process(event);%0A                        %7D%0A                    %7D%0A                    if (event != null) %7B%0A                        for (BaseOutput bo : outputProcessors) %7B%0A                            bo.process(event);%0A                        %7D%0A                    %7D%0A                %7D catch (Exception e) %7B%0A                    logger.error(%22process event failed:%22 + input);%0A                    e.printStackTrace();%0A                    logger.error(e);%0A                %7D%0A            %7D%0A%0A        %7D catch (IOException io) %7B%0A            io.printStackTrace();%0A            logger.error(%22Stdin loop got exception%22);%0A            System.exit(1);%0A        %7D%0A    %7D%0A%7D%0A

add Stdin input plugin