00001 /* 00002 * SessionImpl.java 00003 * 00004 * Created on May 14, 2005, 11:50 AM 00005 * Created by Detro - 566/2145 00006 */ 00007 00008 package org.jaebi.server.auth; 00009 00010 import java.util.Date; 00011 00012 import org.jaebi.server.util.UniqueRandomIntFactory; 00021 public class SessionImpl implements Session { 00025 private final int SessionImplValue; 00026 00030 private final Date lastAccess; 00031 00038 private static UniqueRandomIntFactory intFactory = new UniqueRandomIntFactory(); 00039 00047 public SessionImpl() { 00048 SessionImplValue = intFactory.createUniqueRandomInt(); 00049 lastAccess = new Date(); 00050 } 00051 00052 public boolean equals( Object obj ) { 00053 if( obj == this ) { 00054 return true; 00055 } 00056 if( obj.getClass() == this.getClass() ) { 00057 SessionImpl session = ( SessionImpl ) obj; 00058 if( session.getValue() == this.getValue() ) { 00059 return true; 00060 } 00061 } 00062 00063 return false; 00064 } 00065 00066 public int hashCode() { 00067 return toString().hashCode(); 00068 } 00069 00070 public String toString() { 00071 return "Session Value: " + Integer.toString( SessionImplValue ); 00072 } 00073 00079 public int getValue() { 00080 return SessionImplValue; 00081 } 00082 }