1 11 12 package org.jivesoftware.messenger.audit; 13 14 import org.jivesoftware.messenger.Session; 15 import java.util.Date ; 16 17 23 public class SessionEvent extends AuditEvent { 24 25 28 public static final int SESSION_CODE = 1; 29 30 public static final int SESSION_CONNECT = 1; 32 public static final int SESSION_STREAM = 2; 33 public static final int SESSION_AUTH_FAILURE = 3; 34 public static final int SESSION_AUTH_SUCCESS = 4; 35 public static final int SESSION_DISCONNECT = 10; 36 37 44 private SessionEvent(Session eventSession, int eventReason, String data) { 45 super(eventSession, new Date (), SESSION_CODE, eventReason, data); 46 } 47 48 55 public static SessionEvent createConnectEvent(Session session) { 56 return new SessionEvent(session, SESSION_CONNECT, null); 57 } 58 59 67 public static SessionEvent createStreamEvent(Session session) { 68 return new SessionEvent(session, SESSION_STREAM, null); 69 } 70 71 77 public static SessionEvent createAuthFailureEvent(Session session, String user, 78 String resource) 79 { 80 return new SessionEvent(session, SESSION_AUTH_FAILURE, 81 "User: " + user + " Resource: " + resource); 82 } 83 84 90 public static SessionEvent createAuthSuccessEvent(Session session) { 91 return new SessionEvent(session, SESSION_AUTH_SUCCESS, null); 92 } 93 94 100 public static SessionEvent createDisconnectEvent(Session session) { 101 return new SessionEvent(session, SESSION_DISCONNECT, null); 102 } 103 104 } | Popular Tags |