1 18 19 package org.apache.tools.ant.taskdefs.optional.j2ee; 20 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.types.Path; 23 24 45 public abstract class AbstractHotDeploymentTool implements HotDeploymentTool { 46 47 private ServerDeploy task; 48 49 50 private Path classpath; 51 52 53 private String userName; 54 55 56 private String password; 57 58 59 private String server; 60 61 65 public Path createClasspath() { 66 if (classpath == null) { 67 classpath = new Path(task.getProject()); 68 } 69 return classpath.createPath(); 70 } 71 72 80 protected abstract boolean isActionValid(); 81 82 90 public void validateAttributes() throws BuildException { 91 if (task.getAction() == null) { 92 throw new BuildException("The \"action\" attribute must be set"); 93 } 94 95 if (!isActionValid()) { 96 throw new BuildException("Invalid action \"" + task.getAction() + "\" passed"); 97 } 98 99 if (classpath == null) { 100 throw new BuildException("The classpath attribute must be set"); 101 } 102 } 103 104 109 public abstract void deploy() throws BuildException; 110 111 116 public void setTask(ServerDeploy task) { 117 this.task = task; 118 } 119 120 124 protected ServerDeploy getTask() { 125 return task; 126 } 127 128 132 public Path getClasspath() { 133 return classpath; 134 } 135 136 142 public void setClasspath(Path classpath) { 143 this.classpath = classpath; 144 } 145 146 150 public String getUserName() { 151 return userName; 152 } 153 154 158 public void setUserName(String userName) { 159 this.userName = userName; 160 } 161 162 166 public String getPassword() { 167 return password; 168 } 169 170 174 public void setPassword(String password) { 175 this.password = password; 176 } 177 178 182 public String getServer() { 183 return server; 184 } 185 186 190 public void setServer(String server) { 191 this.server = server; 192 } 193 } 194 | Popular Tags |