// Path: src/main/java/com/appleframework/deploy/entity/ProjectWithBLOBs.java
// public class ProjectWithBLOBs extends Project implements Serializable {
//     
// 	private String hosts;
// 
//     private String preDeploy;
// 
//     private String postDeploy;
// 
//     private String afterDeploy;
// 
//     private static final long serialVersionUID = 1L;
// 
//     public String getHosts() {
//         return hosts;
//     }
// 
//     public void setHosts(String hosts) {
//         this.hosts = hosts == null ? null : hosts.trim();
//     }
// 
//     public String getPreDeploy() {
//         return preDeploy;
//     }
// 
//     public void setPreDeploy(String preDeploy) {
//         this.preDeploy = preDeploy == null ? null : preDeploy.trim();
//     }
// 
//     public String getPostDeploy() {
//         return postDeploy;
//     }
// 
//     public void setPostDeploy(String postDeploy) {
//         this.postDeploy = postDeploy == null ? null : postDeploy.trim();
//     }
// 
//     public String getAfterDeploy() {
//         return afterDeploy;
//     }
// 
//     public void setAfterDeploy(String afterDeploy) {
//         this.afterDeploy = afterDeploy == null ? null : afterDeploy.trim();
//     }
// 
// }
// 
// Path: src/main/java/com/appleframework/deploy/service/ProjectService.java
// public interface ProjectService {
// 
// 	public Integer save(ProjectWithBLOBs record) throws AppleException;
// 	
// 	public Integer update(ProjectWithBLOBs record) throws AppleException;	
// 		
// 	public Integer delete(Integer id) throws AppleException;
// 	
// 	public ProjectWithBLOBs get(Integer id);
// 	
// 	public List<Project> findAll();
// 	
// 	public boolean isExistByName(String name);
// 	
// 	public boolean isUniqueByName(String oldName, String newName);
// 	
// 	public int countByName(String name);
// 	
// 	public Project getByName(String name);
// 	
// 	public Pagination findPage(Pagination page,  ProjectSo so);
// 	
// }


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.appleframework.deploy.entity.ProjectWithBLOBs;
import com.appleframework.deploy.service.ProjectService;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;

		for (String host : hosts) {
			StringBuffer commandBuffer = new StringBuffer();
			commandBuffer.append("mkdir -p " + project.getReleaseTo() + "\n");
			commandBuffer.append("/work/shell/deploy/deploy.sh ");
			commandBuffer.append(project.getReleaseTo() + " ");
			commandBuffer.append(project.getNexusUrl() + " ");
			commandBuffer.append(project.getNexusGroup() + " ");
			commandBuffer.append(project.getNexusArtifact() + " ");
			commandBuffer.append(project.getVersion() + " ");

			String result = "";
			Session session = null;
			ChannelExec openChannel = null;
			try {
				JSch jsch = new JSch();
				session = jsch.getSession(project.getReleaseUser(), host, 22);
				java.util.Properties config = new java.util.Properties();
				config.put("StrictHostKeyChecking", "no");
				session.setConfig(config);
				session.setPassword("123456");
				session.connect();
				openChannel = (ChannelExec) session.openChannel("exec");
				openChannel.setCommand(commandBuffer.toString());
				int exitStatus = openChannel.getExitStatus();
				System.out.println(exitStatus);
				openChannel.connect();
				InputStream in = openChannel.getInputStream();
				BufferedReader reader = new BufferedReader(new InputStreamReader(in));
				String buf = null;
				while ((buf = reader.readLine()) != null) {

// Path: src/main/java/com/appleframework/deploy/entity/ProjectWithBLOBs.java
// public class ProjectWithBLOBs extends Project implements Serializable {
//     
// 	private String hosts;
// 
//     private String preDeploy;
// 
//     private String postDeploy;
// 
//     private String afterDeploy;
// 
//     private static final long serialVersionUID = 1L;
// 
//     public String getHosts() {
//         return hosts;
//     }
// 
//     public void setHosts(String hosts) {
//         this.hosts = hosts == null ? null : hosts.trim();
//     }
// 
//     public String getPreDeploy() {
//         return preDeploy;
//     }
// 
//     public void setPreDeploy(String preDeploy) {
//         this.preDeploy = preDeploy == null ? null : preDeploy.trim();
//     }
// 
//     public String getPostDeploy() {
//         return postDeploy;
//     }
// 
//     public void setPostDeploy(String postDeploy) {
//         this.postDeploy = postDeploy == null ? null : postDeploy.trim();
//     }
// 
//     public String getAfterDeploy() {
//         return afterDeploy;
//     }
// 
//     public void setAfterDeploy(String afterDeploy) {
//         this.afterDeploy = afterDeploy == null ? null : afterDeploy.trim();
//     }
// 
// }
// 
// Path: src/main/java/com/appleframework/deploy/service/ProjectService.java
// public interface ProjectService {
// 
// 	public Integer save(ProjectWithBLOBs record) throws AppleException;
// 	
// 	public Integer update(ProjectWithBLOBs record) throws AppleException;	
// 		
// 	public Integer delete(Integer id) throws AppleException;
// 	
// 	public ProjectWithBLOBs get(Integer id);
// 	
// 	public List<Project> findAll();
// 	
// 	public boolean isExistByName(String name);
// 	
// 	public boolean isUniqueByName(String oldName, String newName);
// 	
// 	public int countByName(String name);
// 	
// 	public Project getByName(String name);
// 	
// 	public Pagination findPage(Pagination page,  ProjectSo so);
// 	
// }


// Path: src/main/java/com/appleframework/deploy/task/DeployTask.java
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.appleframework.deploy.entity.ProjectWithBLOBs;
import com.appleframework.deploy.service.ProjectService;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;

		for (String host : hosts) {
			StringBuffer commandBuffer = new StringBuffer();
			commandBuffer.append("mkdir -p " + project.getReleaseTo() + "\n");
			commandBuffer.append("/work/shell/deploy/deploy.sh ");
			commandBuffer.append(project.getReleaseTo() + " ");
			commandBuffer.append(project.getNexusUrl() + " ");
			commandBuffer.append(project.getNexusGroup() + " ");
			commandBuffer.append(project.getNexusArtifact() + " ");
			commandBuffer.append(project.getVersion() + " ");

			String result = "";
			Session session = null;
			ChannelExec openChannel = null;
			try {
				JSch jsch = new JSch();
				session = jsch.getSession(project.getReleaseUser(), host, 22);
				java.util.Properties config = new java.util.Properties();
				config.put("StrictHostKeyChecking", "no");
				session.setConfig(config);
				session.setPassword("123456");
				session.connect();
				openChannel = (ChannelExec) session.openChannel("exec");
				openChannel.setCommand(commandBuffer.toString());
				int exitStatus = openChannel.getExitStatus();
				System.out.println(exitStatus);
				openChannel.connect();
				InputStream in = openChannel.getInputStream();
				BufferedReader reader = new BufferedReader(new InputStreamReader(in));
				String buf = null;
				while ((buf = reader.readLine()) != null) {

					result += new String(buf.getBytes("utf-8"), "UTF-8") + "\r\n";
