KickJava   Java API By Example, From Geeks To Geeks.

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


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.InvictaException;
7 import net.sf.invicta.api.Property;
8
9 /**
10  *
11  */

12 public class SetGeneralPropertiesHandler extends InvictaBasicHandler {
13     public final static String JavaDoc GENERAL_PROPERTY_PREFIX = "general.";
14
15     /**
16      *
17      */

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

25     public String JavaDoc handle(Map JavaDoc paramsMap) throws InvictaException {
26         String JavaDoc propertyCommands = "";
27         for (Iterator JavaDoc iter = getProject().getGeneralProperties().iterator(); iter.hasNext();) {
28             Property property = (Property) iter.next();
29             propertyCommands +=
30                 getPropertyCommand(property.getName(), property.getValue());
31             
32         }
33         return propertyCommands;
34     }
35
36     /**
37      *
38      */

39     protected String JavaDoc getPropertyCommand(String JavaDoc name, String JavaDoc value) {
40         return "\t\t<property name=\"" + GENERAL_PROPERTY_PREFIX +
41                 name + "\" value=\"" + value + "\"/>\n";
42     }
43
44 }
45
Popular Tags