1 package org.apache.jcs.auxiliary.remote;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.io.Serializable;
24 import java.rmi.RemoteException;
25 import java.util.Set;
26
27 import org.apache.jcs.access.exception.ObjectExistsException;
28 import org.apache.jcs.access.exception.ObjectNotFoundException;
29 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
30 import org.apache.jcs.engine.behavior.ICacheElement;
31
32 /***
33 * This is a mock impl of the remote cache service.
34 * <p>
35 * @author admin
36 */
37 public class RemoteCacheServiceMockImpl
38 implements IRemoteCacheService
39 {
40 /*** The object that was last passed to update. */
41 public Object lastUpdate;
42
43 /*** The key that was last passed to remove. */
44 public Object lastRemoveKey;
45
46 /***
47 * The cache name that was last passed to removeAll.
48 */
49 public String lastRemoveAllCacheName;
50
51
52
53
54
55
56 public ICacheElement get( String cacheName, Serializable key, long requesterId )
57 throws IOException
58 {
59
60 return null;
61 }
62
63
64
65
66
67
68 public Set getGroupKeys( String cacheName, String groupName )
69 throws RemoteException
70 {
71
72 return null;
73 }
74
75
76
77
78
79
80 public void remove( String cacheName, Serializable key, long requesterId )
81 throws IOException
82 {
83 lastRemoveKey = key;
84 }
85
86 /***
87 * Set the lastRemoveAllCacheName to the cacheName.
88 * <p>
89 * (non-Javadoc)
90 * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#removeAll(java.lang.String,
91 * long)
92 */
93 public void removeAll( String cacheName, long requesterId )
94 throws IOException
95 {
96 lastRemoveAllCacheName = cacheName;
97 }
98
99
100
101
102
103
104 public void update( ICacheElement item, long requesterId )
105 throws ObjectExistsException, IOException
106 {
107 lastUpdate = item;
108 }
109
110 public void dispose( String cacheName )
111 throws IOException
112 {
113
114
115 }
116
117
118
119
120
121 public ICacheElement get( String cacheName, Serializable key )
122 throws ObjectNotFoundException, IOException
123 {
124
125 return null;
126 }
127
128
129
130
131
132 public void release()
133 throws IOException
134 {
135
136
137 }
138
139
140
141
142
143
144 public void remove( String cacheName, Serializable key )
145 throws IOException
146 {
147 lastRemoveKey = key;
148 }
149
150
151
152
153
154 public void removeAll( String cacheName )
155 throws IOException
156 {
157 lastRemoveAllCacheName = cacheName;
158 }
159
160
161
162
163
164 public void update( ICacheElement item )
165 throws ObjectExistsException, IOException
166 {
167 lastUpdate = item;
168 }
169
170 }