KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > scenario > util > isac > plugin > ObjectDescription


1 /*
2 * CLIF is a Load Injection Framework
3 * Copyright (C) 2004 France Telecom R&D
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * CLIF
20 *
21 * Contact: clif@objectweb.org
22 */

23 package org.objectweb.clif.scenario.util.isac.plugin;
24
25 import org.apache.log4j.Category;
26 import org.objectweb.clif.scenario.util.isac.util.tree.NodeDescription;
27
28 import java.util.*;
29 /**
30  * This class store an object description
31  *
32  * @author JC Meillaud
33  * @author A Peyrard
34  */

35 public class ObjectDescription implements ActionDescription {
36     static Category cat = Category.getInstance(ObjectDescription.class.getName());
37     private String JavaDoc name;
38     private String JavaDoc clazz;
39     private Vector params;
40     private Vector help;
41     private String JavaDoc guiKey;
42
43     /**
44      * Build a new 'object description' object
45      * @param n The name of the object
46      * @param c The clazz name of the implementation of the object
47      * @param p The parameters descriptions which are needed to construct the object
48      * @param h The help of the object
49      */

50     public ObjectDescription(String JavaDoc n, String JavaDoc c, Vector p, Vector h) {
51         cat.debug("-> constructor") ;
52         cat.warn("SIZE OF THE PARAMS IS : " + p.size()) ;
53         this.name = n;
54         this.clazz = c;
55         this.params = p;
56         this.help = h;
57         this.guiKey = null;
58     }
59
60     /**
61      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#createNodeDescription(org.objectweb.clif.scenario.util.isac.util.tree.NodeDescription)
62      */

63     public void createNodeDescription(NodeDescription desc) {
64         cat.debug("-> createNodeDescription") ;
65         desc.setActionName(this.name);
66         // create a new table wich will store the parameters values in the node description
67
Hashtable paramsValues = new Hashtable();
68         for (int i = 0; i < this.params.size(); i++)
69             paramsValues.put(
70                 ((ParameterDescription) this.params.elementAt(i)).getName(),
71                 "");
72         desc.setParams(paramsValues);
73     }
74
75     /**
76      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#getGUIKey()
77      */

78     public String JavaDoc getGUIKey() {
79         cat.debug("-> getGUIKey") ;
80         return guiKey ;
81     }
82
83     /**
84      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#setGUIKey(java.lang.String)
85      */

86     public void setGUIKey(String JavaDoc key) {
87         cat.debug("-> setGUIKey") ;
88         this.guiKey = key ;
89     }
90     /**
91      * Attribute clazz getter
92      * @return The class name of the object
93      */

94     public String JavaDoc getClazz() {
95         cat.debug("-> getClazz") ;
96         return clazz;
97     }
98
99     /**
100      * Attribute help getter
101      * @return The help of the object
102      */

103     public Vector getHelp() {
104         cat.debug("-> getHelp") ;
105         return help;
106     }
107
108     /**
109      * Attribute name getter
110      * @return The name of the object
111      */

112     public String JavaDoc getName() {
113         cat.debug("-> getName") ;
114         return name;
115     }
116
117     /**
118      * Attribute params getter
119      * @return The parameters descriptions which are needed by the object to be build
120      */

121     public Vector getParams() {
122         cat.debug("-> getParams") ;
123         cat.warn("-> getParams, SIZE IS : " + params.size()) ;
124         return params;
125     }
126 }
127
Popular Tags