KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > terracotta > session > util > MockLifecycleEventMgr


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.terracotta.session.util;
5
6 import com.terracotta.session.Session;
7
8 public class MockLifecycleEventMgr implements LifecycleEventMgr {
9
10   private Session sess;
11   private String JavaDoc name;
12   private Object JavaDoc val;
13   private String JavaDoc lastMethod;
14
15
16   public void clear() {
17     sess = null;
18     name = null;
19     val = null;
20     lastMethod = null;
21   }
22
23   public void fireSessionCreatedEvent(Session s) {
24     this.lastMethod = "fireSessionCreatedEvent";
25     this.sess = s;
26   }
27
28   public void fireSessionDestroyedEvent(Session s) {
29     this.lastMethod = "fireSessionDestroyedEvent";
30     this.sess = s;
31   }
32
33   public void unbindAttribute(Session s, String JavaDoc n, Object JavaDoc ov) {
34     this.lastMethod = "unbindAttribute";
35     this.sess = s;
36     this.name = n;
37     this.val = ov;
38   }
39
40   public void bindAttribute(Session s, String JavaDoc n, Object JavaDoc o) {
41     this.lastMethod = "bindAttribute";
42     this.sess = s;
43     this.name = n;
44     this.val = o;
45   }
46
47   public void removeAttribute(Session s, String JavaDoc n, Object JavaDoc o) {
48     this.lastMethod = "removeAttribute";
49     this.sess = s;
50     this.name = n;
51     this.val = o;
52   }
53
54   public void replaceAttribute(Session s, String JavaDoc n, Object JavaDoc o, Object JavaDoc newVal) {
55     this.lastMethod = "replaceAttribute";
56     this.sess = s;
57     this.name = n;
58     this.val = o;
59   }
60
61   public void setAttribute(Session s, String JavaDoc n, Object JavaDoc o) {
62     this.lastMethod = "setAttribute";
63     this.sess = s;
64     this.name = n;
65     this.val = o;
66   }
67
68   public String JavaDoc getLastMethod() {
69     return lastMethod;
70   }
71
72   public String JavaDoc getName() {
73     return name;
74   }
75
76   public Object JavaDoc getValue() {
77     return val;
78   }
79
80   public Session getSession() {
81     return sess;
82   }
83
84 }
85
Popular Tags