KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > junit > Authentication


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.junit;
8
9
10 import java.util.HashMap JavaDoc;
11 import java.util.Map JavaDoc;
12
13
14 /**
15  * This class stores authentication pairs that are used to
16  * authenticate with the server. These are not used when
17  * running a test locally.
18  *
19  * @author Brian Pontarelli
20  * @since 2.0
21  * @version 2.0
22  */

23 public class Authentication {
24
25     private Map JavaDoc pairs;
26
27
28     /**
29      * Constructs a new Authentication
30      */

31     public Authentication() {
32         pairs = new HashMap JavaDoc();
33     }
34
35
36     /**
37      * Sets a pair into the authentication
38      *
39      * @param key The key of the pair as an Object
40      * @param value The value of the pair as an Object
41      */

42     public void addPair(Object JavaDoc key, Object JavaDoc value) {
43         pairs.put(key, value);
44     }
45
46     /**
47      * Removes a pair from the authentication
48      *
49      * @param key The key of the pair to remove
50      */

51     public void removePair(Object JavaDoc key) {
52         pairs.remove(key);
53     }
54
55     /**
56      * Retrieves a pair from the authentication
57      *
58      * @param key The key of the pair to retrieve.
59      * @return The value of the pair or null if the key does not exist in
60      * the authentication
61      */

62     public Object JavaDoc getValue(Object JavaDoc key) {
63         return pairs.get(key);
64     }
65 }
66
Popular Tags