Source Code Cross Referenced for LDAPArguments.java in  » Testing » jakarta-jmeter » org » apache » jmeter » protocol » ldap » config » gui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » jakarta jmeter » org.apache.jmeter.protocol.ldap.config.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.protocol.ldap.config.gui;
020:
021:        import java.io.Serializable;
022:        import java.util.ArrayList;
023:        import java.util.HashMap;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import org.apache.jmeter.testelement.property.CollectionProperty;
028:        import org.apache.jmeter.testelement.property.PropertyIterator;
029:        import org.apache.jmeter.testelement.property.TestElementProperty;
030:        import org.apache.jmeter.config.ConfigTestElement;
031:
032:        // Mark Walsh, 2002-08-03 add method:
033:        // addArgument(String name, Object value, Object metadata)
034:        // Modify methods:
035:        // toString(), addEmptyArgument(), addArgument(String name, Object value)
036:
037:        /**
038:         * A set of LDAPArgument objects. author Dolf Smits(Dolf.Smits@Siemens.com)
039:         * created Aug 09 2003 11:00 AM company Siemens Netherlands N.V..
040:         * 
041:         * Based on the work of:
042:         * 
043:         * author Michael Stover author Mark Walsh
044:         */
045:
046:        public class LDAPArguments extends ConfigTestElement implements 
047:                Serializable {
048:            /** The name of the property used to store the arguments. */
049:            public static final String ARGUMENTS = "Arguments.arguments"; //$NON-NLS$
050:
051:            /**
052:             * Create a new Arguments object with no arguments.
053:             */
054:            public LDAPArguments() {
055:                setProperty(new CollectionProperty(ARGUMENTS, new ArrayList()));
056:            }
057:
058:            /**
059:             * Get the arguments.
060:             * 
061:             * @return the arguments
062:             */
063:            public CollectionProperty getArguments() {
064:                return (CollectionProperty) getProperty(ARGUMENTS);
065:            }
066:
067:            /**
068:             * Clear the arguments.
069:             */
070:            public void clear() {
071:                super .clear();
072:                setProperty(new CollectionProperty(ARGUMENTS, new ArrayList()));
073:            }
074:
075:            /**
076:             * Set the list of arguments. Any existing arguments will be lost.
077:             * 
078:             * @param arguments
079:             *            the new arguments
080:             */
081:            public void setArguments(List arguments) {
082:                setProperty(new CollectionProperty(ARGUMENTS, arguments));
083:            }
084:
085:            /**
086:             * Get the arguments as a Map. Each argument name is used as the key, and
087:             * its value as the value.
088:             * 
089:             * @return a new Map with String keys and values containing the arguments
090:             */
091:            public Map getArgumentsAsMap() {
092:                PropertyIterator iter = getArguments().iterator();
093:                Map argMap = new HashMap();
094:                while (iter.hasNext()) {
095:                    LDAPArgument arg = (LDAPArgument) iter.next()
096:                            .getObjectValue();
097:                    argMap.put(arg.getName(), arg.getValue());
098:                }
099:                return argMap;
100:            }
101:
102:            /**
103:             * Add a new argument with the given name and value.
104:             * 
105:             * @param name
106:             *            the name of the argument
107:             * @param value
108:             *            the value of the argument
109:             */
110:            public void addArgument(String name, String value, String opcode) {
111:                addArgument(new LDAPArgument(name, value, opcode, null));
112:            }
113:
114:            /**
115:             * Add a new argument.
116:             * 
117:             * @param arg
118:             *            the new argument
119:             */
120:            public void addArgument(LDAPArgument arg) {
121:                TestElementProperty newArg = new TestElementProperty(arg
122:                        .getName(), arg);
123:                if (isRunningVersion()) {
124:                    this .setTemporary(newArg);
125:                }
126:                getArguments().addItem(newArg);
127:            }
128:
129:            /**
130:             * Add a new argument with the given name, value, and metadata.
131:             * 
132:             * @param name
133:             *            the name of the argument
134:             * @param value
135:             *            the value of the argument
136:             * @param metadata
137:             *            the metadata for the argument
138:             */
139:            public void addArgument(String name, String value, String opcode,
140:                    String metadata) {
141:                addArgument(new LDAPArgument(name, value, opcode, metadata));
142:            }
143:
144:            /**
145:             * Get a PropertyIterator of the arguments.
146:             * 
147:             * @return an iteration of the arguments
148:             */
149:            public PropertyIterator iterator() {
150:                return getArguments().iterator();
151:            }
152:
153:            /**
154:             * Create a string representation of the arguments.
155:             * 
156:             * @return the string representation of the arguments
157:             */
158:            public String toString() {
159:                StringBuffer str = new StringBuffer();
160:                PropertyIterator iter = getArguments().iterator();
161:                while (iter.hasNext()) {
162:                    LDAPArgument arg = (LDAPArgument) iter.next()
163:                            .getObjectValue();
164:                    final String metaData = arg.getMetaData();
165:                    str.append(arg.getName());
166:                    if (metaData == null) {
167:                        str.append("="); //$NON-NLS$
168:                    } else {
169:                        str.append(metaData);
170:                    }
171:                    str.append(arg.getValue());
172:                    if (iter.hasNext()) {
173:                        str.append("&"); //$NON-NLS$
174:                    }
175:                }
176:                return str.toString();
177:            }
178:
179:            /**
180:             * Remove the specified argument from the list.
181:             * 
182:             * @param row
183:             *            the index of the argument to remove
184:             */
185:            public void removeArgument(int row) {
186:                if (row < getArguments().size()) {
187:                    getArguments().remove(row);
188:                }
189:            }
190:
191:            /**
192:             * Remove the specified argument from the list.
193:             * 
194:             * @param arg
195:             *            the argument to remove
196:             */
197:            public void removeArgument(LDAPArgument arg) {
198:                PropertyIterator iter = getArguments().iterator();
199:                while (iter.hasNext()) {
200:                    LDAPArgument item = (LDAPArgument) iter.next()
201:                            .getObjectValue();
202:                    if (arg.equals(item)) {
203:                        iter.remove();
204:                    }
205:                }
206:            }
207:
208:            /**
209:             * Remove the argument with the specified name.
210:             * 
211:             * @param argName
212:             *            the name of the argument to remove
213:             */
214:            public void removeArgument(String argName) {
215:                PropertyIterator iter = getArguments().iterator();
216:                while (iter.hasNext()) {
217:                    LDAPArgument arg = (LDAPArgument) iter.next()
218:                            .getObjectValue();
219:                    if (arg.getName().equals(argName)) {
220:                        iter.remove();
221:                    }
222:                }
223:            }
224:
225:            /**
226:             * Remove all arguments from the list.
227:             */
228:            public void removeAllArguments() {
229:                getArguments().clear();
230:            }
231:
232:            /**
233:             * Add a new empty argument to the list. The new argument will have the
234:             * empty string as its name and value, and null metadata.
235:             */
236:            public void addEmptyArgument() {
237:                addArgument(new LDAPArgument("", "", "", null));
238:            }
239:
240:            /**
241:             * Get the number of arguments in the list.
242:             * 
243:             * @return the number of arguments
244:             */
245:            public int getArgumentCount() {
246:                return getArguments().size();
247:            }
248:
249:            /**
250:             * Get a single argument.
251:             * 
252:             * @param row
253:             *            the index of the argument to return.
254:             * @return the argument at the specified index, or null if no argument
255:             *         exists at that index.
256:             */
257:            public LDAPArgument getArgument(int row) {
258:                LDAPArgument argument = null;
259:
260:                if (row < getArguments().size()) {
261:                    argument = (LDAPArgument) getArguments().get(row)
262:                            .getObjectValue();
263:                }
264:
265:                return argument;
266:            }
267:        }
ww__w_._j_a__v_a___2_s__.c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.