KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > invicta > handler > SetPropertiesHandler


1 package net.sf.invicta.handler;
2
3 import java.util.Iterator JavaDoc;
4 import java.util.Map JavaDoc;
5
6 import net.sf.invicta.InvictaConstants;
7 import net.sf.invicta.InvictaException;
8 import net.sf.invicta.api.DefinedProperty;
9
10 /**
11  *
12  */

13 public class SetPropertiesHandler extends InvictaBasicHandler {
14
15     /**
16      *
17      */

18     public String JavaDoc getName() {
19         return "setProperties";
20     }
21
22     /**
23      *
24      */

25     public String JavaDoc handle(Map JavaDoc paramsMap) throws InvictaException {
26         
27         String JavaDoc propertyCommands = "";
28         for (Iterator JavaDoc iter = getComponent().getDefinedProperties().iterator(); iter.hasNext();) {
29             DefinedProperty definedProperty = (DefinedProperty) iter.next();
30             
31             if (!definedProperty.isLocalType()) {
32             
33                 String JavaDoc 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     /**
45      *
46      */

47     protected String JavaDoc getPropertyCommand(String JavaDoc name, String JavaDoc value) {
48         return "\t\t<property name=\"" + name + "\" value=\"" + value + "\"/>\n";
49     }
50     
51 }
52
Popular Tags