KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > mocks > portlet > MockPortletPreferences


1 /**
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5 package org.exoplatform.test.mocks.portlet;
6
7 import java.util.Hashtable JavaDoc ;
8 import javax.portlet.* ;
9 /**
10  * Created by The eXo Platform SARL
11  * Author : Tuan Nguyen
12  * tuan08@users.sourceforge.net
13  * Date: Jul 27, 2003
14  * Time: 2:13:09 AM
15  */

16 public class MockPortletPreferences implements PortletPreferences {
17   private Hashtable JavaDoc map_ ;
18
19   public MockPortletPreferences() {
20     map_ = new Hashtable JavaDoc() ;
21   }
22   
23   public boolean isReadOnly(String JavaDoc key) {
24     return true ;
25   }
26
27   public String JavaDoc getValue(String JavaDoc key, String JavaDoc def) {
28     String JavaDoc value = (String JavaDoc) map_.get(key) ;
29     if (value == null) value = def ;
30     return value ;
31   }
32
33   public String JavaDoc[] getValues(String JavaDoc key, String JavaDoc[] def) {
34     String JavaDoc[] values = (String JavaDoc[]) map_.get(key) ;
35     if (values == null) values = def ;
36     return values ;
37   }
38
39   public void setValue(String JavaDoc key, String JavaDoc value) throws ReadOnlyException {
40     map_.put(key, value) ;
41   }
42
43   public void setValues(String JavaDoc key, String JavaDoc[] values) throws ReadOnlyException {
44     map_.put(key, values) ;
45   }
46
47   public java.util.Enumeration JavaDoc getNames() {
48     return map_.keys() ;
49   }
50
51   public java.util.Map JavaDoc getMap() {
52     return map_ ;
53   }
54
55   public void reset(String JavaDoc key) throws ReadOnlyException {
56     map_.remove(key) ;
57   }
58
59   public void store() throws java.io.IOException JavaDoc, ValidatorException {
60
61   }
62 }
63
Popular Tags