KickJava   Java API By Example, From Geeks To Geeks.

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


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  * The class which store the description of a sample action
31  *
32  * @author JC Meillaud
33  * @author A Peyrard
34  */

35 public class SampleDescription implements ActionDescription {
36     static Category cat = Category.getInstance(SampleDescription.class
37             .getName());
38     private String JavaDoc name;
39     private String JavaDoc clazz;
40     private String JavaDoc method;
41     private Vector params;
42     private Vector help;
43     private String JavaDoc guiKey;
44
45     /**
46      * Build a new sample description object with specified values
47      *
48      * @param n
49      * The name of the action
50      * @param c
51      * The clazz where the action method is defined
52      * @param m
53      * The method to be launch by the action
54      * @param p
55      * The description of the parameters needed for this method
56      * @param h
57      * The help of the action
58      */

59     public SampleDescription(String JavaDoc n, String JavaDoc c, String JavaDoc m, Vector p, Vector h) {
60         cat.debug("-> constructor");
61         this.name = n;
62         this.clazz = c;
63         this.method = m;
64         this.params = p;
65         this.help = h;
66         this.guiKey = null;
67     }
68
69     /**
70      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#createNodeDescription(org.objectweb.clif.scenario.util.isac.util.tree.NodeDescription)
71      */

72     public void createNodeDescription(NodeDescription desc) {
73         cat.debug("-> createNodeDescription");
74         desc.setActionName(this.name);
75         // create a new table wich will store the parameters values in the node
76
// description
77
Hashtable paramsValues = new Hashtable();
78         for (int i = 0; i < this.params.size(); i++) {
79             paramsValues.put(((ParameterDescription) this.params.elementAt(i))
80                     .getName(), "");
81         }
82         desc.setParams(paramsValues);
83     }
84
85     /**
86      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#getGUIKey()
87      */

88     public String JavaDoc getGUIKey() {
89         cat.debug("-> getGUIKey");
90         return this.guiKey;
91     }
92
93     /**
94      * @see org.objectweb.clif.scenario.util.isac.plugin.ActionDescription#setGUIKey(java.lang.String)
95      */

96     public void setGUIKey(String JavaDoc key) {
97         cat.debug("-> setGUIKey");
98         this.guiKey = key;
99     }
100
101     /**
102      * Attribute clazz getter
103      *
104      * @return The clazz name of the action
105      */

106     public String JavaDoc getClazz() {
107         cat.debug("-> getClazz");
108         return clazz;
109     }
110
111     /**
112      * Attribute help getter
113      *
114      * @return The help in a vector, each element in the vector is a help line
115      */

116     public Vector getHelp() {
117         cat.debug("-> getHelp");
118         return help;
119     }
120
121     /**
122      * Atribute method getter
123      *
124      * @return The method name of the action
125      */

126     public String JavaDoc getMethod() {
127         cat.debug("-> getMethod");
128         return method;
129     }
130
131     /**
132      * Attribute name getter
133      *
134      * @return The name of the action
135      */

136     public String JavaDoc getName() {
137         cat.debug("-> getName");
138         return name;
139     }
140
141     /**
142      * Attribute params getter
143      *
144      * @return The parameters descriptions
145      */

146     public Vector getParams() {
147         cat.debug("-> getParams");
148         return params;
149     }
150 }
Popular Tags