1 17 18 19 20 package org.apache.lenya.cms.ant; 21 22 import org.apache.tools.ant.BuildException; 23 import org.apache.tools.ant.Project; 24 import org.apache.tools.ant.Target; 25 import org.apache.tools.ant.Task; 26 27 30 public class SetAreaProperties extends Task { 31 private String area; 32 private String dirpropertyname; 33 36 public SetAreaProperties() { 37 super(); 38 } 39 42 public String getArea() { 43 return area; 44 } 45 46 49 public void setArea(String area) { 50 this.area = area; 51 } 52 53 56 public String getDirpropertyname() { 57 return dirpropertyname; 58 } 59 60 63 public void setDirpropertyname(String dirpropertyname) { 64 this.dirpropertyname = dirpropertyname; 65 } 66 67 72 protected void setNewProperties(String area, String dirpropertyname) { 73 Target target = getOwningTarget(); 74 Project project = target.getProject(); 75 76 String dirproperty = project.getProperty(area+".dir"); 77 project.setProperty(dirpropertyname, dirproperty); 78 } 79 80 83 public void execute() throws BuildException { 84 try { 85 log("area " + this.getArea()); 86 log("name of the property for the directory " + this.getDirpropertyname()); 87 setNewProperties(this.getArea(), this.getDirpropertyname()); 88 } catch (Exception e) { 89 throw new BuildException(e); 90 } 91 } 92 } 93 | Popular Tags |