1 23 24 package org.apache.tools.ant.taskdefs.optional.iplanet; 25 26 import org.apache.tools.ant.Project; 27 import org.apache.tools.ant.BuildException; 28 29 import java.io.File ; 30 31 public class DeployTask extends ComponentAdmin { 32 private static final String DEPLOY_COMMAND = "deploy"; 33 34 protected void checkComponentConfig(Component comp) throws BuildException { 35 super.checkComponentConfig(comp); 36 37 File theFile = comp.getFile(); 39 if ((theFile == null) || (!theFile.exists())) { 40 String msg = "The file specified (" + theFile + ") could not be found."; 41 throw new BuildException(msg, getLocation()); 42 } 43 44 String theType = comp.getType(); 46 if ((theType != null) && (!theType.equals(TYPE_WEB)) && (comp.contextRootIsSet())) { 47 String msg = "The \"contextroot\" attribute doesn't apply to " 48 + comp.getType() + " files -- it only applies to war files."; 49 log(msg, Project.MSG_WARN); 50 } 51 } 52 53 protected String getCommandString(Server server, Component comp) { 54 StringBuffer cmdString = new StringBuffer (DEPLOY_COMMAND); 55 cmdString.append(server.getCommandParameters(true)); 56 if (comp.getType() != null) { 57 cmdString.append(" --type ").append(comp.getType()); 58 if (comp.getType().equals(TYPE_WEB)) { 59 cmdString.append(" --contextroot ").append(comp.getContextroot()); 60 } 61 } 62 63 cmdString.append(" --force=").append(comp.getForce()); 64 cmdString.append(" --name ").append(comp.getName()); 65 cmdString.append(" --upload=").append(comp.getUpload()); 66 cmdString.append(" ").append(comp.getFile().getPath()); 67 68 return cmdString.toString(); 69 } 70 } | Popular Tags |