KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > deploy > PropertyDescriptor


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.ioc.deploy;
8
9 import java.util.ArrayList JavaDoc;
10 import java.util.Iterator JavaDoc;
11 import java.util.List JavaDoc;
12
13 import org.jfox.ioc.deployment.Descriptor;
14 import org.jfox.ioc.util.XMLUtils;
15 import org.w3c.dom.Element JavaDoc;
16 import org.w3c.dom.Node JavaDoc;
17
18 /**
19  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
20  */

21
22 public class PropertyDescriptor implements Descriptor {
23     private List JavaDoc params = new ArrayList JavaDoc();
24     private String JavaDoc name = "";
25
26     public void processXML(Node JavaDoc node) throws ComponentDescriptionException {
27         setName(XMLUtils.getAtrributeValueOf(node, "name"));
28         Iterator JavaDoc paramDescriptors = XMLUtils.getElementsByTagName((Element JavaDoc) node, "param");
29         while(paramDescriptors.hasNext()) {
30             Element JavaDoc paramElement = (Element JavaDoc) paramDescriptors.next();
31             ParameterDescriptor pd = new ParameterDescriptor();
32             pd.processXML(paramElement);
33             addParamDescriptor(pd);
34         }
35     }
36
37     private void addParamDescriptor(ParameterDescriptor pd) {
38         params.add(pd);
39     }
40
41     public ParameterDescriptor[] getParamDescriptors() {
42         return (ParameterDescriptor[]) params.toArray(new ParameterDescriptor[params.size()]);
43     }
44
45     public String JavaDoc getName() {
46         return name;
47     }
48
49     public void setName(String JavaDoc name) {
50         this.name = name;
51     }
52
53     public static void main(String JavaDoc[] args) {
54
55     }
56 }
57
58
Popular Tags