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