1 package org.apache.jcs.engine;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.Serializable;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.jcs.engine.behavior.ICacheElement;
27 import org.apache.jcs.engine.behavior.ICacheService;
28
29 import org.apache.jcs.engine.behavior.IZombie;
30
31 /***
32 * Zombie adapter for any cache service. balks at every call.
33 */
34 public class ZombieCacheService
35 implements ICacheService, IZombie
36 {
37
38 private static final Log log = LogFactory.getLog( ZombieCacheService.class );
39
40 /***
41 * @param item
42 */
43 public void put( ICacheElement item )
44 {
45 if ( log.isDebugEnabled() )
46 {
47 log.debug( "Zombie put for item " + item );
48 }
49 // zombies have no inner life
50 }
51
52 /*
53 * (non-Javadoc)
54 * @see org.apache.jcs.engine.behavior.ICacheService#update(org.apache.jcs.engine.behavior.ICacheElement)
55 */
56 public void update( ICacheElement item )
57 {
58 // zombies have no inner life
59 }
60
61 /*
62 * (non-Javadoc)
63 * @see org.apache.jcs.engine.behavior.ICacheService#get(java.lang.String,
64 * java.io.Serializable)
65 */
66 public ICacheElement get( String cacheName, Serializable key )
67 {
68 return null;
69 }
70
71 /***
72 * Logs the get to debug, but always balks.
73 * <p>
74 * @param cacheName
75 * @param key
76 * @param container
77 * @return null always
78 */
79 public Serializable get( String cacheName, Serializable key, boolean container )
80 {
81 if ( log.isDebugEnabled() )
82 {
83 log.debug( "Zombie get for key [" + key + "] cacheName [" + cacheName + "] container [" + container + "]" );
84 }
85 // zombies have no inner life
86 return null;
87 }
88
89 /*
90 * (non-Javadoc)
91 * @see org.apache.jcs.engine.behavior.ICacheService#remove(java.lang.String,
92 * java.io.Serializable)
93 */
94 public void remove( String cacheName, Serializable key )
95 {
96 // zombies have no inner life
97 }
98
99 /*
100 * (non-Javadoc)
101 * @see org.apache.jcs.engine.behavior.ICacheService#removeAll(java.lang.String)
102 */
103 public void removeAll( String cacheName )
104 {
105 // zombies have no inner life
106 }
107
108 /*
109 * (non-Javadoc)
110 * @see org.apache.jcs.engine.behavior.ICacheService#dispose(java.lang.String)
111 */
112 public void dispose( String cacheName )
113 {
114 // zombies have no inner life
115 return;
116 }
117
118 /*
119 * (non-Javadoc)
120 * @see org.apache.jcs.engine.behavior.ICacheService#release()
121 */
122 public void release()
123 {
124 // zombies have no inner life
125 return;
126 }
127
128 }