1 package org.apache.jcs.engine;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.Serializable;
23 import java.util.Collections;
24 import java.util.Map;
25 import java.util.Set;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29 import org.apache.jcs.engine.behavior.ICacheElement;
30 import org.apache.jcs.engine.behavior.ICacheService;
31 import org.apache.jcs.engine.behavior.IZombie;
32
33 /***
34 * Zombie adapter for any cache service. Balks at every call.
35 */
36 public class ZombieCacheService
37 implements ICacheService, IZombie
38 {
39 /*** The logger. */
40 private static final Log log = LogFactory.getLog( ZombieCacheService.class );
41
42 /***
43 * @param item
44 */
45 public void put( ICacheElement item )
46 {
47 if ( log.isDebugEnabled() )
48 {
49 log.debug( "Zombie put for item " + item );
50 }
51
52 }
53
54 /***
55 * Does nothing.
56 * <p>
57 * @param item
58 */
59 public void update( ICacheElement item )
60 {
61
62 }
63
64 /***
65 * @param cacheName
66 * @param key
67 * @return null. zombies have no internal data
68 */
69 public ICacheElement get( String cacheName, Serializable key )
70 {
71 return null;
72 }
73
74 /***
75 * Returns an empty map. Zombies have no internal data.
76 * <p>
77 * @param cacheName
78 * @param keys
79 * @return Collections.EMPTY_MAP
80 */
81 public Map getMultiple( String cacheName, Set keys )
82 {
83 return Collections.EMPTY_MAP;
84 }
85
86 /***
87 * Returns an empty map. Zombies have no internal data.
88 * <p>
89 * @param cacheName
90 * @param pattern
91 * @return Collections.EMPTY_MAP
92 */
93 public Map getMatching( String cacheName, String pattern )
94 {
95 return Collections.EMPTY_MAP;
96 }
97
98 /***
99 * Logs the get to debug, but always balks.
100 * <p>
101 * @param cacheName
102 * @param key
103 * @param container
104 * @return null always
105 */
106 public Serializable get( String cacheName, Serializable key, boolean container )
107 {
108 if ( log.isDebugEnabled() )
109 {
110 log.debug( "Zombie get for key [" + key + "] cacheName [" + cacheName + "] container [" + container + "]" );
111 }
112
113 return null;
114 }
115
116 /***
117 * @param cacheName
118 * @param key
119 */
120 public void remove( String cacheName, Serializable key )
121 {
122
123 }
124
125 /***
126 * @param cacheName
127 */
128 public void removeAll( String cacheName )
129 {
130
131 }
132
133 /***
134 * @param cacheName
135 */
136 public void dispose( String cacheName )
137 {
138
139 return;
140 }
141
142 /***
143 * Frees all caches.
144 */
145 public void release()
146 {
147
148 return;
149 }
150 }