1 9 package org.jboss.portal.server.impl.user; 10 11 import java.io.IOException ; 12 import java.io.ObjectInputStream ; 13 import java.io.ObjectOutputStream ; 14 import java.io.Serializable ; 15 import java.util.HashMap ; 16 import java.util.Map ; 17 18 import org.apache.log4j.Logger; 19 import org.jboss.portal.server.ServerObject; 20 import org.jboss.portal.server.plugins.preferences.AbstractPreferenceStore; 21 import org.jboss.portal.server.plugins.preferences.PreferenceStore; 22 import org.jboss.portal.server.user.ServerObjectContext; 23 import org.jboss.portal.server.user.UserContext; 24 25 31 public class UserContextImpl implements UserContext, Serializable 32 { 33 34 private static final Logger log = Logger.getLogger(UserContextImpl.class); 35 36 private Map contexts; 37 private Map informations; 38 private PreferenceStore store; 39 40 public UserContextImpl() 41 { 42 this.contexts = new HashMap (); 43 this.informations = new HashMap (); 44 this.store = new AbstractPreferenceStore(); 45 informations.put("user.name.given", "given"); 46 informations.put("user.name.family", "family"); 47 } 48 49 public ServerObjectContext getContext(ServerObject serverObject) 50 { 51 ServerObjectContext ctx = (ServerObjectContext)contexts.get(serverObject.getID()); 52 if (ctx == null) 53 { 54 ctx = serverObject.createContext(); 55 contexts.put(serverObject.getID(), ctx); 56 } 57 return ctx; 58 } 59 60 public PreferenceStore getPreferenceStore() 61 { 62 return store; 63 } 64 65 public Map getInformations() 66 { 67 return informations; 68 } 69 70 private void readObject(ObjectInputStream in) throws ClassNotFoundException , IOException 71 { 72 if (log.isDebugEnabled()) 73 { 74 log.debug("Read object"); 75 } 76 in.defaultReadObject(); 77 } 78 79 private void writeObject(ObjectOutputStream out) throws IOException 80 { 81 if (log.isDebugEnabled()) 82 { 83 log.debug("Write object"); 84 } 85 out.defaultWriteObject(); 86 } 87 } 88 | Popular Tags |