View Javadoc

1   /*** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.codehaus.activespace.cache.impl;
19  
20  import javax.cache.Cache;
21  import javax.cache.CacheEntry;
22  import javax.cache.CacheException;
23  import javax.cache.CacheListener;
24  import javax.cache.CacheStatistics;
25  import java.util.Collection;
26  import java.util.Map;
27  import java.util.Set;
28  
29  /***
30   * Delegates all operations to a delegate cache.
31   *
32   * @version $Revision: 1.2 $
33   */
34  public abstract class CacheFacade implements Cache {
35  
36      protected abstract Cache getDelegate();
37  
38      public void addListener(CacheListener listener) {
39          getDelegate().addListener(listener);
40      }
41  
42      public void clear() {
43          getDelegate().clear();
44      }
45  
46      public boolean containsKey(Object key) {
47          return getDelegate().containsKey(key);
48      }
49  
50  
51      public boolean containsValue(Object value) {
52          return getDelegate().containsValue(value);
53      }
54  
55      public Set entrySet() {
56          return getDelegate().entrySet();
57      }
58  
59      public void evict() {
60          getDelegate().evict();
61      }
62  
63      public Object get(Object key) {
64          return getDelegate().get(key);
65      }
66  
67      public Map getAll(Collection keys) throws CacheException {
68          return getDelegate().getAll(keys);
69      }
70  
71      public CacheEntry getCacheEntry(Object key) {
72          return getDelegate().getCacheEntry(key);
73      }
74  
75      public CacheStatistics getCacheStatistics() {
76          return getDelegate().getCacheStatistics();
77      }
78  
79      public boolean isEmpty() {
80          return getDelegate().isEmpty();
81      }
82  
83      public Set keySet() {
84          return getDelegate().keySet();
85      }
86  
87      public void load(Object key) throws CacheException {
88          getDelegate().load(key);
89      }
90  
91      public void loadAll(Collection keys) throws CacheException {
92          getDelegate().loadAll(keys);
93      }
94  
95      public Object peek(Object key) {
96          return getDelegate().peek(key);
97      }
98  
99      public Object put(Object key, Object value) {
100         return getDelegate().put(key, value);
101     }
102 
103     public void putAll(Map t) {
104         getDelegate().putAll(t);
105     }
106 
107     public Object remove(Object key) {
108         return getDelegate().remove(key);
109     }
110 
111     public void removeListener(CacheListener listener) {
112         getDelegate().removeListener(listener);
113     }
114 
115     public int size() {
116         return getDelegate().size();
117     }
118 
119     public Collection values() {
120         return getDelegate().values();
121     }
122 }