1 64 package com.jcorporate.expresso.core.controller.session; 65 66 import java.util.Enumeration ; 67 import java.util.HashMap ; 68 import java.util.Hashtable ; 69 import java.util.Map ; 70 71 72 95 public class SimplePersistentSession implements PersistentSession { 96 99 private Hashtable attributes = new Hashtable (); 100 101 104 private Hashtable persistentAttributes = new Hashtable (); 105 106 109 public SimplePersistentSession() { 110 } 111 112 118 public void setAttribute(String attribName, Object attribValue) { 119 if (attribValue == null) { 120 attributes.remove(attribName); 121 } else { 122 attributes.put(attribName, attribValue); 123 } 124 } 125 126 132 public Object getAttribute(String attribName) { 133 return attributes.get(attribName); 134 } 135 136 141 public Enumeration getAttributeNames() { 142 return attributes.keys(); 143 } 144 145 152 public void setClientAttribute(String attribName, String attribValue) { 153 } 154 155 163 public String getClientAttribute(String attribName) { 164 return null; 165 } 166 167 174 public Map getPersistentAttributes() { 175 return new HashMap (persistentAttributes); 176 } 177 178 184 public void setPersistentAttributes(Map newAttributes) { 185 persistentAttributes = new Hashtable (newAttributes); 186 } 187 188 193 public Enumeration getPeristentAttributeNames() { 194 return persistentAttributes.keys(); 195 } 196 197 205 public void setPersistentAttribute(String attribName, Object attribValue) { 206 if (attribValue == null) { 207 attributes.remove(attribName); 208 } else { 209 persistentAttributes.put(attribName, attribValue); 210 } 211 } 212 213 219 public Object getPersistentAttribute(String attribName) { 220 return persistentAttributes.get(attribName); 221 } 222 223 226 public void invalidate() { 227 attributes = new Hashtable (); 228 persistentAttributes = new Hashtable (); 229 } 230 231 236 public void removeAttribute(String attribName) { 237 attributes.remove(attribName); 238 } 239 240 245 public void removePersistentAttribute(String attribName) { 246 persistentAttributes.remove(attribName); 247 } 248 } 249 | Popular Tags |