1 package net.sf.invicta.handler; 2 3 import java.util.Iterator ; 4 import java.util.Map ; 5 6 import net.sf.invicta.InvictaConstants; 7 import net.sf.invicta.InvictaException; 8 import net.sf.invicta.api.DefinedProperty; 9 10 13 public class SetPropertiesHandler extends InvictaBasicHandler { 14 15 18 public String getName() { 19 return "setProperties"; 20 } 21 22 25 public String handle(Map paramsMap) throws InvictaException { 26 27 String propertyCommands = ""; 28 for (Iterator iter = getComponent().getDefinedProperties().iterator(); iter.hasNext();) { 29 DefinedProperty definedProperty = (DefinedProperty) iter.next(); 30 31 if (!definedProperty.isLocalType()) { 32 33 String propertyName = getComponent().getName() + 34 InvictaConstants.ANT_PROPERTY_SEPARATOR + definedProperty.getName(); 35 36 propertyCommands += getPropertyCommand 37 (propertyName, definedProperty.getFormattedValue()); 38 } 39 } 40 41 return propertyCommands; 42 } 43 44 47 protected String getPropertyCommand(String name, String value) { 48 return "\t\t<property name=\"" + name + "\" value=\"" + value + "\"/>\n"; 49 } 50 51 } 52 | Popular Tags |