@@ -0,0 +1,1658 @@
+package metadata.etl.utils;%0A%0Aimport com.jcraft.jsch.ChannelExec;%0Aimport com.jcraft.jsch.JSch;%0Aimport com.jcraft.jsch.Session;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0A%0A/**%0A * Created by hadoop on 4/12/17.%0A */%0Apublic class SshUtils %7B%0A    public static String exec(String host, String user, String keyLocation, String command) %7B%0A        String result = %22%22;%0A        Session session = null;%0A        ChannelExec openChannel = null;%0A        try %7B%0A            JSch jsch = new JSch();%0A%0A            session = jsch.getSession(user, host);%0A            jsch.addIdentity(keyLocation);%0A            java.util.Properties config = new java.util.Properties();%0A            config.put(%22StrictHostKeyChecking%22, %22no%22);%0A            session.setConfig(config);%0A            session.connect();%0A%0A            openChannel = (ChannelExec) session.openChannel(%22exec%22);%0A            openChannel.setCommand(command);%0A            openChannel.connect();%0A%0A            InputStream in = openChannel.getInputStream();%0A            BufferedReader reader = new BufferedReader(%0A                    new InputStreamReader(in));%0A            String buf = null;%0A            while ((buf = reader.readLine()) != null) %7B%0A                result += %22 %22 + buf;%0A            %7D%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A            result = null;%0A        %7D finally %7B%0A            if (openChannel != null && !openChannel.isClosed()) %7B%0A                openChannel.disconnect();%0A            %7D%0A            if (session != null && session.isConnected()) %7B%0A                session.disconnect();%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%7D

add ssh utils