1 23 24 77 78 package org.apache.tools.ant.taskdefs.optional.sun.appserv; 79 80 import org.apache.tools.ant.Project; 81 import org.apache.tools.ant.BuildException; 82 83 102 public class UndeployTask extends ComponentAdmin { 103 private static final String UNDEPLOY_COMMAND = "undeploy"; 104 LocalStringsManager lsm = new LocalStringsManager(); 105 private boolean droptables; private boolean droptablesIsSet = false; 108 private boolean cascade; private boolean cascadeIsSet = false; 114 115 protected void checkComponentConfig(Server aServer, Component comp) 116 throws BuildException { 117 super.checkComponentConfig(aServer, comp); 118 119 String theName = comp.getName(); 121 if ((theName == null) || (theName.length() == 0)) { 122 final String msg = lsm.getString("InvalidComponentName", new Object [] {theName}); 123 throw new BuildException(msg, getLocation()); 124 } 125 } 126 127 133 public void setDroptables(boolean droptables) { 134 this.droptables = droptables; 135 droptablesIsSet = true; 136 } 137 138 146 public void setCascade(boolean casacde) { 147 this.cascade = cascade; 148 cascadeIsSet = true; 149 } 150 151 protected String getCommandString(Server server, Component comp) { 152 StringBuffer cmdString = new StringBuffer (UNDEPLOY_COMMAND); 153 cmdString.append(server.getCommandParameters(true)); 154 if (comp.getType() != null) { 155 log(lsm.getString("DeprecatedTypeAttribute"), Project.MSG_WARN); 156 } 157 if (droptablesIsSet) { 158 cmdString.append(" --droptables=").append(droptables); 159 droptablesIsSet = false; 160 } 161 if (cascade) { 162 cmdString.append(" --cascade=").append(cascade); 163 cascadeIsSet = false; 164 } 165 166 String lTarget = comp.getTarget(); 168 if ((lTarget != null) && (lTarget.length() > 0)) { 169 cmdString.append(" --target ").append(lTarget); 170 } 171 172 cmdString.append(" ").append(comp.getName()); 173 174 return cmdString.toString(); 175 } 176 } 177 | Popular Tags |