View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.constructs.nonstop;
18  
19  import java.util.Collection;
20  import java.util.Properties;
21  
22  import net.sf.ehcache.CacheEntry;
23  import net.sf.ehcache.CacheException;
24  import net.sf.ehcache.Ehcache;
25  import net.sf.ehcache.Element;
26  import net.sf.ehcache.writer.CacheWriter;
27  import net.sf.ehcache.writer.CacheWriterFactory;
28  
29  public class MockCacheWriterFactory extends CacheWriterFactory {
30  
31      @Override
32      public CacheWriter createCacheWriter(Ehcache cache, Properties properties) {
33          return new CacheWriter() {
34  
35              public void writeAll(Collection<Element> elements) throws CacheException {
36                  // no-op
37              }
38  
39              public void write(Element element) throws CacheException {
40                  // no-op
41  
42              }
43  
44              public void init() {
45                  // no-op
46  
47              }
48  
49              public void dispose() throws CacheException {
50                  // no-op
51  
52              }
53  
54              public void deleteAll(Collection<CacheEntry> entries) throws CacheException {
55                  // no-op
56  
57              }
58  
59              public void delete(CacheEntry entry) throws CacheException {
60                  // no-op
61  
62              }
63  
64              public CacheWriter clone(Ehcache cache) throws CloneNotSupportedException {
65                  // no-op
66                  return null;
67              }
68          };
69      }
70  
71  }