1 17 18 19 package org.apache.catalina.ant; 20 21 22 import java.net.URLEncoder ; 23 24 import org.apache.tools.ant.BuildException; 25 26 27 36 public class InstallTask extends AbstractCatalinaTask { 37 38 39 41 42 45 protected String config = null; 46 47 public String getConfig() { 48 return (this.config); 49 } 50 51 public void setConfig(String config) { 52 this.config = config; 53 } 54 55 56 59 protected String path = null; 60 61 public String getPath() { 62 return (this.path); 63 } 64 65 public void setPath(String path) { 66 this.path = path; 67 } 68 69 70 74 protected String war = null; 75 76 public String getWar() { 77 return (this.war); 78 } 79 80 public void setWar(String war) { 81 this.war = war; 82 } 83 84 85 87 88 93 public void execute() throws BuildException { 94 95 super.execute(); 96 if (path == null) { 97 throw new BuildException 98 ("Must specify 'path' attribute"); 99 } 100 if ((config == null) && (war == null)) { 101 throw new BuildException 102 ("Must specify at least one of 'config' and 'war'"); 103 } 104 StringBuffer sb = new StringBuffer ("/install?path="); 105 sb.append(URLEncoder.encode(this.path)); 106 if (config != null) { 107 sb.append("&config="); 108 sb.append(URLEncoder.encode(config)); 109 } 110 if (war != null) { 111 sb.append("&war="); 112 sb.append(URLEncoder.encode(war)); 113 } 114 execute(sb.toString()); 115 116 } 117 118 119 } 120 | Popular Tags |