1 2 24 25 package com.lutris.appserver.server.sessionEnhydra.persistent; 26 27 import java.io.Serializable ; 28 29 import com.lutris.appserver.server.session.SessionException; 30 import com.lutris.appserver.server.sessionEnhydra.PagedSession; 31 import com.lutris.appserver.server.sessionEnhydra.StandardSessionManager; 32 import com.lutris.appserver.server.user.User; 33 34 41 public class PersistentSession extends PagedSession { 42 43 transient PersistentSessionHome sessionHome; 44 45 48 public PersistentSession() { 49 } 50 51 57 protected PersistentSession(StandardSessionManager sessionManager, 58 String sessionKey, 59 PersistentSessionHome sessionHome) { 60 super(sessionManager, sessionKey); 61 this.sessionHome = sessionHome; 62 } 63 64 72 public void setUser(User user) throws SessionException { 73 if (!(user instanceof Serializable )) { 74 throw new SessionException("Persistent session user must be serializable."); 75 } 76 super.setUser(user); 77 DBUtil.dbUpdate(this, sessionHome.getDatabaseName()); 80 } 81 82 89 void restoreSessionManager(StandardSessionManager mgr) { 90 this.sessionManager = mgr; 91 } 92 93 100 void restoreSessionHome(PersistentSessionHome home) { 101 this.sessionHome = home; 102 } 103 104 } 105 106 107 108 109 | Popular Tags |